#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 EOF;
int getchar();
scalar_t__ isdigit(int);
int /*<<< orphan*/ printf(char *, char const *, ...);
int main() {
  int n = 0, c;
  const char *str[] = {"zero", "one", "two",   "three", "four",
                       "five", "six", "seven", "eight", "nine"};
  while ((c = getchar()) != EOF && isdigit(c))
    n += c - '0';
  int b = n / 100, s = n / 10 % 10, g = n % 10;
  if (b != 0)
    printf("%s %s %s\n", str[b], str[s], str[g]);
  else if (s != 0)
    printf("%s %s\n", str[s], str[g]);
  else
    printf("%s\n", str[g]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2c5f(%rip),%rsi
mov    $0x50,%edx
call   1060 <memcpy@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
mov    0x2e60(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x6d(%rbp)
je     119d <main+0x5d>
mov    -0xc(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x6d(%rbp)
mov    -0x6d(%rbp),%al
test   $0x1,%al
jne    11ad <main+0x6d>
jmp    11be <main+0x7e>
mov    -0xc(%rbp),%eax
sub    $0x30,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    116b <main+0x2b>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x68(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x6c(%rbp)
cmpl   $0x0,-0x64(%rbp)
je     1228 <main+0xe8>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
movslq -0x68(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdx
movslq -0x6c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rcx
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1273 <main+0x133>
cmpl   $0x0,-0x68(%rbp)
je     1257 <main+0x117>
movslq -0x68(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
movslq -0x6c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdx
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    126e <main+0x12e>
movslq -0x6c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1273 <main+0x133>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e98(%rip),%r15
cmp    (%r15),%eax
jne    116e <main+0x3e>
movslq %r14d,%rax
lea    0x2c69(%rip),%rcx
mov    (%rcx,%rax,8),%rsi
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1256 <main+0x126>
mov    %eax,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     119f <main+0x6f>
add    %ebx,%ebp
add    $0xffffffd0,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    (%r15),%eax
jne    1180 <main+0x50>
movslq %ebp,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%esi
mov    %edx,%ecx
sub    %esi,%ecx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
mov    %eax,%r14d
sub    %edx,%r14d
lea    0x63(%rax),%edx
cmp    $0xc7,%edx
jae    1219 <main+0xe9>
test   %ecx,%ecx
je     114d <main+0x1d>
movslq %ecx,%rax
lea    0x2bc2(%rip),%rcx
mov    (%rcx,%rax,8),%rsi
movslq %r14d,%rax
mov    (%rcx,%rax,8),%rdx
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1256 <main+0x126>
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
cltq
lea    0x2b8a(%rip),%rdi
mov    (%rdi,%rax,8),%rsi
movslq %ecx,%rax
mov    (%rdi,%rax,8),%rdx
movslq %r14d,%rax
mov    (%rdi,%rax,8),%rcx
lea    0xde3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"zero\00"
@.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.main.str = [10 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 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)]
@EOF = global i32 0
@.str.10 = [10 x i8] c"%s %s %s\0A\00"
@.str.11 = [7 x i8] c"%s %s\0A\00"
@.str.12 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8*]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%8 = bitcast [10 x i8*]* %4 to i8*
br label %9
9: ; preds = %19, %0
%10 = call i32 (...) @getchar()
store i32 %10, i32* %3
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %3
%15 = call i64 @isdigit(i32 %14)
%16 = icmp ne i64 %15, 0
br label %17
17: ; preds = %13, %9
%18 = phi i1 [ false, %9 ], [ %16, %13 ]
br i1 %18, label %19, label %24
19: ; preds = %17
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 48
%22 = load i32, i32* %2
%23 = add nsw i32 %22, %21
store i32 %23, i32* %2
br label %9
24: ; preds = %17
%25 = load i32, i32* %2
%26 = sdiv i32 %25, 100
store i32 %26, i32* %5
%27 = load i32, i32* %2
%28 = sdiv i32 %27, 10
%29 = srem i32 %28, 10
store i32 %29, i32* %6
%30 = load i32, i32* %2
%31 = srem i32 %30, 10
store i32 %31, i32* %7
%32 = load i32, i32* %5
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %48
34: ; preds = %24
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i8*], [10 x i8*]* %4, i64 0, i64 %36
%38 = load i8*, i8** %37
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10 x i8*], [10 x i8*]* %4, i64 0, i64 %40
%42 = load i8*, i8** %41
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [10 x i8*], [10 x i8*]* %4, i64 0, i64 %44
%46 = load i8*, i8** %45
%47 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %38, i8* %42, i8* %46)
br label %68
48: ; preds = %24
%49 = load i32, i32* %6
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %61
51: ; preds = %48
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [10 x i8*], [10 x i8*]* %4, i64 0, i64 %53
%55 = load i8*, i8** %54
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [10 x i8*], [10 x i8*]* %4, i64 0, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %55, i8* %59)
br label %67
61: ; preds = %48
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [10 x i8*], [10 x i8*]* %4, i64 0, i64 %63
%65 = load i8*, i8** %64
%66 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %65)
br label %67
67: ; preds = %61, %51
br label %68
68: ; preds = %67, %34
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"zero\00"
@.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.main.str = [10 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 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)]
@EOF = global i32 0
@.str.10 = [10 x i8] c"%s %s %s\0A\00"
@.str.11 = [7 x i8] c"%s %s\0A\00"
@.str.12 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %44, label %4
4: ; preds = %0, %9
%5 = phi i32 [ %12, %9 ], [ %1, %0 ]
%6 = phi i32 [ %11, %9 ], [ 0, %0 ]
%7 = tail call i64 @isdigit(i32 %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = add i32 %6, -48
%11 = add i32 %10, %5
%12 = tail call i32 (...) @getchar()
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %4
15: ; preds = %4, %9
%16 = phi i32 [ %6, %4 ], [ %11, %9 ]
%17 = sdiv i32 %16, 10
%18 = srem i32 %17, 10
%19 = srem i32 %16, 10
%20 = add i32 %16, 99
%21 = icmp ult i32 %20, 199
br i1 %21, label %34, label %22
22: ; preds = %15
%23 = sdiv i32 %16, 100
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.main.str, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = sext i32 %18 to i64
%28 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.main.str, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = sext i32 %19 to i64
%31 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.main.str, i64 0, i64 %30
%32 = load i8*, i8** %31
%33 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* %26, i8* %29, i8* %32)
br label %50
34: ; preds = %15
%35 = icmp eq i32 %18, 0
br i1 %35, label %44, label %36
36: ; preds = %34
%37 = sext i32 %18 to i64
%38 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.main.str, i64 0, i64 %37
%39 = load i8*, i8** %38
%40 = sext i32 %19 to i64
%41 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.main.str, i64 0, i64 %40
%42 = load i8*, i8** %41
%43 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %39, i8* %42)
br label %50
44: ; preds = %0, %34
%45 = phi i32 [ %19, %34 ], [ 0, %0 ]
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [10 x i8*], [10 x i8*]* @__const.main.str, i64 0, i64 %46
%48 = load i8*, i8** %47
%49 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %36, %44, %22
ret i32 0
}