#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*/ hextochar(int);
int /*<<< orphan*/ putc(int /*<<< orphan*/);
void printhex(int h) {
  putc(hextochar(h >> 28));
  putc(hextochar(h >> 24));
  putc(hextochar(h >> 20));
  putc(hextochar(h >> 16));
  putc(hextochar(h >> 12));
  putc(hextochar(h >> 8));
  putc(hextochar(h >> 4));
  putc(hextochar(h));
}


x86 assembly (clang, -O0):
<printhex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x1c,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    -0x4(%rbp),%edi
sar    $0x18,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    -0x4(%rbp),%edi
sar    $0x14,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    -0x4(%rbp),%edi
sar    $0x10,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    -0x4(%rbp),%edi
sar    $0xc,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    -0x4(%rbp),%edi
sar    $0x8,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    -0x4(%rbp),%edi
sar    $0x4,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    -0x4(%rbp),%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printhex>:
push   %rbx
mov    %edi,%ebx
sar    $0x1c,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    %ebx,%edi
sar    $0x18,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    %ebx,%edi
sar    $0x14,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    %ebx,%edi
sar    $0x10,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    %ebx,%edi
sar    $0xc,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    %ebx,%edi
sar    $0x8,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    %ebx,%edi
sar    $0x4,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
call   1030 <putc@plt>
mov    %ebx,%edi
call   1040 <hextochar@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <putc@plt>

LLVM IR (-O0):
define void @printhex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 28
%5 = call i32 @hextochar(i32 %4)
%6 = call i32 @putc(i32 %5)
%7 = load i32, i32* %2
%8 = ashr i32 %7, 24
%9 = call i32 @hextochar(i32 %8)
%10 = call i32 @putc(i32 %9)
%11 = load i32, i32* %2
%12 = ashr i32 %11, 20
%13 = call i32 @hextochar(i32 %12)
%14 = call i32 @putc(i32 %13)
%15 = load i32, i32* %2
%16 = ashr i32 %15, 16
%17 = call i32 @hextochar(i32 %16)
%18 = call i32 @putc(i32 %17)
%19 = load i32, i32* %2
%20 = ashr i32 %19, 12
%21 = call i32 @hextochar(i32 %20)
%22 = call i32 @putc(i32 %21)
%23 = load i32, i32* %2
%24 = ashr i32 %23, 8
%25 = call i32 @hextochar(i32 %24)
%26 = call i32 @putc(i32 %25)
%27 = load i32, i32* %2
%28 = ashr i32 %27, 4
%29 = call i32 @hextochar(i32 %28)
%30 = call i32 @putc(i32 %29)
%31 = load i32, i32* %2
%32 = call i32 @hextochar(i32 %31)
%33 = call i32 @putc(i32 %32)
ret void
}

LLVM IR (-O2):
define void @printhex(i32 %0) {
%2 = ashr i32 %0, 28
%3 = tail call i32 @hextochar(i32 %2)
%4 = tail call i32 @putc(i32 %3)
%5 = ashr i32 %0, 24
%6 = tail call i32 @hextochar(i32 %5)
%7 = tail call i32 @putc(i32 %6)
%8 = ashr i32 %0, 20
%9 = tail call i32 @hextochar(i32 %8)
%10 = tail call i32 @putc(i32 %9)
%11 = ashr i32 %0, 16
%12 = tail call i32 @hextochar(i32 %11)
%13 = tail call i32 @putc(i32 %12)
%14 = ashr i32 %0, 12
%15 = tail call i32 @hextochar(i32 %14)
%16 = tail call i32 @putc(i32 %15)
%17 = ashr i32 %0, 8
%18 = tail call i32 @hextochar(i32 %17)
%19 = tail call i32 @putc(i32 %18)
%20 = ashr i32 %0, 4
%21 = tail call i32 @hextochar(i32 %20)
%22 = tail call i32 @putc(i32 %21)
%23 = tail call i32 @hextochar(i32 %0)
%24 = tail call i32 @putc(i32 %23)
ret void
}