#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 /*<<< orphan*/ ce_poller_initialized();
scalar_t__ ce_poller_lookup(int, int);
scalar_t__ ce_poller_remove(int, int);
int /*<<< orphan*/ printf(char *, ...);
int ce_unlisten(int fd, int event) {
  if (!ce_poller_initialized()) {
    printf("INFO: Poller is not initialized\n");
    return -1;
  }
  if (ce_poller_lookup(fd, event) != 0) {
    printf("INFO: Event is not listened on fd %d\n", fd);
    return -1;
  }
  if (ce_poller_remove(fd, event) != 0) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ce_unlisten>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1060 <ce_poller_initialized@plt>
cmp    $0x0,%eax
jne    1178 <ce_unlisten+0x38>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d2 <ce_unlisten+0x92>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <ce_poller_lookup@plt>
cmp    $0x0,%rax
je     11aa <ce_unlisten+0x6a>
mov    -0x8(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d2 <ce_unlisten+0x92>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <ce_poller_remove@plt>
cmp    $0x0,%rax
je     11cb <ce_unlisten+0x8b>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d2 <ce_unlisten+0x92>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ce_unlisten>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1070 <ce_poller_initialized@plt>
test   %eax,%eax
je     1187 <ce_unlisten+0x37>
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <ce_poller_lookup@plt>
test   %rax,%rax
je     119a <ce_unlisten+0x4a>
lea    0xe89(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%eax
jmp    11a8 <ce_unlisten+0x58>
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    11a8 <ce_unlisten+0x58>
mov    %ebx,%edi
mov    %ebp,%esi
call   1060 <ce_poller_remove@plt>
neg    %rax
sbb    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"INFO: Poller is not initialized\0A\00"
@.str.1 = [38 x i8] c"INFO: Event is not listened on fd %d\0A\00"
define i32 @ce_unlisten(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (...) @ce_poller_initialized()
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %25
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call i64 @ce_poller_lookup(i32 %11, i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %16)
store i32 -1, i32* %3
br label %25
18: ; preds = %10
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = call i64 @ce_poller_remove(i32 %19, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 -1, i32* %3
br label %25
24: ; preds = %18
store i32 0, i32* %3
br label %25
25: ; preds = %24, %23, %15, %8
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str.1 = [38 x i8] c"INFO: Event is not listened on fd %d\0A\00"
@str = [32 x i8] c"INFO: Poller is not initialized\00"
define i32 @ce_unlisten(i32 %0, i32 %1) {
%3 = tail call i32 (...) @ce_poller_initialized()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %16
7: ; preds = %2
%8 = tail call i64 @ce_poller_lookup(i32 %0, i32 %1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %16
12: ; preds = %7
%13 = tail call i64 @ce_poller_remove(i32 %0, i32 %1)
%14 = icmp ne i64 %13, 0
%15 = sext i1 %14 to i32
br label %16
16: ; preds = %12, %10, %5
%17 = phi i32 [ -1, %10 ], [ -1, %5 ], [ %15, %12 ]
ret i32 %17
}