#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 *, ...);
int /*<<< orphan*/ putchar(char);
int strlen(char *);
int test(char *msg, int assertion) {
  printf("%s", msg);
  for (int i = strlen(msg); i < 72; i++)
    putchar(' ');
  if (assertion)
    printf("\e[1;32mPASSED\e[00m\n");
  else
    printf("\e[1;31mFAILED\e[00m\n");
  return assertion;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x48,-0x10(%rbp)
jge    117f <test+0x4f>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <test+0x2d>
cmpl   $0x0,-0xc(%rbp)
je     119c <test+0x6c>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11aa <test+0x7a>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%rbp
lea    0xeb1(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
cmp    $0x47,%eax
jg     117e <test+0x3e>
mov    %eax,%ebp
add    $0xffffffb8,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebp
jne    1170 <test+0x30>
test   %ebx,%ebx
lea    0xe7c(%rip),%rax
lea    0xe88(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [20 x i8] c"\1B[1;32mPASSED\1B[00m\0A\00"
@.str.2 = [20 x i8] c"\1B[1;31mFAILED\1B[00m\0A\00"
define i32 @test(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %5
br label %10
10: ; preds = %15, %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 72
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = call i32 @putchar(i8 signext 32)
br label %15
15: ; preds = %13
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %10
18: ; preds = %10
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %25
23: ; preds = %18
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@str = [19 x i8] c"\1B[1;31mFAILED\1B[00m\00"
@str.3 = [19 x i8] c"\1B[1;32mPASSED\1B[00m\00"
define i32 @test(i8* %0, i32 returned %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp slt i32 %4, 72
br i1 %5, label %10, label %6
6: ; preds = %10, %2
%7 = icmp eq i32 %1, 0
%8 = select i1 %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.3, i64 0, i64 0)
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
ret i32 %1
10: ; preds = %2, %10
%11 = phi i32 [ %13, %10 ], [ %4, %2 ]
%12 = tail call i32 @putchar(i8 signext 32)
%13 = add i32 %11, 1
%14 = icmp eq i32 %13, 72
br i1 %14, label %6, label %10
}