#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 *, ...);
void assert_equal_int(int x, int y, char *func_name, char *msg) {
  if (x == y) {
    printf("%s[PASSED] %s: passed\n", "\x1B[32m", func_name);
  } else {
    printf("%s[FAILED] %s: %s\n", "\x1B[31m", func_name, msg);
    printf("%sGot: %d\n", "\x1B[37m", y);
    printf("Expected: %d\n", x);
  }
  printf("%s", "\x1B[37m");
}


x86 assembly (clang, -O0):
<assert_equal_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1150 <assert_equal_int+0x40>
mov    -0x10(%rbp),%rdx
lea    0xec3(%rip),%rdi
lea    0xed3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1196 <assert_equal_int+0x86>
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xebe(%rip),%rdi
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edx
lea    0xebf(%rip),%rdi
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_equal_int>:
push   %rbp
push   %rbx
push   %rax
cmp    %esi,%edi
jne    112e <assert_equal_int+0x1e>
lea    0xee2(%rip),%rdi
lea    0xef2(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    116e <assert_equal_int+0x5e>
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xee4(%rip),%rdi
lea    0xef0(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    0xeec(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    0xec5(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"%s[PASSED] %s: passed\0A\00"
@.str.1 = [6 x i8] c"\1B[32m\00"
@.str.2 = [19 x i8] c"%s[FAILED] %s: %s\0A\00"
@.str.3 = [6 x i8] c"\1B[31m\00"
@.str.4 = [11 x i8] c"%sGot: %d\0A\00"
@.str.5 = [6 x i8] c"\1B[37m\00"
@.str.6 = [14 x i8] c"Expected: %d\0A\00"
@.str.7 = [3 x i8] c"%s\00"
define void @assert_equal_int(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i8*, i8** %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %23
15: ; preds = %4
%16 = load i8*, i8** %7
%17 = load i8*, i8** %8
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i32, i32* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %5
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %15, %12
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"%s[PASSED] %s: passed\0A\00"
@.str.1 = [6 x i8] c"\1B[32m\00"
@.str.2 = [19 x i8] c"%s[FAILED] %s: %s\0A\00"
@.str.3 = [6 x i8] c"\1B[31m\00"
@.str.4 = [11 x i8] c"%sGot: %d\0A\00"
@.str.5 = [6 x i8] c"\1B[37m\00"
@.str.6 = [14 x i8] c"Expected: %d\0A\00"
@.str.7 = [3 x i8] c"%s\00"
define void @assert_equal_int(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp eq i32 %0, %1
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %12
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* %3)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %1)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %0)
br label %12
12: ; preds = %8, %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}