#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*/ printf(char *, ...);
int sprintf(char *, char *, int);
void padd(int val) {
  char p[20];
  int len = sprintf(p, "%i", val);
  printf("%i", val);
  if (val > 1000000000)
    printf(" ");
  else if (val > 100000000)
    printf("  ");
  else if (val > 10000000)
    printf("   ");
  else if (val > 1000000)
    printf("    ");
  else if (val > 100000)
    printf("     ");
  else if (val > 10000)
    printf("      ");
  else if (val > 1000)
    printf("       ");
  else if (val > 100)
    printf("        ");
  else if (val > 10)
    printf("         ");
  else if (val >= 0)
    printf("          ");
  else if (val == -1)
    printf("         ");
}


x86 assembly (clang, -O0):
<padd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec7(%rip),%rsi
call   1040 <sprintf@plt>
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3b9aca00,-0x4(%rbp)
jle    1172 <padd+0x52>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d3 <padd+0x1b3>
cmpl   $0x5f5e100,-0x4(%rbp)
jle    1192 <padd+0x72>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ce <padd+0x1ae>
cmpl   $0x989680,-0x4(%rbp)
jle    11b2 <padd+0x92>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c9 <padd+0x1a9>
cmpl   $0xf4240,-0x4(%rbp)
jle    11d2 <padd+0xb2>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c4 <padd+0x1a4>
cmpl   $0x186a0,-0x4(%rbp)
jle    11f2 <padd+0xd2>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12bf <padd+0x19f>
cmpl   $0x2710,-0x4(%rbp)
jle    1212 <padd+0xf2>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ba <padd+0x19a>
cmpl   $0x3e8,-0x4(%rbp)
jle    1232 <padd+0x112>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b5 <padd+0x195>
cmpl   $0x64,-0x4(%rbp)
jle    124f <padd+0x12f>
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b0 <padd+0x190>
cmpl   $0xa,-0x4(%rbp)
jle    126c <padd+0x14c>
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ab <padd+0x18b>
cmpl   $0x0,-0x4(%rbp)
jl     1289 <padd+0x169>
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a6 <padd+0x186>
cmpl   $0xffffffff,-0x4(%rbp)
jne    12a1 <padd+0x181>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a6 <padd+0x186>
jmp    12ab <padd+0x18b>
jmp    12b0 <padd+0x190>
jmp    12b5 <padd+0x195>
jmp    12ba <padd+0x19a>
jmp    12bf <padd+0x19f>
jmp    12c4 <padd+0x1a4>
jmp    12c9 <padd+0x1a9>
jmp    12ce <padd+0x1ae>
jmp    12d3 <padd+0x1b3>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<padd>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0xec0(%rip),%r14
mov    %rsp,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <sprintf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x3b9aca01,%ebx
jl     1172 <padd+0x42>
mov    $0x20,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>
cmp    $0x5f5e101,%ebx
jl     1183 <padd+0x53>
lea    0xe8a(%rip),%rdi
jmp    11ff <padd+0xcf>
cmp    $0x989681,%ebx
jl     1194 <padd+0x64>
lea    0xe78(%rip),%rdi
jmp    11ff <padd+0xcf>
cmp    $0xf4241,%ebx
jl     11a5 <padd+0x75>
lea    0xe66(%rip),%rdi
jmp    11ff <padd+0xcf>
cmp    $0x186a1,%ebx
jl     11b6 <padd+0x86>
lea    0xe54(%rip),%rdi
jmp    11ff <padd+0xcf>
cmp    $0x2711,%ebx
jl     11c7 <padd+0x97>
lea    0xe42(%rip),%rdi
jmp    11ff <padd+0xcf>
cmp    $0x3e9,%ebx
jl     11d8 <padd+0xa8>
lea    0xe30(%rip),%rdi
jmp    11ff <padd+0xcf>
cmp    $0x65,%ebx
jl     11e6 <padd+0xb6>
lea    0xe21(%rip),%rdi
jmp    11ff <padd+0xcf>
cmp    $0xb,%ebx
jl     11f4 <padd+0xc4>
lea    0xe12(%rip),%rdi
jmp    11ff <padd+0xcf>
test   %ebx,%ebx
js     120d <padd+0xdd>
lea    0xe04(%rip),%rdi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>
cmp    $0xffffffff,%ebx
je     11eb <padd+0xbb>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [4 x i8] c" \00"
@.str.4 = [5 x i8] c" \00"
@.str.5 = [6 x i8] c" \00"
@.str.6 = [7 x i8] c" \00"
@.str.7 = [8 x i8] c" \00"
@.str.8 = [9 x i8] c" \00"
@.str.9 = [10 x i8] c" \00"
@.str.10 = [11 x i8] c" \00"
define void @padd(i32 %0) {
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 1000000000
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %74
14: ; preds = %1
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 100000000
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %73
19: ; preds = %14
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 10000000
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %72
24: ; preds = %19
%25 = load i32, i32* %2
%26 = icmp sgt i32 %25, 1000000
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %71
29: ; preds = %24
%30 = load i32, i32* %2
%31 = icmp sgt i32 %30, 100000
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %70
34: ; preds = %29
%35 = load i32, i32* %2
%36 = icmp sgt i32 %35, 10000
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %69
39: ; preds = %34
%40 = load i32, i32* %2
%41 = icmp sgt i32 %40, 1000
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %68
44: ; preds = %39
%45 = load i32, i32* %2
%46 = icmp sgt i32 %45, 100
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %67
49: ; preds = %44
%50 = load i32, i32* %2
%51 = icmp sgt i32 %50, 10
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %66
54: ; preds = %49
%55 = load i32, i32* %2
%56 = icmp sge i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %65
59: ; preds = %54
%60 = load i32, i32* %2
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %64
62: ; preds = %59
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %64
64: ; preds = %62, %59
br label %65
65: ; preds = %64, %57
br label %66
66: ; preds = %65, %52
br label %67
67: ; preds = %66, %47
br label %68
68: ; preds = %67, %42
br label %69
69: ; preds = %68, %37
br label %70
70: ; preds = %69, %32
br label %71
71: ; preds = %70, %27
br label %72
72: ; preds = %71, %22
br label %73
73: ; preds = %72, %17
br label %74
74: ; preds = %73, %12
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [4 x i8] c" \00"
@.str.4 = [5 x i8] c" \00"
@.str.5 = [6 x i8] c" \00"
@.str.6 = [7 x i8] c" \00"
@.str.7 = [8 x i8] c" \00"
@.str.8 = [9 x i8] c" \00"
@.str.9 = [10 x i8] c" \00"
@.str.10 = [11 x i8] c" \00"
define void @padd(i32 %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = icmp sgt i32 %0, 1000000000
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @putchar(i32 32)
br label %49
9: ; preds = %1
%10 = icmp sgt i32 %0, 100000000
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %49
13: ; preds = %9
%14 = icmp sgt i32 %0, 10000000
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %49
17: ; preds = %13
%18 = icmp sgt i32 %0, 1000000
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %49
21: ; preds = %17
%22 = icmp sgt i32 %0, 100000
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %49
25: ; preds = %21
%26 = icmp sgt i32 %0, 10000
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %49
29: ; preds = %25
%30 = icmp sgt i32 %0, 1000
br i1 %30, label %31, label %33
31: ; preds = %29
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %49
33: ; preds = %29
%34 = icmp sgt i32 %0, 100
br i1 %34, label %35, label %37
35: ; preds = %33
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %49
37: ; preds = %33
%38 = icmp sgt i32 %0, 10
br i1 %38, label %39, label %41
39: ; preds = %37
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %49
41: ; preds = %37
%42 = icmp sgt i32 %0, -1
br i1 %42, label %43, label %45
43: ; preds = %41
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %49
45: ; preds = %41
%46 = icmp eq i32 %0, -1
br i1 %46, label %47, label %49
47: ; preds = %45
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
br label %49
49: ; preds = %11, %19, %27, %35, %43, %47, %45, %39, %31, %23, %15, %7
ret void
}