#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*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, char *);
int expect_bol(int expected, int ret) {
  printf("\tBOL Expected %s, Got %s\n",
         expected == 0 ? "TRUE(SUCCESS)" : "FALSE(FAILURE)",
         ret ? "TRUE(SUCCESS)" : "FALSE(FAILURE)");
  fflush(NULL);
  if ((expected == 0) && (ret == 0)) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<expect_bol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
lea    0xef0(%rip),%rsi
lea    0xedb(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
mov    -0xc(%rbp),%ecx
lea    0xed8(%rip),%rdx
lea    0xec3(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <fflush@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1193 <expect_bol+0x73>
cmpl   $0x0,-0xc(%rbp)
jne    1193 <expect_bol+0x73>
movl   $0xffffffff,-0x4(%rbp)
jmp    119a <expect_bol+0x7a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_bol>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
test   %edi,%edi
lea    0xeec(%rip),%rdx
lea    0xef3(%rip),%rcx
mov    %rcx,%rax
cmove  %rdx,%rax
mov    %esi,%ebp
test   %esi,%esi
cmove  %rcx,%rdx
lea    0xeb5(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
xor    %eax,%eax
or     %ebx,%ebp
sete   %al
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\09BOL Expected %s, Got %s\0A\00"
@.str.1 = [14 x i8] c"TRUE(SUCCESS)\00"
@.str.2 = [15 x i8] c"FALSE(FAILURE)\00"
define i32 @expect_bol(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0)
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0)
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %13)
%15 = call i32 @fflush(i32* null)
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 -1, i32* %3
br label %23
22: ; preds = %18, %2
store i32 0, i32* %3
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [26 x i8] c"\09BOL Expected %s, Got %s\0A\00"
@.str.1 = [14 x i8] c"TRUE(SUCCESS)\00"
@.str.2 = [15 x i8] c"FALSE(FAILURE)\00"
define i32 @expect_bol(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0)
%5 = icmp eq i32 %1, 0
%6 = select i1 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6)
%8 = tail call i32 @fflush(i32* null)
%9 = or i32 %1, %0
%10 = icmp eq i32 %9, 0
%11 = sext i1 %10 to i32
ret i32 %11
}