#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_s(char *, int *);
int /*<<< orphan*/ system(char *);
main() {
  int grade;
  printf("Enter the grade: ");
  scanf_s("%d", &grade);
  if (grade > 100) {
    printf("Error!!\n");
  } else if (grade < 0) {
    printf("Error!!\n");
  } else {
    if (grade >= 90)
      printf("%d --> AA\n", grade);
    else if (grade >= 80)
      printf("%d --> BA\n", grade);
    else if (grade >= 70)
      printf("%d --> BB\n", grade);
    else if (grade >= 60)
      printf("%d --> CB\n", grade);
    else if (grade >= 50)
      printf("%d --> CC\n", grade);
    else
      printf("%d --> FF\n", grade);
  }
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf_s@plt>
cmpl   $0x64,-0x8(%rbp)
jle    117a <main+0x4a>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1266 <main+0x136>
cmpl   $0x0,-0x8(%rbp)
jge    1197 <main+0x67>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1261 <main+0x131>
cmpl   $0x5a,-0x8(%rbp)
jl     11b7 <main+0x87>
mov    -0x8(%rbp),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125c <main+0x12c>
cmpl   $0x50,-0x8(%rbp)
jl     11d7 <main+0xa7>
mov    -0x8(%rbp),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1257 <main+0x127>
cmpl   $0x46,-0x8(%rbp)
jl     11f7 <main+0xc7>
mov    -0x8(%rbp),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1252 <main+0x122>
cmpl   $0x3c,-0x8(%rbp)
jl     1217 <main+0xe7>
mov    -0x8(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    124d <main+0x11d>
cmpl   $0x32,-0x8(%rbp)
jl     1237 <main+0x107>
mov    -0x8(%rbp),%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1248 <main+0x118>
mov    -0x8(%rbp),%esi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    124d <main+0x11d>
jmp    1252 <main+0x122>
jmp    1257 <main+0x127>
jmp    125c <main+0x12c>
jmp    1261 <main+0x131>
jmp    1266 <main+0x136>
lea    0xdf3(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf_s@plt>
mov    0x4(%rsp),%esi
cmp    $0x65,%esi
jge    117b <main+0x3b>
test   %esi,%esi
js     117b <main+0x3b>
cmp    $0x5a,%esi
jb     1189 <main+0x49>
lea    0xe9c(%rip),%rdi
jmp    11c8 <main+0x88>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
jmp    11cf <main+0x8f>
cmp    $0x50,%esi
jb     1197 <main+0x57>
lea    0xe8b(%rip),%rdi
jmp    11c8 <main+0x88>
cmp    $0x46,%esi
jb     11a5 <main+0x65>
lea    0xe88(%rip),%rdi
jmp    11c8 <main+0x88>
cmp    $0x3c,%esi
jb     11b3 <main+0x73>
lea    0xe85(%rip),%rdi
jmp    11c8 <main+0x88>
cmp    $0x32,%esi
jb     11c1 <main+0x81>
lea    0xe82(%rip),%rdi
jmp    11c8 <main+0x88>
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe81(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter the grade: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"Error!!\0A\00"
@.str.3 = [11 x i8] c"%d --> AA\0A\00"
@.str.4 = [11 x i8] c"%d --> BA\0A\00"
@.str.5 = [11 x i8] c"%d --> BB\0A\00"
@.str.6 = [11 x i8] c"%d --> CB\0A\00"
@.str.7 = [11 x i8] c"%d --> CC\0A\00"
@.str.8 = [11 x i8] c"%d --> FF\0A\00"
@.str.9 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 100
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %53
9: ; preds = %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %52
14: ; preds = %9
%15 = load i32, i32* %2
%16 = icmp sge i32 %15, 90
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %18)
br label %51
20: ; preds = %14
%21 = load i32, i32* %2
%22 = icmp sge i32 %21, 80
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %24)
br label %50
26: ; preds = %20
%27 = load i32, i32* %2
%28 = icmp sge i32 %27, 70
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %30)
br label %49
32: ; preds = %26
%33 = load i32, i32* %2
%34 = icmp sge i32 %33, 60
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %36)
br label %48
38: ; preds = %32
%39 = load i32, i32* %2
%40 = icmp sge i32 %39, 50
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %42)
br label %47
44: ; preds = %38
%45 = load i32, i32* %2
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %44, %41
br label %48
48: ; preds = %47, %35
br label %49
49: ; preds = %48, %29
br label %50
50: ; preds = %49, %23
br label %51
51: ; preds = %50, %17
br label %52
52: ; preds = %51, %12
br label %53
53: ; preds = %52, %7
%54 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%55 = load i32, i32* %1
ret i32 %55
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter the grade: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"%d --> AA\0A\00"
@.str.4 = [11 x i8] c"%d --> BA\0A\00"
@.str.5 = [11 x i8] c"%d --> BB\0A\00"
@.str.6 = [11 x i8] c"%d --> CB\0A\00"
@.str.7 = [11 x i8] c"%d --> CC\0A\00"
@.str.8 = [11 x i8] c"%d --> FF\0A\00"
@.str.9 = [6 x i8] c"pause\00"
@str.10 = [8 x i8] c"Error!!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 100
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0))
br label %35
9: ; preds = %0
%10 = icmp slt i32 %5, 0
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0))
br label %35
13: ; preds = %9
%14 = icmp ugt i32 %5, 89
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %5)
br label %35
17: ; preds = %13
%18 = icmp ugt i32 %5, 79
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %5)
br label %35
21: ; preds = %17
%22 = icmp ugt i32 %5, 69
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %5)
br label %35
25: ; preds = %21
%26 = icmp ugt i32 %5, 59
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %5)
br label %35
29: ; preds = %25
%30 = icmp ugt i32 %5, 49
br i1 %30, label %31, label %33
31: ; preds = %29
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %5)
br label %35
33: ; preds = %29
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32 %5)
br label %35
35: ; preds = %11, %19, %27, %33, %31, %23, %15, %7
%36 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}