// https://syzkaller.appspot.com/bug?id=1b4ffc3a5debcc305862eeb179d57104168553e6
// autogenerated by syzkaller (https://github.com/google/syzkaller)

#define _GNU_SOURCE

#include <dirent.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>

#include <linux/capability.h>

static void sleep_ms(uint64_t ms)
{
  usleep(ms * 1000);
}

static uint64_t current_time_ms(void)
{
  struct timespec ts;
  if (clock_gettime(CLOCK_MONOTONIC, &ts))
    exit(1);
  return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
}

#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))))

static bool write_file(const char* file, const char* what, ...)
{
  char buf[1024];
  va_list args;
  va_start(args, what);
  vsnprintf(buf, sizeof(buf), what, args);
  va_end(args);
  buf[sizeof(buf) - 1] = 0;
  int len = strlen(buf);
  int fd = open(file, O_WRONLY | O_CLOEXEC);
  if (fd == -1)
    return false;
  if (write(fd, buf, len) != len) {
    int err = errno;
    close(fd);
    errno = err;
    return false;
  }
  close(fd);
  return true;
}

#define MAX_FDS 30

static void setup_common()
{
  if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) {
  }
}

static void loop();

static void sandbox_common()
{
  prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  setpgrp();
  setsid();
  struct rlimit rlim;
  rlim.rlim_cur = rlim.rlim_max = (200 << 20);
  setrlimit(RLIMIT_AS, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 32 << 20;
  setrlimit(RLIMIT_MEMLOCK, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 136 << 20;
  setrlimit(RLIMIT_FSIZE, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 1 << 20;
  setrlimit(RLIMIT_STACK, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 0;
  setrlimit(RLIMIT_CORE, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 256;
  setrlimit(RLIMIT_NOFILE, &rlim);
  if (unshare(CLONE_NEWNS)) {
  }
  if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) {
  }
  if (unshare(CLONE_NEWIPC)) {
  }
  if (unshare(0x02000000)) {
  }
  if (unshare(CLONE_NEWUTS)) {
  }
  if (unshare(CLONE_SYSVSEM)) {
  }
  typedef struct {
    const char* name;
    const char* value;
  } sysctl_t;
  static const sysctl_t sysctls[] = {
      {"/proc/sys/kernel/shmmax", "16777216"},
      {"/proc/sys/kernel/shmall", "536870912"},
      {"/proc/sys/kernel/shmmni", "1024"},
      {"/proc/sys/kernel/msgmax", "8192"},
      {"/proc/sys/kernel/msgmni", "1024"},
      {"/proc/sys/kernel/msgmnb", "1024"},
      {"/proc/sys/kernel/sem", "1024 1048576 500 1024"},
  };
  unsigned i;
  for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++)
    write_file(sysctls[i].name, sysctls[i].value);
}

static int wait_for_loop(int pid)
{
  if (pid < 0)
    exit(1);
  int status = 0;
  while (waitpid(-1, &status, __WALL) != pid) {
  }
  return WEXITSTATUS(status);
}

static void drop_caps(void)
{
  struct __user_cap_header_struct cap_hdr = {};
  struct __user_cap_data_struct cap_data[2] = {};
  cap_hdr.version = _LINUX_CAPABILITY_VERSION_3;
  cap_hdr.pid = getpid();
  if (syscall(SYS_capget, &cap_hdr, &cap_data))
    exit(1);
  const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE);
  cap_data[0].effective &= ~drop;
  cap_data[0].permitted &= ~drop;
  cap_data[0].inheritable &= ~drop;
  if (syscall(SYS_capset, &cap_hdr, &cap_data))
    exit(1);
}

static int do_sandbox_none(void)
{
  if (unshare(CLONE_NEWPID)) {
  }
  int pid = fork();
  if (pid != 0)
    return wait_for_loop(pid);
  setup_common();
  sandbox_common();
  drop_caps();
  if (unshare(CLONE_NEWNET)) {
  }
  loop();
  exit(1);
}

static void kill_and_wait(int pid, int* status)
{
  kill(-pid, SIGKILL);
  kill(pid, SIGKILL);
  for (int i = 0; i < 100; i++) {
    if (waitpid(-1, status, WNOHANG | __WALL) == pid)
      return;
    usleep(1000);
  }
  DIR* dir = opendir("/sys/fs/fuse/connections");
  if (dir) {
    for (;;) {
      struct dirent* ent = readdir(dir);
      if (!ent)
        break;
      if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
        continue;
      char abort[300];
      snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort",
               ent->d_name);
      int fd = open(abort, O_WRONLY);
      if (fd == -1) {
        continue;
      }
      if (write(fd, abort, 1) < 0) {
      }
      close(fd);
    }
    closedir(dir);
  } else {
  }
  while (waitpid(-1, status, __WALL) != pid) {
  }
}

static void setup_test()
{
  prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  setpgrp();
  write_file("/proc/self/oom_score_adj", "1000");
}

static void close_fds()
{
  for (int fd = 3; fd < MAX_FDS; fd++)
    close(fd);
}

static void execute_one(void);

#define WAIT_FLAGS __WALL

static void loop(void)
{
  int iter = 0;
  for (;; iter++) {
    int pid = fork();
    if (pid < 0)
      exit(1);
    if (pid == 0) {
      setup_test();
      execute_one();
      close_fds();
      exit(0);
    }
    int status = 0;
    uint64_t start = current_time_ms();
    for (;;) {
      if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
        break;
      sleep_ms(1);
      if (current_time_ms() - start < 5 * 1000)
        continue;
      kill_and_wait(pid, &status);
      break;
    }
  }
}

uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0};

