#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 */
typedef int /*<<< orphan*/ _linestr;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, long);
int /*<<< orphan*/ stdout;
void _test_ptr(const char *file, long line, const char *desc,
               const void *actual, const void *expected) {
  do {
    const char *_exprstr = (actual == expected) ? "PASS" : "FAIL";
    char _linestr[BUFSIZ];
    if (!(actual == expected)) {
      snprintf(_linestr, sizeof(_linestr), " (%s:%ld)", file, line);
    } else {
      _linestr[0] = 0;
    }
    if ("%p" == 0) {
      printf("\tValue: "
             "%p"
             "\n"
             "[%s] %s%s\n",
             actual, _exprstr, desc, _linestr);
    } else {
      printf("\tActual: "
             "%p"
             "\n"
             "\tExpected: "
             "%p"
             "\n"
             "[%s] %s%s\n",
             actual, expected, _exprstr, desc, _linestr);
    }
    if (!(actual == expected)) {
      printf("\t%s:%ld\n", file, line);
    }
    fflush(stdout);
  } while (0);
  ;
}


x86 assembly (clang, -O0):
<_test_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
lea    0xea2(%rip),%rcx
lea    0xea0(%rip),%rax
cmove  %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    0x2e6c(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x50(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     11ce <_test_ptr+0x9e>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rax
mov    %eax,%esi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe46(%rip),%rdx
call   1040 <snprintf@plt>
jmp    11d5 <_test_ptr+0xa5>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%r9
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     121b <_test_ptr+0xeb>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_test_ptr>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rcx,%r13
mov    %rdx,%r8
mov    %rsi,%r9
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
lea    0xf(%rsi),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe92(%rip),%rax
lea    0xe90(%rip),%r15
cmp    %r14,%rcx
cmove  %rax,%r15
je     11d3 <_test_ptr+0xa3>
mov    %rdi,%r12
lea    0xe82(%rip),%rdx
mov    %rbx,%rdi
mov    %r12,%rcx
mov    %r8,-0x30(%rbp)
mov    %r9,%r8
mov    %r9,-0x38(%rbp)
call   1040 <snprintf@plt>
lea    0xe6f(%rip),%rdi
mov    %r13,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    -0x30(%rbp),%r8
mov    %rbx,%r9
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe76(%rip),%rdi
mov    %r12,%rsi
mov    -0x38(%rbp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11f0 <_test_ptr+0xc0>
movb   $0x0,(%rbx)
lea    0xe37(%rip),%rdi
mov    %r13,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
mov    %rbx,%r9
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"PASS\00"
@.str.1 = [5 x i8] c"FAIL\00"
@BUFSIZ = global i32 0
@.str.2 = [10 x i8] c" (%s:%ld)\00"
@.str.3 = [37 x i8] c"\09Actual: %p\0A\09Expected: %p\0A[%s] %s%s\0A\00"
@.str.4 = [9 x i8] c"\09%s:%ld\0A\00"
@stdout = global i32 0
define void @_test_ptr(i8* %0, i64 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i64
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
br label %14
14: ; preds = %5
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = icmp eq i8* %15, %16
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
store i8* %19, i8** %11
%20 = load i32, i32* @BUFSIZ
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %12
%23 = alloca i8, i64 %21
store i64 %21, i64* %13
%24 = load i8*, i8** %9
%25 = load i8*, i8** %10
%26 = icmp eq i8* %24, %25
br i1 %26, label %32, label %27
27: ; preds = %14
%28 = trunc i64 %21 to i32
%29 = load i8*, i8** %6
%30 = load i64, i64* %7
%31 = call i32 @snprintf(i8* %23, i32 %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %29, i64 %30)
br label %34
32: ; preds = %14
%33 = getelementptr inbounds i8, i8* %23, i64 0
store i8 0, i8* %33
br label %34
34: ; preds = %32, %27
%35 = load i8*, i8** %9
%36 = load i8*, i8** %10
%37 = load i8*, i8** %11
%38 = load i8*, i8** %8
%39 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* %35, i8* %36, i8* %37, i8* %38, i8* %23)
%40 = load i8*, i8** %9
%41 = load i8*, i8** %10
%42 = icmp eq i8* %40, %41
br i1 %42, label %47, label %43
43: ; preds = %34
%44 = load i8*, i8** %6
%45 = load i64, i64* %7
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %44, i64 %45)
br label %47
47: ; preds = %43, %34
%48 = load i32, i32* @stdout
%49 = call i32 @fflush(i32 %48)
%50 = load i8*, i8** %12
br label %51
51: ; preds = %47
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"PASS\00"
@.str.1 = [5 x i8] c"FAIL\00"
@BUFSIZ = global i32 0
@.str.2 = [10 x i8] c" (%s:%ld)\00"
@.str.3 = [37 x i8] c"\09Actual: %p\0A\09Expected: %p\0A[%s] %s%s\0A\00"
@.str.4 = [9 x i8] c"\09%s:%ld\0A\00"
@stdout = global i32 0
define void @_test_ptr(i8* %0, i64 %1, i8* %2, i8* %3, i8* %4) {
%6 = icmp eq i8* %3, %4
%7 = select i1 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%8 = load i32, i32* @BUFSIZ
%9 = zext i32 %8 to i64
%10 = alloca i8, i64 %9
br i1 %6, label %11, label %13
11: ; preds = %5
store i8 0, i8* %10
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* %3, i8* %3, i8* %7, i8* %2, i8* %10)
br label %17
13: ; preds = %5
%14 = call i32 @snprintf(i8* %10, i32 %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %0, i64 %1)
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* %3, i8* %4, i8* %7, i8* %2, i8* %10)
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %0, i64 %1)
br label %17
17: ; preds = %11, %13
%18 = load i32, i32* @stdout
%19 = call i32 @fflush(i32 %18)
ret void
}