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


x86 assembly (clang, -O0):
<uint_is>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edx
mov    -0x20(%rbp),%rcx
call   1030 <ok@plt>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     11c9 <uint_is+0x99>
lea    0xe86(%rip),%rdi
call   1040 <putstr@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe80(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <putstr@plt>
lea    0xe76(%rip),%rdi
call   1040 <putstr@plt>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe55(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   1040 <putstr@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint_is>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebx
mov    %edx,%ebp
xor    %edx,%edx
cmp    %ecx,%ebp
sete   %dl
mov    %r8,%rcx
call   1030 <ok@plt>
cmp    %ebx,%ebp
je     11a1 <uint_is+0x71>
lea    0xea8(%rip),%rdi
call   1040 <putstr@plt>
lea    0xeac(%rip),%r14
mov    %rsp,%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
call   1050 <sprintf@plt>
mov    %r15,%rdi
call   1040 <putstr@plt>
lea    0xe96(%rip),%rdi
call   1040 <putstr@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %ebx,%ecx
call   1050 <sprintf@plt>
mov    %r15,%rdi
call   1040 <putstr@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"# got: \00"
@.str.1 = [11 x i8] c"0x%X (%u)\0A\00"
@.str.2 = [16 x i8] c"# expected: \00"
define void @uint_is(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca [24 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = icmp eq i32 %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 i32, i32* %8
%21 = load i32, i32* %9
%22 = icmp ne i32 %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 i32, i32* %8
%27 = load i32, i32* %8
%28 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 %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 i32, i32* %9
%34 = load i32, i32* %9
%35 = call i32 @sprintf(i8* %32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %33, i32 %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 = [11 x i8] c"0x%X (%u)\0A\00"
@.str.2 = [16 x i8] c"# expected: \00"
define void @uint_is(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca [24 x i8]
%7 = icmp eq i32 %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 ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %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 ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %3)
%17 = call i32 @putstr(i8* %11)
br label %18
18: ; preds = %10, %5
ret void
}