#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*/ log_warn(char *, char const *, char const *);
scalar_t__ strcmp(char const *, char const *);
int /*<<< orphan*/ test_fail();
void ensure_equals(const char *a, const char *b) {
  if (a == NULL && b == NULL)
    return;
  if (a == NULL || b == NULL || strcmp(a, b) != 0) {
    log_warn("strings differ: \"%s\" != \"%s\"", a, b);
    test_fail();
  }
}


x86 assembly (clang, -O0):
<ensure_equals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115b <ensure_equals+0x2b>
cmpq   $0x0,-0x10(%rbp)
jne    115b <ensure_equals+0x2b>
jmp    11a3 <ensure_equals+0x73>
cmpq   $0x0,-0x8(%rbp)
je     1188 <ensure_equals+0x58>
cmpq   $0x0,-0x10(%rbp)
je     1188 <ensure_equals+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11a3 <ensure_equals+0x73>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe69(%rip),%rdi
call   1050 <log_warn@plt>
mov    $0x0,%al
call   1040 <test_fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ensure_equals>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rax
or     %rsi,%rax
jne    1144 <ensure_equals+0x14>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
je     1164 <ensure_equals+0x34>
test   %r14,%r14
je     1164 <ensure_equals+0x34>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     113c <ensure_equals+0xc>
lea    0xe95(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <log_warn@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <test_fail@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"strings differ: \22%s\22 != \22%s\22\00"
define void @ensure_equals(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %7
br label %27
11: ; preds = %7, %2
%12 = load i8*, i8** %3
%13 = icmp eq i8* %12, null
br i1 %13, label %22, label %14
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = icmp eq i8* %15, null
br i1 %16, label %22, label %17
17: ; preds = %14
%18 = load i8*, i8** %3
%19 = load i8*, i8** %4
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %17, %14, %11
%23 = load i8*, i8** %3
%24 = load i8*, i8** %4
%25 = call i32 @log_warn(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24)
%26 = call i32 (...) @test_fail()
br label %27
27: ; preds = %10, %22, %17
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"strings differ: \22%s\22 != \22%s\22\00"
define void @ensure_equals(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %14, label %6
6: ; preds = %2
%7 = or i1 %3, %4
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = tail call i64 @strcmp(i8* %0, i8* %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8, %6
%12 = tail call i32 @log_warn(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%13 = tail call i32 (...) @test_fail()
br label %14
14: ; preds = %2, %11, %8
ret void
}