#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() {
  char i, j;
  printf("请输入第一个字符:");
  scanf("%c", &i);
  getchar();
  switch (i) {
  case 'm':
    printf("monday\n");
    break;
  case 'w':
    printf("wednesday\n");
    break;
  case 'f':
    printf("friday\n");
    break;
  case 't':
    printf("请输入下一个字母:");
    scanf("%c", &j);
    if (j == 'u') {
      printf("tuesday:\n");
      break;
    }
    if (j == 'h') {
      printf("thursday:\n");
      break;
    }
  case 's':
    printf("请输入下一个字母:");
    scanf("%c", &j);
    if (j == 'a') {
      printf("saturday:\n");
      break;
    }
    if (j == 'u') {
      printf("sunday:\n");
      break;
    }
  default:
    printf("input error\n");
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
lea    0xf10(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffff9a,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x11,%eax
ja     1279 <main+0x149>
mov    -0x10(%rbp),%rax
lea    0xe7d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
jmp    1285 <main+0x155>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    1285 <main+0x155>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    1285 <main+0x155>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xe90(%rip),%rdi
lea    -0x6(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x6(%rbp),%eax
cmp    $0x75,%eax
jne    11f9 <main+0xc9>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    1285 <main+0x155>
movsbl -0x6(%rbp),%eax
cmp    $0x68,%eax
jne    1217 <main+0xe7>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    1285 <main+0x155>
jmp    121c <main+0xec>
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe33(%rip),%rdi
lea    -0x6(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x6(%rbp),%eax
cmp    $0x61,%eax
jne    1256 <main+0x126>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
jmp    1285 <main+0x155>
movsbl -0x6(%rbp),%eax
cmp    $0x75,%eax
jne    1274 <main+0x144>
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
jmp    1285 <main+0x155>
jmp    1279 <main+0x149>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf00(%rip),%rdi
call   1040 <printf@plt>
lea    0xf0e(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl 0x7(%rsp),%eax
add    $0xffffff9a,%eax
cmp    $0x11,%eax
ja     1195 <main+0x55>
lea    0xf48(%rip),%rdi
lea    0xe80(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf20(%rip),%rdi
jmp    1227 <main+0xe7>
lea    0xee3(%rip),%rdi
jmp    1227 <main+0xe7>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x6(%rsp),%al
cmp    $0x75,%al
je     1220 <main+0xe0>
cmp    $0x68,%al
jne    11d3 <main+0x93>
lea    0xecc(%rip),%rdi
jmp    1227 <main+0xe7>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x6(%rsp),%al
cmp    $0x75,%al
lea    0xe8e(%rip),%rcx
lea    0xe7b(%rip),%rdx
cmove  %rcx,%rdx
cmp    $0x61,%al
lea    0xe82(%rip),%rdi
cmovne %rdx,%rdi
jmp    1227 <main+0xe7>
lea    0xe99(%rip),%rdi
jmp    1227 <main+0xe7>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E7\AC\AC\E4\B8\80\E4\B8\AA\E5\AD\97\E7\AC\A6:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [8 x i8] c"monday\0A\00"
@.str.3 = [11 x i8] c"wednesday\0A\00"
@.str.4 = [8 x i8] c"friday\0A\00"
@.str.5 = [26 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\8B\E4\B8\80\E4\B8\AA\E5\AD\97\E6\AF\8D:\00"
@.str.6 = [10 x i8] c"tuesday:\0A\00"
@.str.7 = [11 x i8] c"thursday:\0A\00"
@.str.8 = [11 x i8] c"saturday:\0A\00"
@.str.9 = [9 x i8] c"sunday:\0A\00"
@.str.10 = [13 x i8] c"input error\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 (...) @getchar()
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
switch i32 %8, label %45 [
i32 109, label %9
i32 119, label %11
i32 102, label %13
i32 116, label %15
i32 115, label %30
]
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %47
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %47
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %47
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 117
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %47
23: ; preds = %15
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 104
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %47
29: ; preds = %23
br label %30
30: ; preds = %0, %29
%31 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%33 = load i8, i8* %3
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 97
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %47
38: ; preds = %30
%39 = load i8, i8* %3
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 117
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %47
44: ; preds = %38
br label %45
45: ; preds = %0, %44
%46 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
br label %47
47: ; preds = %45, %42, %36, %27, %21, %13, %11, %9
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@.str = [26 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E7\AC\AC\E4\B8\80\E4\B8\AA\E5\AD\97\E7\AC\A6:\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.5 = [26 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\8B\E4\B8\80\E4\B8\AA\E5\AD\97\E6\AF\8D:\00"
@str = [12 x i8] c"input error\00"
@str.11 = [8 x i8] c"sunday:\00"
@str.12 = [10 x i8] c"saturday:\00"
@str.13 = [10 x i8] c"thursday:\00"
@str.14 = [9 x i8] c"tuesday:\00"
@str.15 = [7 x i8] c"friday\00"
@str.16 = [10 x i8] c"wednesday\00"
@str.17 = [7 x i8] c"monday\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 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 = call i32 (...) @getchar()
%6 = load i8, i8* %1
%7 = sext i8 %6 to i32
switch i32 %7, label %23 [
i32 109, label %24
i32 119, label %8
i32 102, label %9
i32 116, label %10
i32 115, label %15
]
8: ; preds = %0
br label %24
9: ; preds = %0
br label %24
10: ; preds = %0
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%13 = load i8, i8* %2
switch i8 %13, label %15 [
i8 117, label %24
i8 104, label %14
]
14: ; preds = %10
br label %24
15: ; preds = %10, %0
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%18 = load i8, i8* %2
%19 = icmp eq i8 %18, 117
%20 = select i1 %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0)
%21 = icmp eq i8 %18, 97
%22 = select i1 %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.12, i64 0, i64 0), i8* %20
br label %24
23: ; preds = %0
br label %24
24: ; preds = %15, %10, %0, %23, %14, %9, %8
%25 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0), %23 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.15, i64 0, i64 0), %9 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.16, i64 0, i64 0), %8 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.17, i64 0, i64 0), %0 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.14, i64 0, i64 0), %10 ], [ %22, %15 ]
%26 = call i32 @puts(i8* dereferenceable(1) %25)
ret i32 0
}