#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int fd;
};
struct epoll_event {
  int events;
  TYPE_1__ data;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int EPOLLIN;
int /*<<< orphan*/ EPOLL_CTL_ADD;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ close(int);
int epoll_create(int);
int epoll_ctl(int, int /*<<< orphan*/, int, struct epoll_event *);
int epoll_wait(int, struct epoll_event *, int, int);
int mkfifo(char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
int lab6(int argc, char **argv) {
  int ret;
  int fd;
  ret = mkfifo("test_fifo", 0666);
  if (ret != 0) {
    perror("mkfifo：");
  }
  fd = open("test_fifo", O_RDWR);
  if (fd < 0) {
    perror("open fifo");
    return -1;
  }
  ret = 0;
  struct epoll_event event;
  struct epoll_event wait_event;
  int epfd = epoll_create(10);
  if (-1 == epfd) {
    perror("epoll_create");
    return -1;
  }
  event.data.fd = 0;
  event.events = EPOLLIN;
  ret = epoll_ctl(epfd, EPOLL_CTL_ADD, 0, &event);
  if (-1 == ret) {
    perror("epoll_ctl");
    return -1;
  }
  event.data.fd = fd;
  event.events = EPOLLIN;
  ret = epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &event);
  if (-1 == ret) {
    perror("epoll_ctl");
    return -1;
  }
  ret = 0;
  while (1) {
    ret = epoll_wait(epfd, &wait_event, 2, -1);
    if (ret == -1) {
      close(epfd);
      perror("epoll");
    } else if (ret > 0) {
      char buf[100] = {0};
      if ((0 == wait_event.data.fd) &&
          (EPOLLIN == wait_event.events & EPOLLIN)) {
        read(0, buf, sizeof(buf));
        printf("stdin buf = %s\n", buf);
      } else if ((fd == wait_event.data.fd) &&
                 (EPOLLIN == wait_event.events & EPOLLIN)) {
        read(fd, buf, sizeof(buf));
        printf("fifo buf = %s\n", buf);
      }
    } else if (0 == ret) {
      printf("time out\n");
    }
  }
  close(epfd);
  return 0;
}


x86 assembly (clang, -O0):
<lab6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe47(%rip),%rdi
mov    $0x1b6,%esi
call   1080 <mkfifo@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11dc <lab6+0x3c>
lea    0xe33(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%esi
lea    0xe14(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1216 <lab6+0x76>
lea    0xe0f(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1441 <lab6+0x2a1>
movl   $0x0,-0x14(%rbp)
mov    $0xa,%edi
call   10c0 <epoll_create@plt>
mov    %eax,-0x2c(%rbp)
mov    $0xffffffff,%eax
cmp    -0x2c(%rbp),%eax
jne    1250 <lab6+0xb0>
lea    0xddf(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1441 <lab6+0x2a1>
movl   $0x0,-0x1c(%rbp)
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%edi
mov    0x2d6b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
lea    -0x20(%rbp),%rcx
call   1060 <epoll_ctl@plt>
mov    %eax,-0x14(%rbp)
mov    $0xffffffff,%eax
cmp    -0x14(%rbp),%eax
jne    12a3 <lab6+0x103>
lea    0xd99(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1441 <lab6+0x2a1>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%edi
mov    0x2d19(%rip),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%edx
lea    -0x20(%rbp),%rcx
call   1060 <epoll_ctl@plt>
mov    %eax,-0x14(%rbp)
mov    $0xffffffff,%eax
cmp    -0x14(%rbp),%eax
jne    12f6 <lab6+0x156>
lea    0xd46(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1441 <lab6+0x2a1>
movl   $0x0,-0x14(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x2,%edx
mov    $0xffffffff,%ecx
call   1090 <epoll_wait@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1339 <lab6+0x199>
mov    -0x2c(%rbp),%edi
call   1050 <close@plt>
lea    0xd06(%rip),%rdi
call   10b0 <perror@plt>
jmp    143c <lab6+0x29c>
cmpl   $0x0,-0x14(%rbp)
jle    1419 <lab6+0x279>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
xor    %eax,%eax
cmp    -0x24(%rbp),%eax
jne    13b4 <lab6+0x214>
mov    0x2c78(%rip),%rax
mov    (%rax),%eax
cmp    -0x28(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    0x2c64(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13b4 <lab6+0x214>
lea    -0x90(%rbp),%rsi
xor    %edi,%edi
mov    $0x64,%edx
call   1070 <read@plt>
lea    -0x90(%rbp),%rsi
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1414 <lab6+0x274>
mov    -0x18(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    140f <lab6+0x26f>
mov    0x2c19(%rip),%rax
mov    (%rax),%eax
cmp    -0x28(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    0x2c05(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     140f <lab6+0x26f>
mov    -0x18(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x64,%edx
call   1070 <read@plt>
lea    -0x90(%rbp),%rsi
lea    0xc43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1414 <lab6+0x274>
jmp    1437 <lab6+0x297>
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jne    1432 <lab6+0x292>
lea    0xc2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1437 <lab6+0x297>
jmp    143c <lab6+0x29c>
jmp    12fd <lab6+0x15d>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lab6>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xe4b(%rip),%rdi
mov    $0x1b6,%esi
call   1080 <mkfifo@plt>
test   %eax,%eax
jne    1360 <lab6+0x1c0>
mov    0x2e1a(%rip),%rax
mov    (%rax),%esi
lea    0xe29(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     1371 <lab6+0x1d1>
mov    %eax,%r14d
mov    $0xa,%edi
call   10c0 <epoll_create@plt>
cmp    $0xffffffff,%eax
je     137a <lab6+0x1da>
mov    %eax,%ebp
movl   $0x0,0x4(%rsp)
mov    0x2dd5(%rip),%r15
mov    (%r15),%eax
mov    %eax,(%rsp)
mov    0x2dc0(%rip),%rbx
mov    (%rbx),%esi
mov    %rsp,%rcx
mov    %ebp,%edi
xor    %edx,%edx
call   1060 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
je     1357 <lab6+0x1b7>
mov    %r14d,0x4(%rsp)
mov    (%r15),%eax
mov    %eax,(%rsp)
mov    (%rbx),%esi
mov    %rsp,%rcx
mov    %ebp,%edi
mov    %r14d,%edx
call   1060 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
je     1357 <lab6+0x1b7>
lea    0x8(%rsp),%rbx
lea    0xdd7(%rip),%r15
lea    0x10(%rsp),%r12
jmp    127f <lab6+0xdf>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1050 <close@plt>
mov    %r15,%rdi
call   10b0 <perror@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
mov    $0xffffffff,%ecx
call   1090 <epoll_wait@plt>
cmp    $0xffffffff,%eax
je     1270 <lab6+0xd0>
test   %eax,%eax
jle    1340 <lab6+0x1a0>
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x70(%rsp)
mov    0xc(%rsp),%eax
test   %eax,%eax
jne    12ee <lab6+0x14e>
mov    0x2d08(%rip),%rcx
mov    (%rcx),%ecx
cmp    0x8(%rsp),%ecx
sete   %dl
xor    %edi,%edi
lea    0xd51(%rip),%r13
test   %dl,%cl
jne    1317 <lab6+0x177>
cmp    %eax,%r14d
jne    127f <lab6+0xdf>
mov    0x2ce6(%rip),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
cmp    0x8(%rsp),%eax
sete   %cl
mov    %r14d,%edi
lea    0xd3c(%rip),%r13
test   %ecx,%eax
je     127f <lab6+0xdf>
mov    %r12,%rsi
mov    $0x64,%edx
call   1070 <read@plt>
mov    %r13,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    127f <lab6+0xdf>
cs nopw 0x0(%rax,%rax,1)
jne    127f <lab6+0xdf>
lea    0xd0d(%rip),%rdi
call   1030 <puts@plt>
jmp    127f <lab6+0xdf>
lea    0xccd(%rip),%rdi
jmp    1381 <lab6+0x1e1>
lea    0xca3(%rip),%rdi
call   10b0 <perror@plt>
jmp    11c7 <lab6+0x27>
lea    0xc9c(%rip),%rdi
jmp    1381 <lab6+0x1e1>
lea    0xc9d(%rip),%rdi
call   10b0 <perror@plt>
mov    $0xffffffff,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.epoll_event = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@.str = [10 x i8] c"test_fifo\00"
@.str.1 = [10 x i8] c"mkfifo\EF\BC\9A\00"
@O_RDWR = global i32 0
@.str.2 = [10 x i8] c"open fifo\00"
@.str.3 = [13 x i8] c"epoll_create\00"
@EPOLLIN = global i32 0
@EPOLL_CTL_ADD = global i32 0
@.str.4 = [10 x i8] c"epoll_ctl\00"
@.str.5 = [6 x i8] c"epoll\00"
@.str.6 = [16 x i8] c"stdin buf = %s\0A\00"
@.str.7 = [15 x i8] c"fifo buf = %s\0A\00"
@.str.8 = [10 x i8] c"time out\0A\00"
define i32 @lab6(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.epoll_event
%9 = alloca %struct.epoll_event
%10 = alloca i32
%11 = alloca [100 x i8]
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 @mkfifo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 438)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
%18 = load i32, i32* @O_RDWR
%19 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %120
24: ; preds = %17
store i32 0, i32* %6
%25 = call i32 @epoll_create(i32 10)
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = icmp eq i32 -1, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %120
30: ; preds = %24
%31 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %8, i32 0, i32 1
%32 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %31, i32 0, i32 0
store i32 0, i32* %32
%33 = load i32, i32* @EPOLLIN
%34 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %8, i32 0, i32 0
store i32 %33, i32* %34
%35 = load i32, i32* %10
%36 = load i32, i32* @EPOLL_CTL_ADD
%37 = call i32 @epoll_ctl(i32 %35, i32 %36, i32 0, %struct.epoll_event* %8)
store i32 %37, i32* %6
%38 = load i32, i32* %6
%39 = icmp eq i32 -1, %38
br i1 %39, label %40, label %42
40: ; preds = %30
%41 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %120
42: ; preds = %30
%43 = load i32, i32* %7
%44 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %8, i32 0, i32 1
%45 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %44, i32 0, i32 0
store i32 %43, i32* %45
%46 = load i32, i32* @EPOLLIN
%47 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %8, i32 0, i32 0
store i32 %46, i32* %47
%48 = load i32, i32* %10
%49 = load i32, i32* @EPOLL_CTL_ADD
%50 = load i32, i32* %7
%51 = call i32 @epoll_ctl(i32 %48, i32 %49, i32 %50, %struct.epoll_event* %8)
store i32 %51, i32* %6
%52 = load i32, i32* %6
%53 = icmp eq i32 -1, %52
br i1 %53, label %54, label %56
54: ; preds = %42
%55 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %120
56: ; preds = %42
store i32 0, i32* %6
br label %57
57: ; preds = %56, %119
%58 = load i32, i32* %10
%59 = call i32 @epoll_wait(i32 %58, %struct.epoll_event* %9, i32 2, i32 -1)
store i32 %59, i32* %6
%60 = load i32, i32* %6
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %66
62: ; preds = %57
%63 = load i32, i32* %10
%64 = call i32 @close(i32 %63)
%65 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %119
66: ; preds = %57
%67 = load i32, i32* %6
%68 = icmp sgt i32 %67, 0
br i1 %68, label %69, label %112
69: ; preds = %66
%70 = bitcast [100 x i8]* %11 to i8*
%71 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %9, i32 0, i32 1
%72 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %71, i32 0, i32 0
%73 = load i32, i32* %72
%74 = icmp eq i32 0, %73
br i1 %74, label %75, label %89
75: ; preds = %69
%76 = load i32, i32* @EPOLLIN
%77 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %9, i32 0, i32 0
%78 = load i32, i32* %77
%79 = icmp eq i32 %76, %78
%80 = zext i1 %79 to i32
%81 = load i32, i32* @EPOLLIN
%82 = and i32 %80, %81
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %89
84: ; preds = %75
%85 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%86 = call i32 @read(i32 0, i8* %85, i32 100)
%87 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %87)
br label %111
89: ; preds = %75, %69
%90 = load i32, i32* %7
%91 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %9, i32 0, i32 1
%92 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %91, i32 0, i32 0
%93 = load i32, i32* %92
%94 = icmp eq i32 %90, %93
br i1 %94, label %95, label %110
95: ; preds = %89
%96 = load i32, i32* @EPOLLIN
%97 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %9, i32 0, i32 0
%98 = load i32, i32* %97
%99 = icmp eq i32 %96, %98
%100 = zext i1 %99 to i32
%101 = load i32, i32* @EPOLLIN
%102 = and i32 %100, %101
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %110
104: ; preds = %95
%105 = load i32, i32* %7
%106 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%107 = call i32 @read(i32 %105, i8* %106, i32 100)
%108 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %108)
br label %110
110: ; preds = %104, %95, %89
br label %111
111: ; preds = %110, %84
br label %118
112: ; preds = %66
%113 = load i32, i32* %6
%114 = icmp eq i32 0, %113
br i1 %114, label %115, label %117
115: ; preds = %112
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %117
117: ; preds = %115, %112
br label %118
118: ; preds = %117, %111
br label %119
119: ; preds = %118, %62
br label %57
120: ; preds = %54, %40, %28, %22
%121 = load i32, i32* %3
ret i32 %121
}

LLVM IR (-O2):
%struct.epoll_event = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@.str = [10 x i8] c"test_fifo\00"
@.str.1 = [10 x i8] c"mkfifo\EF\BC\9A\00"
@O_RDWR = global i32 0
@.str.2 = [10 x i8] c"open fifo\00"
@.str.3 = [13 x i8] c"epoll_create\00"
@EPOLLIN = global i32 0
@EPOLL_CTL_ADD = global i32 0
@.str.4 = [10 x i8] c"epoll_ctl\00"
@.str.5 = [6 x i8] c"epoll\00"
@.str.6 = [16 x i8] c"stdin buf = %s\0A\00"
@.str.7 = [15 x i8] c"fifo buf = %s\0A\00"
@str = [9 x i8] c"time out\00"
define i32 @lab6(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.epoll_event
%4 = alloca %struct.epoll_event
%5 = alloca [100 x i8]
%6 = tail call i32 @mkfifo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 438)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* @O_RDWR
%12 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %82
16: ; preds = %10
%17 = bitcast %struct.epoll_event* %3 to i8*
%18 = bitcast %struct.epoll_event* %4 to i8*
%19 = tail call i32 @epoll_create(i32 10)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %81
23: ; preds = %16
%24 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %3, i64 0, i32 1, i32 0
store i32 0, i32* %24
%25 = load i32, i32* @EPOLLIN
%26 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %3, i64 0, i32 0
store i32 %25, i32* %26
%27 = load i32, i32* @EPOLL_CTL_ADD
%28 = call i32 @epoll_ctl(i32 %19, i32 %27, i32 0, %struct.epoll_event* %3)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %23
%31 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %81
32: ; preds = %23
store i32 %12, i32* %24
%33 = load i32, i32* @EPOLLIN
store i32 %33, i32* %26
%34 = load i32, i32* @EPOLL_CTL_ADD
%35 = call i32 @epoll_ctl(i32 %19, i32 %34, i32 %12, %struct.epoll_event* %3)
%36 = icmp eq i32 %35, -1
br i1 %36, label %41, label %37
37: ; preds = %32
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%39 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %4, i64 0, i32 1, i32 0
%40 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %4, i64 0, i32 0
br label %43
41: ; preds = %32
%42 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %81
43: ; preds = %76, %37
%44 = call i32 @epoll_wait(i32 %19, %struct.epoll_event* %4, i32 2, i32 -1)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = call i32 @close(i32 %19)
%48 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %76
49: ; preds = %43
%50 = icmp sgt i32 %44, 0
br i1 %50, label %51, label %77
51: ; preds = %49
%52 = load i32, i32* %39
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = load i32, i32* @EPOLLIN
%56 = load i32, i32* %40
%57 = icmp eq i32 %55, %56
%58 = zext i1 %57 to i32
%59 = and i32 %55, %58
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %70
61: ; preds = %54, %51
%62 = icmp eq i32 %12, %52
br i1 %62, label %63, label %75
63: ; preds = %61
%64 = load i32, i32* @EPOLLIN
%65 = load i32, i32* %40
%66 = icmp eq i32 %64, %65
%67 = zext i1 %66 to i32
%68 = and i32 %64, %67
%69 = icmp eq i32 %68, 0
br i1 %69, label %75, label %70
70: ; preds = %63, %54
%71 = phi i32 [ 0, %54 ], [ %12, %63 ]
%72 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), %54 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), %63 ]
%73 = call i32 @read(i32 %71, i8* %38, i32 100)
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %72, i8* %38)
br label %75
75: ; preds = %70, %61, %63
br label %76
76: ; preds = %75, %79, %77, %46
br label %43
77: ; preds = %49
%78 = icmp eq i32 %44, 0
br i1 %78, label %79, label %76
79: ; preds = %77
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %76
81: ; preds = %41, %30, %21
br label %82
82: ; preds = %81, %14
ret i32 -1
}