// 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 = 0x20000e00;
  *(uint32_t*)0x20000e00 = 0xc0;
  *(uint16_t*)0x20000e04 = 0x24;
  *(uint16_t*)0x20000e06 = 0xf0b;
  *(uint32_t*)0x20000e08 = 0;
  *(uint32_t*)0x20000e0c = 0;
  *(uint8_t*)0x20000e10 = 0x60;
  *(uint8_t*)0x20000e11 = 0;
  *(uint16_t*)0x20000e12 = 0;
  *(uint32_t*)0x20000e14 = r[2];
  *(uint16_t*)0x20000e18 = 0;
  *(uint16_t*)0x20000e1a = 0;
  *(uint16_t*)0x20000e1c = -1;
  *(uint16_t*)0x20000e1e = -1;
  *(uint16_t*)0x20000e20 = 0;
  *(uint16_t*)0x20000e22 = 0;
  *(uint16_t*)0x20000e24 = 0xa;
  *(uint16_t*)0x20000e26 = 1;
  memcpy((void*)0x20000e28, "netem\000", 6);
  *(uint16_t*)0x20000e30 = 0x90;
  *(uint16_t*)0x20000e32 = 2;
  *(uint32_t*)0x20000e34 = 0x800000;
  *(uint32_t*)0x20000e38 = 0;
  *(uint32_t*)0x20000e3c = 0;
  *(uint32_t*)0x20000e40 = 0;
  *(uint32_t*)0x20000e44 = 0;
  *(uint32_t*)0x20000e48 = 0;
  *(uint16_t*)0x20000e4c = 0x2e;
  *(uint16_t*)0x20000e4e = 2;
  memcpy((void*)0x20000e50,
         "\x95\x74\xdc\x7b\x88\x35\xbd\x82\x69\x6d\x57\xe0\xec\xba\x9b\x89\x7a"
         "\xf8\xc4\x94\x3b\x38\x36\xf8\x4d\xc3\x0d\x64\x83\x41\x51\xd4\x56\xb5"
         "\xfe\x5b\xb3\xfd\xdf\x6c\x73\x13",
         42);
  *(uint16_t*)0x20000e7c = 0x14;
  *(uint16_t*)0x20000e7e = 6;
  *(uint32_t*)0x20000e80 = 2;
  *(uint32_t*)0x20000e84 = 5;
  *(uint32_t*)0x20000e88 = 2;
  *(uint32_t*)0x20000e8c = 0x20;
  *(uint16_t*)0x20000e90 = 8;
  *(uint16_t*)0x20000e92 = 7;
  *(uint32_t*)0x20000e94 = 0;
  *(uint16_t*)0x20000e98 = 0xff40;
  *(uint16_t*)0x20000e9a = 6;
  *(uint32_t*)0x20000e9c = 8;
  *(uint32_t*)0x20000ea0 = 0x24;
  *(uint32_t*)0x20000ea4 = 0xf96;
  *(uint32_t*)0x20000ea8 = 0x5038;
  *(uint16_t*)0x20000eac = 0x14;
  *(uint16_t*)0x20000eae = 6;
  *(uint32_t*)0x20000eb0 = 0xa207;
  *(uint32_t*)0x20000eb4 = 3;
  *(uint32_t*)0x20000eb8 = 2;
  *(uint32_t*)0x20000ebc = 0x9c;
  *(uint64_t*)0x20000788 = 0xc0;
  *(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=*/0x4010000ul);
  return 0;
}