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


x86 assembly (clang, -O0):
<expect_zng>:
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
cmove  %rax,%rdx
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <fflush@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    118b <expect_zng+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    1192 <expect_zng+0x72>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_zng>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
test   %edi,%edi
lea    0xeec(%rip),%rcx
lea    0xeed(%rip),%rdx
mov    %rdx,%rax
cmove  %rcx,%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
cmp    %ebx,%ebp
setne  %al
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\09ZNG 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_zng(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 eq 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 = load i32, i32* %4
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %2
store i32 0, i32* %3
br label %21
20: ; preds = %2
store i32 -1, i32* %3
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [26 x i8] c"\09ZNG 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_zng(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 eq i32 %1, 0
%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 = icmp ne i32 %1, %0
%10 = sext i1 %9 to i32
ret i32 %10
}