#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 *, char const *, char const *);
scalar_t__ strcmp(char const *, char const *);
int /*<<< orphan*/ test_failure();
bool _expect_string_eq(const char *expected, const char *actual,
                       const char *message) {
  if (strcmp(expected, actual) == 0)
    return true;
  test_failure();
  printf(" \x1b[1;31mFAILED:\x1b[m %s\n"
         "  Expected: \"%s\"\n  Actual:   \"%s\"\n",
         message, expected, actual);
  return false;
}


x86 assembly (clang, -O0):
<_expect_string_eq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1167 <_expect_string_eq+0x37>
movl   $0x1,-0x4(%rbp)
jmp    118d <_expect_string_eq+0x5d>
mov    $0x0,%al
call   1050 <test_failure@plt>
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_expect_string_eq>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <strcmp@plt>
test   %rax,%rax
je     116a <_expect_string_eq+0x3a>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <test_failure@plt>
lea    0xea6(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1030 <printf@plt>
jmp    116f <_expect_string_eq+0x3f>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [57 x i8] c" \1B[1;31mFAILED:\1B[m %s\0A Expected: \22%s\22\0A Actual: \22%s\22\0A\00"
define i32 @_expect_string_eq(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i64 @strcmp(i8* %8, i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 1, i32* %4
br label %19
13: ; preds = %3
%14 = call i32 (...) @test_failure()
%15 = load i8*, i8** %7
%16 = load i8*, i8** %5
%17 = load i8*, i8** %6
%18 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16, i8* %17)
store i32 0, i32* %4
br label %19
19: ; preds = %13, %12
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
@.str = [57 x i8] c" \1B[1;31mFAILED:\1B[m %s\0A Expected: \22%s\22\0A Actual: \22%s\22\0A\00"
define i32 @_expect_string_eq(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 (...) @test_failure()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0, i8* %1)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %10
}