// https://syzkaller.appspot.com/bug?id=9a279abcd1b5c87648dc31697ab7c0669d5cc499
// 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>

uint64_t r[1] = {0xffffffffffffffff};

int main(void)
{
  syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
  intptr_t res = 0;
  memcpy((void*)0x20000180, "/dev/uinput\000", 12);
  res = syscall(__NR_openat, 0xffffffffffffff9c, 0x20000180, 0, 0);
  if (res != -1)
    r[0] = res;
  *(uint16_t*)0x20000080 = 0x2f;
  *(uint32_t*)0x20000084 = 0;
  *(uint32_t*)0x20000088 = 0;
  *(uint32_t*)0x2000008c = 0x2000fffb;
  *(uint32_t*)0x20000090 = 0;
  *(uint32_t*)0x20000094 = 0;
  *(uint32_t*)0x20000098 = 0;
  syscall(__NR_ioctl, r[0], 0x401c5504, 0x20000080);
  syscall(__NR_ioctl, r[0], 0x40045564, 3);
  *(uint16_t*)0x200000c0 = 0;
  *(uint16_t*)0x200000c2 = 0;
  *(uint16_t*)0x200000c4 = 0;
  *(uint16_t*)0x200000c6 = 0;
  memcpy((void*)0x200000c8,
         "syz0\000\000\000\000\000\200\24017\b\354\326#"
         "\000\000\000\000\000\000\000\b\000\000\000q\253\224%"
         "\000\000\377\377\377\377\377\377\377\347\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\000\000\000\000\000\000\000\000\000\000\000\000",
         80);
  *(uint32_t*)0x20000118 = 0;
  syscall(__NR_ioctl, r[0], 0x405c5503, 0x200000c0);
  syscall(__NR_ioctl, r[0], 0x5501, 0);
  return 0;
}