#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*/ fromDecimal2(int, int, char *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char result[100];
  int b = 26;
  int n;
  for (n = 0; n <= 100; n++) {
    int size = 0;
    result[size] = '\0';
    printf("%d at %d = ", n, b);
    fromDecimal2(n, b, result, &size);
    result[size] = '\0';
    printf("%s\n", result);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1a,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x64,-0x78(%rbp)
jg     11aa <main+0x8a>
movl   $0x0,-0x7c(%rbp)
movslq -0x7c(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
mov    -0x78(%rbp),%esi
mov    -0x74(%rbp),%edx
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%edi
mov    -0x74(%rbp),%esi
lea    -0x70(%rbp),%rdx
lea    -0x7c(%rbp),%rcx
call   1040 <fromDecimal2@plt>
movslq -0x7c(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
lea    -0x70(%rbp),%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xebf(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r15
xor    %ebp,%ebp
nopl   (%rax)
movl   $0x0,0xc(%rsp)
movb   $0x0,0x10(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1a,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
mov    $0x1a,%esi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1050 <fromDecimal2@plt>
movslq 0xc(%rsp),%rax
movb   $0x0,0x10(%rsp,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    $0x65,%ebp
jne    1150 <main+0x20>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d at %d = \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 26, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %25, %0
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 100
br i1 %8, label %9, label %28
9: ; preds = %6
store i32 0, i32* %5
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %11
store i8 0, i8* %12
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%19 = call i32 @fromDecimal2(i32 %16, i32 %17, i8* %18, i32* %5)
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %21
store i8 0, i8* %22
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %9
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %6
28: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d at %d = \00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %13, %5 ]
store i32 0, i32* %2
store i8 0, i8* %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6, i32 26)
%8 = call i32 @fromDecimal2(i32 %6, i32 26, i8* %3, i32* %2)
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %10
store i8 0, i8* %11
%12 = call i32 @puts(i8* %3)
%13 = add nuw nsw i32 %6, 1
%14 = icmp eq i32 %13, 101
br i1 %14, label %15, label %5
15: ; preds = %5
ret i32 0
}