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

/* Variables and functions */
int POLLERR;
int POLLHUP;
int POLLIN;
int POLLNVAL;
int POLLOUT;
int POLLPRI;
int /*<<< orphan*/ printf(char *);
void print_events(int events) {
  if (events & POLLIN)
    printf("POLLIN ");
  if (events & POLLPRI)
    printf("POLLPRI ");
  if (events & POLLOUT)
    printf("POLLOUT ");
  if (events & POLLERR)
    printf("POLLERR ");
  if (events & POLLHUP)
    printf("POLLHUP ");
  if (events & POLLNVAL)
    printf("POLLNVAL ");
  printf("\n");
}


x86 assembly (clang, -O0):
<print_events>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e9b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     113c <print_events+0x2c>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2ea2(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     115d <print_events+0x4d>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2e91(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     117e <print_events+0x6e>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2e48(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     119f <print_events+0x8f>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2e2f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11c0 <print_events+0xb0>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    0x2dfe(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11e1 <print_events+0xd1>
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_events>:
push   %rbx
mov    %edi,%ebx
mov    0x2e96(%rip),%rax
test   %edi,(%rax)
je     113a <print_events+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
mov    0x2ea7(%rip),%rax
test   %ebx,(%rax)
je     1151 <print_events+0x31>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
mov    0x2ea0(%rip),%rax
test   %ebx,(%rax)
je     1168 <print_events+0x48>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e61(%rip),%rax
test   %ebx,(%rax)
je     117f <print_events+0x5f>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e52(%rip),%rax
test   %ebx,(%rax)
je     1196 <print_events+0x76>
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e2b(%rip),%rax
test   %ebx,(%rax)
je     11ad <print_events+0x8d>
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@POLLIN = global i32 0
@.str = [8 x i8] c"POLLIN \00"
@POLLPRI = global i32 0
@.str.1 = [9 x i8] c"POLLPRI \00"
@POLLOUT = global i32 0
@.str.2 = [9 x i8] c"POLLOUT \00"
@POLLERR = global i32 0
@.str.3 = [9 x i8] c"POLLERR \00"
@POLLHUP = global i32 0
@.str.4 = [9 x i8] c"POLLHUP \00"
@POLLNVAL = global i32 0
@.str.5 = [10 x i8] c"POLLNVAL \00"
@.str.6 = [2 x i8] c"\0A\00"
define void @print_events(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @POLLIN
%5 = and i32 %3, %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
%11 = load i32, i32* @POLLPRI
%12 = and i32 %10, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %9
%17 = load i32, i32* %2
%18 = load i32, i32* @POLLOUT
%19 = and i32 %17, %18
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %16
%24 = load i32, i32* %2
%25 = load i32, i32* @POLLERR
%26 = and i32 %24, %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %23
%31 = load i32, i32* %2
%32 = load i32, i32* @POLLHUP
%33 = and i32 %31, %32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35, %30
%38 = load i32, i32* %2
%39 = load i32, i32* @POLLNVAL
%40 = and i32 %38, %39
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42, %37
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@POLLIN = global i32 0
@.str = [8 x i8] c"POLLIN \00"
@POLLPRI = global i32 0
@.str.1 = [9 x i8] c"POLLPRI \00"
@POLLOUT = global i32 0
@.str.2 = [9 x i8] c"POLLOUT \00"
@POLLERR = global i32 0
@.str.3 = [9 x i8] c"POLLERR \00"
@POLLHUP = global i32 0
@.str.4 = [9 x i8] c"POLLHUP \00"
@POLLNVAL = global i32 0
@.str.5 = [10 x i8] c"POLLNVAL \00"
define void @print_events(i32 %0) {
%2 = load i32, i32* @POLLIN
%3 = and i32 %2, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* @POLLPRI
%9 = and i32 %8, %0
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %7
%14 = load i32, i32* @POLLOUT
%15 = and i32 %14, %0
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
%20 = load i32, i32* @POLLERR
%21 = and i32 %20, %0
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23, %19
%26 = load i32, i32* @POLLHUP
%27 = and i32 %26, %0
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
%32 = load i32, i32* @POLLNVAL
%33 = and i32 %32, %0
%34 = icmp eq i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %37
37: ; preds = %35, %31
%38 = tail call i32 @putchar(i32 10)
ret void
}