#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_gez(int expected, int result) {
  printf("\tGEZ Expected %s, Got %s\n", expected == 0 ? "SUCCESS" : "FAILURE",
         result >= 0 ? "SUCCESS" : "FAILURE");
  fflush(NULL);
  if ((result >= 0) && (expected == 0)) {
    return 0;
  }
  return -1;
}


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

x86 assembly (clang, -O2):
<expect_gez>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
sete   %bpl
lea    0xeea(%rip),%rcx
lea    0xeeb(%rip),%rdx
mov    %rdx,%rax
cmove  %rcx,%rax
test   %esi,%esi
setns  %bl
cmovns %rcx,%rdx
lea    0xeb2(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
and    %bpl,%bl
movzbl %bl,%eax
add    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\09GEZ Expected %s, Got %s\0A\00"
@.str.1 = [8 x i8] c"SUCCESS\00"
@.str.2 = [8 x i8] c"FAILURE\00"
define i32 @expect_gez(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 ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%10 = load i32, i32* %5
%11 = icmp sge i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 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* %5
%17 = icmp sge i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 0, i32* %3
br label %23
22: ; preds = %18, %2
store i32 -1, 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"\09GEZ Expected %s, Got %s\0A\00"
@.str.1 = [8 x i8] c"SUCCESS\00"
@.str.2 = [8 x i8] c"FAILURE\00"
define i32 @expect_gez(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%5 = icmp sgt i32 %1, -1
%6 = select i1 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, 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 = and i1 %3, %5
%10 = xor i1 %9, true
%11 = sext i1 %10 to i32
ret i32 %11
}