// https://syzkaller.appspot.com/bug?id=8811da714a6d22caa3b77119a3711303936e598b
// 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, 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0);
  intptr_t res = 0;
  res = syscall(__NR_socket, 0x10ul, 0x80002ul, 0);
  if (res != -1)
    r[0] = res;
  *(uint64_t*)0x20002980 = 0;
  *(uint32_t*)0x20002988 = 0;
  *(uint64_t*)0x20002990 = 0x20002940;
  *(uint64_t*)0x20002940 = 0x20000000;
  *(uint32_t*)0x20000000 = 0x58;
  *(uint16_t*)0x20000004 = 0x30;
  *(uint16_t*)0x20000006 = 0x53b;
  *(uint32_t*)0x20000008 = 0;
  *(uint32_t*)0x2000000c = 0;
  *(uint8_t*)0x20000010 = 0;
  *(uint8_t*)0x20000011 = 0;
  *(uint16_t*)0x20000012 = 0;
  *(uint16_t*)0x20000014 = 0x44;
  *(uint16_t*)0x20000016 = 1;
  *(uint16_t*)0x20000018 = 0x40;
  STORE_BY_BITMASK(uint16_t, , 0x2000001a, 1, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x2000001b, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x2000001b, 0, 7, 1);
  *(uint16_t*)0x2000001c = 0xb;
  *(uint16_t*)0x2000001e = 1;
  memcpy((void*)0x20000020, "sample\000", 7);
  *(uint16_t*)0x20000028 = 0x2c;
  STORE_BY_BITMASK(uint16_t, , 0x2000002a, 2, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x2000002b, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x2000002b, 1, 7, 1);
  *(uint16_t*)0x2000002c = 0x18;
  *(uint16_t*)0x2000002e = 2;
  *(uint32_t*)0x20000030 = 0;
  *(uint32_t*)0x20000034 = 0;
  *(uint32_t*)0x20000038 = 0;
  *(uint32_t*)0x2000003c = 0;
  *(uint32_t*)0x20000040 = 0;
  *(uint16_t*)0x20000044 = 8;
  *(uint16_t*)0x20000046 = 3;
  *(uint32_t*)0x20000048 = 0x8579;
  *(uint16_t*)0x2000004c = 8;
  *(uint16_t*)0x2000004e = 5;
  *(uint32_t*)0x20000050 = 0;
  *(uint16_t*)0x20000054 = 4;
  *(uint16_t*)0x20000056 = 6;
  *(uint64_t*)0x20002948 = 0x58;
  *(uint64_t*)0x20002998 = 1;
  *(uint64_t*)0x200029a0 = 0;
  *(uint64_t*)0x200029a8 = 0;
  *(uint32_t*)0x200029b0 = 0;
  syscall(__NR_sendmsg, r[0], 0x20002980ul, 0ul);
  return 0;
}