#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 eng_to_dec(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int main(void) {
  char *test[] = {"zero", "one", "two",   "three", "four",
                  "five", "six", "seven", "eight", "nine"};
  for (int i = 0; i < 10; i++) {
    printf("eng_to_dec(\'%s\') #\t => %d\n", test[i], eng_to_dec(test[i]));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0x2c86(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    11a0 <main+0x70>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rax
mov    %rax,-0x70(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdi
call   1030 <eng_to_dec@plt>
mov    -0x70(%rbp),%rsi
mov    %eax,%edx
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    115b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
lea    0xef8(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xeb7(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe9f(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe87(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe71(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe5a(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe43(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe2b(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe15(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xdff(%rip),%rbx
mov    %rbx,%rdi
call   1030 <eng_to_dec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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.test = [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)]
@.str.10 = [27 x i8] c"eng_to_dec('%s') #\09 => %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8*]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [10 x i8*]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @eng_to_dec(i8* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* %12, i32 %17)
br label %19
19: ; preds = %8
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %5
22: ; preds = %5
%23 = load i32, i32* %1
ret i32 %23
}

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"
@.str.10 = [27 x i8] c"eng_to_dec('%s') #\09 => %d\0A\00"
define i32 @main() {
%1 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%12 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%14 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%16 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %15)
%17 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%18 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %17)
%19 = tail call i32 @eng_to_dec(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%20 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %19)
ret i32 0
}