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


x86 assembly (clang, -O0):
<assert_equal_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    116c <assert_equal_str+0x4c>
cmpq   $0x0,-0x10(%rbp)
jne    116c <assert_equal_str+0x4c>
mov    -0x18(%rbp),%rdx
lea    0xea7(%rip),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1255 <assert_equal_str+0x135>
cmpq   $0x0,-0x8(%rbp)
je     1182 <assert_equal_str+0x62>
cmpq   $0x0,-0x10(%rbp)
jne    11cf <assert_equal_str+0xaf>
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe8c(%rip),%rdi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdx
lea    0xe8c(%rip),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1255 <assert_equal_str+0x135>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1203 <assert_equal_str+0xe3>
mov    -0x18(%rbp),%rdx
lea    0xe10(%rip),%rdi
lea    0xe20(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124b <assert_equal_str+0x12b>
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe0b(%rip),%rdi
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdx
lea    0xe0b(%rip),%rdi
lea    0xe0f(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1250 <assert_equal_str+0x130>
jmp    1255 <assert_equal_str+0x135>
lea    0xdf9(%rip),%rdi
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_equal_str>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rdi,%rax
or     %rsi,%rax
jne    114d <assert_equal_str+0x2d>
lea    0xec6(%rip),%rdi
lea    0xed6(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11b3 <assert_equal_str+0x93>
mov    %rcx,%r12
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rdi,%rdi
je     116f <assert_equal_str+0x4f>
test   %rbx,%rbx
je     116f <assert_equal_str+0x4f>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1133 <assert_equal_str+0x13>
lea    0xea7(%rip),%rdi
lea    0xeb3(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
lea    0xea9(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    0xe80(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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: %s\0A\00"
@.str.5 = [6 x i8] c"\1B[37m\00"
@.str.6 = [14 x i8] c"Expected: %s\0A\00"
@.str.7 = [3 x i8] c"%s\00"
define void @assert_equal_str(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %4
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i8*, i8** %7
%16 = call i32 (i8*, 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* %15)
br label %49
17: ; preds = %11, %4
%18 = load i8*, i8** %5
%19 = icmp eq i8* %18, null
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i8*, i8** %6
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %31
23: ; preds = %20, %17
%24 = load i8*, i8** %7
%25 = load i8*, i8** %8
%26 = call i32 (i8*, 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* %24, i8* %25)
%27 = load i8*, i8** %6
%28 = call i32 (i8*, 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), i8* %27)
%29 = load i8*, i8** %5
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %29)
br label %49
31: ; preds = %20
%32 = load i8*, i8** %5
%33 = load i8*, i8** %6
%34 = call i32 @strcmp(i8* %32, i8* %33)
%35 = icmp ne i32 %34, 0
br i1 %35, label %39, label %36
36: ; preds = %31
%37 = load i8*, i8** %7
%38 = call i32 (i8*, 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* %37)
br label %47
39: ; preds = %31
%40 = load i8*, i8** %7
%41 = load i8*, i8** %8
%42 = call i32 (i8*, 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* %40, i8* %41)
%43 = load i8*, i8** %6
%44 = call i32 (i8*, 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), i8* %43)
%45 = load i8*, i8** %5
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %39, %36
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48, %23, %14
%50 = call i32 (i8*, 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: %s\0A\00"
@.str.5 = [6 x i8] c"\1B[37m\00"
@.str.6 = [14 x i8] c"Expected: %s\0A\00"
@.str.7 = [3 x i8] c"%s\00"
define void @assert_equal_str(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = icmp eq i8* %0, null
%6 = icmp eq i8* %1, null
%7 = and i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 (i8*, 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* %2)
br label %25
10: ; preds = %4
%11 = or i1 %5, %6
br i1 %11, label %12, label %16
12: ; preds = %10
%13 = tail call i32 (i8*, 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* %2, i8* %3)
%14 = tail call i32 (i8*, 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), i8* %1)
%15 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %0)
br label %25
16: ; preds = %10
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 (i8*, 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* %2)
br label %25
21: ; preds = %16
%22 = tail call i32 (i8*, 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* %2, i8* %3)
%23 = tail call i32 (i8*, 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), i8* %1)
%24 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %0)
br label %25
25: ; preds = %21, %19, %12, %8
%26 = tail call i32 (i8*, 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
}