#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 *, ...);
void printWithStatus(const char *prefix, int occurred) {
  printf("%s", prefix);
  if (occurred)
    printf("%sFailed.%s\n", "\x1B[31m", "\x1B[0m");
  else
    printf("%sSuccess.%s", "\x1B[32m", "\x1B[0m");
}


x86 assembly (clang, -O0):
<printWithStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     115c <printWithStatus+0x4c>
lea    0xebe(%rip),%rdi
lea    0xec4(%rip),%rsi
lea    0xec3(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1178 <printWithStatus+0x68>
lea    0xeb5(%rip),%rdi
lea    0xebb(%rip),%rsi
lea    0xea2(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printWithStatus>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0xf05(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
je     1138 <printWithStatus+0x28>
lea    0xed1(%rip),%rdi
lea    0xed7(%rip),%rsi
jmp    1146 <printWithStatus+0x36>
lea    0xed9(%rip),%rdi
lea    0xedf(%rip),%rsi
lea    0xec6(%rip),%rdx
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"%sFailed.%s\0A\00"
@.str.2 = [6 x i8] c"\1B[31m\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
@.str.4 = [13 x i8] c"%sSuccess.%s\00"
@.str.5 = [6 x i8] c"\1B[32m\00"
define void @printWithStatus(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %9
7: ; preds = %2
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}