#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*/ test_fail_message(int /*<<< orphan*/ *, char const *, int,
                                     char *, char const *, char const *, char *,
                                     char *, void const *, void const *);
int test_ptr_eq(const char *file, int line, const char *s1, const char *s2,
                const void *t1, const void *t2) {
  if (t1 == t2)
    return 1;
  test_fail_message(NULL, file, line, "void *", s1, s2, "==",
                    "["
                    "%p"
                    "] compared to ["
                    "%p"
                    "]",
                    t1, t2);
  return 0;
}


x86 assembly (clang, -O0):
<test_ptr_eq>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x58,%rsp
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x40(%rbp),%rax
jne    114a <test_ptr_eq+0x3a>
movl   $0x1,-0xc(%rbp)
jmp    1199 <test_ptr_eq+0x89>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x38(%rbp),%r10
mov    -0x40(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edi
lea    0xe94(%rip),%rcx
lea    0xe94(%rip),%rbx
lea    0xe90(%rip),%r11
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1030 <test_fail_message@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ptr_eq>:
push   %r14
push   %rbx
push   %rax
mov    %r9,%rbx
mov    %r8,%rax
cmp    %r9,%r8
je     1155 <test_ptr_eq+0x45>
mov    %rcx,%r9
mov    %rdx,%r8
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xed9(%rip),%r10
lea    0xecf(%rip),%r11
lea    0xec1(%rip),%rcx
xor    %r14d,%r14d
xor    %edi,%edi
push   %rbx
push   %rax
push   %r10
push   %r11
call   1030 <test_fail_message@plt>
add    $0x20,%rsp
jmp    115b <test_ptr_eq+0x4b>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"void *\00"
@.str.1 = [3 x i8] c"==\00"
@.str.2 = [22 x i8] c"[%p] compared to [%p]\00"
define i32 @test_ptr_eq(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = icmp eq i8* %4, %5
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @test_fail_message(i32* null, i8* %0, i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %4, i8* %5)
br label %10
10: ; preds = %6, %8
%11 = phi i32 [ 0, %8 ], [ 1, %6 ]
ret i32 %11
}