#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*/ strcasecmp(char *, char *);
int get_wday(char *wday) {
  if (!strcasecmp(wday, "Mon") || !strcasecmp(wday, "Monday"))
    return 1;
  else if (!strcasecmp(wday, "Tue") || !strcasecmp(wday, "Tuesday"))
    return 2;
  else if (!strcasecmp(wday, "Wed") || !strcasecmp(wday, "Wednesday"))
    return 3;
  else if (!strcasecmp(wday, "Thu") || !strcasecmp(wday, "Thursday"))
    return 4;
  else if (!strcasecmp(wday, "Fri") || !strcasecmp(wday, "Friday"))
    return 5;
  else if (!strcasecmp(wday, "Sat") || !strcasecmp(wday, "Saturday"))
    return 6;
  else if (!strcasecmp(wday, "Sun") || !strcasecmp(wday, "Sunday"))
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<get_wday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     114e <get_wday+0x3e>
mov    -0x10(%rbp),%rdi
lea    0xec4(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    115a <get_wday+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    12d5 <get_wday+0x1c5>
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     118c <get_wday+0x7c>
mov    -0x10(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1198 <get_wday+0x88>
movl   $0x2,-0x4(%rbp)
jmp    12d5 <get_wday+0x1c5>
mov    -0x10(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     11ca <get_wday+0xba>
mov    -0x10(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11d6 <get_wday+0xc6>
movl   $0x3,-0x4(%rbp)
jmp    12d5 <get_wday+0x1c5>
mov    -0x10(%rbp),%rdi
lea    0xe44(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1208 <get_wday+0xf8>
mov    -0x10(%rbp),%rdi
lea    0xe2f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1214 <get_wday+0x104>
movl   $0x4,-0x4(%rbp)
jmp    12d5 <get_wday+0x1c5>
mov    -0x10(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1246 <get_wday+0x136>
mov    -0x10(%rbp),%rdi
lea    0xdfe(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1252 <get_wday+0x142>
movl   $0x5,-0x4(%rbp)
jmp    12d5 <get_wday+0x1c5>
mov    -0x10(%rbp),%rdi
lea    0xde0(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1284 <get_wday+0x174>
mov    -0x10(%rbp),%rdi
lea    0xdcb(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1290 <get_wday+0x180>
movl   $0x6,-0x4(%rbp)
jmp    12d5 <get_wday+0x1c5>
mov    -0x10(%rbp),%rdi
lea    0xdaf(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     12c2 <get_wday+0x1b2>
mov    -0x10(%rbp),%rdi
lea    0xd9a(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    12ce <get_wday+0x1be>
movl   $0x0,-0x4(%rbp)
jmp    12d5 <get_wday+0x1c5>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_wday>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xece(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x2,%ebp
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe97(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x3,%ebp
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe72(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x4,%ebp
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe5a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x5,%ebp
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe2c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x6,%ebp
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe18(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125f <get_wday+0x14f>
lea    0xe0e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125d <get_wday+0x14d>
lea    0xdff(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
neg    %eax
sbb    %ebp,%ebp
jmp    125f <get_wday+0x14f>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"Mon\00"
@.str.1 = [7 x i8] c"Monday\00"
@.str.2 = [4 x i8] c"Tue\00"
@.str.3 = [8 x i8] c"Tuesday\00"
@.str.4 = [4 x i8] c"Wed\00"
@.str.5 = [10 x i8] c"Wednesday\00"
@.str.6 = [4 x i8] c"Thu\00"
@.str.7 = [9 x i8] c"Thursday\00"
@.str.8 = [4 x i8] c"Fri\00"
@.str.9 = [7 x i8] c"Friday\00"
@.str.10 = [4 x i8] c"Sat\00"
@.str.11 = [9 x i8] c"Saturday\00"
@.str.12 = [4 x i8] c"Sun\00"
@.str.13 = [7 x i8] c"Sunday\00"
define i32 @get_wday(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strcasecmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strcasecmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7, %1
store i32 1, i32* %2
br label %67
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = call i32 @strcasecmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call i32 @strcasecmp(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16, %12
store i32 2, i32* %2
br label %67
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = call i32 @strcasecmp(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = call i32 @strcasecmp(i8* %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %25, %21
store i32 3, i32* %2
br label %67
30: ; preds = %25
%31 = load i8*, i8** %3
%32 = call i32 @strcasecmp(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i8*, i8** %3
%36 = call i32 @strcasecmp(i8* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%37 = icmp ne i32 %36, 0
br i1 %37, label %39, label %38
38: ; preds = %34, %30
store i32 4, i32* %2
br label %67
39: ; preds = %34
%40 = load i8*, i8** %3
%41 = call i32 @strcasecmp(i8* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i8*, i8** %3
%45 = call i32 @strcasecmp(i8* %44, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%46 = icmp ne i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %43, %39
store i32 5, i32* %2
br label %67
48: ; preds = %43
%49 = load i8*, i8** %3
%50 = call i32 @strcasecmp(i8* %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %56
52: ; preds = %48
%53 = load i8*, i8** %3
%54 = call i32 @strcasecmp(i8* %53, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%55 = icmp ne i32 %54, 0
br i1 %55, label %57, label %56
56: ; preds = %52, %48
store i32 6, i32* %2
br label %67
57: ; preds = %52
%58 = load i8*, i8** %3
%59 = call i32 @strcasecmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %65
61: ; preds = %57
%62 = load i8*, i8** %3
%63 = call i32 @strcasecmp(i8* %62, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%64 = icmp ne i32 %63, 0
br i1 %64, label %66, label %65
65: ; preds = %61, %57
store i32 0, i32* %2
br label %67
66: ; preds = %61
store i32 -1, 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 = [4 x i8] c"Mon\00"
@.str.1 = [7 x i8] c"Monday\00"
@.str.2 = [4 x i8] c"Tue\00"
@.str.3 = [8 x i8] c"Tuesday\00"
@.str.4 = [4 x i8] c"Wed\00"
@.str.5 = [10 x i8] c"Wednesday\00"
@.str.6 = [4 x i8] c"Thu\00"
@.str.7 = [9 x i8] c"Thursday\00"
@.str.8 = [4 x i8] c"Fri\00"
@.str.9 = [7 x i8] c"Friday\00"
@.str.10 = [4 x i8] c"Sat\00"
@.str.11 = [9 x i8] c"Saturday\00"
@.str.12 = [4 x i8] c"Sun\00"
@.str.13 = [7 x i8] c"Sunday\00"
define i32 @get_wday(i8* nocapture %0) {
%2 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %44, label %4
4: ; preds = %1
%5 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %44, label %7
7: ; preds = %4
%8 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %44, label %10
10: ; preds = %7
%11 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %44, label %13
13: ; preds = %10
%14 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %44, label %16
16: ; preds = %13
%17 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %44, label %19
19: ; preds = %16
%20 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %44, label %22
22: ; preds = %19
%23 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %44, label %25
25: ; preds = %22
%26 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %44, label %28
28: ; preds = %25
%29 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %44, label %31
31: ; preds = %28
%32 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %44, label %34
34: ; preds = %31
%35 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %44, label %37
37: ; preds = %34
%38 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %37
%41 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%42 = icmp ne i32 %41, 0
%43 = sext i1 %42 to i32
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 ], [ 0, %37 ], [ %43, %40 ]
ret i32 %45
}