#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*/ puts(char *);
int main() {
  char str[100];
  itoa(-120, str, 6);
  puts(str);
  itoa(123456, str, 8);
  puts(str);
  itoa(-2147483648, str, 8);
  puts(str);
  itoa(829374, str, 9);
  puts(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
mov    $0xffffff88,%edi
mov    $0x6,%edx
call   1040 <itoa@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rsi
mov    $0x1e240,%edi
mov    $0x8,%edx
call   1040 <itoa@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rsi
mov    $0x80000000,%edi
mov    $0x8,%edx
call   1040 <itoa@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x70(%rbp),%rsi
mov    $0xca7be,%edi
mov    $0x9,%edx
call   1040 <itoa@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    $0xffffff88,%edi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1040 <itoa@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1e240,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1040 <itoa@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x80000000,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1040 <itoa@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0xca7be,%edi
mov    %rbx,%rsi
mov    $0x9,%edx
call   1040 <itoa@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @itoa(i32 -120, i8* %3, i32 6)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @puts(i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @itoa(i32 123456, i8* %7, i32 8)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32 @puts(i8* %9)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%12 = call i32 @itoa(i32 -2147483648, i8* %11, i32 8)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%14 = call i32 @puts(i8* %13)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%16 = call i32 @itoa(i32 829374, i8* %15, i32 9)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%18 = call i32 @puts(i8* %17)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa(i32 -120, i8* %2, i32 6)
%4 = call i32 @puts(i8* %2)
%5 = call i32 @itoa(i32 123456, i8* %2, i32 8)
%6 = call i32 @puts(i8* %2)
%7 = call i32 @itoa(i32 -2147483648, i8* %2, i32 8)
%8 = call i32 @puts(i8* %2)
%9 = call i32 @itoa(i32 829374, i8* %2, i32 9)
%10 = call i32 @puts(i8* %2)
ret i32 0
}