// https://syzkaller.appspot.com/bug?id=40abc1f181d9c0f680a6f31245098d4314e162e8
// autogenerated by syzkaller (https://github.com/google/syzkaller)

#define _GNU_SOURCE

#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>

#define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off))
#define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len)               \
  *(type*)(addr) =                                                             \
      htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) |           \
            (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len))))

uint64_t r[5] = {0xffffffffffffffff, 0x0, 0xffffffffffffffff,
                 0xffffffffffffffff, 0x0};

int main(void)
{
  syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
  syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
  syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
  intptr_t res = 0;
  res = syscall(__NR_socket, 0x11ul, 3ul, 0x300);
  if (res != -1)
    r[0] = res;
  memcpy((void*)0x20000180, "bond0\000\000\000\000\000\000\000\000\000\000\000",
         16);
  res = syscall(__NR_ioctl, r[0], 0x8933, 0x20000180ul);
  if (res != -1)
    r[1] = *(uint32_t*)0x20000190;
  *(uint16_t*)0x20000100 = 0x11;
  *(uint16_t*)0x20000102 = htobe16(0);
  *(uint32_t*)0x20000104 = r[1];
  *(uint16_t*)0x20000108 = 1;
  *(uint8_t*)0x2000010a = 0x7f;
  *(uint8_t*)0x2000010b = 6;
  memset((void*)0x2000010c, 187, 6);
  memset((void*)0x20000112, 0, 2);
  syscall(__NR_bind, -1, 0x20000100ul, 0x14ul);
  res = syscall(__NR_socket, 0x10ul, 3ul, 0);
  if (res != -1)
    r[2] = res;
  res = syscall(__NR_socket, 1ul, 0x803ul, 0);
  if (res != -1)
    r[3] = res;
  *(uint32_t*)0x200002c0 = 0x14;
  res = syscall(__NR_getsockname, r[3], 0x20000100ul, 0x200002c0ul);
  if (res != -1)
    r[4] = *(uint32_t*)0x20000104;
  *(uint64_t*)0x20000240 = 0;
  *(uint32_t*)0x20000248 = 0;
  *(uint64_t*)0x20000250 = 0x20000000;
  *(uint64_t*)0x20000000 = 0x20000380;
  *(uint32_t*)0x20000380 = 0x54;
  *(uint16_t*)0x20000384 = 0x10;
  *(uint16_t*)0x20000386 = 0x401;
  *(uint32_t*)0x20000388 = 0;
  *(uint32_t*)0x2000038c = 0;
  *(uint8_t*)0x20000390 = 0;
  *(uint8_t*)0x20000391 = 0;
  *(uint16_t*)0x20000392 = 0;
  *(uint32_t*)0x20000394 = 0;
  *(uint32_t*)0x20000398 = 1;
  *(uint32_t*)0x2000039c = 0x20002;
  *(uint16_t*)0x200003a0 = 0x24;
  STORE_BY_BITMASK(uint16_t, , 0x200003a2, 0x12, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x200003a3, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x200003a3, 1, 7, 1);
  *(uint16_t*)0x200003a4 = 0xc;
  *(uint16_t*)0x200003a6 = 1;
  memcpy((void*)0x200003a8, "macvlan\000", 8);
  *(uint16_t*)0x200003b0 = 0x14;
  STORE_BY_BITMASK(uint16_t, , 0x200003b2, 2, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x200003b3, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x200003b3, 1, 7, 1);
  *(uint16_t*)0x200003b4 = 8;
  *(uint16_t*)0x200003b6 = 1;
  *(uint32_t*)0x200003b8 = 8;
  *(uint16_t*)0x200003bc = 6;
  *(uint16_t*)0x200003be = 2;
  *(uint16_t*)0x200003c0 = 1;
  *(uint16_t*)0x200003c4 = 8;
  *(uint16_t*)0x200003c6 = 5;
  *(uint32_t*)0x200003c8 = r[1];
  *(uint16_t*)0x200003cc = 8;
  *(uint16_t*)0x200003ce = 0xa;
  *(uint32_t*)0x200003d0 = r[4];
  *(uint64_t*)0x20000008 = 0x54;
  *(uint64_t*)0x20000258 = 1;
  *(uint64_t*)0x20000260 = 0;
  *(uint64_t*)0x20000268 = 0;
  *(uint32_t*)0x20000270 = 0x4008800;
  syscall(__NR_sendmsg, r[2], 0x20000240ul, 0x4000ul);
  return 0;
}