void execute_one(void)
{
  intptr_t res = 0;
  res = syscall(__NR_socket, 0x10ul, 3ul, 0);
  if (res != -1)
    r[0] = res;
  res = syscall(__NR_socket, 0x10ul, 0x803ul, 0);
  if (res != -1)
    r[1] = res;
  *(uint64_t*)0x200001c0 = 0;
  *(uint32_t*)0x200001c8 = 0;
  *(uint64_t*)0x200001d0 = 0x20000180;
  *(uint64_t*)0x20000180 = 0;
  *(uint64_t*)0x20000188 = 0;
  *(uint64_t*)0x200001d8 = 1;
  *(uint64_t*)0x200001e0 = 0;
  *(uint64_t*)0x200001e8 = 0;
  *(uint32_t*)0x200001f0 = 0;
  syscall(__NR_sendmsg, r[1], 0x200001c0ul, 0ul);
  *(uint32_t*)0x20000200 = 0x14;
  res = syscall(__NR_getsockname, r[1], 0x200002c0ul, 0x20000200ul);
  if (res != -1)
    r[2] = *(uint32_t*)0x200002c4;
  *(uint64_t*)0x20000040 = 0;
  *(uint32_t*)0x20000048 = 0;
  *(uint64_t*)0x20000050 = 0x20000100;
  *(uint64_t*)0x20000100 = 0x20000900;
  *(uint32_t*)0x20000900 = 0x40c;
  *(uint16_t*)0x20000904 = 0x24;
  *(uint16_t*)0x20000906 = 0xf1d;
  *(uint32_t*)0x20000908 = 0;
  *(uint32_t*)0x2000090c = 0;
  *(uint8_t*)0x20000910 = 0;
  *(uint8_t*)0x20000911 = 0;
  *(uint16_t*)0x20000912 = 0;
  *(uint32_t*)0x20000914 = r[2];
  *(uint16_t*)0x20000918 = 0;
  *(uint16_t*)0x2000091a = 0;
  *(uint16_t*)0x2000091c = 0xfff1;
  *(uint16_t*)0x2000091e = -1;
  *(uint16_t*)0x20000920 = 0;
  *(uint16_t*)0x20000922 = 0;
  *(uint16_t*)0x20000924 = 0xa;
  *(uint16_t*)0x20000926 = 1;
  memcpy((void*)0x20000928, "choke\000", 6);
  *(uint16_t*)0x20000930 = 0x25c;
  *(uint16_t*)0x20000932 = 2;
  *(uint16_t*)0x20000934 = 0x104;
  *(uint16_t*)0x20000936 = 2;
  memcpy((void*)0x20000938,
         "\x28\xa6\xb2\x9f\x28\x98\x28\xfe\x5b\x75\x59\x80\xf4\x31\xca\x66\xc9"
         "\xca\x56\x49\x33\x7d\xf6\x9e\x63\xa7\xa5\x91\x03\x25\x69\x66\xe2\x70"
         "\x52\xd2\xc8\x29\xb5\x7f\x22\xe2\xa1\x61\x62\xd1\x1f\x16\xe7\x5d\xcc"
         "\x00\x20\x9b\xcb\x3d\x4b\x1e\x3e\xf0\xd5\x4a\xfc\x5a\x7f\x37\x2b\xdb"
         "\xd8\xee\xd9\xd5\xa0\x46\x2c\x4f\x3e\x7f\x4f\xa4\x87\xc1\xc2\x83\xd5"
         "\x3f\x74\xbf\xcc\x25\xdc\xc4\x86\x5a\x54\x3f\x80\xd9\x34\xdb\x10\xbc"
         "\x75\xa2\x81\xf8\x2c\x41\xbe\x27\x48\x5c\x8e\xbd\x24\x79\x51\x9f\xe7"
         "\xcd\xe5\x40\xe5\xae\x0b\x12\x4c\x8d\x4a\xb1\x2c\x41\xe9\x36\x0c\xfa"
         "\xdb\x17\x3d\x6b\xf1\x80\xe0\x7f\xdf\x85\x58\x21\x60\x6f\x36\xa2\x4d"
         "\xe3\xe5\xd7\x77\xf6\x2f\x9c\x1e\x0b\x02\x7e\xb0\xf1\x47\x22\xee\xc7"
         "\x49\x47\xdd\x14\x86\x16\x9d\xf1\x36\x1d\x59\x68\x36\xa7\xcf\x0c\x72"
         "\xe9\xe0\xdd\xf4\xd3\xc2\xe4\x3a\xba\xf1\xc1\x81\x43\x56\x53\xfc\x19"
         "\x53\xd4\x54\x84\x50\x87\xbf\xbb\x29\x54\xdd\x8c\x29\xc9\xf2\x88\x5f"
         "\x7a\xb9\xb7\x68\xdd\x47\x52\x26\xe4\x8e\x73\x47\x90\xef\xae\xbf\x6e"
         "\x26\xc3\xd9\xfc\xcb\x73\x88\xb6\x7c\xf4\xb3\x9b\x19\xf5\xcf\x2f\x4a"
         "\x76",
         256);
  *(uint16_t*)0x20000a38 = 0x104;
  *(uint16_t*)0x20000a3a = 2;
  memcpy((void*)0x20000a3c,
         "\xa4\xa9\x18\x95\x57\x3e\xa1\x28\x26\xdb\xf2\xe4\xfb\x3c\xac\xa6\x03"
         "\xf0\x7d\xe3\x71\xe4\x4d\x63\x2e\x8c\xb6\xf4\x78\xd4\x4e\x4d\xfb\xb5"
         "\xbb\x19\xed\x2e\xcc\x6b\x48\xc6\xfa\x24\xdc\x79\xb7\x6d\x26\x39\xd6"
         "\x2a\xe8\x8f\x2d\x18\xf7\x93\x19\xf7\x9f\x61\xb6\x01\x4d\xc3\x78\x5d"
         "\xae\xff\x92\xe4\x98\x07\x7f\x8c\x08\x75\x04\xfe\x84\x8e\x30\x65\xf3"
         "\x6d\x1b\x0d\x68\x85\x5f\x86\x86\x2e\x31\x74\xdd\x1c\x6a\x95\x29\x42"
         "\x04\x87\x81\x0a\xff\x8b\xd3\x03\x01\x0d\xcc\x03\x67\x24\x75\xb8\xd5"
         "\x9a\x72\x75\x8e\x67\x56\x21\xde\xd1\x2d\xb1\x54\xe7\x2f\xc4\xf7\x72"
         "\x5b\xdb\xab\x09\x1e\xed\x9b\x3c\xce\x18\x11\x59\xe0\xcf\x48\x8f\x6d"
         "\x07\x92\x8d\x6e\x82\xea\x31\x62\x97\x61\xc6\x94\xe2\xca\x30\x1b\x1b"
         "\x16\x01\x82\x3c\x97\xa1\x54\xcd\x92\xca\x84\x8e\x40\xeb\x92\x05\x21"
         "\x0f\x80\x42\x10\x9f\xa3\x8c\x7b\x6c\x11\xce\x61\x36\x66\x12\x18\x22"
         "\xda\xbd\x72\xf3\x42\x68\x90\x60\xf1\x7b\xb6\x22\x30\x6b\x99\xd3\xb5"
         "\x29\x26\xca\x86\x2b\x3e\x6f\x53\x4f\xa2\x3c\xe8\x06\x86\x8e\x7d\x9e"
         "\x53\x47\x00\xd9\x5c\x37\x75\xa6\x5d\x97\xeb\x21\x13\xe2\xa2\xdd\x6c"
         "\x40",
         256);
  *(uint16_t*)0x20000b3c = 0x14;
  *(uint16_t*)0x20000b3e = 1;
  *(uint32_t*)0x20000b40 = 0x68;
  *(uint32_t*)0x20000b44 = 2;
  *(uint32_t*)0x20000b48 = 4;
  *(uint8_t*)0x20000b4c = 9;
  *(uint8_t*)0x20000b4d = 0x12;
  *(uint8_t*)0x20000b4e = 0x16;
  *(uint8_t*)0x20000b4f = 2;
  *(uint16_t*)0x20000b50 = 0x14;
  *(uint16_t*)0x20000b52 = 1;
  *(uint32_t*)0x20000b54 = 2;
  *(uint32_t*)0x20000b58 = 8;
  *(uint32_t*)0x20000b5c = 0x20000000;
  *(uint8_t*)0x20000b60 = 2;
  *(uint8_t*)0x20000b61 = 0;
  *(uint8_t*)0x20000b62 = 0x1d;
  *(uint8_t*)0x20000b63 = 1;
  *(uint16_t*)0x20000b64 = 0x14;
  *(uint16_t*)0x20000b66 = 1;
  *(uint32_t*)0x20000b68 = 0xba;
  *(uint32_t*)0x20000b6c = 1;
  *(uint32_t*)0x20000b70 = 0;
  *(uint8_t*)0x20000b74 = 0x1c;
  *(uint8_t*)0x20000b75 = 0x20;
  *(uint8_t*)0x20000b76 = 0x1e;
  *(uint8_t*)0x20000b77 = 0;
  *(uint16_t*)0x20000b78 = 0x14;
  *(uint16_t*)0x20000b7a = 1;
  *(uint32_t*)0x20000b7c = 8;
  *(uint32_t*)0x20000b80 = 7;
  *(uint32_t*)0x20000b84 = 9;
  *(uint8_t*)0x20000b88 = 0x40;
  *(uint8_t*)0x20000b89 = 0x13;
  *(uint8_t*)0x20000b8a = 1;
  *(uint8_t*)0x20000b8b = 6;
  *(uint16_t*)0x20000b8c = 0xd4;
  STORE_BY_BITMASK(uint16_t, , 0x20000b8e, 8, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x20000b8f, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x20000b8f, 1, 7, 1);
  *(uint16_t*)0x20000b90 = 0x1c;
  *(uint16_t*)0x20000b92 = 1;
  *(uint8_t*)0x20000b94 = 1;
  *(uint8_t*)0x20000b95 = 3;
  *(uint16_t*)0x20000b96 = 7;
  *(uint32_t*)0x20000b98 = 3;
  *(uint32_t*)0x20000b9c = 2;
  *(uint32_t*)0x20000ba0 = 5;
  *(uint32_t*)0x20000ba4 = 5;
  *(uint32_t*)0x20000ba8 = 2;
  *(uint16_t*)0x20000bac = 8;
  *(uint16_t*)0x20000bae = 2;
  *(uint16_t*)0x20000bb0 = 0x101;
  *(uint16_t*)0x20000bb2 = 0x3f;
  *(uint16_t*)0x20000bb4 = 0x1c;
  *(uint16_t*)0x20000bb6 = 1;
  *(uint8_t*)0x20000bb8 = 0;
  *(uint8_t*)0x20000bb9 = 0xb9;
  *(uint16_t*)0x20000bba = 5;
  *(uint32_t*)0x20000bbc = 5;
  *(uint32_t*)0x20000bc0 = 2;
  *(uint32_t*)0x20000bc4 = 0x10001;
  *(uint32_t*)0x20000bc8 = 0x8000;
  *(uint32_t*)0x20000bcc = 6;
  *(uint16_t*)0x20000bd0 = 0x10;
  *(uint16_t*)0x20000bd2 = 2;
  *(uint16_t*)0x20000bd4 = 3;
  *(uint16_t*)0x20000bd6 = 0xe9c;
  *(uint16_t*)0x20000bd8 = 0x7fff;
  *(uint16_t*)0x20000bda = 3;
  *(uint16_t*)0x20000bdc = 0xfffd;
  *(uint16_t*)0x20000bde = 0xfff7;
  *(uint16_t*)0x20000be0 = 0x1c;
  *(uint16_t*)0x20000be2 = 1;
  *(uint8_t*)0x20000be4 = 6;
  *(uint8_t*)0x20000be5 = 0x80;
  *(uint16_t*)0x20000be6 = 0x8001;
  *(uint32_t*)0x20000be8 = 3;
  *(uint32_t*)0x20000bec = 2;
  *(uint32_t*)0x20000bf0 = 5;
  *(uint32_t*)0x20000bf4 = 0xffff;
  *(uint32_t*)0x20000bf8 = 7;
  *(uint16_t*)0x20000bfc = 0x12;
  *(uint16_t*)0x20000bfe = 2;
  *(uint16_t*)0x20000c00 = 2;
  *(uint16_t*)0x20000c02 = 0x40;
  *(uint16_t*)0x20000c04 = 0;
  *(uint16_t*)0x20000c06 = 6;
  *(uint16_t*)0x20000c08 = 8;
  *(uint16_t*)0x20000c0a = 6;
  *(uint16_t*)0x20000c0c = 4;
  *(uint16_t*)0x20000c10 = 0x1c;
  *(uint16_t*)0x20000c12 = 1;
  *(uint8_t*)0x20000c14 = 3;
  *(uint8_t*)0x20000c15 = 4;
  *(uint16_t*)0x20000c16 = 4;
  *(uint32_t*)0x20000c18 = 0xffff;
  *(uint32_t*)0x20000c1c = 1;
  *(uint32_t*)0x20000c20 = 7;
  *(uint32_t*)0x20000c24 = 0x3f;
  *(uint32_t*)0x20000c28 = 3;
  *(uint16_t*)0x20000c2c = 0xa;
  *(uint16_t*)0x20000c2e = 2;
  *(uint16_t*)0x20000c30 = 0x80;
  *(uint16_t*)0x20000c32 = 0xfff;
  *(uint16_t*)0x20000c34 = 4;
  *(uint16_t*)0x20000c38 = 0x1c;
  *(uint16_t*)0x20000c3a = 1;
  *(uint8_t*)0x20000c3c = 6;
  *(uint8_t*)0x20000c3d = 7;
  *(uint16_t*)0x20000c3e = 1;
  *(uint32_t*)0x20000c40 = 0xffff0001;
  *(uint32_t*)0x20000c44 = 2;
  *(uint32_t*)0x20000c48 = 9;
  *(uint32_t*)0x20000c4c = 0x800;
  *(uint32_t*)0x20000c50 = 3;
  *(uint16_t*)0x20000c54 = 0xa;
  *(uint16_t*)0x20000c56 = 2;
  *(uint16_t*)0x20000c58 = 0x401;
  *(uint16_t*)0x20000c5a = 0xfffc;
  *(uint16_t*)0x20000c5c = 0;
  *(uint16_t*)0x20000c60 = 0x54;
  STORE_BY_BITMASK(uint16_t, , 0x20000c62, 8, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x20000c63, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x20000c63, 1, 7, 1);
  *(uint16_t*)0x20000c64 = 0x1c;
  *(uint16_t*)0x20000c66 = 1;
  *(uint8_t*)0x20000c68 = 8;
  *(uint8_t*)0x20000c69 = 2;
  *(uint16_t*)0x20000c6a = 3;
  *(uint32_t*)0x20000c6c = 0xfaf;
  *(uint32_t*)0x20000c70 = 2;
  *(uint32_t*)0x20000c74 = 0xff;
  *(uint32_t*)0x20000c78 = 1;
  *(uint32_t*)0x20000c7c = 3;
  *(uint16_t*)0x20000c80 = 0xa;
  *(uint16_t*)0x20000c82 = 2;
  *(uint16_t*)0x20000c84 = 7;
  *(uint16_t*)0x20000c86 = 0x3ff;
  *(uint16_t*)0x20000c88 = 9;
  *(uint16_t*)0x20000c8c = 0x1c;
  *(uint16_t*)0x20000c8e = 1;
  *(uint8_t*)0x20000c90 = 0xdc;
  *(uint8_t*)0x20000c91 = 0x14;
  *(uint16_t*)0x20000c92 = 0x1608;
  *(uint32_t*)0x20000c94 = 0x7ff;
  *(uint32_t*)0x20000c98 = 0;
  *(uint32_t*)0x20000c9c = 3;
  *(uint32_t*)0x20000ca0 = 0x209;
  *(uint32_t*)0x20000ca4 = 3;
  *(uint16_t*)0x20000ca8 = 0xa;
  *(uint16_t*)0x20000caa = 2;
  *(uint16_t*)0x20000cac = 9;
  *(uint16_t*)0x20000cae = 0x80;
  *(uint16_t*)0x20000cb0 = 0xfff9;
  *(uint16_t*)0x20000cb4 = 0xb;
  *(uint16_t*)0x20000cb6 = 1;
  memcpy((void*)0x20000cb8, "clsact\000", 7);
  *(uint16_t*)0x20000cc0 = 8;
  *(uint16_t*)0x20000cc2 = 0xd;
  *(uint32_t*)0x20000cc4 = 4;
  *(uint16_t*)0x20000cc8 = 8;
  *(uint16_t*)0x20000cca = 0xe;
  *(uint32_t*)0x20000ccc = 0x20;
  *(uint16_t*)0x20000cd0 = 6;
  *(uint16_t*)0x20000cd2 = 5;
  *(uint8_t*)0x20000cd4 = 0;
  *(uint8_t*)0x20000cd5 = 0x1f;
  *(uint16_t*)0x20000cd8 = 0x34;
  STORE_BY_BITMASK(uint16_t, , 0x20000cda, 8, 0, 14);
  STORE_BY_BITMASK(uint16_t, , 0x20000cdb, 0, 6, 1);
  STORE_BY_BITMASK(uint16_t, , 0x20000cdb, 1, 7, 1);
  *(uint16_t*)0x20000cdc = 0x1c;
  *(uint16_t*)0x20000cde = 1;
  *(uint8_t*)0x20000ce0 = 0;
  *(uint8_t*)0x20000ce1 = 0x80;
  *(uint16_t*)0x20000ce2 = 0x72;
  *(uint32_t*)0x20000ce4 = 0xa96;
  *(uint32_t*)0x20000ce8 = 0;
  *(uint32_t*)0x20000cec = 5;
  *(uint32_t*)0x20000cf0 = 0;
  *(uint32_t*)0x20000cf4 = 7;
  *(uint16_t*)0x20000cf8 = 0x12;
  *(uint16_t*)0x20000cfa = 2;
  *(uint16_t*)0x20000cfc = 0x7ff;
  *(uint16_t*)0x20000cfe = 7;
  *(uint16_t*)0x20000d00 = 0x1ff;
  *(uint16_t*)0x20000d02 = 7;
  *(uint16_t*)0x20000d04 = 7;
  *(uint16_t*)0x20000d06 = 4;
  *(uint16_t*)0x20000d08 = 0xbd;
  *(uint64_t*)0x20000108 = 0x40c;
  *(uint64_t*)0x20000058 = 1;
  *(uint64_t*)0x20000060 = 0;
  *(uint64_t*)0x20000068 = 0;
  *(uint32_t*)0x20000070 = 0;
  syscall(__NR_sendmsg, r[0], 0x20000040ul, 0ul);
}
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);
  do_sandbox_none();
  return 0;
}