#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*/ inttostr(int, char *);
int /*<<< orphan*/ printf(char *, char *);
void test2(void) {
  char buffer[12];
  inttostr(1, buffer);
  printf("|%s|\n", buffer);
  inttostr(12, buffer);
  printf("|%s|\n", buffer);
  inttostr(123, buffer);
  printf("|%s|\n", buffer);
  inttostr(1234, buffer);
  printf("|%s|\n", buffer);
  inttostr(1234567890, buffer);
  printf("|%s|\n", buffer);
  inttostr(0, buffer);
  printf("|%s|\n", buffer);
  inttostr(-1, buffer);
  printf("|%s|\n", buffer);
  inttostr(-12, buffer);
  printf("|%s|\n", buffer);
  inttostr(-123, buffer);
  printf("|%s|\n", buffer);
  inttostr(-1234, buffer);
  printf("|%s|\n", buffer);
  inttostr(-1234567890, buffer);
  printf("|%s|\n", buffer);
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0xc(%rbp),%rsi
mov    $0x1,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0xc,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0x7b,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0x4d2,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0x499602d2,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
xor    %edi,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0xffffffff,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0xfffffff4,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0xffffff85,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0xfffffb2e,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xdb4(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
mov    $0xb669fd2e,%edi
call   1040 <inttostr@plt>
lea    -0xc(%rbp),%rsi
lea    0xd96(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xc(%rsp),%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
lea    0xec0(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xc,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x7b,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x4d2,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x499602d2,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xfffffff4,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xffffff85,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xfffffb2e,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xb669fd2e,%edi
mov    %rbx,%rsi
call   1040 <inttostr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"|%s|\0A\00"
define void @test2() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @inttostr(i32 1, i8* %2)
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%7 = call i32 @inttostr(i32 12, i8* %6)
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%11 = call i32 @inttostr(i32 123, i8* %10)
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%15 = call i32 @inttostr(i32 1234, i8* %14)
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%19 = call i32 @inttostr(i32 1234567890, i8* %18)
%20 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%23 = call i32 @inttostr(i32 0, i8* %22)
%24 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%27 = call i32 @inttostr(i32 -1, i8* %26)
%28 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%31 = call i32 @inttostr(i32 -12, i8* %30)
%32 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%33 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%35 = call i32 @inttostr(i32 -123, i8* %34)
%36 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%37 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%39 = call i32 @inttostr(i32 -1234, i8* %38)
%40 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%43 = call i32 @inttostr(i32 -1234567890, i8* %42)
%44 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%45 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %44)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"|%s|\0A\00"
define void @test2() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @inttostr(i32 1, i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 @inttostr(i32 12, i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = call i32 @inttostr(i32 123, i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @inttostr(i32 1234, i8* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%11 = call i32 @inttostr(i32 1234567890, i8* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%13 = call i32 @inttostr(i32 0, i8* %2)
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%15 = call i32 @inttostr(i32 -1, i8* %2)
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%17 = call i32 @inttostr(i32 -12, i8* %2)
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%19 = call i32 @inttostr(i32 -123, i8* %2)
%20 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%21 = call i32 @inttostr(i32 -1234, i8* %2)
%22 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
%23 = call i32 @inttostr(i32 -1234567890, i8* %2)
%24 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}