#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ v;
typedef int uint64_t;
struct epoll_event {
  int events;
};
typedef int /*<<< orphan*/ ev;

/* Variables and functions */
int /*<<< orphan*/ EFD_NONBLOCK;
int EPOLLIN;
int EPOLLOUT;
int /*<<< orphan*/ EPOLL_CTL_ADD;
int epoll_create(int);
scalar_t__ epoll_ctl(int, int /*<<< orphan*/, int, struct epoll_event *);
int /*<<< orphan*/ errno;
int eventfd(unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ memset(struct epoll_event *, int, int);
scalar_t__ pipe(int *);
int read(int, int *, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ test_daemon();
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, ...);
int /*<<< orphan*/ test_waitsig();
int write(int, int *, int);
int main(int argc, char *argv[]) {
  int efd, ret, epollfd;
  int pipefd[2];
  uint64_t v = 30;
  struct epoll_event ev;
  test_init(argc, argv);
  epollfd = epoll_create(1);
  if (epollfd < 0) {
    test_msg("FAIL: %s:%d: "
             "epoll_create"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/eventfs00.c",
             45, errno, strerror(errno));
    exit(1);
  }
  efd = eventfd((unsigned int)v, EFD_NONBLOCK);
  if (efd < 0) {
    test_msg("FAIL: %s:%d: "
             "eventfd"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/eventfs00.c",
             51, errno, strerror(errno));
    exit(1);
  }
  memset(&ev, 0xff, sizeof(ev));
  ev.events = EPOLLIN | EPOLLOUT;
  if (pipe(pipefd)) {
    test_msg("FAIL: %s:%d: "
             "pipe"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/eventfs00.c",
             59, errno, strerror(errno));
    exit(1);
  }
  if (epoll_ctl(epollfd, EPOLL_CTL_ADD, pipefd[0], &ev)) {
    test_msg("FAIL: %s:%d: "
             "epoll_ctl"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/eventfs00.c",
             64, errno, strerror(errno));
    exit(1);
  }
  test_msg("created eventfd with %lx\n", v);
  ret = write(efd, &v, sizeof(v));
  if (ret != sizeof(v)) {
    test_msg("FAIL: %s:%d: "
             "write"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/eventfs00.c",
             72, errno, strerror(errno));
    exit(1);
  }
  ret = write(efd, &v, sizeof(v));
  if (ret != sizeof(v)) {
    test_msg("FAIL: %s:%d: "
             "write"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/eventfs00.c",
             78, errno, strerror(errno));
    exit(1);
  }
  test_daemon();
  test_waitsig();
  ret = read(efd, &v, sizeof(v));
  if (ret != sizeof(v)) {
    test_msg("FAIL: %s:%d: "
             "write"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/eventfs00.c",
             87, errno, strerror(errno));
    exit(1);
  }
  if (v != 90) {
    test_msg("FAIL: %s:%d: "
             "EVENTFD_FINAL mismatch\n"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/eventfs00.c",
             92, errno, strerror(errno));
    exit(1);
  }
  test_msg("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1e,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_init@plt>
mov    $0x1,%edi
call   10c0 <epoll_create@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1254 <main+0x84>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x34(%rbp),%ecx
mov    %eax,%r8d
lea    0xdc9(%rip),%rdi
lea    0xdef(%rip),%rsi
mov    $0x2d,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x28(%rbp),%edi
mov    0x2d82(%rip),%rax
mov    (%rax),%esi
call   10e0 <eventfd@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12b6 <main+0xe6>
mov    0x2d47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x38(%rbp),%ecx
mov    %eax,%r8d
lea    0xe3a(%rip),%rdi
lea    0xd8d(%rip),%rsi
mov    $0x33,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x30(%rbp),%rdi
mov    $0xff,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
mov    0x2d18(%rip),%rax
mov    (%rax),%eax
mov    0x2cef(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x30(%rbp)
lea    -0x24(%rbp),%rdi
call   1070 <pipe@plt>
cmp    $0x0,%rax
je     1335 <main+0x165>
mov    0x2cc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x3c(%rbp),%ecx
mov    %eax,%r8d
lea    0xde3(%rip),%rdi
lea    0xd0e(%rip),%rsi
mov    $0x3b,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    0x2c99(%rip),%rax
mov    (%rax),%esi
mov    -0x24(%rbp),%edx
lea    -0x30(%rbp),%rcx
call   1090 <epoll_ctl@plt>
cmp    $0x0,%rax
je     139b <main+0x1cb>
mov    0x2c62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2c56(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x40(%rbp),%ecx
mov    %eax,%r8d
lea    0xda2(%rip),%rdi
lea    0xca8(%rip),%rsi
mov    $0x40,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x28(%rbp),%esi
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x4,%rax
je     1412 <main+0x242>
mov    0x2beb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2bdf(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x44(%rbp),%ecx
mov    %eax,%r8d
lea    0xd6f(%rip),%rdi
lea    0xc31(%rip),%rsi
mov    $0x48,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x4,%rax
je     1478 <main+0x2a8>
mov    0x2b85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x48(%rbp),%ecx
mov    %eax,%r8d
lea    0xd09(%rip),%rdi
lea    0xbcb(%rip),%rsi
mov    $0x4e,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    $0x0,%al
call   1050 <test_daemon@plt>
mov    $0x0,%al
call   10b0 <test_waitsig@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   10a0 <read@plt>
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x4,%rax
je     14ec <main+0x31c>
mov    0x2b11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2b05(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x4c(%rbp),%ecx
mov    %eax,%r8d
lea    0xc95(%rip),%rdi
lea    0xb57(%rip),%rsi
mov    $0x57,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpl   $0x5a,-0x28(%rbp)
je     153a <main+0x36a>
mov    0x2ac3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2ab7(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x50(%rbp),%ecx
mov    %eax,%r8d
lea    0xc6d(%rip),%rdi
lea    0xb09(%rip),%rsi
mov    $0x5c,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1080 <test_msg@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movl   $0x1e,0x4(%rsp)
call   1030 <test_init@plt>
mov    $0x1,%edi
call   10c0 <epoll_create@plt>
test   %eax,%eax
js     1304 <main+0x134>
mov    %eax,%ebp
mov    0x2de2(%rip),%rax
mov    (%rax),%esi
mov    $0x1e,%edi
call   10e0 <eventfd@plt>
test   %eax,%eax
js     132c <main+0x15c>
mov    %eax,%ebx
lea    0x8(%rsp),%rdi
mov    $0xff,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
mov    0x2db9(%rip),%rax
mov    0x2d92(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x8(%rsp)
lea    0x10(%rsp),%rdi
call   1070 <pipe@plt>
test   %rax,%rax
jne    1354 <main+0x184>
mov    0x2d80(%rip),%rax
mov    (%rax),%esi
mov    0x10(%rsp),%edx
lea    0x8(%rsp),%rcx
mov    %ebp,%edi
call   1090 <epoll_ctl@plt>
test   %rax,%rax
jne    137c <main+0x1ac>
lea    0xed0(%rip),%rdi
mov    $0x1e,%esi
xor    %eax,%eax
call   1080 <test_msg@plt>
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1040 <write@plt>
cmp    $0x4,%eax
jne    13a4 <main+0x1d4>
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1040 <write@plt>
cmp    $0x4,%eax
jne    13c9 <main+0x1f9>
xor    %eax,%eax
call   1050 <test_daemon@plt>
xor    %eax,%eax
call   10b0 <test_waitsig@plt>
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   10a0 <read@plt>
cmp    $0x4,%eax
jne    13ee <main+0x21e>
cmpl   $0x5a,0x4(%rsp)
jne    1413 <main+0x243>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1080 <test_msg@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2cb5(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10f0 <strerror@plt>
lea    0xce5(%rip),%rdi
lea    0xd0b(%rip),%rsi
mov    $0x2d,%edx
jmp    1436 <main+0x266>
mov    0x2c8d(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10f0 <strerror@plt>
lea    0xd90(%rip),%rdi
lea    0xce3(%rip),%rsi
mov    $0x33,%edx
jmp    1436 <main+0x266>
mov    0x2c65(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10f0 <strerror@plt>
lea    0xd90(%rip),%rdi
lea    0xcbb(%rip),%rsi
mov    $0x3b,%edx
jmp    1436 <main+0x266>
mov    0x2c3d(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10f0 <strerror@plt>
lea    0xd8d(%rip),%rdi
lea    0xc93(%rip),%rsi
mov    $0x40,%edx
jmp    1436 <main+0x266>
mov    0x2c15(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10f0 <strerror@plt>
lea    0xda9(%rip),%rdi
lea    0xc6b(%rip),%rsi
mov    $0x48,%edx
jmp    1436 <main+0x266>
mov    0x2bf0(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10f0 <strerror@plt>
lea    0xd84(%rip),%rdi
lea    0xc46(%rip),%rsi
mov    $0x4e,%edx
jmp    1436 <main+0x266>
mov    0x2bcb(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10f0 <strerror@plt>
lea    0xd5f(%rip),%rdi
lea    0xc21(%rip),%rsi
mov    $0x57,%edx
jmp    1436 <main+0x266>
mov    0x2ba6(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10f0 <strerror@plt>
lea    0xd60(%rip),%rdi
lea    0xbfc(%rip),%rsi
mov    $0x5c,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1080 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.epoll_event = type { i32 }
@.str = [45 x i8] c"FAIL: %s:%d: epoll_create (errno = %d (%s))\0A\00"
@.str.1 = [166 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/master/test/zdtm/live/static/eventfs00.c\00"
@errno = global i32 0
@EFD_NONBLOCK = global i32 0
@.str.2 = [40 x i8] c"FAIL: %s:%d: eventfd (errno = %d (%s))\0A\00"
@EPOLLIN = global i32 0
@EPOLLOUT = global i32 0
@.str.3 = [37 x i8] c"FAIL: %s:%d: pipe (errno = %d (%s))\0A\00"
@EPOLL_CTL_ADD = global i32 0
@.str.4 = [42 x i8] c"FAIL: %s:%d: epoll_ctl (errno = %d (%s))\0A\00"
@.str.5 = [26 x i8] c"created eventfd with %lx\0A\00"
@.str.6 = [38 x i8] c"FAIL: %s:%d: write (errno = %d (%s))\0A\00"
@.str.7 = [56 x i8] c"FAIL: %s:%d: EVENTFD_FINAL mismatch\0A (errno = %d (%s))\0A\00"
@.str.8 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [2 x i32]
%10 = alloca i32
%11 = alloca %struct.epoll_event
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 30, i32* %10
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @test_init(i32 %12, i8** %13)
%15 = call i32 @epoll_create(i32 1)
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i32, i32* @errno
%20 = load i32, i32* @errno
%21 = call i32 @strerror(i32 %20)
%22 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 45, i32 %19, i32 %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i32, i32* %10
%26 = load i32, i32* @EFD_NONBLOCK
%27 = call i32 @eventfd(i32 %25, i32 %26)
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %24
%31 = load i32, i32* @errno
%32 = load i32, i32* @errno
%33 = call i32 @strerror(i32 %32)
%34 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 51, i32 %31, i32 %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %24
%37 = call i32 @memset(%struct.epoll_event* %11, i32 255, i32 4)
%38 = load i32, i32* @EPOLLIN
%39 = load i32, i32* @EPOLLOUT
%40 = or i32 %38, %39
%41 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %11, i32 0, i32 0
store i32 %40, i32* %41
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%43 = call i64 @pipe(i32* %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %36
%46 = load i32, i32* @errno
%47 = load i32, i32* @errno
%48 = call i32 @strerror(i32 %47)
%49 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 59, i32 %46, i32 %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %36
%52 = load i32, i32* %8
%53 = load i32, i32* @EPOLL_CTL_ADD
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%55 = load i32, i32* %54
%56 = call i64 @epoll_ctl(i32 %52, i32 %53, i32 %55, %struct.epoll_event* %11)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %64
58: ; preds = %51
%59 = load i32, i32* @errno
%60 = load i32, i32* @errno
%61 = call i32 @strerror(i32 %60)
%62 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 64, i32 %59, i32 %61)
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %51
%65 = load i32, i32* %10
%66 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %65)
%67 = load i32, i32* %6
%68 = call i32 @write(i32 %67, i32* %10, i32 4)
store i32 %68, i32* %7
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = icmp ne i64 %70, 4
br i1 %71, label %72, label %78
72: ; preds = %64
%73 = load i32, i32* @errno
%74 = load i32, i32* @errno
%75 = call i32 @strerror(i32 %74)
%76 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 72, i32 %73, i32 %75)
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %64
%79 = load i32, i32* %6
%80 = call i32 @write(i32 %79, i32* %10, i32 4)
store i32 %80, i32* %7
%81 = load i32, i32* %7
%82 = sext i32 %81 to i64
%83 = icmp ne i64 %82, 4
br i1 %83, label %84, label %90
84: ; preds = %78
%85 = load i32, i32* @errno
%86 = load i32, i32* @errno
%87 = call i32 @strerror(i32 %86)
%88 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 78, i32 %85, i32 %87)
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %78
%91 = call i32 (...) @test_daemon()
%92 = call i32 (...) @test_waitsig()
%93 = load i32, i32* %6
%94 = call i32 @read(i32 %93, i32* %10, i32 4)
store i32 %94, i32* %7
%95 = load i32, i32* %7
%96 = sext i32 %95 to i64
%97 = icmp ne i64 %96, 4
br i1 %97, label %98, label %104
98: ; preds = %90
%99 = load i32, i32* @errno
%100 = load i32, i32* @errno
%101 = call i32 @strerror(i32 %100)
%102 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 87, i32 %99, i32 %101)
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %90
%105 = load i32, i32* %10
%106 = icmp ne i32 %105, 90
br i1 %106, label %107, label %113
107: ; preds = %104
%108 = load i32, i32* @errno
%109 = load i32, i32* @errno
%110 = call i32 @strerror(i32 %109)
%111 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 92, i32 %108, i32 %110)
%112 = call i32 @exit(i32 1)
unreachable
113: ; preds = %104
%114 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.epoll_event = type { i32 }
@.str = [45 x i8] c"FAIL: %s:%d: epoll_create (errno = %d (%s))\0A\00"
@.str.1 = [166 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/master/test/zdtm/live/static/eventfs00.c\00"
@errno = global i32 0
@EFD_NONBLOCK = global i32 0
@.str.2 = [40 x i8] c"FAIL: %s:%d: eventfd (errno = %d (%s))\0A\00"
@EPOLLIN = global i32 0
@EPOLLOUT = global i32 0
@.str.3 = [37 x i8] c"FAIL: %s:%d: pipe (errno = %d (%s))\0A\00"
@EPOLL_CTL_ADD = global i32 0
@.str.4 = [42 x i8] c"FAIL: %s:%d: epoll_ctl (errno = %d (%s))\0A\00"
@.str.5 = [26 x i8] c"created eventfd with %lx\0A\00"
@.str.6 = [38 x i8] c"FAIL: %s:%d: write (errno = %d (%s))\0A\00"
@.str.7 = [56 x i8] c"FAIL: %s:%d: EVENTFD_FINAL mismatch\0A (errno = %d (%s))\0A\00"
@.str.8 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca %struct.epoll_event
%6 = bitcast [2 x i32]* %3 to i8*
%7 = bitcast i32* %4 to i8*
store i32 30, i32* %4
%8 = bitcast %struct.epoll_event* %5 to i8*
%9 = tail call i32 @test_init(i32 %0, i8** %1)
%10 = tail call i32 @epoll_create(i32 1)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32, i32* @errno
%14 = tail call i32 @strerror(i32 %13)
%15 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 45, i32 %13, i32 %14)
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i32, i32* @EFD_NONBLOCK
%19 = tail call i32 @eventfd(i32 30, i32 %18)
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load i32, i32* @errno
%23 = tail call i32 @strerror(i32 %22)
%24 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 51, i32 %22, i32 %23)
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %17
%27 = call i32 @memset(%struct.epoll_event* %5, i32 255, i32 4)
%28 = load i32, i32* @EPOLLIN
%29 = load i32, i32* @EPOLLOUT
%30 = or i32 %29, %28
%31 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %5, i64 0, i32 0
store i32 %30, i32* %31
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%33 = call i64 @pipe(i32* %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %26
%36 = load i32, i32* @errno
%37 = call i32 @strerror(i32 %36)
%38 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 59, i32 %36, i32 %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %26
%41 = load i32, i32* @EPOLL_CTL_ADD
%42 = load i32, i32* %32
%43 = call i64 @epoll_ctl(i32 %10, i32 %41, i32 %42, %struct.epoll_event* %5)
%44 = icmp eq i64 %43, 0
br i1 %44, label %50, label %45
45: ; preds = %40
%46 = load i32, i32* @errno
%47 = call i32 @strerror(i32 %46)
%48 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 64, i32 %46, i32 %47)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %40
%51 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 30)
%52 = call i32 @write(i32 %19, i32* %4, i32 4)
%53 = icmp eq i32 %52, 4
br i1 %53, label %59, label %54
54: ; preds = %50
%55 = load i32, i32* @errno
%56 = call i32 @strerror(i32 %55)
%57 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 72, i32 %55, i32 %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %50
%60 = call i32 @write(i32 %19, i32* %4, i32 4)
%61 = icmp eq i32 %60, 4
br i1 %61, label %67, label %62
62: ; preds = %59
%63 = load i32, i32* @errno
%64 = call i32 @strerror(i32 %63)
%65 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 78, i32 %63, i32 %64)
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %59
%68 = call i32 (...) @test_daemon()
%69 = call i32 (...) @test_waitsig()
%70 = call i32 @read(i32 %19, i32* %4, i32 4)
%71 = icmp eq i32 %70, 4
br i1 %71, label %77, label %72
72: ; preds = %67
%73 = load i32, i32* @errno
%74 = call i32 @strerror(i32 %73)
%75 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 87, i32 %73, i32 %74)
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %67
%78 = load i32, i32* %4
%79 = icmp eq i32 %78, 90
br i1 %79, label %85, label %80
80: ; preds = %77
%81 = load i32, i32* @errno
%82 = call i32 @strerror(i32 %81)
%83 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.1, i64 0, i64 0), i32 92, i32 %81, i32 %82)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %77
%86 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}