#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 convert(int thousands, int hundreds, int tens, int ones) {
  char *num[] = {"",     "One", "Two",   "Three", "Four",
                 "Five", "Six", "Seven", "Eight", "Nine"};
  char *for_ten[] = {"",      "",      "Twenty",  "Thirty", "Fourty",
                     "Fifty", "Sixty", "Seventy", "Eighty", "Ninty"};
  char *af_ten[] = {"Ten",     "Eleven",  "Twelve",    "Thirteen", "Fourteen",
                    "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Ninteen"};
  printf("\nThe year in words is:\n");
  printf("%s thousand", num[thousands]);
  if (hundreds != 0)
    printf(" %s hundred", num[hundreds]);
  if (tens != 1)
    printf(" %s %s", for_ten[tens], num[ones]);
  else
    printf(" %s", af_ten[ones]);
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2bee(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0x2c26(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
lea    -0x100(%rbp),%rdi
lea    0x2c5e(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
lea    0xf2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x4(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
lea    0xf30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11c2 <convert+0xa2>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
je     11f4 <convert+0xd4>
movslq -0xc(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rsi
ff
movslq -0x10(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdx
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120e <convert+0xee>
movslq -0x10(%rbp),%rax
mov    -0x100(%rbp,%rax,8),%rsi
ff
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xf99(%rip),%rdi
call   1030 <puts@plt>
movslq %ebp,%rax
lea    0x2c89(%rip),%rbp
mov    0x0(%rbp,%rax,8),%rsi
lea    0xf5f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
je     1174 <convert+0x54>
movslq %ebx,%rax
mov    0x0(%rbp,%rax,8),%rsi
lea    0xf51(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%r15d
jne    11a3 <convert+0x83>
movslq %r14d,%rax
lea    0xf8c(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xf3b(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
movslq %r15d,%rax
lea    0xf3b(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
movslq %r14d,%rax
mov    0x0(%rbp,%rax,8),%rdx
lea    0xf07(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"One\00"
@.str.2 = [4 x i8] c"Two\00"
@.str.3 = [6 x i8] c"Three\00"
@.str.4 = [5 x i8] c"Four\00"
@.str.5 = [5 x i8] c"Five\00"
@.str.6 = [4 x i8] c"Six\00"
@.str.7 = [6 x i8] c"Seven\00"
@.str.8 = [6 x i8] c"Eight\00"
@.str.9 = [5 x i8] c"Nine\00"
@__const.convert.num = [10 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0)]
@.str.10 = [7 x i8] c"Twenty\00"
@.str.11 = [7 x i8] c"Thirty\00"
@.str.12 = [7 x i8] c"Fourty\00"
@.str.13 = [6 x i8] c"Fifty\00"
@.str.14 = [6 x i8] c"Sixty\00"
@.str.15 = [8 x i8] c"Seventy\00"
@.str.16 = [7 x i8] c"Eighty\00"
@.str.17 = [6 x i8] c"Ninty\00"
@__const.convert.for_ten = [10 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i32 0, i32 0)]
@.str.18 = [4 x i8] c"Ten\00"
@.str.19 = [7 x i8] c"Eleven\00"
@.str.20 = [7 x i8] c"Twelve\00"
@.str.21 = [9 x i8] c"Thirteen\00"
@.str.22 = [9 x i8] c"Fourteen\00"
@.str.23 = [8 x i8] c"Fifteen\00"
@.str.24 = [8 x i8] c"Sixteen\00"
@.str.25 = [10 x i8] c"Seventeen\00"
@.str.26 = [9 x i8] c"Eighteen\00"
@.str.27 = [8 x i8] c"Ninteen\00"
@__const.convert.af_ten = [10 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.27, i32 0, i32 0)]
@.str.28 = [24 x i8] c"\0AThe year in words is:\0A\00"
@.str.29 = [12 x i8] c"%s thousand\00"
@.str.30 = [12 x i8] c" %s hundred\00"
@.str.31 = [7 x i8] c" %s %s\00"
@.str.32 = [4 x i8] c" %s\00"
define void @convert(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [10 x i8*]
%10 = alloca [10 x i8*]
%11 = alloca [10 x i8*]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = bitcast [10 x i8*]* %9 to i8*
%13 = bitcast [10 x i8*]* %10 to i8*
%14 = bitcast [10 x i8*]* %11 to i8*
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.28, i64 0, i64 0))
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x i8*], [10 x i8*]* %9, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.29, i64 0, i64 0), i8* %19)
%21 = load i32, i32* %6
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10 x i8*], [10 x i8*]* %9, i64 0, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.30, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %23, %4
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %42
32: ; preds = %29
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i8*], [10 x i8*]* %10, i64 0, i64 %34
%36 = load i8*, i8** %35
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x i8*], [10 x i8*]* %9, i64 0, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i64 0, i64 0), i8* %36, i8* %40)
br label %48
42: ; preds = %29
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [10 x i8*], [10 x i8*]* %11, i64 0, i64 %44
%46 = load i8*, i8** %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.32, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %42, %32
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"One\00"
@.str.2 = [4 x i8] c"Two\00"
@.str.3 = [6 x i8] c"Three\00"
@.str.4 = [5 x i8] c"Four\00"
@.str.5 = [5 x i8] c"Five\00"
@.str.6 = [4 x i8] c"Six\00"
@.str.7 = [6 x i8] c"Seven\00"
@.str.8 = [6 x i8] c"Eight\00"
@.str.9 = [5 x i8] c"Nine\00"
@__const.convert.num = [10 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0)]
@.str.10 = [7 x i8] c"Twenty\00"
@.str.11 = [7 x i8] c"Thirty\00"
@.str.12 = [7 x i8] c"Fourty\00"
@.str.13 = [6 x i8] c"Fifty\00"
@.str.14 = [6 x i8] c"Sixty\00"
@.str.15 = [8 x i8] c"Seventy\00"
@.str.16 = [7 x i8] c"Eighty\00"
@.str.17 = [6 x i8] c"Ninty\00"
@reltable.convert = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.10 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.11 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.12 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.13 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.14 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.15 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.16 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.17 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert to i64)) to i32)]
@.str.18 = [4 x i8] c"Ten\00"
@.str.19 = [7 x i8] c"Eleven\00"
@.str.20 = [7 x i8] c"Twelve\00"
@.str.21 = [9 x i8] c"Thirteen\00"
@.str.22 = [9 x i8] c"Fourteen\00"
@.str.23 = [8 x i8] c"Fifteen\00"
@.str.24 = [8 x i8] c"Sixteen\00"
@.str.25 = [10 x i8] c"Seventeen\00"
@.str.26 = [9 x i8] c"Eighteen\00"
@.str.27 = [8 x i8] c"Ninteen\00"
@reltable.convert.33 = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.18 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.19 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.20 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.21 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.22 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.23 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.24 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.25 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.26 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.27 to i64), i64 ptrtoint ([10 x i32]* @reltable.convert.33 to i64)) to i32)]
@.str.29 = [12 x i8] c"%s thousand\00"
@.str.30 = [12 x i8] c" %s hundred\00"
@.str.31 = [7 x i8] c" %s %s\00"
@.str.32 = [4 x i8] c" %s\00"
@str = [23 x i8] c"\0AThe year in words is:\00"
define void @convert(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%6 = sext i32 %0 to i64
%7 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.convert.num, i64 0, i64 %6
%8 = load i8*, i8** %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.29, i64 0, i64 0), i8* %8)
%10 = icmp eq i32 %1, 0
br i1 %10, label %16, label %11
11: ; preds = %4
%12 = sext i32 %1 to i64
%13 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.convert.num, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.30, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %11, %4
%17 = icmp eq i32 %2, 1
br i1 %17, label %26, label %18
18: ; preds = %16
%19 = sext i32 %2 to i64
%20 = shl i64 %19, 2
%21 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.convert to i8*), i64 %20)
%22 = sext i32 %3 to i64
%23 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.convert.num, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i64 0, i64 0), i8* %21, i8* %24)
br label %31
26: ; preds = %16
%27 = sext i32 %3 to i64
%28 = shl i64 %27, 2
%29 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.convert.33 to i8*), i64 %28)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.32, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %26, %18
ret void
}