#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 getnum(int *);
int /*<<< orphan*/ itob(int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int num[1] = {0};
  int base, error = 1;
  char s[1 + 65 + 1];
  error = getnum(num);
  base = num[0];
  if (base < 2 || base > 36)
    return 1;
  while (getnum(num)) {
    itob(num[0], s, base);
    printf("%s\n", s);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1050 <memset@plt>
movl   $0x1,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <getnum@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jl     118c <main+0x4c>
cmpl   $0x24,-0xc(%rbp)
jle    1198 <main+0x58>
movl   $0x1,-0x4(%rbp)
jmp    11da <main+0x9a>
jmp    119d <main+0x5d>
lea    -0x8(%rbp),%rdi
call   1030 <getnum@plt>
cmp    $0x0,%eax
je     11d3 <main+0x93>
mov    -0x8(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1060 <itob@plt>
lea    -0x60(%rbp),%rsi
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
jmp    119d <main+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <getnum@plt>
mov    0xc(%rsp),%ebx
lea    -0x25(%rbx),%eax
mov    $0x1,%r14d
cmp    $0xffffffdd,%eax
jb     11b5 <main+0x85>
lea    0xc(%rsp),%rdi
call   1030 <getnum@plt>
xor    %r14d,%r14d
test   %eax,%eax
je     11b5 <main+0x85>
lea    0x10(%rsp),%rbp
lea    0xe83(%rip),%r15
lea    0xc(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xc(%rsp),%edi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1050 <itob@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1040 <printf@plt>
mov    %r12,%rdi
call   1030 <getnum@plt>
test   %eax,%eax
jne    1190 <main+0x60>
mov    %r14d,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca [67 x i8]
store i32 0, i32* %1
%6 = bitcast [1 x i32]* %2 to i8*
store i32 1, i32* %4
%7 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%8 = call i32 @getnum(i32* %7)
store i32 %8, i32* %4
%9 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 2
br i1 %12, label %16, label %13
13: ; preds = %0
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 36
br i1 %15, label %16, label %17
16: ; preds = %13, %0
store i32 1, i32* %1
br label %31
17: ; preds = %13
br label %18
18: ; preds = %22, %17
%19 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%20 = call i32 @getnum(i32* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %18
%23 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%24 = load i32, i32* %23
%25 = getelementptr inbounds [67 x i8], [67 x i8]* %5, i64 0, i64 0
%26 = load i32, i32* %3
%27 = call i32 @itob(i32 %24, i8* %25, i32 %26)
%28 = getelementptr inbounds [67 x i8], [67 x i8]* %5, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %28)
br label %18
30: ; preds = %18
store i32 0, i32* %1
br label %31
31: ; preds = %30, %16
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1 x i32]
%2 = alloca [67 x i8]
%3 = bitcast [1 x i32]* %1 to i8*
%4 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 0, i32* %4
%5 = getelementptr inbounds [67 x i8], [67 x i8]* %2, i64 0, i64 0
%6 = call i32 @getnum(i32* %4)
%7 = load i32, i32* %4
%8 = add i32 %7, -37
%9 = icmp ult i32 %8, -35
br i1 %9, label %19, label %10
10: ; preds = %0
%11 = call i32 @getnum(i32* %4)
%12 = icmp eq i32 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %10, %13
%14 = load i32, i32* %4
%15 = call i32 @itob(i32 %14, i8* %5, i32 %7)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%17 = call i32 @getnum(i32* %4)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %13
19: ; preds = %13, %10, %0
%20 = phi i32 [ 1, %0 ], [ 0, %10 ], [ 0, %13 ]
ret i32 %20
}