#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 grade = -999;
  while (grade > 100 || grade < 0) {
    printf("Please input the numerical grade. \n");
    scanf("%d", &grade);
    if (grade > 100) {
      printf("Invalid grade; Please input a valid grade.\n");
    } else if (grade < 0) {
      printf("Invalid grade; Please input a valid grade.\n");
    } else if (grade > 89) {
      printf("Letter grade is: A\n");
    } else if (grade > 79 && grade < 90) {
      printf("Letter grade is: B\n");
    } else if (grade > 69 && grade < 80) {
      printf("Letter grade is: C\n");
    } else if (grade > 59 && grade < 70) {
      printf("Letter grade is: D\n");
    } else if (grade < 60) {
      printf("Letter grade is: F\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffc19,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x64,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jg     114f <main+0x2f>
cmpl   $0x0,-0x8(%rbp)
setl   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115f <main+0x3f>
jmp    1274 <main+0x154>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jle    1196 <main+0x76>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    126f <main+0x14f>
cmpl   $0x0,-0x8(%rbp)
jge    11b1 <main+0x91>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
jmp    126a <main+0x14a>
cmpl   $0x59,-0x8(%rbp)
jle    11cc <main+0xac>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
jmp    1265 <main+0x145>
cmpl   $0x4f,-0x8(%rbp)
jle    11f1 <main+0xd1>
cmpl   $0x5a,-0x8(%rbp)
jge    11f1 <main+0xd1>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
jmp    1260 <main+0x140>
cmpl   $0x45,-0x8(%rbp)
jle    1216 <main+0xf6>
cmpl   $0x50,-0x8(%rbp)
jge    1216 <main+0xf6>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
jmp    125b <main+0x13b>
cmpl   $0x3b,-0x8(%rbp)
jle    123b <main+0x11b>
cmpl   $0x46,-0x8(%rbp)
jge    123b <main+0x11b>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
jmp    1256 <main+0x136>
cmpl   $0x3c,-0x8(%rbp)
jge    1251 <main+0x131>
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
jmp    1256 <main+0x136>
jmp    125b <main+0x13b>
jmp    1260 <main+0x140>
jmp    1265 <main+0x145>
jmp    126a <main+0x14a>
jmp    126f <main+0x14f>
jmp    1136 <main+0x16>
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
movl   $0xfffffc19,0x4(%rsp)
ff
lea    0xec9(%rip),%r14
lea    0xebf(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xf38(%rip),%rbx
lea    0xf1e(%rip),%r13
lea    0xf04(%rip),%rbp
jmp    116c <main+0x4c>
nopl   (%rax)
call   1030 <puts@plt>
cmpl   $0x64,0x4(%rsp)
jbe    11c5 <main+0xa5>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %rbx,%rdi
cmp    $0x64,%eax
jg     1160 <main+0x40>
mov    %rbx,%rdi
test   %eax,%eax
js     1160 <main+0x40>
mov    %r13,%rdi
cmp    $0x59,%eax
ja     1160 <main+0x40>
mov    %rbp,%rdi
cmp    $0x4f,%eax
ja     1160 <main+0x40>
lea    0xea3(%rip),%rdi
cmp    $0x45,%eax
ja     1160 <main+0x40>
cmp    $0x3c,%eax
lea    0xe6e(%rip),%rdi
lea    0xe7a(%rip),%rax
cmovae %rax,%rdi
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Please input the numerical grade. \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [44 x i8] c"Invalid grade; Please input a valid grade.\0A\00"
@.str.3 = [20 x i8] c"Letter grade is: A\0A\00"
@.str.4 = [20 x i8] c"Letter grade is: B\0A\00"
@.str.5 = [20 x i8] c"Letter grade is: C\0A\00"
@.str.6 = [20 x i8] c"Letter grade is: D\0A\00"
@.str.7 = [20 x i8] c"Letter grade is: F\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -999, i32* %2
br label %3
3: ; preds = %63, %0
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 100
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 0
br label %9
9: ; preds = %6, %3
%10 = phi i1 [ true, %3 ], [ %8, %6 ]
br i1 %10, label %11, label %64
11: ; preds = %9
%12 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 100
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
br label %63
18: ; preds = %11
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
br label %62
23: ; preds = %18
%24 = load i32, i32* %2
%25 = icmp sgt i32 %24, 89
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %61
28: ; preds = %23
%29 = load i32, i32* %2
%30 = icmp sgt i32 %29, 79
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 90
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %60
36: ; preds = %31, %28
%37 = load i32, i32* %2
%38 = icmp sgt i32 %37, 69
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = load i32, i32* %2
%41 = icmp slt i32 %40, 80
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %59
44: ; preds = %39, %36
%45 = load i32, i32* %2
%46 = icmp sgt i32 %45, 59
br i1 %46, label %47, label %52
47: ; preds = %44
%48 = load i32, i32* %2
%49 = icmp slt i32 %48, 70
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %58
52: ; preds = %47, %44
%53 = load i32, i32* %2
%54 = icmp slt i32 %53, 60
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %57
57: ; preds = %55, %52
br label %58
58: ; preds = %57, %50
br label %59
59: ; preds = %58, %42
br label %60
60: ; preds = %59, %34
br label %61
61: ; preds = %60, %26
br label %62
62: ; preds = %61, %21
br label %63
63: ; preds = %62, %16
br label %3
64: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [35 x i8] c"Please input the numerical grade. \00"
@str.8 = [19 x i8] c"Letter grade is: F\00"
@str.9 = [19 x i8] c"Letter grade is: D\00"
@str.10 = [19 x i8] c"Letter grade is: C\00"
@str.11 = [19 x i8] c"Letter grade is: B\00"
@str.12 = [19 x i8] c"Letter grade is: A\00"
@str.14 = [43 x i8] c"Invalid grade; Please input a valid grade.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 -999, i32* %1
br label %3
3: ; preds = %0, %19
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 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* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 100
br i1 %7, label %19, label %8
8: ; preds = %3
%9 = icmp slt i32 %6, 0
br i1 %9, label %19, label %10
10: ; preds = %8
%11 = icmp ugt i32 %6, 89
br i1 %11, label %19, label %12
12: ; preds = %10
%13 = icmp ugt i32 %6, 79
br i1 %13, label %19, label %14
14: ; preds = %12
%15 = icmp ugt i32 %6, 69
br i1 %15, label %19, label %16
16: ; preds = %14
%17 = icmp ugt i32 %6, 59
%18 = select i1 %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.8, i64 0, i64 0)
br label %19
19: ; preds = %16, %14, %12, %10, %8, %3
%20 = phi i8* [ getelementptr inbounds ([43 x i8], [43 x i8]* @str.14, i64 0, i64 0), %3 ], [ getelementptr inbounds ([43 x i8], [43 x i8]* @str.14, i64 0, i64 0), %8 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.12, i64 0, i64 0), %10 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0), %14 ], [ %18, %16 ]
%21 = call i32 @puts(i8* dereferenceable(1) %20)
%22 = load i32, i32* %1
%23 = icmp ugt i32 %22, 100
br i1 %23, label %3, label %24
24: ; preds = %19
ret i32 0
}