#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*/ strcmp(char *, char *);
int Clock_ScanWeekday(char *ptr) {
  switch (*ptr) {
  case 'S':
    if ((strcmp(ptr, "SUN") == 0) || (strcmp(ptr, "SUNDAY") == 0))
      return 0;
    else if ((strcmp(ptr, "SAT") == 0) || (strcmp(ptr, "SATURDAY") == 0))
      return 6;
    return -1;
  case 'M':
    if ((strcmp(ptr, "MON") == 0) || (strcmp(ptr, "MONDAY") == 0))
      return 1;
    return -1;
  case 'T':
    if ((strcmp(ptr, "TUE") == 0) || (strcmp(ptr, "TUESDAY") == 0))
      return 2;
    else if ((strcmp(ptr, "THU") == 0) || (strcmp(ptr, "THURSDAY") == 0))
      return 4;
    return -1;
  case 'W':
    if ((strcmp(ptr, "WED") == 0) || (strcmp(ptr, "WEDNESDAY") == 0))
      return 3;
    return -1;
  case 'F':
    if ((strcmp(ptr, "FRI") == 0) || (strcmp(ptr, "FRIDAY") == 0))
      return 5;
    return -1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<Clock_ScanWeekday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffba,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x11,%eax
ja     1341 <Clock_ScanWeekday+0x231>
mov    -0x18(%rbp),%rax
lea    0xec0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xef4(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     117b <Clock_ScanWeekday+0x6b>
mov    -0x10(%rbp),%rdi
lea    0xedf(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1187 <Clock_ScanWeekday+0x77>
movl   $0x0,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     11b9 <Clock_ScanWeekday+0xa9>
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c5 <Clock_ScanWeekday+0xb5>
movl   $0x6,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
jmp    11ca <Clock_ScanWeekday+0xba>
movl   $0xffffffff,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
mov    -0x10(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1208 <Clock_ScanWeekday+0xf8>
mov    -0x10(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1214 <Clock_ScanWeekday+0x104>
movl   $0x1,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
movl   $0xffffffff,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
mov    -0x10(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1252 <Clock_ScanWeekday+0x142>
mov    -0x10(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    125e <Clock_ScanWeekday+0x14e>
movl   $0x2,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
mov    -0x10(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1290 <Clock_ScanWeekday+0x180>
mov    -0x10(%rbp),%rdi
lea    0xdf9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    129c <Clock_ScanWeekday+0x18c>
movl   $0x4,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
jmp    12a1 <Clock_ScanWeekday+0x191>
movl   $0xffffffff,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
mov    -0x10(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     12df <Clock_ScanWeekday+0x1cf>
mov    -0x10(%rbp),%rdi
lea    0xdb7(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12eb <Clock_ScanWeekday+0x1db>
movl   $0x3,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
movl   $0xffffffff,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
mov    -0x10(%rbp),%rdi
lea    0xd90(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1329 <Clock_ScanWeekday+0x219>
mov    -0x10(%rbp),%rdi
lea    0xd7b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1335 <Clock_ScanWeekday+0x225>
movl   $0x5,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
movl   $0xffffffff,-0x4(%rbp)
jmp    1348 <Clock_ScanWeekday+0x238>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Clock_ScanWeekday>:
push   %rbp
push   %rbx
push   %rax
movsbl (%rdi),%eax
mov    $0xffffffff,%ebp
add    $0xffffffba,%eax
cmp    $0x11,%eax
ja     12a6 <Clock_ScanWeekday+0x196>
mov    %rdi,%rbx
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf51(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1285 <Clock_ScanWeekday+0x175>
lea    0xf3e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x5,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
lea    0xeed(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     128c <Clock_ScanWeekday+0x17c>
lea    0xeda(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x1,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     12a6 <Clock_ScanWeekday+0x196>
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     12a6 <Clock_ScanWeekday+0x196>
lea    0xe7e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     129a <Clock_ScanWeekday+0x18a>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x6,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x2,%ebp
test   %eax,%eax
je     12a6 <Clock_ScanWeekday+0x196>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     12a6 <Clock_ScanWeekday+0x196>
lea    0xe41(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     12a1 <Clock_ScanWeekday+0x191>
lea    0xe32(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x4,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
lea    0xe23(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1293 <Clock_ScanWeekday+0x183>
lea    0xe14(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
neg    %eax
sbb    %ebp,%ebp
or     $0x3,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
mov    $0x5,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
mov    $0x1,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
mov    $0x3,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
mov    $0x6,%ebp
jmp    12a6 <Clock_ScanWeekday+0x196>
mov    $0x4,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"SUN\00"
@.str.1 = [7 x i8] c"SUNDAY\00"
@.str.2 = [4 x i8] c"SAT\00"
@.str.3 = [9 x i8] c"SATURDAY\00"
@.str.4 = [4 x i8] c"MON\00"
@.str.5 = [7 x i8] c"MONDAY\00"
@.str.6 = [4 x i8] c"TUE\00"
@.str.7 = [8 x i8] c"TUESDAY\00"
@.str.8 = [4 x i8] c"THU\00"
@.str.9 = [9 x i8] c"THURSDAY\00"
@.str.10 = [4 x i8] c"WED\00"
@.str.11 = [10 x i8] c"WEDNESDAY\00"
@.str.12 = [4 x i8] c"FRI\00"
@.str.13 = [7 x i8] c"FRIDAY\00"
define i32 @Clock_ScanWeekday(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %77 [
i32 83, label %7
i32 77, label %27
i32 84, label %37
i32 87, label %57
i32 70, label %67
]
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11, %7
store i32 0, i32* %2
br label %78
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20, %16
store i32 6, i32* %2
br label %78
25: ; preds = %20
br label %26
26: ; preds = %25
store i32 -1, i32* %2
br label %78
27: ; preds = %1
%28 = load i8*, i8** %3
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load i8*, i8** %3
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31, %27
store i32 1, i32* %2
br label %78
36: ; preds = %31
store i32 -1, i32* %2
br label %78
37: ; preds = %1
%38 = load i8*, i8** %3
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i32 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %37
%42 = load i8*, i8** %3
%43 = call i32 @strcmp(i8* %42, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %41, %37
store i32 2, i32* %2
br label %78
46: ; preds = %41
%47 = load i8*, i8** %3
%48 = call i32 @strcmp(i8* %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%49 = icmp eq i32 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %46
%51 = load i8*, i8** %3
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %50, %46
store i32 4, i32* %2
br label %78
55: ; preds = %50
br label %56
56: ; preds = %55
store i32 -1, i32* %2
br label %78
57: ; preds = %1
%58 = load i8*, i8** %3
%59 = call i32 @strcmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%60 = icmp eq i32 %59, 0
br i1 %60, label %65, label %61
61: ; preds = %57
%62 = load i8*, i8** %3
%63 = call i32 @strcmp(i8* %62, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %61, %57
store i32 3, i32* %2
br label %78
66: ; preds = %61
store i32 -1, i32* %2
br label %78
67: ; preds = %1
%68 = load i8*, i8** %3
%69 = call i32 @strcmp(i8* %68, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%70 = icmp eq i32 %69, 0
br i1 %70, label %75, label %71
71: ; preds = %67
%72 = load i8*, i8** %3
%73 = call i32 @strcmp(i8* %72, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %76
75: ; preds = %71, %67
store i32 5, i32* %2
br label %78
76: ; preds = %71
store i32 -1, i32* %2
br label %78
77: ; preds = %1
store i32 -1, i32* %2
br label %78
78: ; preds = %77, %76, %75, %66, %65, %56, %54, %45, %36, %35, %26, %24, %15
%79 = load i32, i32* %2
ret i32 %79
}

LLVM IR (-O2):
@.str = [4 x i8] c"SUN\00"
@.str.1 = [7 x i8] c"SUNDAY\00"
@.str.2 = [4 x i8] c"SAT\00"
@.str.3 = [9 x i8] c"SATURDAY\00"
@.str.4 = [4 x i8] c"MON\00"
@.str.5 = [7 x i8] c"MONDAY\00"
@.str.6 = [4 x i8] c"TUE\00"
@.str.7 = [8 x i8] c"TUESDAY\00"
@.str.8 = [4 x i8] c"THU\00"
@.str.9 = [9 x i8] c"THURSDAY\00"
@.str.10 = [4 x i8] c"WED\00"
@.str.11 = [10 x i8] c"WEDNESDAY\00"
@.str.12 = [4 x i8] c"FRI\00"
@.str.13 = [7 x i8] c"FRIDAY\00"
define i32 @Clock_ScanWeekday(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %51 [
i32 83, label %4
i32 77, label %17
i32 84, label %24
i32 87, label %37
i32 70, label %44
]
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %51, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %51, label %10
10: ; preds = %7
%11 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %51, label %13
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i32 6, i32 -1
br label %51
17: ; preds = %1
%18 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %51, label %20
20: ; preds = %17
%21 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i32 1, i32 -1
br label %51
24: ; preds = %1
%25 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %51, label %27
27: ; preds = %24
%28 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%29 = icmp eq i32 %28, 0
br i1 %29, label %51, label %30
30: ; preds = %27
%31 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
br i1 %32, label %51, label %33
33: ; preds = %30
%34 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
%36 = select i1 %35, i32 4, i32 -1
br label %51
37: ; preds = %1
%38 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %51, label %40
40: ; preds = %37
%41 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%42 = icmp eq i32 %41, 0
%43 = select i1 %42, i32 3, i32 -1
br label %51
44: ; preds = %1
%45 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%46 = icmp eq i32 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %44
%48 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%49 = icmp eq i32 %48, 0
%50 = select i1 %49, i32 5, i32 -1
br label %51
51: ; preds = %47, %40, %33, %20, %13, %1, %44, %37, %30, %24, %27, %17, %10, %4, %7
%52 = phi i32 [ 0, %7 ], [ 0, %4 ], [ 6, %10 ], [ 1, %17 ], [ 2, %27 ], [ 2, %24 ], [ 4, %30 ], [ 3, %37 ], [ 5, %44 ], [ -1, %1 ], [ %16, %13 ], [ %23, %20 ], [ %36, %33 ], [ %43, %40 ], [ %50, %47 ]
ret i32 %52
}