#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*/ strcpy(char *, char *);
char *strstr(char *, char *);
int Get_Fraction(char *val) {
  int frac = 0;
  char *t;
  if ((t = strstr(val, "1/2")))
    frac = 2;
  else if ((t = strstr(val, "3/4")))
    frac = 3;
  else if ((t = strstr(val, "1/4")))
    frac = 1;
  else if ((t = strstr(val, "2/4")))
    frac = 2;
  if (t)
    strcpy(t, "   ");
  if (strstr(val, "half"))
    frac = 2;
  if (strstr(val, "one"))
    frac += 4;
  if (strstr(val, "two"))
    frac += 8;
  if (strstr(val, "three"))
    frac += 12;
  if (strstr(val, "four"))
    frac += 16;
  if (strstr(val, "five"))
    frac += 20;
  return (frac);
}


x86 assembly (clang, -O0):
<Get_Fraction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     115d <Get_Fraction+0x3d>
movl   $0x2,-0xc(%rbp)
jmp    11e5 <Get_Fraction+0xc5>
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1187 <Get_Fraction+0x67>
movl   $0x3,-0xc(%rbp)
jmp    11e0 <Get_Fraction+0xc0>
mov    -0x8(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11b1 <Get_Fraction+0x91>
movl   $0x1,-0xc(%rbp)
jmp    11db <Get_Fraction+0xbb>
mov    -0x8(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11d6 <Get_Fraction+0xb6>
movl   $0x2,-0xc(%rbp)
jmp    11db <Get_Fraction+0xbb>
jmp    11e0 <Get_Fraction+0xc0>
jmp    11e5 <Get_Fraction+0xc5>
cmpq   $0x0,-0x18(%rbp)
je     1200 <Get_Fraction+0xe0>
mov    -0x18(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xe09(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1221 <Get_Fraction+0x101>
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xded(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1244 <Get_Fraction+0x124>
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xdce(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1267 <Get_Fraction+0x147>
mov    -0xc(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xdaf(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     128a <Get_Fraction+0x16a>
mov    -0xc(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xd92(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     12ad <Get_Fraction+0x18d>
mov    -0xc(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xd74(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     12d0 <Get_Fraction+0x1b0>
mov    -0xc(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_Fraction>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xecf(%rip),%rsi
call   1040 <strstr@plt>
mov    $0x2,%r14d
test   %rax,%rax
jne    1191 <Get_Fraction+0x71>
lea    0xebc(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     115d <Get_Fraction+0x3d>
mov    $0x3,%r14d
jmp    1191 <Get_Fraction+0x71>
lea    0xea4(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     1179 <Get_Fraction+0x59>
mov    $0x1,%r14d
jmp    1191 <Get_Fraction+0x71>
lea    0xe8c(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     1240 <Get_Fraction+0x120>
lea    0xe78(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
lea    0xe6d(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
mov    $0x2,%ebp
cmove  %r14d,%ebp
lea    0xe57(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
lea    0x4(%rbp),%ebx
test   %rax,%rax
cmove  %ebp,%ebx
lea    0xe43(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
lea    0x8(%rbx),%ebp
test   %rax,%rax
cmove  %ebx,%ebp
lea    0xe2f(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
lea    0xc(%rbp),%ebx
test   %rax,%rax
cmove  %ebp,%ebx
lea    0xe1d(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
lea    0x10(%rbx),%ebp
test   %rax,%rax
cmove  %ebx,%ebp
lea    0xe0a(%rip),%rsi
mov    %r15,%rdi
call   1040 <strstr@plt>
lea    0x14(%rbp),%ecx
test   %rax,%rax
cmove  %ebp,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
jmp    11a0 <Get_Fraction+0x80>

LLVM IR (-O0):
@.str = [4 x i8] c"1/2\00"
@.str.1 = [4 x i8] c"3/4\00"
@.str.2 = [4 x i8] c"1/4\00"
@.str.3 = [4 x i8] c"2/4\00"
@.str.4 = [4 x i8] c" \00"
@.str.5 = [5 x i8] c"half\00"
@.str.6 = [4 x i8] c"one\00"
@.str.7 = [4 x i8] c"two\00"
@.str.8 = [6 x i8] c"three\00"
@.str.9 = [5 x i8] c"four\00"
@.str.10 = [5 x i8] c"five\00"
define i32 @Get_Fraction(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
%6 = call i8* @strstr(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 2, i32* %3
br label %27
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i8* @strstr(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8* %11, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 3, i32* %3
br label %26
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = call i8* @strstr(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i8* %16, i8** %4
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 1, i32* %3
br label %25
19: ; preds = %14
%20 = load i8*, i8** %2
%21 = call i8* @strstr(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i8* %21, i8** %4
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 2, i32* %3
br label %24
24: ; preds = %23, %19
br label %25
25: ; preds = %24, %18
br label %26
26: ; preds = %25, %13
br label %27
27: ; preds = %26, %8
%28 = load i8*, i8** %4
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i8*, i8** %4
%32 = call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %30, %27
%34 = load i8*, i8** %2
%35 = call i8* @strstr(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 2, i32* %3
br label %38
38: ; preds = %37, %33
%39 = load i8*, i8** %2
%40 = call i8* @strstr(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 4
store i32 %44, i32* %3
br label %45
45: ; preds = %42, %38
%46 = load i8*, i8** %2
%47 = call i8* @strstr(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 8
store i32 %51, i32* %3
br label %52
52: ; preds = %49, %45
%53 = load i8*, i8** %2
%54 = call i8* @strstr(i8* %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%55 = icmp ne i8* %54, null
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 12
store i32 %58, i32* %3
br label %59
59: ; preds = %56, %52
%60 = load i8*, i8** %2
%61 = call i8* @strstr(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%62 = icmp ne i8* %61, null
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 16
store i32 %65, i32* %3
br label %66
66: ; preds = %63, %59
%67 = load i8*, i8** %2
%68 = call i8* @strstr(i8* %67, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%69 = icmp ne i8* %68, null
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = load i32, i32* %3
%72 = add nsw i32 %71, 20
store i32 %72, i32* %3
br label %73
73: ; preds = %70, %66
%74 = load i32, i32* %3
ret i32 %74
}

LLVM IR (-O2):
@.str = [4 x i8] c"1/2\00"
@.str.1 = [4 x i8] c"3/4\00"
@.str.2 = [4 x i8] c"1/4\00"
@.str.3 = [4 x i8] c"2/4\00"
@.str.4 = [4 x i8] c" \00"
@.str.5 = [5 x i8] c"half\00"
@.str.6 = [4 x i8] c"one\00"
@.str.7 = [4 x i8] c"two\00"
@.str.8 = [6 x i8] c"three\00"
@.str.9 = [5 x i8] c"four\00"
@.str.10 = [5 x i8] c"five\00"
define i32 @Get_Fraction(i8* %0) {
%2 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %17, label %13
13: ; preds = %7, %4, %1, %10
%14 = phi i8* [ %11, %10 ], [ %8, %7 ], [ %5, %4 ], [ %2, %1 ]
%15 = phi i32 [ 2, %10 ], [ 1, %7 ], [ 3, %4 ], [ 2, %1 ]
%16 = tail call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %13, %10
%18 = phi i32 [ %15, %13 ], [ 0, %10 ]
%19 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%20 = icmp eq i8* %19, null
%21 = select i1 %20, i32 %18, i32 2
%22 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%23 = icmp eq i8* %22, null
%24 = add nuw nsw i32 %21, 4
%25 = select i1 %23, i32 %21, i32 %24
%26 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%27 = icmp eq i8* %26, null
%28 = add nuw nsw i32 %25, 8
%29 = select i1 %27, i32 %25, i32 %28
%30 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%31 = icmp eq i8* %30, null
%32 = add nuw nsw i32 %29, 12
%33 = select i1 %31, i32 %29, i32 %32
%34 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%35 = icmp eq i8* %34, null
%36 = add nuw nsw i32 %33, 16
%37 = select i1 %35, i32 %33, i32 %36
%38 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%39 = icmp eq i8* %38, null
%40 = add nuw nsw i32 %37, 20
%41 = select i1 %39, i32 %37, i32 %40
ret i32 %41
}