#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 INT_MAX;
int INT_MIN;
int /*<<< orphan*/ itoa_rec(int, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int i;
  char s[128];
  int nums[10] = {0, -1, 7, -15, 123, -325, 2567, -10342, INT_MAX, INT_MIN};
  for (i = 0; i < 10; ++i) {
    itoa_rec(nums[i], s);
    printf("%11s\n", s);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc0(%rbp)
movl   $0xffffffff,-0xbc(%rbp)
ff ff ff
movl   $0x7,-0xb8(%rbp)
movl   $0xfffffff1,-0xb4(%rbp)
ff ff ff
movl   $0x7b,-0xb0(%rbp)
movl   $0xfffffebb,-0xac(%rbp)
fe ff ff
movl   $0xa07,-0xa8(%rbp)
movl   $0xffffd79a,-0xa4(%rbp)
d7 ff ff
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa0(%rbp)
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11e9 <main+0xc9>
movslq -0x8(%rbp),%rax
mov    -0xc0(%rbp,%rax,4),%edi
lea    -0x90(%rbp),%rsi
call   1030 <itoa_rec@plt>
lea    -0x90(%rbp),%rsi
lea    0xe2a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a7 <main+0x87>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    0x2eb4(%rip),%rax
mov    (%rax),%r15d
mov    0x2ea2(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
lea    0xeab(%rip),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x7,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0xfffffff1,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x7b,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0xfffffebb,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0xa07,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0xffffd79a,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1030 <itoa_rec@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
@INT_MIN = global i32 0
@.str = [6 x i8] c"%11s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca [10 x i32]
store i32 0, i32* %1
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
store i32 0, i32* %5
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 -1, i32* %6
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 7, i32* %7
%8 = getelementptr inbounds i32, i32* %7, i64 1
store i32 -15, i32* %8
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32 123, i32* %9
%10 = getelementptr inbounds i32, i32* %9, i64 1
store i32 -325, i32* %10
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 2567, i32* %11
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 -10342, i32* %12
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* @INT_MAX
store i32 %14, i32* %13
%15 = getelementptr inbounds i32, i32* %13, i64 1
%16 = load i32, i32* @INT_MIN
store i32 %16, i32* %15
store i32 0, i32* %2
br label %17
17: ; preds = %29, %0
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%26 = call i32 @itoa_rec(i32 %24, i8* %25)
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%28 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %20
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
br label %17
32: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
@INT_MAX = global i32 0
@INT_MIN = global i32 0
@.str = [6 x i8] c"%11s\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @INT_MAX
%4 = load i32, i32* @INT_MIN
%5 = call i32 @itoa_rec(i32 0, i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = call i32 @itoa_rec(i32 -1, i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @itoa_rec(i32 7, i8* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%11 = call i32 @itoa_rec(i32 -15, i8* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%13 = call i32 @itoa_rec(i32 123, i8* %2)
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%15 = call i32 @itoa_rec(i32 -325, i8* %2)
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%17 = call i32 @itoa_rec(i32 2567, i8* %2)
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%19 = call i32 @itoa_rec(i32 -10342, i8* %2)
%20 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%21 = call i32 @itoa_rec(i32 %3, i8* %2)
%22 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%23 = call i32 @itoa_rec(i32 %4, i8* %2)
%24 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}