#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*/ ioprint(char *);
int /*<<< orphan*/ putc(int);
void ioprint_int(int i) {
  int b;
  int c;
  ioprint("0x");
  for (b = 28; b >= 0; b = b - 4) {
    c = (i >> b) & 0xF;
    if (c < 10) {
      putc(48 + c);
    } else {
      putc(65 - 10 + c);
    }
  }
  putc(10);
}


x86 assembly (clang, -O0):
<ioprint_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <ioprint@plt>
movl   $0x1c,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     118e <ioprint_int+0x6e>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0xf,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1170 <ioprint_int+0x50>
mov    -0xc(%rbp),%edi
add    $0x30,%edi
call   1040 <putc@plt>
jmp    117b <ioprint_int+0x5b>
mov    -0xc(%rbp),%edi
add    $0x37,%edi
call   1040 <putc@plt>
jmp    1180 <ioprint_int+0x60>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <ioprint_int+0x1e>
mov    $0xa,%edi
call   1040 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioprint_int>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <ioprint@plt>
mov    %ebx,%edi
shr    $0x1c,%edi
lea    0x30(%rdi),%eax
add    $0x37,%edi
cmp    $0xa0000000,%ebx
cmovb  %eax,%edi
call   1040 <putc@plt>
mov    %ebx,%eax
shr    $0x18,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%edi
cmp    $0xa,%eax
cmovb  %ecx,%edi
call   1040 <putc@plt>
mov    %ebx,%eax
shr    $0x14,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%edi
cmp    $0xa,%eax
cmovb  %ecx,%edi
call   1040 <putc@plt>
mov    %ebx,%eax
shr    $0x10,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%edi
cmp    $0xa,%eax
cmovb  %ecx,%edi
call   1040 <putc@plt>
mov    %ebx,%eax
shr    $0xc,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%edi
cmp    $0xa,%eax
cmovb  %ecx,%edi
call   1040 <putc@plt>
mov    %ebx,%eax
shr    $0x8,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%edi
cmp    $0xa,%eax
cmovb  %ecx,%edi
call   1040 <putc@plt>
mov    %ebx,%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%edi
cmp    $0xa,%eax
cmovb  %ecx,%edi
call   1040 <putc@plt>
and    $0xf,%ebx
lea    0x30(%rbx),%eax
lea    0x37(%rbx),%edi
cmp    $0xa,%ebx
cmovb  %eax,%edi
call   1040 <putc@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1040 <putc@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"0x\00"
define void @ioprint_int(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @ioprint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 28, i32* %3
br label %6
6: ; preds = %25, %1
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = ashr i32 %10, %11
%13 = and i32 %12, 15
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %20
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 48, %17
%19 = call i32 @putc(i32 %18)
br label %24
20: ; preds = %9
%21 = load i32, i32* %4
%22 = add nsw i32 55, %21
%23 = call i32 @putc(i32 %22)
br label %24
24: ; preds = %20, %16
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = sub nsw i32 %26, 4
store i32 %27, i32* %3
br label %6
28: ; preds = %6
%29 = call i32 @putc(i32 10)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"0x\00"
define void @ioprint_int(i32 %0) {
%2 = tail call i32 @ioprint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = lshr i32 %0, 28
%4 = icmp ult i32 %0, -1610612736
%5 = or i32 %3, 48
%6 = add nuw nsw i32 %3, 55
%7 = select i1 %4, i32 %5, i32 %6
%8 = tail call i32 @putc(i32 %7)
%9 = lshr i32 %0, 24
%10 = and i32 %9, 15
%11 = icmp ult i32 %10, 10
%12 = or i32 %10, 48
%13 = add nuw nsw i32 %10, 55
%14 = select i1 %11, i32 %12, i32 %13
%15 = tail call i32 @putc(i32 %14)
%16 = lshr i32 %0, 20
%17 = and i32 %16, 15
%18 = icmp ult i32 %17, 10
%19 = or i32 %17, 48
%20 = add nuw nsw i32 %17, 55
%21 = select i1 %18, i32 %19, i32 %20
%22 = tail call i32 @putc(i32 %21)
%23 = lshr i32 %0, 16
%24 = and i32 %23, 15
%25 = icmp ult i32 %24, 10
%26 = or i32 %24, 48
%27 = add nuw nsw i32 %24, 55
%28 = select i1 %25, i32 %26, i32 %27
%29 = tail call i32 @putc(i32 %28)
%30 = lshr i32 %0, 12
%31 = and i32 %30, 15
%32 = icmp ult i32 %31, 10
%33 = or i32 %31, 48
%34 = add nuw nsw i32 %31, 55
%35 = select i1 %32, i32 %33, i32 %34
%36 = tail call i32 @putc(i32 %35)
%37 = lshr i32 %0, 8
%38 = and i32 %37, 15
%39 = icmp ult i32 %38, 10
%40 = or i32 %38, 48
%41 = add nuw nsw i32 %38, 55
%42 = select i1 %39, i32 %40, i32 %41
%43 = tail call i32 @putc(i32 %42)
%44 = lshr i32 %0, 4
%45 = and i32 %44, 15
%46 = icmp ult i32 %45, 10
%47 = or i32 %45, 48
%48 = add nuw nsw i32 %45, 55
%49 = select i1 %46, i32 %47, i32 %48
%50 = tail call i32 @putc(i32 %49)
%51 = and i32 %0, 15
%52 = icmp ult i32 %51, 10
%53 = or i32 %51, 48
%54 = add nuw nsw i32 %51, 55
%55 = select i1 %52, i32 %53, i32 %54
%56 = tail call i32 @putc(i32 %55)
%57 = tail call i32 @putc(i32 10)
ret void
}