#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*/ printf(char *, char const *, char *, char *, char *);
void test_result(const char *testname, const bool passed) {
  char *color;
  char *msg;
  if (passed) {
    msg = "passed";
    color = "\033[0;32m";
  } else {
    msg = "failed";
    color = "\033[0;31m";
  }
  printf("%-15s %s%s%s\n", testname, color, msg, "\033[0;m");
}


x86 assembly (clang, -O0):
<test_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1144 <test_result+0x34>
lea    0xed0(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xecc(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    115a <test_result+0x4a>
lea    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xec0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xeb1(%rip),%rdi
lea    0xeb8(%rip),%r8
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_result>:
mov    %rdi,%rax
test   %esi,%esi
lea    0xefa(%rip),%rcx
lea    0xee4(%rip),%rdx
cmove  %rcx,%rdx
lea    0xee1(%rip),%rsi
lea    0xecb(%rip),%rcx
cmove  %rsi,%rcx
lea    0xede(%rip),%rdi
lea    0xee5(%rip),%r8
mov    %rax,%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"passed\00"
@.str.1 = [8 x i8] c"\1B[0;32m\00"
@.str.2 = [7 x i8] c"failed\00"
@.str.3 = [8 x i8] c"\1B[0;31m\00"
@.str.4 = [14 x i8] c"%-15s %s%s%s\0A\00"
@.str.5 = [6 x i8] c"\1B[0;m\00"
define void @test_result(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %11
10: ; preds = %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %5
br label %11
11: ; preds = %10, %9
%12 = load i8*, i8** %3
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %12, i8* %13, i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"passed\00"
@.str.1 = [8 x i8] c"\1B[0;32m\00"
@.str.2 = [7 x i8] c"failed\00"
@.str.3 = [8 x i8] c"\1B[0;31m\00"
@.str.4 = [14 x i8] c"%-15s %s%s%s\0A\00"
@.str.5 = [6 x i8] c"\1B[0;m\00"
define void @test_result(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
%5 = select i1 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* %4, i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}