#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*/ puts(char *);
scalar_t__ scanf(char *, int *);
int main() {
  int score;
  puts("input your score:");
  while (scanf("%d", &score) && score) {
    if (score < 0 || score > 100) {
      puts("input error");
      continue;
    }
    switch (score / 10) {
    case 10:
    case 9:
      puts("A");
      break;
    case 8:
      puts("B");
      break;
    case 7:
      puts("C");
      break;
    case 6:
      puts("D");
      break;
    default:
      puts("NO PASS!");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1167 <main+0x47>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1177 <main+0x57>
jmp    1234 <main+0x114>
cmpl   $0x0,-0x8(%rbp)
jl     118b <main+0x6b>
cmpl   $0x64,-0x8(%rbp)
jle    119c <main+0x7c>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
jmp    113b <main+0x1b>
movslq -0x8(%rbp),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
sar    $0x22,%rcx
mov    %ecx,%edx
shr    $0x3f,%rax
mov    %eax,%ecx
mov    %edx,%eax
lea    -0x6(%rax,%rcx,1),%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     1223 <main+0x103>
mov    -0x18(%rbp),%rax
lea    0xe2a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe4f(%rip),%rdi
call   1030 <puts@plt>
jmp    122f <main+0x10f>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
jmp    122f <main+0x10f>
lea    0xe31(%rip),%rdi
call   1030 <puts@plt>
jmp    122f <main+0x10f>
lea    0xe22(%rip),%rdi
call   1030 <puts@plt>
jmp    122f <main+0x10f>
lea    0xe13(%rip),%rdi
call   1030 <puts@plt>
jmp    113b <main+0x1b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xed2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11c6 <main+0xa6>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11c6 <main+0xa6>
lea    0xeb7(%rip),%r15
lea    0xead(%rip),%r14
lea    0xc(%rsp),%rbx
lea    0xeb8(%rip),%r12
lea    0xebc(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
cmp    $0x64,%eax
ja     11a9 <main+0x89>
movzbl %al,%eax
imul   $0xcd,%eax,%eax
shr    $0xb,%eax
add    $0xfffffffa,%eax
mov    %r12,%rdi
cmp    $0x5,%eax
jae    11a9 <main+0x89>
cltq
movslq 0x0(%r13,%rax,4),%rdi
add    %r13,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11c6 <main+0xa6>
mov    0xc(%rsp),%eax
test   %eax,%eax
jne    1180 <main+0x60>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"input your score:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"input error\00"
@.str.3 = [2 x i8] c"A\00"
@.str.4 = [2 x i8] c"B\00"
@.str.5 = [2 x i8] c"C\00"
@.str.6 = [2 x i8] c"D\00"
@.str.7 = [9 x i8] c"NO PASS!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %33, %18, %0
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ false, %4 ], [ %9, %7 ]
br i1 %11, label %12, label %34
12: ; preds = %10
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 100
br i1 %17, label %18, label %20
18: ; preds = %15, %12
%19 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %4
20: ; preds = %15
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 10
switch i32 %22, label %31 [
i32 10, label %23
i32 9, label %23
i32 8, label %25
i32 7, label %27
i32 6, label %29
]
23: ; preds = %20, %20
%24 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %33
25: ; preds = %20
%26 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %33
27: ; preds = %20
%28 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %33
29: ; preds = %20
%30 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %33
31: ; preds = %20
%32 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %33
33: ; preds = %31, %29, %27, %25, %23
br label %4
34: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"input your score:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"input error\00"
@.str.3 = [2 x i8] c"A\00"
@.str.4 = [2 x i8] c"B\00"
@.str.5 = [2 x i8] c"C\00"
@.str.6 = [2 x i8] c"D\00"
@.str.7 = [9 x i8] c"NO PASS!\00"
@reltable.main = [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.4 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([5 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = icmp ne i64 %4, 0
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 0
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %9, label %30
9: ; preds = %0, %16
%10 = phi i32 [ %21, %16 ], [ %6, %0 ]
%11 = icmp ugt i32 %10, 100
br i1 %11, label %16, label %24
12: ; preds = %24
%13 = sext i32 %28 to i64
%14 = shl i64 %13, 2
%15 = call i8* @llvm.load.relative.i64(i8* bitcast ([5 x i32]* @reltable.main to i8*), i64 %14)
br label %16
16: ; preds = %24, %12, %9
%17 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %9 ], [ %15, %12 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %24 ]
%18 = call i32 @puts(i8* dereferenceable(1) %17)
%19 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%20 = icmp ne i64 %19, 0
%21 = load i32, i32* %1
%22 = icmp ne i32 %21, 0
%23 = select i1 %20, i1 %22, i1 false
br i1 %23, label %9, label %30
24: ; preds = %9
%25 = trunc i32 %10 to i8
%26 = udiv i8 %25, 10
%27 = zext i8 %26 to i32
%28 = add nsw i32 %27, -6
%29 = icmp ult i32 %28, 5
br i1 %29, label %12, label %16
30: ; preds = %16, %0
ret i32 0
}