#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(int, char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
main() {
  int a = 0;
  char s[1024];
  itoa(a, s, 5);
  printf("a: %d, %s\n", a, s);
  a = INT_MIN;
  itoa(a, s, 20);
  printf("INT_MIN: %d, %s\n", a, s);
  a = INT_MAX;
  itoa(a, s, 15);
  printf("INT_MAX: %d, %s\n", a, s);
  a = 1234567890;
  itoa(a, s, 5);
  printf("a: %d, %s\n", a, s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x14,%edx
call   1040 <itoa@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0xf,%edx
call   1040 <itoa@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
movl   $0x499602d2,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
lea    0xebc(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x14,%edx
call   1040 <itoa@plt>
lea    0xe9b(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xf,%edx
call   1040 <itoa@plt>
lea    0xe83(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0x499602d2,%edi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    $0x499602d2,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"a: %d, %s\0A\00"
@INT_MIN = global i32 0
@.str.1 = [17 x i8] c"INT_MIN: %d, %s\0A\00"
@INT_MAX = global i32 0
@.str.2 = [17 x i8] c"INT_MAX: %d, %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
%3 = load i32, i32* %1
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 @itoa(i32 %3, i8* %4, i32 5)
%6 = load i32, i32* %1
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %7)
%9 = load i32, i32* @INT_MIN
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%12 = call i32 @itoa(i32 %10, i8* %11, i32 20)
%13 = load i32, i32* %1
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %13, i8* %14)
%16 = load i32, i32* @INT_MAX
store i32 %16, i32* %1
%17 = load i32, i32* %1
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%19 = call i32 @itoa(i32 %17, i8* %18, i32 15)
%20 = load i32, i32* %1
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %20, i8* %21)
store i32 1234567890, i32* %1
%23 = load i32, i32* %1
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%25 = call i32 @itoa(i32 %23, i8* %24, i32 5)
%26 = load i32, i32* %1
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%28 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %26, i8* %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"a: %d, %s\0A\00"
@INT_MIN = global i32 0
@.str.1 = [17 x i8] c"INT_MIN: %d, %s\0A\00"
@INT_MAX = global i32 0
@.str.2 = [17 x i8] c"INT_MAX: %d, %s\0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa(i32 0, i8* %2, i32 5)
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 0, i8* %2)
%5 = load i32, i32* @INT_MIN
%6 = call i32 @itoa(i32 %5, i8* %2, i32 20)
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %2)
%8 = load i32, i32* @INT_MAX
%9 = call i32 @itoa(i32 %8, i8* %2, i32 15)
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %8, i8* %2)
%11 = call i32 @itoa(i32 1234567890, i8* %2, i32 5)
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1234567890, i8* %2)
ret i32 0
}