#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int test(int cond, char *name) {
  printf("Checking %60s...", name);
  if (cond == 0) {
    printf("%c[0;32;40m%s%c[0m\n", 27, ("Passed"), 27);
    ;
    return 0;
  } else if (cond > 0) {
    printf("%c[0;31;40m%s%c[0m\n", 27, ("Failed"), 27);
    ;
    return 1;
  } else {
    printf("%c[7;31;40m%s%c[0m\n", 27, ("Critical Fail! ABORTING!"), 27);
    ;
    exit(1);
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1173 <test+0x53>
lea    0xebf(%rip),%rdi
mov    $0x1b,%ecx
lea    0xec7(%rip),%rdx
mov    %ecx,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11cb <test+0xab>
cmpl   $0x0,-0x8(%rbp)
jle    11a5 <test+0x85>
lea    0xea8(%rip),%rdi
mov    $0x1b,%ecx
lea    0xeb0(%rip),%rdx
mov    %ecx,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11cb <test+0xab>
lea    0xe9b(%rip),%rdi
mov    $0x1b,%ecx
lea    0xea3(%rip),%rdx
mov    %ecx,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
je     1161 <test+0x41>
jle    1189 <test+0x69>
lea    0xeea(%rip),%rdi
lea    0xef7(%rip),%rdx
mov    $0x1b,%esi
mov    $0x1b,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
jmp    1180 <test+0x60>
lea    0xea9(%rip),%rdi
lea    0xeb6(%rip),%rdx
mov    $0x1b,%esi
mov    $0x1b,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xeb7(%rip),%rdi
lea    0xec4(%rip),%rdx
mov    $0x1b,%esi
mov    $0x1b,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Checking %60s...\00"
@.str.1 = [20 x i8] c"%c[0;32;40m%s%c[0m\0A\00"
@.str.2 = [7 x i8] c"Passed\00"
@.str.3 = [20 x i8] c"%c[0;31;40m%s%c[0m\0A\00"
@.str.4 = [7 x i8] c"Failed\00"
@.str.5 = [20 x i8] c"%c[7;31;40m%s%c[0m\0A\00"
@.str.6 = [25 x i8] c"Critical Fail! ABORTING!\00"
define i32 @test(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 27)
store i32 0, i32* %3
br label %20
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 27)
store i32 1, i32* %3
br label %20
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 27)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %15, %10
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [17 x i8] c"Checking %60s...\00"
@.str.1 = [20 x i8] c"%c[0;32;40m%s%c[0m\0A\00"
@.str.2 = [7 x i8] c"Passed\00"
@.str.3 = [20 x i8] c"%c[0;31;40m%s%c[0m\0A\00"
@.str.4 = [7 x i8] c"Failed\00"
@.str.5 = [20 x i8] c"%c[7;31;40m%s%c[0m\0A\00"
@.str.6 = [25 x i8] c"Critical Fail! ABORTING!\00"
define i32 @test(i32 %0, i8* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 27)
br label %14
7: ; preds = %2
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 27)
br label %14
11: ; preds = %7
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 27, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 27)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %9, %5
%15 = phi i32 [ 0, %5 ], [ 1, %9 ]
ret i32 %15
}