// 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*)0x20000000 = 0;
  *(uint32_t*)0x20000008 = 0;
  *(uint64_t*)0x20000010 = 0x20000040;
  *(uint64_t*)0x20000040 = 0x20001600;
  *(uint32_t*)0x20001600 = 0x54;
  *(uint16_t*)0x20001604 = 0x24;
  *(uint16_t*)0x20001606 = 0xf0b;
  *(uint32_t*)0x20001608 = 0;
  *(uint32_t*)0x2000160c = 0;
  *(uint8_t*)0x20001610 = 0x60;
  *(uint8_t*)0x20001611 = 0;
  *(uint16_t*)0x20001612 = 0;
  *(uint32_t*)0x20001614 = r[2];
  *(uint16_t*)0x20001618 = 0;
  *(uint16_t*)0x2000161a = 0;
  *(uint16_t*)0x2000161c = -1;
  *(uint16_t*)0x2000161e = -1;
  *(uint16_t*)0x20001620 = 0;
  *(uint16_t*)0x20001622 = 0;
  *(uint16_t*)0x20001624 = 0xa;
  *(uint16_t*)0x20001626 = 1;
  memcpy((void*)0x20001628, "netem\000", 6);
  *(uint16_t*)0x20001630 = 0x24;
  *(uint16_t*)0x20001632 = 2;
  *(uint32_t*)0x20001634 = 0;
  *(uint32_t*)0x20001638 = 0;
  *(uint32_t*)0x2000163c = 0;
  *(uint32_t*)0x20001640 = 0;
  *(uint32_t*)0x20001644 = 0;
  *(uint32_t*)0x20001648 = 0;
  *(uint16_t*)0x2000164c = 6;
  *(uint16_t*)0x2000164e = 0xd;
  memcpy((void*)0x20001650, "\x83\x8f", 2);
  *(uint64_t*)0x20000048 = 0x54;
  *(uint64_t*)0x20000018 = 1;
  *(uint64_t*)0x20000020 = 0;
  *(uint64_t*)0x20000028 = 0;
  *(uint32_t*)0x20000030 = 0;
  syscall(__NR_sendmsg, /*fd=*/r[0], /*msg=*/0x20000000ul, /*f=*/0ul);
  return 0;
}