// https://syzkaller.appspot.com/bug?id=5388824c1e18a045263859c865be0409bc5459bf
// 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[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0};

int main(void)
{
  syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=*/7ul,
          /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=*/0x32ul, /*fd=*/-1, /*offset=*/0ul);
  intptr_t res = 0;
  res = syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=*/0);
  if (res != -1)
    r[0] = res;
  res = syscall(__NR_socketpair, /*domain=*/1ul, /*type=*/1ul, /*proto=*/0,
                /*fds=*/0x20000080ul);
  if (res != -1)
    r[1] = *(uint32_t*)0x20000084;
  memcpy((void*)0x20000000,
         "lo\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 16);
  res = syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x8933, /*arg=*/0x20000000ul);
  if (res != -1)
    r[2] = *(uint32_t*)0x20000010;
  *(uint64_t*)0x20000040 = 0;
  *(uint32_t*)0x20000048 = 0;
  *(uint64_t*)0x20000050 = 0x20000780;
  *(uint64_t*)0x20000780 = 0x20002b00;
  *(uint32_t*)0x20002b00 = 0x88;
  *(uint16_t*)0x20002b04 = 0x24;
  *(uint16_t*)0x20002b06 = 0xf0b;
  *(uint32_t*)0x20002b08 = 0;
  *(uint32_t*)0x20002b0c = 0;
  *(uint8_t*)0x20002b10 = 0x60;
  *(uint8_t*)0x20002b11 = 0;
  *(uint16_t*)0x20002b12 = 0;
  *(uint32_t*)0x20002b14 = r[2];
  *(uint16_t*)0x20002b18 = 0;
  *(uint16_t*)0x20002b1a = 0;
  *(uint16_t*)0x20002b1c = -1;
  *(uint16_t*)0x20002b1e = -1;
  *(uint16_t*)0x20002b20 = 0;
  *(uint16_t*)0x20002b22 = 0;
  *(uint16_t*)0x20002b24 = 0xa;
  *(uint16_t*)0x20002b26 = 1;
  memcpy((void*)0x20002b28, "netem\000", 6);
  *(uint16_t*)0x20002b30 = 0x58;
  *(uint16_t*)0x20002b32 = 2;
  *(uint32_t*)0x20002b34 = 0;
  *(uint32_t*)0x20002b38 = 0;
  *(uint32_t*)0x20002b3c = 0;
  *(uint32_t*)0x20002b40 = 0;
  *(uint32_t*)0x20002b44 = 0;
  *(uint32_t*)0x20002b48 = 0;
  *(uint16_t*)0x20002b4c = 4;
  STORE_BY_BITMASK(uint16_t, , 0x20002b4e, 5, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x20002b4f, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x20002b4f, 1, 7, 1);
  *(uint16_t*)0x20002b50 = 0x18;
  *(uint16_t*)0x20002b52 = 1;
  *(uint32_t*)0x20002b54 = 0;
  *(uint32_t*)0x20002b58 = 0;
  *(uint32_t*)0x20002b5c = 0;
  *(uint32_t*)0x20002b60 = 0;
  *(uint32_t*)0x20002b64 = 0;
  *(uint16_t*)0x20002b68 = 0x14;
  *(uint16_t*)0x20002b6a = 2;
  *(uint32_t*)0x20002b6c = 0;
  *(uint32_t*)0x20002b70 = 0;
  *(uint32_t*)0x20002b74 = 0;
  *(uint32_t*)0x20002b78 = 0;
  *(uint16_t*)0x20002b7c = 0xa;
  *(uint16_t*)0x20002b7e = 2;
  memcpy((void*)0x20002b80, "\x72\xf4\x2d\x1a\xf2\x5d", 6);
  *(uint64_t*)0x20000788 = 0x88;
  *(uint64_t*)0x20000058 = 1;
  *(uint64_t*)0x20000060 = 0;
  *(uint64_t*)0x20000068 = 0;
  *(uint32_t*)0x20000070 = 0;
  syscall(__NR_sendmsg, /*fd=*/r[0], /*msg=*/0x20000040ul, /*f=*/0ul);
  return 0;
}