#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*/ printf(char *, int, char *);
int main() {
  void itoa(int, char *);
  int n = 0;
  char s[10];
  itoa(n, s);
  printf("%d to %s\n", n, s);
  n = -0;
  itoa(n, s);
  printf("%d to %s\n", n, s);
  n = 1234;
  itoa(n, s);
  printf("%d to %s\n", n, s);
  n = INT_MIN;
  itoa(n, s);
  printf("%d to %s\n", n, s);
  n = INT_MAX;
  itoa(n, s);
  printf("%d to %s\n", n, s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
call   1040 <itoa@plt>
mov    -0x8(%rbp),%esi
lea    -0x12(%rbp),%rdx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
call   1040 <itoa@plt>
mov    -0x8(%rbp),%esi
lea    -0x12(%rbp),%rdx
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x4d2,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
call   1040 <itoa@plt>
mov    -0x8(%rbp),%esi
lea    -0x12(%rbp),%rdx
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
call   1040 <itoa@plt>
mov    -0x8(%rbp),%esi
lea    -0x12(%rbp),%rdx
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
call   1040 <itoa@plt>
mov    -0x8(%rbp),%esi
lea    -0x12(%rbp),%rdx
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0x6(%rsp),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <itoa@plt>
lea    0xec2(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <itoa@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0x4d2,%edi
mov    %rbx,%rsi
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    $0x4d2,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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