#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*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
scalar_t__ isatty(int);
int /*<<< orphan*/ stdout;
void unit_test_checker(const char *expr, int eval) {
  char *pass_str = NULL;
  char *fail_str = NULL;
  char *long_dash = "---------------";
  if (isatty(1)) {
    pass_str = "[\e[1;32mPASS\e[0m]";
    fail_str = "[\e[1;31mFAIL\e[0m]";
  } else {
    pass_str = "[PASS]";
    fail_str = "[FAIL]";
  }
  if (!eval) {
    fprintf(stdout, "%s", fail_str);
  } else {
    fprintf(stdout, "%s", pass_str);
  }
  fprintf(stdout, " %s %s\n", long_dash, expr);
  return;
}


x86 assembly (clang, -O0):
<unit_test_checker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    $0x1,%edi
call   1030 <isatty@plt>
cmp    $0x0,%rax
je     1179 <unit_test_checker+0x59>
lea    0xeab(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb2(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    118f <unit_test_checker+0x6f>
lea    0xeb4(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb0(%rip),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11b9 <unit_test_checker+0x99>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe95(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11d4 <unit_test_checker+0xb4>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe59(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unit_test_checker>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x1,%edi
call   1030 <isatty@plt>
test   %rax,%rax
lea    0xef8(%rip),%rax
lea    0xecd(%rip),%rcx
cmove  %rax,%rcx
lea    0xeed(%rip),%rax
lea    0xecd(%rip),%rdx
cmove  %rax,%rdx
test   %ebp,%ebp
cmovne %rcx,%rdx
mov    0x2e7a(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xed2(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xec4(%rip),%rsi
lea    0xe78(%rip),%rdx
mov    %rbx,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"---------------\00"
@.str.1 = [18 x i8] c"[\1B[1;32mPASS\1B[0m]\00"
@.str.2 = [18 x i8] c"[\1B[1;31mFAIL\1B[0m]\00"
@.str.3 = [7 x i8] c"[PASS]\00"
@.str.4 = [7 x i8] c"[FAIL]\00"
@stdout = global i32 0
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [8 x i8] c" %s %s\0A\00"
define void @unit_test_checker(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i8* null, i8** %5
store i8* null, i8** %6
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = call i64 @isatty(i32 1)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8** %6
br label %12
11: ; preds = %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %6
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %12
%16 = load i32, i32* @stdout
%17 = load i8*, i8** %6
%18 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %17)
br label %23
19: ; preds = %12
%20 = load i32, i32* @stdout
%21 = load i8*, i8** %5
%22 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %19, %15
%24 = load i32, i32* @stdout
%25 = load i8*, i8** %7
%26 = load i8*, i8** %3
%27 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %25, i8* %26)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"---------------\00"
@.str.1 = [18 x i8] c"[\1B[1;32mPASS\1B[0m]\00"
@.str.2 = [18 x i8] c"[\1B[1;31mFAIL\1B[0m]\00"
@.str.3 = [7 x i8] c"[PASS]\00"
@.str.4 = [7 x i8] c"[FAIL]\00"
@stdout = global i32 0
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [8 x i8] c" %s %s\0A\00"
define void @unit_test_checker(i8* %0, i32 %1) {
%3 = tail call i64 @isatty(i32 1)
%4 = icmp eq i64 %3, 0
%5 = icmp eq i32 %1, 0
%6 = select i1 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0)
%7 = select i1 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0)
%8 = select i1 %5, i8* %7, i8* %6
%9 = load i32, i32* @stdout
%10 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %8)
%11 = load i32, i32* @stdout
%12 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}