#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*/ itob(int, char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
main() {
  int n = 255;
  char s[1024];
  itob(n, s, 16);
  printf("n: %d, s: %s\n", n, s);
  n = INT_MAX;
  itob(n, s, 16);
  printf("n: %d, s: %s\n", n, s);
  n = 2048;
  itob(n, s, 2);
  printf("n: %d, s: %s\n", n, s);
  n = 2048;
  itob(n, s, 8);
  printf("n: %d, s: %s\n", n, s);
  n = INT_MIN;
  itob(n, s, 16);
  printf("n: %d, s: %s\n", n, s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0xff,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
movl   $0x800,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x2,%edx
call   1040 <itob@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
movl   $0x800,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x8,%edx
call   1040 <itob@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    -0x4(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xddb(%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
mov    $0xff,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
lea    0xeb9(%rip),%r14
mov    %r14,%rdi
mov    $0xff,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0x800,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1040 <itob@plt>
mov    %r14,%rdi
mov    $0x800,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0x800,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1040 <itob@plt>
mov    %r14,%rdi
mov    $0x800,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    %r14,%rdi
mov    %ebp,%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 = [14 x i8] c"n: %d, s: %s\0A\00"
@INT_MAX = global i32 0
@INT_MIN = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 255, i32* %1
%3 = load i32, i32* %1
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 @itob(i32 %3, i8* %4, i32 16)
%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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %7)
%9 = load i32, i32* @INT_MAX
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 @itob(i32 %10, i8* %11, i32 16)
%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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %13, i8* %14)
store i32 2048, i32* %1
%16 = load i32, i32* %1
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%18 = call i32 @itob(i32 %16, i8* %17, i32 2)
%19 = load i32, i32* %1
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %19, i8* %20)
store i32 2048, i32* %1
%22 = load i32, i32* %1
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%24 = call i32 @itob(i32 %22, i8* %23, i32 8)
%25 = load i32, i32* %1
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %25, i8* %26)
%28 = load i32, i32* @INT_MIN
store i32 %28, i32* %1
%29 = load i32, i32* %1
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%31 = call i32 @itob(i32 %29, i8* %30, i32 16)
%32 = load i32, i32* %1
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%34 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %32, i8* %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"n: %d, s: %s\0A\00"
@INT_MAX = global i32 0
@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 = call i32 @itob(i32 255, i8* %2, i32 16)
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 255, i8* %2)
%5 = load i32, i32* @INT_MAX
%6 = call i32 @itob(i32 %5, i8* %2, i32 16)
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5, i8* %2)
%8 = call i32 @itob(i32 2048, i8* %2, i32 2)
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2048, i8* %2)
%10 = call i32 @itob(i32 2048, i8* %2, i32 8)
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2048, i8* %2)
%12 = load i32, i32* @INT_MIN
%13 = call i32 @itob(i32 %12, i8* %2, i32 16)
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %2)
ret i32 0
}