#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;
    }
    if (score >= 60) {
      if (score >= 70) {
        if (score >= 80) {
          if (score >= 90)
            puts("A");
          else
            puts("B");
        } else
          puts("C");
      } else
        puts("D");
    } else
      puts("NO pass!");
  }
  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 <puts@plt>
lea    0xed0(%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    1219 <main+0xf9>
cmpl   $0x0,-0x8(%rbp)
jl     118b <main+0x6b>
cmpl   $0x64,-0x8(%rbp)
jle    119c <main+0x7c>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
jmp    113b <main+0x1b>
cmpl   $0x3c,-0x8(%rbp)
jl     1208 <main+0xe8>
cmpl   $0x46,-0x8(%rbp)
jl     11f7 <main+0xd7>
cmpl   $0x50,-0x8(%rbp)
jl     11e6 <main+0xc6>
cmpl   $0x5a,-0x8(%rbp)
jl     11d5 <main+0xb5>
lea    0xe56(%rip),%rdi
call   1030 <puts@plt>
jmp    11e1 <main+0xc1>
lea    0xe47(%rip),%rdi
call   1030 <puts@plt>
jmp    11f2 <main+0xd2>
lea    0xe38(%rip),%rdi
call   1030 <puts@plt>
jmp    1203 <main+0xe3>
lea    0xe29(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0xe1a(%rip),%rdi
call   1030 <puts@plt>
jmp    113b <main+0x1b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11ed <main+0xcd>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11ed <main+0xcd>
lea    0xeb1(%rip),%r15
lea    0xea7(%rip),%r14
lea    0x4(%rsp),%rbx
lea    0xeb2(%rip),%r12
lea    0xea9(%rip),%r13
lea    0xea0(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
cmp    $0x65,%eax
jae    11d0 <main+0xb0>
mov    %r12,%rdi
cmp    $0x3c,%eax
jb     11d0 <main+0xb0>
mov    %r13,%rdi
cmp    $0x46,%eax
jb     11d0 <main+0xb0>
mov    %rbp,%rdi
cmp    $0x50,%eax
jb     11d0 <main+0xb0>
lea    0xe6a(%rip),%rdi
cmp    $0x5a,%eax
jae    11d0 <main+0xb0>
lea    0xe60(%rip),%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11ed <main+0xcd>
mov    0x4(%rsp),%eax
test   %eax,%eax
jne    1190 <main+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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 = %45, %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 %46
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 = icmp sge i32 %21, 60
br i1 %22, label %23, label %43
23: ; preds = %20
%24 = load i32, i32* %2
%25 = icmp sge i32 %24, 70
br i1 %25, label %26, label %40
26: ; preds = %23
%27 = load i32, i32* %2
%28 = icmp sge i32 %27, 80
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load i32, i32* %2
%31 = icmp sge i32 %30, 90
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %36
34: ; preds = %29
%35 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %39
37: ; preds = %26
%38 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %39
39: ; preds = %37, %36
br label %42
40: ; preds = %23
%41 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %42
42: ; preds = %40, %39
br label %45
43: ; preds = %20
%44 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %45
45: ; preds = %43, %42
br label %4
46: ; 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"
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 %29
9: ; preds = %0, %12
%10 = phi i32 [ %17, %12 ], [ %6, %0 ]
%11 = icmp ugt i32 %10, 100
br i1 %11, label %12, label %20
12: ; preds = %9, %20, %22, %24, %26
%13 = phi i8* [ %28, %26 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %24 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %22 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %20 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %9 ]
%14 = call i32 @puts(i8* dereferenceable(1) %13)
%15 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%16 = icmp ne i64 %15, 0
%17 = load i32, i32* %1
%18 = icmp ne i32 %17, 0
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %9, label %29
20: ; preds = %9
%21 = icmp ugt i32 %10, 59
br i1 %21, label %22, label %12
22: ; preds = %20
%23 = icmp ugt i32 %10, 69
br i1 %23, label %24, label %12
24: ; preds = %22
%25 = icmp ugt i32 %10, 79
br i1 %25, label %26, label %12
26: ; preds = %24
%27 = icmp ugt i32 %10, 89
%28 = select i1 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0)
br label %12
29: ; preds = %12, %0
ret i32 0
}