#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void main() {
  char letter = '\0';
  char letter2;
  printf("Please input a letter:\n");
  scanf("%c", &letter);
  printf("The letter you input is %c\n", letter);
  switch (letter) {
  case 'M':
    printf("Monday\n");
    break;
  case 'W':
    printf("Wednesday\n");
    break;
  case 'F':
    printf("Friday\n");
    break;
  case 'S':
    printf("Please input second letter\n");
    scanf("%c", &letter2);
    printf("==========%c\n", letter2);
    if ('a' == letter2)
      printf("Saturday\n");
    else if ('u' == letter2)
      printf("Sunday\n");
    else
      printf("error input\n");
    break;
  case 'T':
    printf("Please input second letter\n");
    scanf("%c", &letter2);
    if ('u' == letter2)
      printf("Tuesday\n");
    else if ('h' == letter)
      printf("Thursday\n");
    else
      printf("error input\n");
    break;
  default:
    printf("error input\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movb   $0x0,-0x1(%rbp)
lea    0xf15(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1030 <printf@plt>
lea    0xf1c(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x11(%rbp),%al
movsbl -0x1(%rbp),%esi
lea    0xf08(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x1(%rbp),%eax
add    $0xffffffba,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x11,%eax
ja     12d1 <main+0x1b1>
mov    -0x10(%rbp),%rax
lea    0xe7f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12df <main+0x1bf>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12df <main+0x1bf>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12df <main+0x1bf>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
lea    -0x2(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x2(%rbp),%esi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x2(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jne    1217 <main+0xf7>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124e <main+0x12e>
movsbl -0x2(%rbp),%ecx
mov    $0x75,%eax
cmp    %ecx,%eax
jne    123b <main+0x11b>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1249 <main+0x129>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124e <main+0x12e>
jmp    12df <main+0x1bf>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf8(%rip),%rdi
lea    -0x2(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x2(%rbp),%ecx
mov    $0x75,%eax
cmp    %ecx,%eax
jne    1295 <main+0x175>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12cc <main+0x1ac>
movsbl -0x1(%rbp),%ecx
mov    $0x68,%eax
cmp    %ecx,%eax
jne    12b9 <main+0x199>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c7 <main+0x1a7>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12cc <main+0x1ac>
jmp    12df <main+0x1bf>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x7(%rsp)
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%esi
lea    0xeec(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x7(%rsp),%eax
add    $0xffffffba,%eax
cmp    $0x11,%eax
ja     1196 <main+0x66>
lea    0xf5f(%rip),%rdi
lea    0xe7f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf37(%rip),%rdi
jmp    1246 <main+0x116>
lea    0xf43(%rip),%rdi
jmp    1246 <main+0x116>
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe93(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x6(%rsp),%esi
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x6(%rsp),%al
cmp    $0x75,%al
lea    0xed9(%rip),%rcx
lea    0xefa(%rip),%rdx
cmove  %rcx,%rdx
cmp    $0x61,%al
lea    0xecc(%rip),%rdi
cmovne %rdx,%rdi
jmp    1246 <main+0x116>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3c(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1050 <scanf@plt>
cmpb   $0x75,0x6(%rsp)
jne    122f <main+0xff>
lea    0xe71(%rip),%rdi
jmp    1246 <main+0x116>
lea    0xea2(%rip),%rdi
jmp    1246 <main+0x116>
cmpb   $0x68,0x7(%rsp)
lea    0xe51(%rip),%rax
lea    0xe9e(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Please input a letter:\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [28 x i8] c"The letter you input is %c\0A\00"
@.str.3 = [8 x i8] c"Monday\0A\00"
@.str.4 = [11 x i8] c"Wednesday\0A\00"
@.str.5 = [8 x i8] c"Friday\0A\00"
@.str.6 = [28 x i8] c"Please input second letter\0A\00"
@.str.7 = [14 x i8] c"==========%c\0A\00"
@.str.8 = [10 x i8] c"Saturday\0A\00"
@.str.9 = [8 x i8] c"Sunday\0A\00"
@.str.10 = [13 x i8] c"error input\0A\00"
@.str.11 = [9 x i8] c"Tuesday\0A\00"
@.str.12 = [10 x i8] c"Thursday\0A\00"
define void @main() {
%1 = alloca i8
%2 = alloca i8
store i8 0, i8* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
switch i32 %9, label %55 [
i32 77, label %10
i32 87, label %12
i32 70, label %14
i32 83, label %16
i32 84, label %37
]
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %57
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %57
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %57
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %20)
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = icmp eq i32 97, %23
br i1 %24, label %25, label %27
25: ; preds = %16
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %36
27: ; preds = %16
%28 = load i8, i8* %2
%29 = sext i8 %28 to i32
%30 = icmp eq i32 117, %29
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %35
33: ; preds = %27
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
br label %35
35: ; preds = %33, %31
br label %36
36: ; preds = %35, %25
br label %57
37: ; preds = %0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%40 = load i8, i8* %2
%41 = sext i8 %40 to i32
%42 = icmp eq i32 117, %41
br i1 %42, label %43, label %45
43: ; preds = %37
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
br label %54
45: ; preds = %37
%46 = load i8, i8* %1
%47 = sext i8 %46 to i32
%48 = icmp eq i32 104, %47
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
br label %53
51: ; preds = %45
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
br label %54
54: ; preds = %53, %43
br label %57
55: ; preds = %0
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
br label %57
57: ; preds = %55, %54, %36, %14, %12, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [28 x i8] c"The letter you input is %c\0A\00"
@.str.7 = [14 x i8] c"==========%c\0A\00"
@str = [23 x i8] c"Please input a letter:\00"
@str.15 = [9 x i8] c"Thursday\00"
@str.16 = [8 x i8] c"Tuesday\00"
@str.17 = [27 x i8] c"Please input second letter\00"
@str.19 = [7 x i8] c"Sunday\00"
@str.20 = [9 x i8] c"Saturday\00"
@str.21 = [7 x i8] c"Friday\00"
@str.22 = [10 x i8] c"Wednesday\00"
@str.23 = [7 x i8] c"Monday\00"
@str.24 = [12 x i8] c"error input\00"
define void @main() {
%1 = alloca i8
%2 = alloca i8
store i8 0, i8* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
switch i32 %9, label %32 [
i32 77, label %33
i32 87, label %10
i32 70, label %11
i32 83, label %12
i32 84, label %23
]
10: ; preds = %0
br label %33
11: ; preds = %0
br label %33
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.17, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %16)
%18 = load i8, i8* %2
%19 = icmp eq i8 %18, 117
%20 = select i1 %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.19, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.24, i64 0, i64 0)
%21 = icmp eq i8 %18, 97
%22 = select i1 %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.20, i64 0, i64 0), i8* %20
br label %33
23: ; preds = %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.17, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%26 = load i8, i8* %2
%27 = icmp eq i8 %26, 117
br i1 %27, label %33, label %28
28: ; preds = %23
%29 = load i8, i8* %1
%30 = icmp eq i8 %29, 104
%31 = select i1 %30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.15, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.24, i64 0, i64 0)
br label %33
32: ; preds = %0
br label %33
33: ; preds = %28, %23, %12, %0, %32, %11, %10
%34 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.24, i64 0, i64 0), %32 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.21, i64 0, i64 0), %11 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.22, i64 0, i64 0), %10 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.23, i64 0, i64 0), %0 ], [ %22, %12 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.16, i64 0, i64 0), %23 ], [ %31, %28 ]
%35 = call i32 @puts(i8* dereferenceable(1) %34)
ret void
}