#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*/ itoa1(int, char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  char s[1024];
  printf("INT_MAX: %d\n", INT_MAX);
  itoa1(INT_MAX, s);
  printf("Buffer : %s\n", s);
  printf("INT_MIN: %d\n", INT_MIN);
  itoa1(INT_MIN, s);
  printf("Buffer : %s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
lea    -0x410(%rbp),%rsi
call   1040 <itoa1@plt>
lea    -0x410(%rbp),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
lea    -0x410(%rbp),%rsi
call   1040 <itoa1@plt>
lea    -0x410(%rbp),%rsi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%esi
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <itoa1@plt>
lea    0xeb6(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e75(%rip),%r15
mov    (%r15),%esi
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
call   1040 <itoa1@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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