#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 */
scalar_t__ oldgaa_regex_matches_string(char *, char *);
int day_to_val(char *str) {
  if (oldgaa_regex_matches_string(str, "Su") ||
      oldgaa_regex_matches_string(str, "su"))
    return 1;
  if (oldgaa_regex_matches_string(str, "Mo") ||
      oldgaa_regex_matches_string(str, "mo"))
    return 2;
  if (oldgaa_regex_matches_string(str, "Tu") ||
      oldgaa_regex_matches_string(str, "tu"))
    return 3;
  if (oldgaa_regex_matches_string(str, "We") ||
      oldgaa_regex_matches_string(str, "we"))
    return 4;
  if (oldgaa_regex_matches_string(str, "Th") ||
      oldgaa_regex_matches_string(str, "th"))
    return 5;
  if (oldgaa_regex_matches_string(str, "Fr") ||
      oldgaa_regex_matches_string(str, "fr"))
    return 6;
  if (oldgaa_regex_matches_string(str, "Sa") ||
      oldgaa_regex_matches_string(str, "sa"))
    return 7;
  return 0;
}


x86 assembly (clang, -O0):
<day_to_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
jne    1150 <day_to_val+0x40>
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
je     115c <day_to_val+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    12e3 <day_to_val+0x1d3>
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
jne    1190 <day_to_val+0x80>
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
je     119c <day_to_val+0x8c>
movl   $0x2,-0x4(%rbp)
jmp    12e3 <day_to_val+0x1d3>
mov    -0x10(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
jne    11d0 <day_to_val+0xc0>
mov    -0x10(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
je     11dc <day_to_val+0xcc>
movl   $0x3,-0x4(%rbp)
jmp    12e3 <day_to_val+0x1d3>
mov    -0x10(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
jne    1210 <day_to_val+0x100>
mov    -0x10(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
je     121c <day_to_val+0x10c>
movl   $0x4,-0x4(%rbp)
jmp    12e3 <day_to_val+0x1d3>
mov    -0x10(%rbp),%rdi
lea    0xdf1(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
jne    1250 <day_to_val+0x140>
mov    -0x10(%rbp),%rdi
lea    0xdda(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
je     125c <day_to_val+0x14c>
movl   $0x5,-0x4(%rbp)
jmp    12e3 <day_to_val+0x1d3>
mov    -0x10(%rbp),%rdi
lea    0xdb7(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
jne    1290 <day_to_val+0x180>
mov    -0x10(%rbp),%rdi
lea    0xda0(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
je     129c <day_to_val+0x18c>
movl   $0x6,-0x4(%rbp)
jmp    12e3 <day_to_val+0x1d3>
mov    -0x10(%rbp),%rdi
lea    0xd7d(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
jne    12d0 <day_to_val+0x1c0>
mov    -0x10(%rbp),%rdi
lea    0xd66(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
cmp    $0x0,%rax
je     12dc <day_to_val+0x1cc>
movl   $0x7,-0x4(%rbp)
jmp    12e3 <day_to_val+0x1d3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<day_to_val>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%rsi
call   1030 <oldgaa_regex_matches_string@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
mov    $0x2,%ebp
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
mov    $0x3,%ebp
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xe6e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
mov    $0x4,%ebp
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xe3f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xe2a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
mov    $0x5,%ebp
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xe14(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xe03(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
mov    $0x6,%ebp
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xded(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xddc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
mov    $0x7,%ebp
test   %rax,%rax
jne    1276 <day_to_val+0x166>
lea    0xdc6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <oldgaa_regex_matches_string@plt>
xor    %ecx,%ecx
test   %rax,%rax
mov    $0x7,%ebp
cmove  %ecx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"Su\00"
@.str.1 = [3 x i8] c"su\00"
@.str.2 = [3 x i8] c"Mo\00"
@.str.3 = [3 x i8] c"mo\00"
@.str.4 = [3 x i8] c"Tu\00"
@.str.5 = [3 x i8] c"tu\00"
@.str.6 = [3 x i8] c"We\00"
@.str.7 = [3 x i8] c"we\00"
@.str.8 = [3 x i8] c"Th\00"
@.str.9 = [3 x i8] c"th\00"
@.str.10 = [3 x i8] c"Fr\00"
@.str.11 = [3 x i8] c"fr\00"
@.str.12 = [3 x i8] c"Sa\00"
@.str.13 = [3 x i8] c"sa\00"
define i32 @day_to_val(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @oldgaa_regex_matches_string(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i64 @oldgaa_regex_matches_string(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i32 1, i32* %2
br label %67
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = call i64 @oldgaa_regex_matches_string(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call i64 @oldgaa_regex_matches_string(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16, %12
store i32 2, i32* %2
br label %67
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = call i64 @oldgaa_regex_matches_string(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = call i64 @oldgaa_regex_matches_string(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25, %21
store i32 3, i32* %2
br label %67
30: ; preds = %25
%31 = load i8*, i8** %3
%32 = call i64 @oldgaa_regex_matches_string(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i8*, i8** %3
%36 = call i64 @oldgaa_regex_matches_string(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %34, %30
store i32 4, i32* %2
br label %67
39: ; preds = %34
%40 = load i8*, i8** %3
%41 = call i64 @oldgaa_regex_matches_string(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%42 = icmp ne i64 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %39
%44 = load i8*, i8** %3
%45 = call i64 @oldgaa_regex_matches_string(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %43, %39
store i32 5, i32* %2
br label %67
48: ; preds = %43
%49 = load i8*, i8** %3
%50 = call i64 @oldgaa_regex_matches_string(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%51 = icmp ne i64 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %48
%53 = load i8*, i8** %3
%54 = call i64 @oldgaa_regex_matches_string(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %52, %48
store i32 6, i32* %2
br label %67
57: ; preds = %52
%58 = load i8*, i8** %3
%59 = call i64 @oldgaa_regex_matches_string(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%60 = icmp ne i64 %59, 0
br i1 %60, label %65, label %61
61: ; preds = %57
%62 = load i8*, i8** %3
%63 = call i64 @oldgaa_regex_matches_string(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %61, %57
store i32 7, i32* %2
br label %67
66: ; preds = %61
store i32 0, i32* %2
br label %67
67: ; preds = %66, %65, %56, %47, %38, %29, %20, %11
%68 = load i32, i32* %2
ret i32 %68
}

LLVM IR (-O2):
@.str = [3 x i8] c"Su\00"
@.str.1 = [3 x i8] c"su\00"
@.str.2 = [3 x i8] c"Mo\00"
@.str.3 = [3 x i8] c"mo\00"
@.str.4 = [3 x i8] c"Tu\00"
@.str.5 = [3 x i8] c"tu\00"
@.str.6 = [3 x i8] c"We\00"
@.str.7 = [3 x i8] c"we\00"
@.str.8 = [3 x i8] c"Th\00"
@.str.9 = [3 x i8] c"th\00"
@.str.10 = [3 x i8] c"Fr\00"
@.str.11 = [3 x i8] c"fr\00"
@.str.12 = [3 x i8] c"Sa\00"
@.str.13 = [3 x i8] c"sa\00"
define i32 @day_to_val(i8* %0) {
%2 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %44
4: ; preds = %1
%5 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %44
7: ; preds = %4
%8 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %44
10: ; preds = %7
%11 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %44
13: ; preds = %10
%14 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %44
16: ; preds = %13
%17 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %44
19: ; preds = %16
%20 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %44
22: ; preds = %19
%23 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %44
25: ; preds = %22
%26 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %44
28: ; preds = %25
%29 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %44
31: ; preds = %28
%32 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %44
34: ; preds = %31
%35 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %34
%38 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = tail call i64 @oldgaa_regex_matches_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
%43 = select i1 %42, i32 0, i32 7
br label %44
44: ; preds = %40, %37, %31, %34, %25, %28, %19, %22, %13, %16, %7, %10, %1, %4
%45 = phi i32 [ 1, %4 ], [ 1, %1 ], [ 2, %10 ], [ 2, %7 ], [ 3, %16 ], [ 3, %13 ], [ 4, %22 ], [ 4, %19 ], [ 5, %28 ], [ 5, %25 ], [ 6, %34 ], [ 6, %31 ], [ 7, %37 ], [ %43, %40 ]
ret i32 %45
}