#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*/ itoa(int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int i;
  char foo[16] = "";
  int tests[5] = {-25, 409689, 8, -1000, 135};
  for (i = 0; i < 5; i++) {
    itoa(tests[i], foo, 5);
    printf("Pad to 5 spaces! '%s'\n", foo);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0xeaa(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea5(%rip),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11b3 <main+0x83>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
lea    -0x20(%rbp),%rsi
mov    $0x5,%edx
call   1050 <itoa@plt>
lea    -0x20(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x45>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    $0xffffffe7,%edi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
lea    0xeb6(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x64059,%edi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x8,%edi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xfffffc18,%edi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x87,%edi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.tests = [5 x i32] [i32 -25, i32 409689, i32 8, i32 -1000, i32 135]
@.str = [23 x i8] c"Pad to 5 spaces! '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [16 x i8]
%4 = alloca [5 x i32]
store i32 0, i32* %1
%5 = bitcast [16 x i8]* %3 to i8*
%6 = bitcast [5 x i32]* %4 to i8*
store i32 0, i32* %2
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%16 = call i32 @itoa(i32 %14, i8* %15, i32 5)
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %10
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %7
22: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Pad to 5 spaces! '%s'\0A\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa(i32 -25, i8* %2, i32 5)
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 @itoa(i32 409689, i8* %2, i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = call i32 @itoa(i32 8, i8* %2, i32 5)
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @itoa(i32 -1000, i8* %2, i32 5)
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2)
%11 = call i32 @itoa(i32 135, i8* %2, i32 5)
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}