#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 *, int, char *);
main() {
  int n;
  char test[1000];
  n = 5;
  itoa(n, test, 3);
  printf("%d  %s\n", n, test);
  n = 52;
  itoa(n, test, 1);
  printf("%d  %s\n", n, test);
  n = -400;
  itoa(n, test, 6);
  printf("%d  %s\n", n, test);
  n = 127;
  itoa(n, test, 12);
  printf("%d  %s\n", n, test);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
mov    $0x3,%edx
call   1040 <itoa@plt>
mov    -0x4(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x34,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
mov    $0x1,%edx
call   1040 <itoa@plt>
mov    -0x4(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movl   $0xfffffe70,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
mov    $0x6,%edx
call   1040 <itoa@plt>
mov    -0x4(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
movl   $0x7f,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
mov    $0xc,%edx
call   1040 <itoa@plt>
mov    -0x4(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rbx
mov    $0x5,%edi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1040 <itoa@plt>
lea    0xeba(%rip),%r14
mov    %r14,%rdi
mov    $0x5,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0x34,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    $0x34,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0xfffffe70,%edi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    $0xfffffe70,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0x7f,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    $0x7f,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

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