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

/* Variables and functions */
short EV_READ;
short EV_TIMEOUT;
short EV_WRITE;
int /*<<< orphan*/ client_error_callback(int /*<<< orphan*/, void *);
int /*<<< orphan*/ client_read_callback(int /*<<< orphan*/, void *);
int /*<<< orphan*/ client_write_callback(int /*<<< orphan*/, void *);
void client_callback(evutil_socket_t fd, short ev, void *arg) {
  if (ev & EV_READ)
    client_read_callback(fd, arg);
  if (ev & EV_WRITE)
    client_write_callback(fd, arg);
  if (ev & EV_TIMEOUT)
    client_error_callback(fd, arg);
}


x86 assembly (clang, -O0):
<client_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
movswl -0x6(%rbp),%eax
mov    0x2e97(%rip),%rcx
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     116b <client_callback+0x3b>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <client_read_callback@plt>
movswl -0x6(%rbp),%eax
mov    0x2e52(%rip),%rcx
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1190 <client_callback+0x60>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <client_write_callback@plt>
movswl -0x6(%rbp),%eax
mov    0x2e3d(%rip),%rcx
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11b5 <client_callback+0x85>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <client_error_callback@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client_callback>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2ea6(%rip),%rax
test   %bx,(%rax)
je     1151 <client_callback+0x21>
mov    %ebp,%edi
mov    %r14,%rsi
call   1040 <client_read_callback@plt>
mov    0x2e70(%rip),%rax
test   %bx,(%rax)
je     1167 <client_callback+0x37>
mov    %ebp,%edi
mov    %r14,%rsi
call   1050 <client_write_callback@plt>
mov    0x2e6a(%rip),%rax
test   %bx,(%rax)
je     1181 <client_callback+0x51>
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <client_error_callback@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EV_READ = global i16 0
@EV_WRITE = global i16 0
@EV_TIMEOUT = global i16 0
define void @client_callback(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%7 = load i16, i16* %5
%8 = sext i16 %7 to i32
%9 = load i16, i16* @EV_READ
%10 = sext i16 %9 to i32
%11 = and i32 %8, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* %4
%15 = load i8*, i8** %6
%16 = call i32 @client_read_callback(i32 %14, i8* %15)
br label %17
17: ; preds = %13, %3
%18 = load i16, i16* %5
%19 = sext i16 %18 to i32
%20 = load i16, i16* @EV_WRITE
%21 = sext i16 %20 to i32
%22 = and i32 %19, %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %17
%25 = load i32, i32* %4
%26 = load i8*, i8** %6
%27 = call i32 @client_write_callback(i32 %25, i8* %26)
br label %28
28: ; preds = %24, %17
%29 = load i16, i16* %5
%30 = sext i16 %29 to i32
%31 = load i16, i16* @EV_TIMEOUT
%32 = sext i16 %31 to i32
%33 = and i32 %30, %32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %28
%36 = load i32, i32* %4
%37 = load i8*, i8** %6
%38 = call i32 @client_error_callback(i32 %36, i8* %37)
br label %39
39: ; preds = %35, %28
ret void
}

LLVM IR (-O2):
@EV_READ = global i16 0
@EV_WRITE = global i16 0
@EV_TIMEOUT = global i16 0
define void @client_callback(i32 %0, i16 signext %1, i8* %2) {
%4 = load i16, i16* @EV_READ
%5 = and i16 %4, %1
%6 = icmp eq i16 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @client_read_callback(i32 %0, i8* %2)
br label %9
9: ; preds = %7, %3
%10 = load i16, i16* @EV_WRITE
%11 = and i16 %10, %1
%12 = icmp eq i16 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 @client_write_callback(i32 %0, i8* %2)
br label %15
15: ; preds = %13, %9
%16 = load i16, i16* @EV_TIMEOUT
%17 = and i16 %16, %1
%18 = icmp eq i16 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = tail call i32 @client_error_callback(i32 %0, i8* %2)
br label %21
21: ; preds = %19, %15
ret void
}