#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 strlen(char *);
int Str2Num(char *ch) {
  int i, len;
  len = strlen(ch);
  if (len == 4 && ch[0] == 'z')
    return 0;
  else if (len == 3 && ch[0] == 'o')
    return 1;
  else if (len == 3 && ch[0] == 't')
    return 2;
  else if (len == 5 && ch[0] == 't')
    return 3;
  else if (len == 4 && ch[0] == 'f' && ch[1] == 'o')
    return 4;
  else if (len == 4 && ch[0] == 'f' && ch[1] == 'i')
    return 5;
  else if (len == 3 && ch[0] == 's')
    return 6;
  else if (len == 5 && ch[0] == 's')
    return 7;
  else if (len == 5 && ch[0] == 'e')
    return 8;
  else if (len == 4 && ch[0] == 'n')
    return 9;
}


x86 assembly (clang, -O0):
<Str2Num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jne    114e <Str2Num+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jne    114e <Str2Num+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x3,-0x18(%rbp)
jne    1174 <Str2Num+0x64>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6f,%eax
jne    1174 <Str2Num+0x64>
movl   $0x1,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x3,-0x18(%rbp)
jne    119a <Str2Num+0x8a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x74,%eax
jne    119a <Str2Num+0x8a>
movl   $0x2,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x5,-0x18(%rbp)
jne    11c0 <Str2Num+0xb0>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x74,%eax
jne    11c0 <Str2Num+0xb0>
movl   $0x3,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x4,-0x18(%rbp)
jne    11f7 <Str2Num+0xe7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x66,%eax
jne    11f7 <Str2Num+0xe7>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6f,%eax
jne    11f7 <Str2Num+0xe7>
movl   $0x4,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x4,-0x18(%rbp)
jne    122e <Str2Num+0x11e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x66,%eax
jne    122e <Str2Num+0x11e>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x69,%eax
jne    122e <Str2Num+0x11e>
movl   $0x5,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x3,-0x18(%rbp)
jne    1254 <Str2Num+0x144>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    1254 <Str2Num+0x144>
movl   $0x6,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x5,-0x18(%rbp)
jne    127a <Str2Num+0x16a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    127a <Str2Num+0x16a>
movl   $0x7,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x5,-0x18(%rbp)
jne    12a0 <Str2Num+0x190>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x65,%eax
jne    12a0 <Str2Num+0x190>
movl   $0x8,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
cmpl   $0x4,-0x18(%rbp)
jne    12c6 <Str2Num+0x1b6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6e,%eax
jne    12c6 <Str2Num+0x1b6>
movl   $0x9,-0x4(%rbp)
jmp    12f3 <Str2Num+0x1e3>
jmp    12cb <Str2Num+0x1bb>
jmp    12d0 <Str2Num+0x1c0>
jmp    12d5 <Str2Num+0x1c5>
jmp    12da <Str2Num+0x1ca>
jmp    12df <Str2Num+0x1cf>
jmp    12e4 <Str2Num+0x1d4>
jmp    12e9 <Str2Num+0x1d9>
jmp    12ee <Str2Num+0x1de>
jmp    12f3 <Str2Num+0x1e3>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Str2Num>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x3,%eax
je     113f <Str2Num+0x2f>
mov    %eax,%ecx
cmp    $0x5,%eax
je     1158 <Str2Num+0x48>
cmp    $0x4,%ecx
jne    118f <Str2Num+0x7f>
mov    (%rbx),%cl
cmp    $0x66,%cl
je     1174 <Str2Num+0x64>
xor    %eax,%eax
cmp    $0x7a,%cl
je     118f <Str2Num+0x7f>
mov    $0x9,%eax
pop    %rbx
ret
mov    (%rbx),%al
xor    %ecx,%ecx
cmp    $0x74,%al
setne  %cl
lea    0x2(,%rcx,4),%ecx
cmp    $0x6f,%al
mov    $0x1,%eax
jmp    118c <Str2Num+0x7c>
mov    (%rbx),%al
xor    %ecx,%ecx
cmp    $0x73,%al
sete   %cl
mov    $0x8,%edx
sub    %ecx,%edx
cmp    $0x74,%al
mov    $0x3,%eax
cmovne %edx,%eax
pop    %rbx
ret
mov    0x1(%rbx),%al
xor    %ecx,%ecx
cmp    $0x69,%al
setne  %cl
lea    0x5(,%rcx,4),%ecx
cmp    $0x6f,%al
mov    $0x4,%eax
cmovne %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @Str2Num(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 4
br i1 %9, label %10, label %17
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 122
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 0, i32* %2
br label %128
17: ; preds = %10, %1
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 111
br i1 %25, label %26, label %27
26: ; preds = %20
store i32 1, i32* %2
br label %128
27: ; preds = %20, %17
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 3
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 116
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 2, i32* %2
br label %128
37: ; preds = %30, %27
%38 = load i32, i32* %5
%39 = icmp eq i32 %38, 5
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = load i8*, i8** %3
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 116
br i1 %45, label %46, label %47
46: ; preds = %40
store i32 3, i32* %2
br label %128
47: ; preds = %40, %37
%48 = load i32, i32* %5
%49 = icmp eq i32 %48, 4
br i1 %49, label %50, label %63
50: ; preds = %47
%51 = load i8*, i8** %3
%52 = getelementptr inbounds i8, i8* %51, i64 0
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 102
br i1 %55, label %56, label %63
56: ; preds = %50
%57 = load i8*, i8** %3
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 111
br i1 %61, label %62, label %63
62: ; preds = %56
store i32 4, i32* %2
br label %128
63: ; preds = %56, %50, %47
%64 = load i32, i32* %5
%65 = icmp eq i32 %64, 4
br i1 %65, label %66, label %79
66: ; preds = %63
%67 = load i8*, i8** %3
%68 = getelementptr inbounds i8, i8* %67, i64 0
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 102
br i1 %71, label %72, label %79
72: ; preds = %66
%73 = load i8*, i8** %3
%74 = getelementptr inbounds i8, i8* %73, i64 1
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 105
br i1 %77, label %78, label %79
78: ; preds = %72
store i32 5, i32* %2
br label %128
79: ; preds = %72, %66, %63
%80 = load i32, i32* %5
%81 = icmp eq i32 %80, 3
br i1 %81, label %82, label %89
82: ; preds = %79
%83 = load i8*, i8** %3
%84 = getelementptr inbounds i8, i8* %83, i64 0
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp eq i32 %86, 115
br i1 %87, label %88, label %89
88: ; preds = %82
store i32 6, i32* %2
br label %128
89: ; preds = %82, %79
%90 = load i32, i32* %5
%91 = icmp eq i32 %90, 5
br i1 %91, label %92, label %99
92: ; preds = %89
%93 = load i8*, i8** %3
%94 = getelementptr inbounds i8, i8* %93, i64 0
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 115
br i1 %97, label %98, label %99
98: ; preds = %92
store i32 7, i32* %2
br label %128
99: ; preds = %92, %89
%100 = load i32, i32* %5
%101 = icmp eq i32 %100, 5
br i1 %101, label %102, label %109
102: ; preds = %99
%103 = load i8*, i8** %3
%104 = getelementptr inbounds i8, i8* %103, i64 0
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = icmp eq i32 %106, 101
br i1 %107, label %108, label %109
108: ; preds = %102
store i32 8, i32* %2
br label %128
109: ; preds = %102, %99
%110 = load i32, i32* %5
%111 = icmp eq i32 %110, 4
br i1 %111, label %112, label %119
112: ; preds = %109
%113 = load i8*, i8** %3
%114 = getelementptr inbounds i8, i8* %113, i64 0
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = icmp eq i32 %116, 110
br i1 %117, label %118, label %119
118: ; preds = %112
store i32 9, i32* %2
br label %128
119: ; preds = %112, %109
br label %120
120: ; preds = %119
br label %121
121: ; preds = %120
br label %122
122: ; preds = %121
br label %123
123: ; preds = %122
br label %124
124: ; preds = %123
br label %125
125: ; preds = %124
br label %126
126: ; preds = %125
br label %127
127: ; preds = %126
br label %128
128: ; preds = %16, %26, %36, %46, %62, %78, %88, %98, %108, %118, %127
%129 = load i32, i32* %2
ret i32 %129
}

