#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*/ itob(int, char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
main() {
  int n;
  char test[1000];
  n = 16;
  itob(n, test, 16);
  printf("%d  %s\n", n, test);
  n = 15;
  itob(n, test, 16);
  printf("%d  %s\n", n, test);
  n = 9;
  itob(n, test, 16);
  printf("%d  %s\n", n, test);
  n = -45;
  itob(n, test, 16);
  printf("%d  %s\n", n, test);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x10,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    -0x4(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0xf,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    -0x4(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movl   $0x9,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    -0x4(%rbp),%esi
lea    -0x3f0(%rbp),%rdx
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffd3,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
mov    $0x10,%edx
call   1040 <itob@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    $0x10,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
lea    0xeba(%rip),%r14
mov    %r14,%rdi
mov    $0x10,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0xf,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    %r14,%rdi
mov    $0xf,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0x9,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    %r14,%rdi
mov    $0x9,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    $0xffffffd3,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
mov    %r14,%rdi
mov    $0xffffffd3,%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 16, i32* %1
%3 = load i32, i32* %1
%4 = getelementptr inbounds [1000 x i8], [1000 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 [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 15, i32* %1
%9 = load i32, i32* %1
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%11 = call i32 @itob(i32 %9, i8* %10, i32 16)
%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 9, i32* %1
%15 = load i32, i32* %1
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%17 = call i32 @itob(i32 %15, i8* %16, i32 16)
%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 -45, i32* %1
%21 = load i32, i32* %1
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%23 = call i32 @itob(i32 %21, i8* %22, i32 16)
%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 @itob(i32 16, i8* %2, i32 16)
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 16, i8* %2)
%5 = call i32 @itob(i32 15, i8* %2, i32 16)
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 15, i8* %2)
%7 = call i32 @itob(i32 9, i8* %2, i32 16)
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 9, i8* %2)
%9 = call i32 @itob(i32 -45, i8* %2, i32 16)
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 -45, i8* %2)
ret i32 0
}