#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 main(int argc, char **argv) {
  char s[100];
  int n = 26;
  printf("Number in decimal: %d\n", n);
  int b = 16;
  itob(n, s, b);
  printf("Number in base %d: %s\n", b, s);
  b = 2;
  itob(n, s, b);
  printf("Number in base %d: %s\n", b, s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1a,-0x84(%rbp)
mov    -0x84(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x10,-0x88(%rbp)
mov    -0x84(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    -0x88(%rbp),%edx
call   1040 <itob@plt>
mov    -0x88(%rbp),%esi
lea    -0x80(%rbp),%rdx
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x88(%rbp)
mov    -0x84(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    -0x88(%rbp),%edx
call   1040 <itob@plt>
mov    -0x88(%rbp),%esi
lea    -0x80(%rbp),%rdx
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xed2(%rip),%rdi
mov    $0x1a,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    $0x1a,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
lea    0xec1(%rip),%r14
mov    %r14,%rdi
mov    $0x10,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1a,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1040 <itob@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Number in decimal: %d\0A\00"
@.str.1 = [23 x i8] c"Number in base %d: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 26, i32* %7
%9 = load i32, i32* %7
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 16, i32* %8
%11 = load i32, i32* %7
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%13 = load i32, i32* %8
%14 = call i32 @itob(i32 %11, i8* %12, i32 %13)
%15 = load i32, i32* %8
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8* %16)
store i32 2, i32* %8
%18 = load i32, i32* %7
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%20 = load i32, i32* %8
%21 = call i32 @itob(i32 %18, i8* %19, i32 %20)
%22 = load i32, i32* %8
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %22, i8* %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Number in decimal: %d\0A\00"
@.str.1 = [23 x i8] c"Number in base %d: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 26)
%6 = call i32 @itob(i32 26, i8* %4, i32 16)
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 16, i8* %4)
%8 = call i32 @itob(i32 26, i8* %4, i32 2)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 2, i8* %4)
ret i32 0
}