// 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>

#ifndef __NR_ioctl
#define __NR_ioctl 29
#endif
#ifndef __NR_mmap
#define __NR_mmap 222
#endif
#ifndef __NR_sendmsg
#define __NR_sendmsg 211
#endif
#ifndef __NR_socket
#define __NR_socket 198
#endif
#ifndef __NR_socketpair
#define __NR_socketpair 199
#endif

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 = 0x20000a00;
  *(uint32_t*)0x20000a00 = 0xac;
  *(uint16_t*)0x20000a04 = 0x24;
  *(uint16_t*)0x20000a06 = 0xf0b;
  *(uint32_t*)0x20000a08 = 0;
  *(uint32_t*)0x20000a0c = 0;
  *(uint8_t*)0x20000a10 = 0x60;
  *(uint8_t*)0x20000a11 = 0;
  *(uint16_t*)0x20000a12 = 0;
  *(uint32_t*)0x20000a14 = r[2];
  *(uint16_t*)0x20000a18 = 0;
  *(uint16_t*)0x20000a1a = 0;
  *(uint16_t*)0x20000a1c = -1;
  *(uint16_t*)0x20000a1e = -1;
  *(uint16_t*)0x20000a20 = 0;
  *(uint16_t*)0x20000a22 = 0;
  *(uint16_t*)0x20000a24 = 0xa;
  *(uint16_t*)0x20000a26 = 1;
  memcpy((void*)0x20000a28, "netem\000", 6);
  *(uint16_t*)0x20000a30 = 0x7c;
  *(uint16_t*)0x20000a32 = 2;
  *(uint32_t*)0x20000a34 = 0;
  *(uint32_t*)0x20000a38 = 0;
  *(uint32_t*)0x20000a3c = 0;
  *(uint32_t*)0x20000a40 = 0;
  *(uint32_t*)0x20000a44 = 0;
  *(uint32_t*)0x20000a48 = 0;
  *(uint16_t*)0x20000a4c = 0x10;
  *(uint16_t*)0x20000a4e = 1;
  *(uint32_t*)0x20000a50 = 0;
  *(uint32_t*)0x20000a54 = 0;
  *(uint32_t*)0x20000a58 = 0;
  *(uint16_t*)0x20000a5c = 0xc;
  *(uint16_t*)0x20000a5e = 0xb;
  *(uint64_t*)0x20000a60 = 0;
  *(uint16_t*)0x20000a68 = 0x43;
  *(uint16_t*)0x20000a6a = 2;
  memcpy((void*)0x20000a6c,
         "\xd8\x05\x90\xe6\xd9\x87\x25\x0e\xe3\x27\xfa\x9c\x79\x4a\xcc\x2d\x4a"
         "\x54\x01\x43\xb3\x84\x50\x50\xb1\x6c\x6d\xe5\x1b\xfc\xa3\x27\xa8\xb9"
         "\x3e\xe2\xaa\x69\x04\xdf\x32\xfe\xe8\xf6\xd1\x57\x25\xac\x4b\x13\x86"
         "\x85\xf8\x93\xd2\xa5\x51\xbe\xaf\x26\x57\x19\x2e",
         63);
  *(uint64_t*)0x20000788 = 0xac;
  *(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;
}