#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() {
  int i;
  char n;
  printf("input the score:");
  scanf("%f", &i);
  while (i > 100 || i < 0) {
    printf("error!");
  }
  if (i > 90) {
    n = 'A';
    printf("the grade is %c\n", n);
  } else if (i >= 80) {
    n = 'B';
    printf("the grade is %c\n", n);
  } else if (i >= 70) {
    n = 'C';
    printf("the grade is %c\n", n);
  } else if (i >= 60) {
    n = 'D';
    printf("the grade is %c\n", n);
  } else
    n = 'E';
  printf("the grade is %c\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x64,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jg     1166 <main+0x46>
cmpl   $0x0,-0x8(%rbp)
setl   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1176 <main+0x56>
jmp    1189 <main+0x69>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114d <main+0x2d>
cmpl   $0x5a,-0x8(%rbp)
jle    11ae <main+0x8e>
movb   $0x41,-0x9(%rbp)
movsbl -0x9(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1230 <main+0x110>
cmpl   $0x50,-0x8(%rbp)
jl     11d3 <main+0xb3>
movb   $0x42,-0x9(%rbp)
movsbl -0x9(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0x10b>
cmpl   $0x46,-0x8(%rbp)
jl     11f8 <main+0xd8>
movb   $0x43,-0x9(%rbp)
movsbl -0x9(%rbp),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1226 <main+0x106>
cmpl   $0x3c,-0x8(%rbp)
jl     121d <main+0xfd>
movb   $0x44,-0x9(%rbp)
movsbl -0x9(%rbp),%esi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <main+0x101>
movb   $0x45,-0x9(%rbp)
jmp    1226 <main+0x106>
jmp    122b <main+0x10b>
jmp    1230 <main+0x110>
movsbl -0x9(%rbp),%esi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x65,%eax
jb     1173 <main+0x53>
lea    0xec0(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
cmp    $0x64,%eax
ja     1160 <main+0x40>
mov    $0x41,%ebx
cmp    $0x5a,%eax
ja     11a0 <main+0x80>
mov    $0x42,%ebx
cmp    $0x4f,%eax
ja     11a0 <main+0x80>
mov    $0x43,%ebx
cmp    $0x45,%eax
ja     11a0 <main+0x80>
mov    $0x45,%esi
mov    $0x44,%ebx
cmp    $0x3c,%eax
jb     11b2 <main+0x92>
lea    0xe74(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%esi
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"input the score:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [7 x i8] c"error!\00"
@.str.3 = [17 x i8] c"the grade is %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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), i32* %2)
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 100
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ true, %6 ], [ %11, %9 ]
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %6
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, 90
br i1 %18, label %19, label %23
19: ; preds = %16
store i8 65, i8* %3
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %48
23: ; preds = %16
%24 = load i32, i32* %2
%25 = icmp sge i32 %24, 80
br i1 %25, label %26, label %30
26: ; preds = %23
store i8 66, i8* %3
%27 = load i8, i8* %3
%28 = sext i8 %27 to i32
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %47
30: ; preds = %23
%31 = load i32, i32* %2
%32 = icmp sge i32 %31, 70
br i1 %32, label %33, label %37
33: ; preds = %30
store i8 67, i8* %3
%34 = load i8, i8* %3
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %35)
br label %46
37: ; preds = %30
%38 = load i32, i32* %2
%39 = icmp sge i32 %38, 60
br i1 %39, label %40, label %44
40: ; preds = %37
store i8 68, i8* %3
%41 = load i8, i8* %3
%42 = sext i8 %41 to i32
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %42)
br label %45
44: ; preds = %37
store i8 69, i8* %3
br label %45
45: ; preds = %44, %40
br label %46
46: ; preds = %45, %33
br label %47
47: ; preds = %46, %26
br label %48
48: ; preds = %47, %19
%49 = load i8, i8* %3
%50 = sext i8 %49 to i32
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"input the score:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [7 x i8] c"error!\00"
@.str.3 = [17 x i8] c"the grade is %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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 %11
7: ; preds = %0, %7
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = icmp ugt i32 %9, 100
br i1 %10, label %7, label %11
11: ; preds = %7, %0
%12 = phi i32 [ %5, %0 ], [ %9, %7 ]
%13 = icmp ugt i32 %12, 90
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = icmp ugt i32 %12, 79
br i1 %15, label %20, label %16
16: ; preds = %14
%17 = icmp ugt i32 %12, 69
br i1 %17, label %20, label %18
18: ; preds = %16
%19 = icmp ugt i32 %12, 59
br i1 %19, label %20, label %23
20: ; preds = %18, %16, %14, %11
%21 = phi i32 [ 65, %11 ], [ 66, %14 ], [ 67, %16 ], [ 68, %18 ]
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %18
%24 = phi i32 [ 69, %18 ], [ %21, %20 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %24)
ret i32 0
}