#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 */
struct event_base {
  int dummy;
};
typedef enum event_method_feature {
  ____Placeholder_event_method_feature
} event_method_feature;

/* Variables and functions */
int EV_FEATURE_ET;
int EV_FEATURE_FDS;
int EV_FEATURE_O1;
int event_base_get_features(struct event_base const *);
int /*<<< orphan*/ event_base_get_method(struct event_base const *);
int /*<<< orphan*/ log_dbg_printf(char *, char *, ...);
void proxy_debug_base(const struct event_base *ev_base) {
  log_dbg_printf("Using libevent backend '%s'\n",
                 event_base_get_method(ev_base));
  enum event_method_feature f;
  f = event_base_get_features(ev_base);
  log_dbg_printf("Event base supports: edge %s, O(1) %s, anyfd %s\n",
                 ((f & EV_FEATURE_ET) ? "yes" : "no"),
                 ((f & EV_FEATURE_O1) ? "yes" : "no"),
                 ((f & EV_FEATURE_FDS) ? "yes" : "no"));
}


x86 assembly (clang, -O0):
<proxy_debug_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <event_base_get_method@plt>
movslq %eax,%rsi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <log_dbg_printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <event_base_get_features@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    0x2e6c(%rip),%rax
and    (%rax),%ecx
lea    0xedd(%rip),%rsi
lea    0xed2(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0xc(%rbp),%ecx
mov    0x2e3b(%rip),%rax
and    (%rax),%ecx
lea    0xebc(%rip),%rdx
lea    0xeb1(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0xc(%rbp),%edi
mov    0x2e3a(%rip),%rax
and    (%rax),%edi
lea    0xe9b(%rip),%rcx
lea    0xe90(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <log_dbg_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proxy_debug_base>:
push   %rbx
mov    %rdi,%rbx
call   1050 <event_base_get_method@plt>
movslq %eax,%rsi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <log_dbg_printf@plt>
mov    %rbx,%rdi
call   1030 <event_base_get_features@plt>
mov    0x2e7f(%rip),%rcx
mov    (%rcx),%ecx
and    %eax,%ecx
lea    0xeee(%rip),%rdi
lea    0xee3(%rip),%rcx
mov    %rcx,%rsi
cmove  %rdi,%rsi
mov    0x2e4f(%rip),%rdx
mov    (%rdx),%edx
and    %eax,%edx
mov    %rcx,%rdx
cmove  %rdi,%rdx
mov    0x2e5d(%rip),%rbx
and    (%rbx),%eax
cmove  %rdi,%rcx
lea    0xe85(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <log_dbg_printf@plt>

LLVM IR (-O0):
%struct.event_base = type { i32 }
@.str = [29 x i8] c"Using libevent backend '%s'\0A\00"
@.str.1 = [49 x i8] c"Event base supports: edge %s, O(1) %s, anyfd %s\0A\00"
@EV_FEATURE_ET = global i32 0
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [3 x i8] c"no\00"
@EV_FEATURE_O1 = global i32 0
@EV_FEATURE_FDS = global i32 0
define void @proxy_debug_base(%struct.event_base* %0) {
%2 = alloca %struct.event_base*
%3 = alloca i32
store %struct.event_base* %0, %struct.event_base** %2
%4 = load %struct.event_base*, %struct.event_base** %2
%5 = call i32 @event_base_get_method(%struct.event_base* %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = call i32 (i8*, i8*, ...) @log_dbg_printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load %struct.event_base*, %struct.event_base** %2
%10 = call i32 @event_base_get_features(%struct.event_base* %9)
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = load i32, i32* @EV_FEATURE_ET
%13 = and i32 %11, %12
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%17 = load i32, i32* %3
%18 = load i32, i32* @EV_FEATURE_O1
%19 = and i32 %17, %18
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%23 = load i32, i32* %3
%24 = load i32, i32* @EV_FEATURE_FDS
%25 = and i32 %23, %24
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%29 = call i32 (i8*, i8*, ...) @log_dbg_printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %22, i8* %28)
ret void
}

LLVM IR (-O2):
%struct.event_base = type { i32 }
@.str = [29 x i8] c"Using libevent backend '%s'\0A\00"
@.str.1 = [49 x i8] c"Event base supports: edge %s, O(1) %s, anyfd %s\0A\00"
@EV_FEATURE_ET = global i32 0
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [3 x i8] c"no\00"
@EV_FEATURE_O1 = global i32 0
@EV_FEATURE_FDS = global i32 0
define void @proxy_debug_base(%struct.event_base* %0) {
%2 = tail call i32 @event_base_get_method(%struct.event_base* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 (i8*, i8*, ...) @log_dbg_printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = tail call i32 @event_base_get_features(%struct.event_base* %0)
%7 = load i32, i32* @EV_FEATURE_ET
%8 = and i32 %7, %6
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%11 = load i32, i32* @EV_FEATURE_O1
%12 = and i32 %11, %6
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%15 = load i32, i32* @EV_FEATURE_FDS
%16 = and i32 %15, %6
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%19 = tail call i32 (i8*, i8*, ...) @log_dbg_printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %14, i8* %18)
ret void
}