#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*/ event;

/* Variables and functions */
int EPOLLET;
int EPOLLIN;
int /*<<< orphan*/ EPOLL_CTL_ADD;
int /*<<< orphan*/ bzero(struct epoll_event *, int);
int /*<<< orphan*/ epoll_ctl(int, int /*<<< orphan*/, int,
                             struct epoll_event *);
int addSockfd(int epollfd, int fd) {
  struct epoll_event event;
  bzero(&event, sizeof(event));
  event.data.fd = fd;
  event.events = EPOLLIN | EPOLLET;
  epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &event);
}


x86 assembly (clang, -O0):
<addSockfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x8,%esi
call   1040 <bzero@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
mov    0x2e7e(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e7f(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
lea    -0x18(%rbp),%rcx
call   1030 <epoll_ctl@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addSockfd>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    $0x8,%esi
call   1040 <bzero@plt>
mov    0x2ea3(%rip),%rax
mov    0x2e84(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ebx,0xc(%rsp)
mov    %ecx,0x8(%rsp)
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %ebx,%edx
mov    %r14,%rcx
call   1030 <epoll_ctl@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.epoll_event = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@EPOLLIN = global i32 0
@EPOLLET = global i32 0
@EPOLL_CTL_ADD = global i32 0
define i32 @addSockfd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.epoll_event
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = call i32 @bzero(%struct.epoll_event* %6, i32 8)
%8 = load i32, i32* %5
%9 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %6, i32 0, i32 1
%10 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %9, i32 0, i32 0
store i32 %8, i32* %10
%11 = load i32, i32* @EPOLLIN
%12 = load i32, i32* @EPOLLET
%13 = or i32 %11, %12
%14 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %6, i32 0, i32 0
store i32 %13, i32* %14
%15 = load i32, i32* %4
%16 = load i32, i32* @EPOLL_CTL_ADD
%17 = load i32, i32* %5
%18 = call i32 @epoll_ctl(i32 %15, i32 %16, i32 %17, %struct.epoll_event* %6)
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.epoll_event = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@EPOLLIN = global i32 0
@EPOLLET = global i32 0
@EPOLL_CTL_ADD = global i32 0
define i32 @addSockfd(i32 %0, i32 %1) {
%3 = alloca %struct.epoll_event
%4 = bitcast %struct.epoll_event* %3 to i8*
%5 = call i32 @bzero(%struct.epoll_event* %3, i32 8)
%6 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %3, i64 0, i32 1, i32 0
store i32 %1, i32* %6
%7 = load i32, i32* @EPOLLIN
%8 = load i32, i32* @EPOLLET
%9 = or i32 %8, %7
%10 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %3, i64 0, i32 0
store i32 %9, i32* %10
%11 = load i32, i32* @EPOLL_CTL_ADD
%12 = call i32 @epoll_ctl(i32 %0, i32 %11, i32 %1, %struct.epoll_event* %3)
ret i32 undef
}