#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, int, char *);
int /*<<< orphan*/ putchar(char);
int main(void) {
  char s[128] = {0};
  int tests[6] = {186, -125, 87634, -379, 17, 93};
  int bases[6] = {2, 8, 10, 16, 24, 36};
  for (int i = 0; i < 6; ++i) {
    putchar('\n');
    for (int j = 0; j < 6; ++j) {
      itob(tests[j], s, bases[i]);
      printf("%8d base %2d = %s\n", tests[j], bases[i], s);
    }
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
mov    0xe94(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    0xe8e(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    0xe88(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xe8a(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0xe84(%rip),%rax
mov    %rax,-0xc8(%rbp)
mov    0xe7e(%rip),%rax
mov    %rax,-0xc0(%rbp)
movl   $0x0,-0xd4(%rbp)
cmpl   $0x6,-0xd4(%rbp)
jge    1275 <main+0x135>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xd8(%rbp)
cmpl   $0x6,-0xd8(%rbp)
jge    125c <main+0x11c>
movslq -0xd8(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%edi
lea    -0x90(%rbp),%rsi
movslq -0xd4(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%edx
call   1060 <itob@plt>
movslq -0xd8(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%esi
movslq -0xd4(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%edx
lea    -0x90(%rbp),%rcx
lea    0xdf5(%rip),%rdi
call   1040 <printf@plt>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    11e4 <main+0xa4>
jmp    1261 <main+0x121>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    11c3 <main+0x83>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
xor    %ebx,%ebx
lea    0xe8e(%rip),%r12
mov    %rsp,%r15
lea    0xe9c(%rip),%r14
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rbx,%r12,1),%ebp
mov    $0xba,%edi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <itob@plt>
mov    %r14,%rdi
mov    $0xba,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1040 <printf@plt>
mov    $0xffffff83,%edi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <itob@plt>
mov    %r14,%rdi
mov    $0xffffff83,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1040 <printf@plt>
mov    $0x15652,%edi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <itob@plt>
mov    %r14,%rdi
mov    $0x15652,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1040 <printf@plt>
mov    $0xfffffe85,%edi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <itob@plt>
mov    %r14,%rdi
mov    $0xfffffe85,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1040 <printf@plt>
mov    $0x11,%edi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <itob@plt>
mov    %r14,%rdi
mov    $0x11,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1040 <printf@plt>
mov    $0x5d,%edi
mov    %r15,%rsi
mov    %ebp,%edx
call   1050 <itob@plt>
mov    %r14,%rdi
mov    $0x5d,%esi
mov    %ebp,%edx
mov    %r15,%rcx
call   1040 <printf@plt>
add    $0x4,%rbx
cmp    $0x18,%rbx
jne    1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.tests = [6 x i32] [i32 186, i32 -125, i32 87634, i32 -379, i32 17, i32 93]
@__const.main.bases = [6 x i32] [i32 2, i32 8, i32 10, i32 16, i32 24, i32 36]
@.str = [19 x i8] c"%8d base %2d = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca [6 x i32]
%4 = alloca [6 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [128 x i8]* %2 to i8*
%8 = bitcast [6 x i32]* %3 to i8*
%9 = bitcast [6 x i32]* %4 to i8*
store i32 0, i32* %5
br label %10
10: ; preds = %43, %0
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 6
br i1 %12, label %13, label %46
13: ; preds = %10
%14 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %6
br label %15
15: ; preds = %39, %13
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 6
br i1 %17, label %18, label %42
18: ; preds = %15
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = call i32 @itob(i32 %22, i8* %23, i32 %27)
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%38 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %32, i32 %36, i8* %37)
br label %39
39: ; preds = %18
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %15
42: ; preds = %15
br label %43
43: ; preds = %42
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %10
46: ; preds = %10
%47 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.bases = [6 x i32] [i32 2, i32 8, i32 10, i32 16, i32 24, i32 36]
@.str = [19 x i8] c"%8d base %2d = %s\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
br label %5
3: ; preds = %5
%4 = call i32 @putchar(i8 signext 10)
ret i32 0
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %22, %5 ]
%7 = call i32 @putchar(i8 signext 10)
%8 = getelementptr inbounds [6 x i32], [6 x i32]* @__const.main.bases, i64 0, i64 %6
%9 = load i32, i32* %8
%10 = call i32 @itob(i32 186, i8* %2, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 186, i32 %9, i8* %2)
%12 = call i32 @itob(i32 -125, i8* %2, i32 %9)
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 -125, i32 %9, i8* %2)
%14 = call i32 @itob(i32 87634, i8* %2, i32 %9)
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 87634, i32 %9, i8* %2)
%16 = call i32 @itob(i32 -379, i8* %2, i32 %9)
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 -379, i32 %9, i8* %2)
%18 = call i32 @itob(i32 17, i8* %2, i32 %9)
%19 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 17, i32 %9, i8* %2)
%20 = call i32 @itob(i32 93, i8* %2, i32 %9)
%21 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 93, i32 %9, i8* %2)
%22 = add nuw nsw i64 %6, 1
%23 = icmp eq i64 %22, 6
br i1 %23, label %3, label %5
}