#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*/ printf(char *, ...);
void print(int word_number, char *letters, int space) {
  if (word_number == 0) {
    printf("a");
  } else {
    while (word_number) {
      int mod = word_number % 15;
      word_number /= 15;
      printf("%c", letters[mod]);
    }
  }
  if (space)
    printf(" ");
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113f <print+0x2f>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118e <print+0x7e>
jmp    1144 <print+0x34>
cmpl   $0x0,-0x4(%rbp)
je     1189 <print+0x79>
mov    -0x4(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1144 <print+0x34>
jmp    118e <print+0x7e>
cmpl   $0x0,-0x14(%rbp)
je     11a6 <print+0x96>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
test   %edi,%edi
je     1183 <print+0x73>
mov    %rsi,%r15
mov    %edi,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %ebp,%rbx
imul   $0xffffffff88888889,%rbx,%rbp
shr    $0x20,%rbp
add    %ebx,%ebp
mov    %ebp,%eax
shr    $0x1f,%eax
sar    $0x3,%ebp
add    %eax,%ebp
lea    0x0(%rbp,%rbp,4),%eax
lea    (%rax,%rax,2),%eax
mov    %ebx,%ecx
sub    %eax,%ecx
movslq %ecx,%rax
movsbl (%r15,%rax,1),%edi
call   1030 <putchar@plt>
add    $0xe,%ebx
cmp    $0x1c,%ebx
ja     1130 <print+0x20>
test   %r14d,%r14d
je     1192 <print+0x82>
mov    $0x20,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
mov    $0x61,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jne    116f <print+0x5f>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @print(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @putchar(i32 97)
br label %18
7: ; preds = %3, %7
%8 = phi i32 [ %10, %7 ], [ %0, %3 ]
%9 = srem i32 %8, 15
%10 = sdiv i32 %8, 15
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = tail call i32 @putchar(i32 %14)
%16 = add i32 %8, 14
%17 = icmp ult i32 %16, 29
br i1 %17, label %18, label %7
18: ; preds = %7, %5
%19 = icmp eq i32 %2, 0
br i1 %19, label %22, label %20
20: ; preds = %18
%21 = tail call i32 @putchar(i32 32)
br label %22
22: ; preds = %20, %18
ret void
}