#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*/ fputc(char, unsigned int);
void fprint_uhex(unsigned uhex, unsigned handle) {
  char digits[] = "0123456789abcdef";
  unsigned i, value;
  for (i = 0; i < 8; i++) {
    value = uhex >> 28;
    uhex <<= 4;
    fputc(digits[value], handle);
  }
}


x86 assembly (clang, -O0):
<fprint_uhex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed6(%rip),%al
mov    %al,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x8,-0x24(%rbp)
jae    1180 <fprint_uhex+0x70>
mov    -0x4(%rbp),%eax
shr    $0x1c,%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x4(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x20(%rbp,%rax,1),%al
mov    -0x8(%rbp),%esi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1144 <fprint_uhex+0x34>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_uhex>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    %edi,%r14d
mov    %r14,%rax
shr    $0x1c,%rax
lea    0xed4(%rip),%r15
movsbl (%rax,%r15,1),%edi
call   1030 <fputc@plt>
mov    %ebx,%eax
shr    $0x18,%eax
and    $0xf,%eax
movsbl (%rax,%r15,1),%edi
mov    %ebp,%esi
call   1030 <fputc@plt>
mov    %ebx,%eax
shr    $0x14,%eax
and    $0xf,%eax
movsbl (%rax,%r15,1),%edi
mov    %ebp,%esi
call   1030 <fputc@plt>
mov    %ebx,%eax
shr    $0x10,%eax
and    $0xf,%eax
movsbl (%rax,%r15,1),%edi
mov    %ebp,%esi
call   1030 <fputc@plt>
mov    %ebx,%eax
shr    $0xc,%eax
and    $0xf,%eax
movsbl (%rax,%r15,1),%edi
mov    %ebp,%esi
call   1030 <fputc@plt>
mov    %ebx,%eax
shr    $0x8,%eax
and    $0xf,%eax
movsbl (%rax,%r15,1),%edi
mov    %ebp,%esi
call   1030 <fputc@plt>
shr    $0x4,%ebx
and    $0xf,%ebx
and    $0xf,%r14d
movsbl (%rbx,%r15,1),%edi
mov    %ebp,%esi
call   1030 <fputc@plt>
movsbl (%r14,%r15,1),%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@__const.fprint_uhex.digits = [17 x i8] c"0123456789abcdef\00"
define void @fprint_uhex(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [17 x i8]
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = bitcast [17 x i8]* %5 to i8*
store i32 0, i32* %6
br label %9
9: ; preds = %23, %2
%10 = load i32, i32* %6
%11 = icmp ult i32 %10, 8
br i1 %11, label %12, label %26
12: ; preds = %9
%13 = load i32, i32* %3
%14 = lshr i32 %13, 28
store i32 %14, i32* %7
%15 = load i32, i32* %3
%16 = shl i32 %15, 4
store i32 %16, i32* %3
%17 = load i32, i32* %7
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = load i32, i32* %4
%22 = call i32 @fputc(i8 signext %20, i32 %21)
br label %23
23: ; preds = %12
%24 = load i32, i32* %6
%25 = add i32 %24, 1
store i32 %25, i32* %6
br label %9
26: ; preds = %9
ret void
}

LLVM IR (-O2):
@__const.fprint_uhex.digits = [17 x i8] c"0123456789abcdef\00"
define void @fprint_uhex(i32 %0, i32 %1) {
%3 = lshr i32 %0, 28
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.fprint_uhex.digits, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = tail call i32 @fputc(i8 signext %6, i32 %1)
%8 = lshr i32 %0, 24
%9 = and i32 %8, 15
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.fprint_uhex.digits, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = tail call i32 @fputc(i8 signext %12, i32 %1)
%14 = lshr i32 %0, 20
%15 = and i32 %14, 15
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.fprint_uhex.digits, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = tail call i32 @fputc(i8 signext %18, i32 %1)
%20 = lshr i32 %0, 16
%21 = and i32 %20, 15
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.fprint_uhex.digits, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = tail call i32 @fputc(i8 signext %24, i32 %1)
%26 = lshr i32 %0, 12
%27 = and i32 %26, 15
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.fprint_uhex.digits, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = tail call i32 @fputc(i8 signext %30, i32 %1)
%32 = lshr i32 %0, 8
%33 = and i32 %32, 15
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.fprint_uhex.digits, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = tail call i32 @fputc(i8 signext %36, i32 %1)
%38 = lshr i32 %0, 4
%39 = and i32 %38, 15
%40 = and i32 %0, 15
%41 = zext i32 %39 to i64
%42 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.fprint_uhex.digits, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = tail call i32 @fputc(i8 signext %43, i32 %1)
%45 = zext i32 %40 to i64
%46 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.fprint_uhex.digits, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = tail call i32 @fputc(i8 signext %47, i32 %1)
ret void
}