#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 */
char HexDigit(unsigned int);
int /*<<< orphan*/ printString(char *);
void printInteger(unsigned int Number) {
  char TxString[11];
  int Index = 9;
  TxString[0] = '[';
  TxString[9] = ']';
  TxString[10] = 0;
  Index--;
  while (Index > 0) {
    TxString[Index] = HexDigit(Number & 0x0f);
    Number = Number >> 4;
    Index--;
  }
  printString(TxString);
}


x86 assembly (clang, -O0):
<printInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x9,-0x14(%rbp)
movb   $0x5b,-0xf(%rbp)
movb   $0x5d,-0x6(%rbp)
movb   $0x0,-0x5(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    117d <printInteger+0x5d>
mov    -0x4(%rbp),%edi
and    $0xf,%edi
call   1030 <HexDigit@plt>
mov    %al,%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0xf(%rbp,%rax,1)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x4(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <printInteger+0x27>
lea    -0xf(%rbp),%rdi
call   1040 <printString@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printInteger>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movb   $0x5b,0x5(%rsp)
movw   $0x5d,0xe(%rsp)
and    $0xf,%edi
call   1030 <HexDigit@plt>
mov    %al,0xd(%rsp)
mov    %ebx,%edi
shr    $0x4,%edi
and    $0xf,%edi
call   1030 <HexDigit@plt>
mov    %al,0xc(%rsp)
mov    %ebx,%edi
shr    $0x8,%edi
and    $0xf,%edi
call   1030 <HexDigit@plt>
mov    %al,0xb(%rsp)
mov    %ebx,%edi
shr    $0xc,%edi
and    $0xf,%edi
call   1030 <HexDigit@plt>
mov    %al,0xa(%rsp)
mov    %ebx,%edi
shr    $0x10,%edi
and    $0xf,%edi
call   1030 <HexDigit@plt>
mov    %al,0x9(%rsp)
mov    %ebx,%edi
shr    $0x14,%edi
and    $0xf,%edi
call   1030 <HexDigit@plt>
mov    %al,0x8(%rsp)
mov    %ebx,%edi
shr    $0x18,%edi
and    $0xf,%edi
call   1030 <HexDigit@plt>
mov    %al,0x7(%rsp)
shr    $0x1c,%ebx
mov    %ebx,%edi
call   1030 <HexDigit@plt>
mov    %al,0x6(%rsp)
lea    0x5(%rsp),%rdi
call   1040 <printString@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @printInteger(i32 %0) {
%2 = alloca i32
%3 = alloca [11 x i8]
%4 = alloca i32
store i32 %0, i32* %2
store i32 9, i32* %4
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
store i8 91, i8* %5
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 9
store i8 93, i8* %6
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 10
store i8 0, i8* %7
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
br label %10
10: ; preds = %13, %1
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i32, i32* %2
%15 = and i32 %14, 15
%16 = call signext i8 @HexDigit(i32 %15)
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %18
store i8 %16, i8* %19
%20 = load i32, i32* %2
%21 = lshr i32 %20, 4
store i32 %21, i32* %2
%22 = load i32, i32* %4
%23 = add nsw i32 %22, -1
store i32 %23, i32* %4
br label %10
24: ; preds = %10
%25 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%26 = call i32 @printString(i8* %25)
ret void
}

LLVM IR (-O2):
define void @printInteger(i32 %0) {
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
store i8 91, i8* %3
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 9
store i8 93, i8* %4
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 10
store i8 0, i8* %5
%6 = and i32 %0, 15
%7 = tail call signext i8 @HexDigit(i32 %6)
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 8
store i8 %7, i8* %8
%9 = lshr i32 %0, 4
%10 = and i32 %9, 15
%11 = tail call signext i8 @HexDigit(i32 %10)
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 7
store i8 %11, i8* %12
%13 = lshr i32 %0, 8
%14 = and i32 %13, 15
%15 = tail call signext i8 @HexDigit(i32 %14)
%16 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 6
store i8 %15, i8* %16
%17 = lshr i32 %0, 12
%18 = and i32 %17, 15
%19 = tail call signext i8 @HexDigit(i32 %18)
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 5
store i8 %19, i8* %20
%21 = lshr i32 %0, 16
%22 = and i32 %21, 15
%23 = tail call signext i8 @HexDigit(i32 %22)
%24 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 4
store i8 %23, i8* %24
%25 = lshr i32 %0, 20
%26 = and i32 %25, 15
%27 = tail call signext i8 @HexDigit(i32 %26)
%28 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 3
store i8 %27, i8* %28
%29 = lshr i32 %0, 24
%30 = and i32 %29, 15
%31 = tail call signext i8 @HexDigit(i32 %30)
%32 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 2
store i8 %31, i8* %32
%33 = lshr i32 %0, 28
%34 = tail call signext i8 @HexDigit(i32 %33)
%35 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 1
store i8 %34, i8* %35
%36 = call i32 @printString(i8* %3)
ret void
}