LLVM IR (-O2):
define i32 @Str2Num(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
switch i32 %2, label %25 [
i32 4, label %3
i32 3, label %5
i32 5, label %11
]
3: ; preds = %1
%4 = load i8, i8* %0
switch i8 %4, label %24 [
i8 122, label %25
i8 102, label %17
]
5: ; preds = %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 116
%8 = select i1 %7, i32 2, i32 6
%9 = icmp eq i8 %6, 111
%10 = select i1 %9, i32 1, i32 %8
br label %25
11: ; preds = %1
%12 = load i8, i8* %0
%13 = icmp eq i8 %12, 115
%14 = select i1 %13, i32 7, i32 8
%15 = icmp eq i8 %12, 116
%16 = select i1 %15, i32 3, i32 %14
br label %25
17: ; preds = %3
%18 = getelementptr inbounds i8, i8* %0, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 105
%21 = select i1 %20, i32 5, i32 9
%22 = icmp eq i8 %19, 111
%23 = select i1 %22, i32 4, i32 %21
br label %25
24: ; preds = %3
br label %25
25: ; preds = %17, %3, %11, %5, %1, %24
%26 = phi i32 [ 0, %3 ], [ 9, %24 ], [ undef, %1 ], [ %10, %5 ], [ %16, %11 ], [ %23, %17 ]
ret i32 %26
}