#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 *, int *);
int main(void) {
  int grade;
  printf("输入成绩:");
  scanf("%d", &grade);
  if (grade < 0 || 100 < grade) {
    printf("输入无效!");
    return 1;
  }
  grade = grade / 10;
  switch (grade) {
  case 10:
  case 9:
  case 8:
    printf("优秀!\n");
    break;
  case 7:
    printf("良好!\n");
    break;
  case 6:
    printf("及格!\n");
    break;
  default:
    printf("不及格!\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     1163 <main+0x43>
mov    $0x64,%eax
cmp    -0x8(%rbp),%eax
jge    117b <main+0x5b>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1215 <main+0xf5>
movslq -0x8(%rbp),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x6,%eax
je     11f1 <main+0xd1>
jmp    11aa <main+0x8a>
mov    -0xc(%rbp),%eax
sub    $0x7,%eax
je     11e0 <main+0xc0>
jmp    11bb <main+0x9b>
mov    -0xc(%rbp),%eax
add    $0xfffffff8,%eax
sub    $0x2,%eax
ja     1202 <main+0xe2>
jmp    11cf <main+0xaf>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x65,%eax
jb     116a <main+0x3a>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret
movzbl %al,%eax
imul   $0xcd,%eax,%eax
shr    $0xb,%eax
mov    %eax,0x4(%rsp)
lea    -0x8(%rax),%ecx
cmp    $0x3,%ecx
jae    118b <main+0x5b>
lea    0xe9e(%rip),%rdi
jmp    11ae <main+0x7e>
cmp    $0x6,%eax
je     119e <main+0x6e>
cmp    $0x7,%eax
jne    11a7 <main+0x77>
lea    0xe83(%rip),%rdi
jmp    11ae <main+0x7e>
lea    0xe8d(%rip),%rdi
jmp    11ae <main+0x7e>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\E8\BE\93\E5\85\A5\E6\88\90\E7\BB\A9:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"\E8\BE\93\E5\85\A5\E6\97\A0\E6\95\88!\00"
@.str.3 = [9 x i8] c"\E4\BC\98\E7\A7\80!\0A\00"
@.str.4 = [9 x i8] c"\E8\89\AF\E5\A5\BD!\0A\00"
@.str.5 = [9 x i8] c"\E5\8F\8A\E6\A0\BC!\0A\00"
@.str.6 = [12 x i8] c"\E4\B8\8D\E5\8F\8A\E6\A0\BC!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 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), i32* %2)
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp slt i32 100, %8
br i1 %9, label %10, label %12
10: ; preds = %7, %0
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %25
12: ; preds = %7
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 10
store i32 %14, i32* %2
%15 = load i32, i32* %2
switch i32 %15, label %22 [
i32 10, label %16
i32 9, label %16
i32 8, label %16
i32 7, label %18
i32 6, label %20
]
16: ; preds = %12, %12, %12
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %24
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %24
20: ; preds = %12
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %24
22: ; preds = %12
%23 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %24
24: ; preds = %22, %20, %18, %16
store i32 0, i32* %1
br label %25
25: ; preds = %24, %10
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [14 x i8] c"\E8\BE\93\E5\85\A5\E6\88\90\E7\BB\A9:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"\E8\BE\93\E5\85\A5\E6\97\A0\E6\95\88!\00"
@str = [8 x i8] c"\E5\8F\8A\E6\A0\BC!\00"
@str.7 = [8 x i8] c"\E8\89\AF\E5\A5\BD!\00"
@str.8 = [8 x i8] c"\E4\BC\98\E7\A7\80!\00"
@str.9 = [11 x i8] c"\E4\B8\8D\E5\8F\8A\E6\A0\BC!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 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), i32* %1)
%5 = load i32, i32* %1
%6 = icmp ugt i32 %5, 100
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %21
9: ; preds = %0
%10 = trunc i32 %5 to i8
%11 = udiv i8 %10, 10
%12 = zext i8 %11 to i32
store i32 %12, i32* %1
switch i32 %12, label %19 [
i32 10, label %13
i32 9, label %13
i32 8, label %13
i32 7, label %15
i32 6, label %17
]
13: ; preds = %9, %9, %9
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.8, i64 0, i64 0))
br label %21
15: ; preds = %9
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0))
br label %21
17: ; preds = %9
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %21
19: ; preds = %9
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.9, i64 0, i64 0))
br label %21
21: ; preds = %13, %15, %17, %19, %7
%22 = phi i32 [ 1, %7 ], [ 0, %19 ], [ 0, %17 ], [ 0, %15 ], [ 0, %13 ]
ret i32 %22
}