#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char ch;
  scanf("%c", &ch);
  getchar();
  switch (ch) {
  case 'M':
  case 'm':
    printf("Monday\n");
    break;
  case 'T':
  case 't':
    printf("input the second char\n");
    scanf("%c", &ch);
    if (ch == 'u')
      printf("Tuesday\n");
    else
      printf("Thurday\n");
    break;
  case 'W':
  case 'w':
    printf("Wendnesday\n");
    break;
    break;
  case 'F':
  case 'f':
    printf("Friday\n");
    break;
  case 'S':
  case 's':
    printf("input the second char\n");
    scanf("%c", &ch);
    if (ch == 'a')
      printf("Saturday\n");
    else
      printf("Sunday\n");
    break;
  default:
    printf("error!");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf82(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffba,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x31,%eax
ja     1249 <main+0x119>
mov    -0x10(%rbp),%rax
lea    0xe89(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf44(%rip),%rdi
call   1030 <printf@plt>
jmp    1255 <main+0x125>
lea    0xf3b(%rip),%rdi
call   1030 <printf@plt>
lea    0xf24(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x75,%eax
jne    11cb <main+0x9b>
lea    0xf29(%rip),%rdi
call   1030 <printf@plt>
jmp    11d7 <main+0xa7>
lea    0xf21(%rip),%rdi
call   1030 <printf@plt>
jmp    1255 <main+0x125>
lea    0xf19(%rip),%rdi
call   1030 <printf@plt>
jmp    1255 <main+0x125>
lea    0xf14(%rip),%rdi
call   1030 <printf@plt>
jmp    1255 <main+0x125>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jne    1238 <main+0x108>
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x114>
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
jmp    1255 <main+0x125>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf80(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl 0x7(%rsp),%eax
add    $0xffffffba,%eax
cmp    $0x31,%eax
ja     11f5 <main+0xb5>
lea    0xe8f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf61(%rip),%rdi
jmp    1213 <main+0xd3>
lea    0xf8d(%rip),%rdi
jmp    1213 <main+0xd3>
lea    0xf5b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf23(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1060 <scanf@plt>
cmpb   $0x61,0x7(%rsp)
jne    1203 <main+0xc3>
lea    0xf1c(%rip),%rdi
jmp    1213 <main+0xd3>
lea    0xf2e(%rip),%rdi
call   1030 <puts@plt>
lea    0xef6(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1060 <scanf@plt>
cmpb   $0x75,0x7(%rsp)
jne    120c <main+0xcc>
lea    0xf28(%rip),%rdi
jmp    1213 <main+0xd3>
lea    0xef6(%rip),%rdi
jmp    1213 <main+0xd3>
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
jmp    1218 <main+0xd8>
lea    0xec8(%rip),%rdi
jmp    1213 <main+0xd3>
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [8 x i8] c"Monday\0A\00"
@.str.2 = [23 x i8] c"input the second char\0A\00"
@.str.3 = [9 x i8] c"Tuesday\0A\00"
@.str.4 = [9 x i8] c"Thurday\0A\00"
@.str.5 = [12 x i8] c"Wendnesday\0A\00"
@.str.6 = [8 x i8] c"Friday\0A\00"
@.str.7 = [10 x i8] c"Saturday\0A\00"
@.str.8 = [8 x i8] c"Sunday\0A\00"
@.str.9 = [7 x i8] c"error!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 (...) @getchar()
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
switch i32 %6, label %35 [
i32 77, label %7
i32 109, label %7
i32 84, label %9
i32 116, label %9
i32 87, label %20
i32 119, label %20
i32 70, label %22
i32 102, label %22
i32 83, label %24
i32 115, label %24
]
7: ; preds = %0, %0
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %37
9: ; preds = %0, %0
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 117
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %19
17: ; preds = %9
%18 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
br label %37
20: ; preds = %0, %0
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %37
22: ; preds = %0, %0
%23 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %37
24: ; preds = %0, %0
%25 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 97
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %34
32: ; preds = %24
%33 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
br label %37
35: ; preds = %0
%36 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %37
37: ; preds = %35, %34, %22, %20, %19, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.9 = [7 x i8] c"error!\00"
@str.10 = [7 x i8] c"Sunday\00"
@str.11 = [9 x i8] c"Saturday\00"
@str.12 = [7 x i8] c"Friday\00"
@str.13 = [11 x i8] c"Wendnesday\00"
@str.14 = [22 x i8] c"input the second char\00"
@str.15 = [8 x i8] c"Thurday\00"
@str.16 = [8 x i8] c"Tuesday\00"
@str.17 = [7 x i8] c"Monday\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = call i32 (...) @getchar()
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
switch i32 %5, label %30 [
i32 77, label %6
i32 109, label %6
i32 84, label %8
i32 116, label %8
i32 87, label %17
i32 119, label %17
i32 70, label %19
i32 102, label %19
i32 83, label %21
i32 115, label %21
]
6: ; preds = %0, %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.17, i64 0, i64 0))
br label %32
8: ; preds = %0, %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.14, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%11 = load i8, i8* %1
%12 = icmp eq i8 %11, 117
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.16, i64 0, i64 0))
br label %32
15: ; preds = %8
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.15, i64 0, i64 0))
br label %32
17: ; preds = %0, %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.13, i64 0, i64 0))
br label %32
19: ; preds = %0, %0
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.12, i64 0, i64 0))
br label %32
21: ; preds = %0, %0
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.14, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%24 = load i8, i8* %1
%25 = icmp eq i8 %24, 97
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.11, i64 0, i64 0))
br label %32
28: ; preds = %21
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.10, i64 0, i64 0))
br label %32
30: ; preds = %0
%31 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %32
32: ; preds = %26, %28, %13, %15, %30, %19, %17, %6
ret i32 0
}