#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 */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ my_itoa(int, int, char *, int);
int /*<<< orphan*/ printf(char *, int, int, char *);
int rand();
int main(int argc, char *argv[]) {
  char buffer[256] = {0x00};
  int number, base;
  for (int i = 0; i < 10; i++) {
    number = (rand() % 1000) + 1;
    base = (rand() % 35) + 1;
    memset(buffer, 0x00, sizeof(buffer));
    my_itoa(number, base, buffer, 256);
    printf("%d in Base %d =%s\n", number, base, buffer);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
movl   $0x0,-0x11c(%rbp)
cmpl   $0xa,-0x11c(%rbp)
jge    1216 <main+0xd6>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x114(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x23,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x118(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
mov    -0x114(%rbp),%edi
mov    -0x118(%rbp),%esi
lea    -0x110(%rbp),%rdx
mov    $0x100,%ecx
call   1030 <my_itoa@plt>
mov    -0x114(%rbp),%esi
mov    -0x118(%rbp),%edx
lea    -0x110(%rbp),%rcx
lea    0xe03(%rip),%rdi
call   1040 <printf@plt>
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    1176 <main+0x36>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
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)
mov    $0xa,%ebp
mov    %rsp,%r15
lea    0xe38(%rip),%r14
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r12d
add    $0x1,%r12d
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0xffffffffea0ea0eb,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x23,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1050 <memset@plt>
mov    %r12d,%edi
mov    %ebx,%esi
mov    %r15,%rdx
mov    $0x100,%ecx
call   1030 <my_itoa@plt>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r15,%rcx
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    11d0 <main+0x90>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"%d in Base %d =%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
br label %6
5: ; preds = %6
ret i32 0
6: ; preds = %2, %6
%7 = phi i32 [ 0, %2 ], [ %17, %6 ]
%8 = call i32 (...) @rand()
%9 = srem i32 %8, 1000
%10 = add nsw i32 %9, 1
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 35
%13 = add nsw i32 %12, 1
%14 = call i32 @memset(i8* %4, i32 0, i32 256)
%15 = call i32 @my_itoa(i32 %10, i32 %13, i8* %4, i32 256)
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13, i8* %4)
%17 = add nuw nsw i32 %7, 1
%18 = icmp eq i32 %17, 10
br i1 %18, label %5, label %6
}