#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*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *, int, char const *, ...);
scalar_t__ strcmp(char const *, char const *);
void _assert_str_equals(const char *file, int line, const char *expected,
                        const char *actual) {
  if (expected == NULL && actual != NULL) {
    printf("%s:%d: Expected NULL but got '%s'\n", file, line, actual);
    exit(1);
  }
  if (expected != NULL && actual == NULL) {
    printf("%s:%d: Expected '%s' but got NULL\n", file, line, expected);
    exit(1);
  }
  if (expected != NULL && actual != NULL && strcmp(expected, actual)) {
    printf("%s:%d: Expected '%s' but got '%s'\n", file, line, expected, actual);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<_assert_str_equals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1180 <_assert_str_equals+0x50>
cmpq   $0x0,-0x20(%rbp)
je     1180 <_assert_str_equals+0x50>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpq   $0x0,-0x18(%rbp)
je     11b9 <_assert_str_equals+0x89>
cmpq   $0x0,-0x20(%rbp)
jne    11b9 <_assert_str_equals+0x89>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
cmpq   $0x0,-0x18(%rbp)
je     120d <_assert_str_equals+0xdd>
cmpq   $0x0,-0x20(%rbp)
je     120d <_assert_str_equals+0xdd>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     120d <_assert_str_equals+0xdd>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_assert_str_equals>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %esi,%r14d
mov    %rdi,%r15
test   %rdx,%rdx
jne    114d <_assert_str_equals+0x1d>
test   %rbx,%rbx
jne    117c <_assert_str_equals+0x4c>
test   %rbp,%rbp
je     1157 <_assert_str_equals+0x27>
test   %rbx,%rbx
je     118e <_assert_str_equals+0x5e>
test   %rbp,%rbp
je     1171 <_assert_str_equals+0x41>
test   %rbx,%rbx
je     1171 <_assert_str_equals+0x41>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11af <_assert_str_equals+0x7f>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7d(%rip),%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %rbx,%rcx
jmp    119e <_assert_str_equals+0x6e>
lea    0xe8e(%rip),%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xe90(%rip),%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %rbp,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"%s:%d: Expected NULL but got '%s'\0A\00"
@.str.1 = [35 x i8] c"%s:%d: Expected '%s' but got NULL\0A\00"
@.str.2 = [35 x i8] c"%s:%d: Expected '%s' but got '%s'\0A\00"
define void @_assert_str_equals(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %7
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %20
11: ; preds = %4
%12 = load i8*, i8** %8
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = load i8*, i8** %8
%18 = call i32 (i8*, i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %16, i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %11, %4
%21 = load i8*, i8** %7
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %32
23: ; preds = %20
%24 = load i8*, i8** %8
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = load i8*, i8** %5
%28 = load i32, i32* %6
%29 = load i8*, i8** %7
%30 = call i32 (i8*, i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %27, i32 %28, i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %23, %20
%33 = load i8*, i8** %7
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %50
35: ; preds = %32
%36 = load i8*, i8** %8
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %50
38: ; preds = %35
%39 = load i8*, i8** %7
%40 = load i8*, i8** %8
%41 = call i64 @strcmp(i8* %39, i8* %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %50
43: ; preds = %38
%44 = load i8*, i8** %5
%45 = load i32, i32* %6
%46 = load i8*, i8** %7
%47 = load i8*, i8** %8
%48 = call i32 (i8*, i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %44, i32 %45, i8* %46, i8* %47)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %38, %35, %32
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"%s:%d: Expected NULL but got '%s'\0A\00"
@.str.1 = [35 x i8] c"%s:%d: Expected '%s' but got NULL\0A\00"
@.str.2 = [35 x i8] c"%s:%d: Expected '%s' but got '%s'\0A\00"
define void @_assert_str_equals(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp eq i8* %2, null
%6 = icmp ne i8* %3, null
%7 = and i1 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = tail call i32 (i8*, i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %3)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4
%12 = icmp ne i8* %2, null
%13 = icmp eq i8* %3, null
%14 = and i1 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = tail call i32 (i8*, i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %11
%19 = and i1 %12, %6
br i1 %19, label %20, label %26
20: ; preds = %18
%21 = tail call i64 @strcmp(i8* %2, i8* %3)
%22 = icmp eq i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = tail call i32 (i8*, i8*, i32, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 %1, i8* %2, i8* %3)
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %20, %18
ret void
}