#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*/ CPrintChar(int);
int /*<<< orphan*/ PrintChar(char);
int printfPC(unsigned int addr) {
  int i = 7;
  int a = 0;
  PrintChar('0');
  PrintChar('x');
  while (i > -1) {
    a = (addr >> (i * 4)) & 0xf;
    if (a < 10)
      CPrintChar(a + 0x30);
    else
      CPrintChar(a - 10 + 0x41);
    i--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<printfPC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x30,%edi
call   1030 <PrintChar@plt>
mov    $0x78,%edi
call   1030 <PrintChar@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jle    119e <printfPC+0x7e>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x2,%ecx
shr    %cl,%eax
and    $0xf,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1182 <printfPC+0x62>
mov    -0xc(%rbp),%edi
add    $0x30,%edi
call   1040 <CPrintChar@plt>
jmp    1190 <printfPC+0x70>
mov    -0xc(%rbp),%edi
sub    $0xa,%edi
add    $0x41,%edi
call   1040 <CPrintChar@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <printfPC+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printfPC>:
push   %rbx
mov    %edi,%ebx
mov    $0x30,%edi
call   1030 <PrintChar@plt>
mov    $0x78,%edi
call   1030 <PrintChar@plt>
mov    %ebx,%edi
shr    $0x1c,%edi
lea    0x37(%rdi),%eax
or     $0x30,%edi
cmp    $0xa0000000,%ebx
cmovae %eax,%edi
call   1040 <CPrintChar@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 <CPrintChar@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 <CPrintChar@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 <CPrintChar@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 <CPrintChar@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 <CPrintChar@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 <CPrintChar@plt>
and    $0xf,%ebx
lea    0x30(%rbx),%eax
lea    0x37(%rbx),%edi
cmp    $0xa,%ebx
cmovb  %eax,%edi
call   1040 <CPrintChar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @printfPC(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 7, i32* %3
store i32 0, i32* %4
%5 = call i32 @PrintChar(i8 signext 48)
%6 = call i32 @PrintChar(i8 signext 120)
br label %7
7: ; preds = %27, %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, -1
br i1 %9, label %10, label %30
10: ; preds = %7
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = mul nsw i32 %12, 4
%14 = lshr i32 %11, %13
%15 = and i32 %14, 15
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %22
18: ; preds = %10
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 48
%21 = call i32 @CPrintChar(i32 %20)
br label %27
22: ; preds = %10
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 10
%25 = add nsw i32 %24, 65
%26 = call i32 @CPrintChar(i32 %25)
br label %27
27: ; preds = %22, %18
%28 = load i32, i32* %3
%29 = add nsw i32 %28, -1
store i32 %29, i32* %3
br label %7
30: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @printfPC(i32 %0) {
%2 = tail call i32 @PrintChar(i8 signext 48)
%3 = tail call i32 @PrintChar(i8 signext 120)
%4 = lshr i32 %0, 28
%5 = icmp ult i32 %0, -1610612736
%6 = add nuw nsw i32 %4, 55
%7 = or i32 %4, 48
%8 = select i1 %5, i32 %7, i32 %6
%9 = tail call i32 @CPrintChar(i32 %8)
%10 = lshr i32 %0, 24
%11 = and i32 %10, 15
%12 = icmp ult i32 %11, 10
%13 = or i32 %11, 48
%14 = add nuw nsw i32 %11, 55
%15 = select i1 %12, i32 %13, i32 %14
%16 = tail call i32 @CPrintChar(i32 %15)
%17 = lshr i32 %0, 20
%18 = and i32 %17, 15
%19 = icmp ult i32 %18, 10
%20 = or i32 %18, 48
%21 = add nuw nsw i32 %18, 55
%22 = select i1 %19, i32 %20, i32 %21
%23 = tail call i32 @CPrintChar(i32 %22)
%24 = lshr i32 %0, 16
%25 = and i32 %24, 15
%26 = icmp ult i32 %25, 10
%27 = or i32 %25, 48
%28 = add nuw nsw i32 %25, 55
%29 = select i1 %26, i32 %27, i32 %28
%30 = tail call i32 @CPrintChar(i32 %29)
%31 = lshr i32 %0, 12
%32 = and i32 %31, 15
%33 = icmp ult i32 %32, 10
%34 = or i32 %32, 48
%35 = add nuw nsw i32 %32, 55
%36 = select i1 %33, i32 %34, i32 %35
%37 = tail call i32 @CPrintChar(i32 %36)
%38 = lshr i32 %0, 8
%39 = and i32 %38, 15
%40 = icmp ult i32 %39, 10
%41 = or i32 %39, 48
%42 = add nuw nsw i32 %39, 55
%43 = select i1 %40, i32 %41, i32 %42
%44 = tail call i32 @CPrintChar(i32 %43)
%45 = lshr i32 %0, 4
%46 = and i32 %45, 15
%47 = icmp ult i32 %46, 10
%48 = or i32 %46, 48
%49 = add nuw nsw i32 %46, 55
%50 = select i1 %47, i32 %48, i32 %49
%51 = tail call i32 @CPrintChar(i32 %50)
%52 = and i32 %0, 15
%53 = icmp ult i32 %52, 10
%54 = or i32 %52, 48
%55 = add nuw nsw i32 %52, 55
%56 = select i1 %53, i32 %54, i32 %55
%57 = tail call i32 @CPrintChar(i32 %56)
ret i32 0
}