#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*/ ok(char const *, unsigned int, int, char const *);
int /*<<< orphan*/ putstr(char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned long, unsigned long);
void ulong_is(const char *file, unsigned int line, unsigned long got,
              unsigned long expected, const char *name) {
  ok(file, line, got == expected, name);
  if (got != expected) {
    char buf[24];
    putstr("#         got: ");
    sprintf(buf,
            "0x%lX"
            " ("
            "%lu"
            ")\n",
            got, got);
    putstr(buf);
    putstr("#    expected: ");
    sprintf(buf,
            "0x%lX"
            " ("
            "%lu"
            ")\n",
            expected, expected);
    putstr(buf);
  }
}


x86 assembly (clang, -O0):
<ulong_is>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edx
mov    -0x28(%rbp),%rcx
call   1030 <ok@plt>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     11d3 <ulong_is+0xa3>
lea    0xe80(%rip),%rdi
call   1040 <putstr@plt>
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe78(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <putstr@plt>
lea    0xe70(%rip),%rdi
call   1040 <putstr@plt>
lea    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe4b(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <putstr@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulong_is>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
xor    %edx,%edx
cmp    %rcx,%rbx
sete   %dl
mov    %r8,%rcx
call   1030 <ok@plt>
cmp    %r14,%rbx
je     11aa <ulong_is+0x7a>
lea    0xea3(%rip),%rdi
call   1040 <putstr@plt>
lea    0xea7(%rip),%r15
mov    %rsp,%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
call   1050 <sprintf@plt>
mov    %r12,%rdi
call   1040 <putstr@plt>
lea    0xe91(%rip),%rdi
call   1040 <putstr@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %r12,%rdi
call   1040 <putstr@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"# got: \00"
@.str.1 = [13 x i8] c"0x%lX (%lu)\0A\00"
@.str.2 = [16 x i8] c"# expected: \00"
define void @ulong_is(i8* %0, i32 %1, i64 %2, i64 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
%11 = alloca [24 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i8* %4, i8** %10
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = load i64, i64* %8
%15 = load i64, i64* %9
%16 = icmp eq i64 %14, %15
%17 = zext i1 %16 to i32
%18 = load i8*, i8** %10
%19 = call i32 @ok(i8* %12, i32 %13, i32 %17, i8* %18)
%20 = load i64, i64* %8
%21 = load i64, i64* %9
%22 = icmp ne i64 %20, %21
br i1 %22, label %23, label %38
23: ; preds = %5
%24 = call i32 @putstr(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%25 = getelementptr inbounds [24 x i8], [24 x i8]* %11, i64 0, i64 0
%26 = load i64, i64* %8
%27 = load i64, i64* %8
%28 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %26, i64 %27)
%29 = getelementptr inbounds [24 x i8], [24 x i8]* %11, i64 0, i64 0
%30 = call i32 @putstr(i8* %29)
%31 = call i32 @putstr(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%32 = getelementptr inbounds [24 x i8], [24 x i8]* %11, i64 0, i64 0
%33 = load i64, i64* %9
%34 = load i64, i64* %9
%35 = call i32 @sprintf(i8* %32, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %33, i64 %34)
%36 = getelementptr inbounds [24 x i8], [24 x i8]* %11, i64 0, i64 0
%37 = call i32 @putstr(i8* %36)
br label %38
38: ; preds = %23, %5
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"# got: \00"
@.str.1 = [13 x i8] c"0x%lX (%lu)\0A\00"
@.str.2 = [16 x i8] c"# expected: \00"
define void @ulong_is(i8* %0, i32 %1, i64 %2, i64 %3, i8* %4) {
%6 = alloca [24 x i8]
%7 = icmp eq i64 %2, %3
%8 = zext i1 %7 to i32
%9 = tail call i32 @ok(i8* %0, i32 %1, i32 %8, i8* %4)
br i1 %7, label %18, label %10
10: ; preds = %5
%11 = getelementptr inbounds [24 x i8], [24 x i8]* %6, i64 0, i64 0
%12 = tail call i32 @putstr(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %2, i64 %2)
%14 = call i32 @putstr(i8* %11)
%15 = call i32 @putstr(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %3, i64 %3)
%17 = call i32 @putstr(i8* %11)
br label %18
18: ; preds = %10, %5
ret void
}