#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__ {
  scalar_t__ fd;
};
struct epoll_event {
  int events;
  TYPE_1__ data;
};

/* Variables and functions */
int EPOLLIN;
int EPOLLOUT;
int /*<<< orphan*/ EPOLL_CTL_ADD;
int epoll_create(int);
int /*<<< orphan*/ epoll_ctl(int, int /*<<< orphan*/, int /*<<< orphan*/,
                             struct epoll_event *);
int epoll_wait(int, struct epoll_event *, int, int);
int main(int argc, char **argv) {
  struct epoll_event ev[4];
  int nfds;
  int efd;
  efd = epoll_create(4);
  ev[0].events = EPOLLIN | EPOLLOUT;
  ev[0].data.fd = 0;
  epoll_ctl(efd, EPOLL_CTL_ADD, 0, &(ev[0]));
  if ((nfds = epoll_wait(efd, ev, 4, 20))) {
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1050 <epoll_create@plt>
mov    %eax,-0x58(%rbp)
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
mov    0x2e6d(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x50(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x58(%rbp),%edi
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rcx
xor    %edx,%edx
call   1030 <epoll_ctl@plt>
mov    -0x58(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x4,%edx
mov    $0x14,%ecx
call   1040 <epoll_wait@plt>
mov    %eax,-0x54(%rbp)
cmp    $0x0,%eax
je     11ae <main+0x7e>
jmp    11ae <main+0x7e>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    $0x4,%edi
call   1050 <epoll_create@plt>
mov    %eax,%ebx
mov    0x2e9e(%rip),%rax
mov    0x2e7f(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%r14
mov    %ebx,%edi
xor    %edx,%edx
mov    %r14,%rcx
call   1030 <epoll_ctl@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
mov    $0x14,%ecx
call   1040 <epoll_wait@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.epoll_event = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64 }
@EPOLLIN = global i32 0
@EPOLLOUT = global i32 0
@EPOLL_CTL_ADD = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x %struct.epoll_event]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @epoll_create(i32 4)
store i32 %9, i32* %8
%10 = load i32, i32* @EPOLLIN
%11 = load i32, i32* @EPOLLOUT
%12 = or i32 %10, %11
%13 = getelementptr inbounds [4 x %struct.epoll_event], [4 x %struct.epoll_event]* %6, i64 0, i64 0
%14 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %13, i32 0, i32 0
store i32 %12, i32* %14
%15 = getelementptr inbounds [4 x %struct.epoll_event], [4 x %struct.epoll_event]* %6, i64 0, i64 0
%16 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %15, i32 0, i32 1
%17 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %16, i32 0, i32 0
store i64 0, i64* %17
%18 = load i32, i32* %8
%19 = load i32, i32* @EPOLL_CTL_ADD
%20 = getelementptr inbounds [4 x %struct.epoll_event], [4 x %struct.epoll_event]* %6, i64 0, i64 0
%21 = call i32 @epoll_ctl(i32 %18, i32 %19, i32 0, %struct.epoll_event* %20)
%22 = load i32, i32* %8
%23 = getelementptr inbounds [4 x %struct.epoll_event], [4 x %struct.epoll_event]* %6, i64 0, i64 0
%24 = call i32 @epoll_wait(i32 %22, %struct.epoll_event* %23, i32 4, i32 20)
store i32 %24, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %2
br label %27
27: ; preds = %26, %2
ret i32 0
}

LLVM IR (-O2):
%struct.epoll_event = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64 }
@EPOLLIN = global i32 0
@EPOLLOUT = global i32 0
@EPOLL_CTL_ADD = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x %struct.epoll_event]
%4 = bitcast [4 x %struct.epoll_event]* %3 to i8*
%5 = tail call i32 @epoll_create(i32 4)
%6 = load i32, i32* @EPOLLIN
%7 = load i32, i32* @EPOLLOUT
%8 = or i32 %7, %6
%9 = getelementptr inbounds [4 x %struct.epoll_event], [4 x %struct.epoll_event]* %3, i64 0, i64 0
%10 = getelementptr inbounds [4 x %struct.epoll_event], [4 x %struct.epoll_event]* %3, i64 0, i64 0, i32 0
store i32 %8, i32* %10
%11 = getelementptr inbounds [4 x %struct.epoll_event], [4 x %struct.epoll_event]* %3, i64 0, i64 0, i32 1, i32 0
store i64 0, i64* %11
%12 = load i32, i32* @EPOLL_CTL_ADD
%13 = call i32 @epoll_ctl(i32 %5, i32 %12, i32 0, %struct.epoll_event* %9)
%14 = call i32 @epoll_wait(i32 %5, %struct.epoll_event* %9, i32 4, i32 20)
ret i32 0
}