#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 *, float *);
int main() {
  float score;
  char grade;
  printf("请输入学生成绩：");
  scanf("%f", &score);
  while (score > 100 || score < 0) {
    printf("\n输入有误，请重新输入：");
    scanf("%f", &score);
  }
  switch ((int)score / 10) {
  case 10:
  case 9:
    grade = 'A';
    break;
  case 8:
    grade = 'B';
    break;
  case 7:
    grade = 'C';
    break;
  case 6:
    grade = 'D';
    break;
  case 5:
  case 4:
  case 3:
  case 2:
  case 1:
  case 0:
    grade = 'E';
    break;
  }
  printf("该学生的成绩为%5.1f\t，对应的成绩等级为%c\n", score, grade);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
mov    $0x1,%al
movss  0xea4(%rip),%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0xa(%rbp)
ja     1175 <main+0x55>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
seta   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1185 <main+0x65>
jmp    11a8 <main+0x88>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114d <main+0x2d>
cvttss2si -0x8(%rbp),%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xa,%eax
ja     120e <main+0xee>
mov    -0x18(%rbp),%rax
lea    0xe27(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x41,-0x9(%rbp)
jmp    120e <main+0xee>
movb   $0x42,-0x9(%rbp)
jmp    120e <main+0xee>
movb   $0x43,-0x9(%rbp)
jmp    120e <main+0xee>
movb   $0x44,-0x9(%rbp)
jmp    120e <main+0xee>
movb   $0x45,-0x9(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsbl -0x9(%rbp),%esi
lea    0xe4d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xeab(%rip),%xmm0
ja     115f <main+0x3f>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    11ac <main+0x8c>
lea    0xebe(%rip),%r14
lea    0xeb4(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe5e(%rip),%xmm0
ja     1180 <main+0x60>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     1180 <main+0x60>
cvttss2si %xmm0,%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
xor    %esi,%esi
cmp    $0xa,%eax
ja     11d9 <main+0xb9>
cltq
lea    0xeae(%rip),%rcx
mov    (%rcx,%rax,4),%esi
cvtss2sd %xmm0,%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\AD\A6\E7\94\9F\E6\88\90\E7\BB\A9\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [35 x i8] c"\0A\E8\BE\93\E5\85\A5\E6\9C\89\E8\AF\AF\EF\BC\8C\E8\AF\B7\E9\87\8D\E6\96\B0\E8\BE\93\E5\85\A5\EF\BC\9A\00"
@.str.3 = [58 x i8] c"\E8\AF\A5\E5\AD\A6\E7\94\9F\E7\9A\84\E6\88\90\E7\BB\A9\E4\B8\BA%5.1f\09\EF\BC\8C\E5\AF\B9\E5\BA\94\E7\9A\84\E6\88\90\E7\BB\A9\E7\AD\89\E7\BA\A7\E4\B8\BA%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 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), float* %2)
br label %6
6: ; preds = %14, %0
%7 = load float, float* %2
%8 = fcmp ogt float %7, 1.000000e+02
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load float, float* %2
%11 = fcmp olt float %10, 0.000000e+00
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ true, %6 ], [ %11, %9 ]
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %6
17: ; preds = %12
%18 = load float, float* %2
%19 = fptosi float %18 to i32
%20 = sdiv i32 %19, 10
switch i32 %20, label %26 [
i32 10, label %21
i32 9, label %21
i32 8, label %22
i32 7, label %23
i32 6, label %24
i32 5, label %25
i32 4, label %25
i32 3, label %25
i32 2, label %25
i32 1, label %25
i32 0, label %25
]
21: ; preds = %17, %17
store i8 65, i8* %3
br label %26
22: ; preds = %17
store i8 66, i8* %3
br label %26
23: ; preds = %17
store i8 67, i8* %3
br label %26
24: ; preds = %17
store i8 68, i8* %3
br label %26
25: ; preds = %17, %17, %17, %17, %17, %17
store i8 69, i8* %3
br label %26
26: ; preds = %17, %25, %24, %23, %22, %21
%27 = load float, float* %2
%28 = fpext float %27 to double
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), double %28, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E5\AD\A6\E7\94\9F\E6\88\90\E7\BB\A9\EF\BC\9A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [35 x i8] c"\0A\E8\BE\93\E5\85\A5\E6\9C\89\E8\AF\AF\EF\BC\8C\E8\AF\B7\E9\87\8D\E6\96\B0\E8\BE\93\E5\85\A5\EF\BC\9A\00"
@.str.3 = [58 x i8] c"\E8\AF\A5\E5\AD\A6\E7\94\9F\E7\9A\84\E6\88\90\E7\BB\A9\E4\B8\BA%5.1f\09\EF\BC\8C\E5\AF\B9\E5\BA\94\E7\9A\84\E6\88\90\E7\BB\A9\E7\AD\89\E7\BA\A7\E4\B8\BA%c\0A\00"
@switch.table.main = [11 x i32] [i32 69, i32 69, i32 69, i32 69, i32 69, i32 69, i32 68, i32 67, i32 66, i32 65, i32 65]
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 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), float* %1)
%5 = load float, float* %1
%6 = fcmp ogt float %5, 1.000000e+02
%7 = fcmp olt float %5, 0.000000e+00
%8 = or i1 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %0, %9
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%12 = load float, float* %1
%13 = fcmp ogt float %12, 1.000000e+02
%14 = fcmp olt float %12, 0.000000e+00
%15 = or i1 %13, %14
br i1 %15, label %9, label %16
16: ; preds = %9, %0
%17 = phi float [ %5, %0 ], [ %12, %9 ]
%18 = fptosi float %17 to i32
%19 = sdiv i32 %18, 10
%20 = icmp ult i32 %19, 11
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = sext i32 %19 to i64
%23 = getelementptr inbounds [11 x i32], [11 x i32]* @switch.table.main, i64 0, i64 %22
%24 = load i32, i32* %23
br label %25
25: ; preds = %21, %16
%26 = phi i32 [ 0, %16 ], [ %24, %21 ]
%27 = fpext float %17 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), double %27, i32 %26)
ret i32 0
}