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


x86 assembly (clang, -O0):
<ensure_not_equals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    116b <ensure_not_equals+0x3b>
cmpq   $0x0,-0x10(%rbp)
jne    116b <ensure_not_equals+0x3b>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1050 <log_warn@plt>
mov    $0x0,%al
call   1040 <test_fail@plt>
cmpq   $0x0,-0x8(%rbp)
je     11b1 <ensure_not_equals+0x81>
cmpq   $0x0,-0x10(%rbp)
je     11b1 <ensure_not_equals+0x81>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11b1 <ensure_not_equals+0x81>
mov    -0x8(%rbp),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <log_warn@plt>
mov    $0x0,%al
call   1040 <test_fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ensure_not_equals>:
push   %rbx
mov    %rdi,%rax
or     %rsi,%rax
jne    114f <ensure_not_equals+0x1f>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1050 <log_warn@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <test_fail@plt>
mov    %rdi,%rbx
test   %rdi,%rdi
je     1169 <ensure_not_equals+0x39>
test   %rsi,%rsi
je     1169 <ensure_not_equals+0x39>
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     116b <ensure_not_equals+0x3b>
pop    %rbx
ret
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <log_warn@plt>
jmp    1147 <ensure_not_equals+0x17>

LLVM IR (-O0):
@.str = [22 x i8] c"strings are both NULL\00"
@.str.1 = [22 x i8] c"strings are both \22%s\22\00"
define void @ensure_not_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 %13
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = call i32 (i8*, ...) @log_warn(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (...) @test_fail()
br label %13
13: ; preds = %10, %7, %2
%14 = load i8*, i8** %3
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %28
16: ; preds = %13
%17 = load i8*, i8** %4
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i8*, i8** %3
%21 = load i8*, i8** %4
%22 = call i64 @strcmp(i8* %20, i8* %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i8*, i8** %3
%26 = call i32 (i8*, ...) @log_warn(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = call i32 (...) @test_fail()
br label %28
28: ; preds = %24, %19, %16, %13
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"strings are both NULL\00"
@.str.1 = [22 x i8] c"strings are both \22%s\22\00"
define void @ensure_not_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 %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @log_warn(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %17
8: ; preds = %2
%9 = icmp ne i8* %0, null
%10 = icmp ne i8* %1, null
%11 = and i1 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = tail call i64 @strcmp(i8* %0, i8* %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = tail call i32 (i8*, ...) @log_warn(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %17
17: ; preds = %15, %6
%18 = tail call i32 (...) @test_fail()
br label %19
19: ; preds = %17, %12, %8
ret void
}