// https://syzkaller.appspot.com/bug?id=f05969514787c7bf4526aea1d2113be6b061952f
// 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_mmap
#define __NR_mmap 222
#endif
#ifndef __NR_sendto
#define __NR_sendto 206
#endif
#ifndef __NR_setsockopt
#define __NR_setsockopt 208
#endif
#ifndef __NR_socket
#define __NR_socket 198
#endif

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

int main(void)
{
  syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul,
          /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  const char* reason;
  (void)reason;
  intptr_t res = 0;
  if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {
  }
  res =
      syscall(__NR_socket, /*domain=*/2ul, /*type=SOCK_RAW*/ 3ul, /*proto=*/2);
  if (res != -1)
    r[0] = res;
  syscall(__NR_setsockopt, /*fd=*/r[0], /*level=*/0,
          /*optname=IP_ADD_SOURCE_MEMBERSHIP*/ 0x27, /*optval=*/0ul,
          /*optlen=*/0ul);
  res = syscall(__NR_socket, /*domain=*/2ul,
                /*type=SOCK_STREAM|0x4000000000000000*/ 0x4000000000000001ul,
                /*proto=*/0x100);
  if (res != -1)
    r[1] = res;
  syscall(
      __NR_sendto, /*fd=*/r[1], /*buf=*/0ul, /*len=*/0ul,
      /*f=MSG_FASTOPEN|MSG_PROBE|MSG_OOB|MSG_EOR|MSG_DONTWAIT|MSG_DONTROUTE|0x728*/
      0x200007fdul, /*addr=*/0ul, /*addrlen=*/0ul);
  res = syscall(__NR_socket, /*domain=*/0x2bul, /*type=*/1ul, /*proto=*/0);
  if (res != -1)
    r[2] = res;
  syscall(__NR_setsockopt, /*fd=*/r[2], /*level=*/0,
          /*optname=IP_ADD_SOURCE_MEMBERSHIP*/ 0x27, /*optval=*/0ul,
          /*optlen=*/0ul);
  return 0;
}