// https://syzkaller.appspot.com/bug?id=bf1d98882a783b449bb42e9af6720e4f1b37919d
// 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[1] = {0xffffffffffffffff};

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, 0x10ul, 3ul, 0);
  if (res != -1)
    r[0] = res;
  *(uint64_t*)0x200001c0 = 0;
  *(uint32_t*)0x200001c8 = 0;
  *(uint64_t*)0x200001d0 = 0x20000000;
  *(uint64_t*)0x20000000 = 0x200002c0;
  *(uint32_t*)0x200002c0 = 0x80;
  *(uint16_t*)0x200002c4 = 0x30;
  *(uint16_t*)0x200002c6 = 1;
  *(uint32_t*)0x200002c8 = 0;
  *(uint32_t*)0x200002cc = 0;
  *(uint8_t*)0x200002d0 = 0;
  *(uint8_t*)0x200002d1 = 0;
  *(uint16_t*)0x200002d2 = 0;
  *(uint16_t*)0x200002d4 = 0x6c;
  *(uint16_t*)0x200002d6 = 1;
  *(uint16_t*)0x200002d8 = 0x68;
  STORE_BY_BITMASK(uint16_t, , 0x200002da, 1, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x200002db, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x200002db, 0, 7, 1);
  *(uint16_t*)0x200002dc = 8;
  *(uint16_t*)0x200002de = 1;
  memcpy((void*)0x200002e0, "ipt\000", 4);
  *(uint16_t*)0x200002e4 = 0x40;
  STORE_BY_BITMASK(uint16_t, , 0x200002e6, 2, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x200002e7, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x200002e7, 1, 7, 1);
  *(uint16_t*)0x200002e8 = 0x2a;
  *(uint16_t*)0x200002ea = 6;
  *(uint16_t*)0x200002ec = 3;
  memcpy((void*)0x200002ee,
         "mangle\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
         "\000\000\000\000\000\000\000\000\000\000\000",
         32);
  *(uint8_t*)0x2000030e = 1;
  *(uint16_t*)0x20000310 = 0x100;
  *(uint16_t*)0x20000314 = 8;
  *(uint16_t*)0x20000316 = 3;
  *(uint32_t*)0x20000318 = 5;
  *(uint16_t*)0x2000031c = 8;
  *(uint16_t*)0x2000031e = 2;
  *(uint32_t*)0x20000320 = 2;
  *(uint16_t*)0x20000324 = 4;
  *(uint16_t*)0x20000326 = 6;
  *(uint16_t*)0x20000328 = 0xc;
  *(uint16_t*)0x2000032a = 7;
  *(uint32_t*)0x2000032c = 0;
  *(uint32_t*)0x20000330 = 0;
  *(uint16_t*)0x20000334 = 0xc;
  *(uint16_t*)0x20000336 = 8;
  *(uint32_t*)0x20000338 = 0;
  *(uint32_t*)0x2000033c = 0;
  *(uint64_t*)0x20000008 = 0x80;
  *(uint64_t*)0x200001d8 = 1;
  *(uint64_t*)0x200001e0 = 0;
  *(uint64_t*)0x200001e8 = 0;
  *(uint32_t*)0x200001f0 = 0;
  syscall(__NR_sendmsg, r[0], 0x200001c0ul, 0ul);
  return 0;
}