#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;
  printf("Enter the student's grade: ");
  scanf("%d", &grade);
  if (grade > 100) {
    printf("Invalid grade entered.Expected 0 <= grade <= 100\n");
  } else if (grade < 90) {
    printf("Invalid grade entered.  Expected 90 <= grade <= 100\n");
  } else if (grade >= 90) {
    printf("Letter grade is: A\n");
  }
  printf("Enter the student's grade: ");
  scanf("%d", &grade);
  if (grade > 89) {
    printf("Invalid grade entered. Expected 80 <= grade <= 89\n");
  } else if (grade < 80) {
    printf("Invalid grade entered. Expected 80 <= grade <= 89\n");
  } else if (grade >= 80) {
    printf("Letter grade is: B\n");
  }
  printf("Enter the student's grade: ");
  scanf("%d", &grade);
  if (grade > 79) {
    printf("Invalid grade entered. Expected 70 <= grade <= 79\n");
  } else if (grade < 70) {
    printf("Invalid grade entered. Expected 70 <= grade <= 79\n");
  } else if (grade >= 70) {
    printf("Letter grade is: C\n");
  }
  printf("Enter the student's grade: ");
  scanf("%d", &grade);
  if (grade > 69) {
    printf("Invalid grade entered. Expected 60 <= grade <= 69\n");
  } else if (grade < 60) {
    printf("Invalid grade entered. Expected 60 <= grade <= 69\n");
  } else if (grade >= 60) {
    printf("Letter grade is: D\n");
  }
  printf("Enter the student's grade: ");
  scanf("%d", &grade);
  if (grade > 59) {
    printf("Invalid grade entered. Expected 0 <= grade <= 59\n");
  } else if (grade < 0) {
    printf("Invalid grade entered. Expected 0 <= grade <= 59\n");
  } else if (grade >= 0) {
    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)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jle    1166 <main+0x46>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    11a1 <main+0x81>
cmpl   $0x5a,-0x8(%rbp)
jge    1181 <main+0x61>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
jmp    119c <main+0x7c>
cmpl   $0x5a,-0x8(%rbp)
jl     1197 <main+0x77>
lea    0xef4(%rip),%rdi
call   1030 <printf@plt>
jmp    119c <main+0x7c>
jmp    11a1 <main+0x81>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
lea    0xe68(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x59,-0x8(%rbp)
jle    11d8 <main+0xb8>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
jmp    1213 <main+0xf3>
cmpl   $0x50,-0x8(%rbp)
jge    11f3 <main+0xd3>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
cmpl   $0x50,-0x8(%rbp)
jl     1209 <main+0xe9>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
jmp    1213 <main+0xf3>
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
lea    0xdf6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x4f,-0x8(%rbp)
jle    124a <main+0x12a>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
jmp    1285 <main+0x165>
cmpl   $0x46,-0x8(%rbp)
jge    1265 <main+0x145>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
jmp    1280 <main+0x160>
cmpl   $0x46,-0x8(%rbp)
jl     127b <main+0x15b>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1280 <main+0x160>
jmp    1285 <main+0x165>
lea    0xd74(%rip),%rdi
call   1030 <printf@plt>
lea    0xd84(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x45,-0x8(%rbp)
jle    12bc <main+0x19c>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
jmp    12f7 <main+0x1d7>
cmpl   $0x3c,-0x8(%rbp)
jge    12d7 <main+0x1b7>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    12f2 <main+0x1d2>
cmpl   $0x3c,-0x8(%rbp)
jl     12ed <main+0x1cd>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    12f2 <main+0x1d2>
jmp    12f7 <main+0x1d7>
lea    0xd02(%rip),%rdi
call   1030 <printf@plt>
lea    0xd12(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x3b,-0x8(%rbp)
jle    132e <main+0x20e>
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
jmp    1369 <main+0x249>
cmpl   $0x0,-0x8(%rbp)
jge    1349 <main+0x229>
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
jmp    1364 <main+0x244>
cmpl   $0x0,-0x8(%rbp)
jl     135f <main+0x23f>
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
jmp    1364 <main+0x244>
jmp    1369 <main+0x249>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rbx
lea    0xc(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x5a,%eax
lea    0xfd8(%rip),%rcx
lea    0xeab(%rip),%rdx
cmovl  %rcx,%rdx
cmp    $0x65,%eax
lea    0xff7(%rip),%rdi
cmovl  %rdx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x50,%eax
lea    0xf67(%rip),%rcx
lea    0xe7f(%rip),%rdi
cmovl  %rcx,%rdi
cmp    $0x5a,%eax
cmovge %rcx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x46,%eax
lea    0xefd(%rip),%rcx
lea    0xe5a(%rip),%rdi
cmovl  %rcx,%rdi
cmp    $0x50,%eax
cmovge %rcx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x3c,%eax
lea    0xe93(%rip),%rcx
lea    0xe35(%rip),%rdi
cmovl  %rcx,%rdi
cmp    $0x46,%eax
cmovge %rcx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
lea    0xe2b(%rip),%rcx
lea    0xe11(%rip),%rdi
cmovs  %rcx,%rdi
cmp    $0x3c,%eax
cmovge %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Enter the student's grade: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"Invalid grade entered.Expected 0 <= grade <= 100\0A\00"
@.str.3 = [53 x i8] c"Invalid grade entered. Expected 90 <= grade <= 100\0A\00"
@.str.4 = [20 x i8] c"Letter grade is: A\0A\00"
@.str.5 = [51 x i8] c"Invalid grade entered. Expected 80 <= grade <= 89\0A\00"
@.str.6 = [20 x i8] c"Letter grade is: B\0A\00"
@.str.7 = [51 x i8] c"Invalid grade entered. Expected 70 <= grade <= 79\0A\00"
@.str.8 = [20 x i8] c"Letter grade is: C\0A\00"
@.str.9 = [51 x i8] c"Invalid grade entered. Expected 60 <= grade <= 69\0A\00"
@.str.10 = [20 x i8] c"Letter grade is: D\0A\00"
@.str.11 = [50 x i8] c"Invalid grade entered. Expected 0 <= grade <= 59\0A\00"
@.str.12 = [20 x i8] c"Letter grade is: F\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 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* %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 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %21
9: ; preds = %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 90
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
br label %20
14: ; preds = %9
%15 = load i32, i32* %2
%16 = icmp sge i32 %15, 90
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
br label %20
20: ; preds = %19, %12
br label %21
21: ; preds = %20, %7
%22 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%24 = load i32, i32* %2
%25 = icmp sgt i32 %24, 89
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
br label %40
28: ; preds = %21
%29 = load i32, i32* %2
%30 = icmp slt i32 %29, 80
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
br label %39
33: ; preds = %28
%34 = load i32, i32* %2
%35 = icmp sge i32 %34, 80
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %38
38: ; preds = %36, %33
br label %39
39: ; preds = %38, %31
br label %40
40: ; preds = %39, %26
%41 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%43 = load i32, i32* %2
%44 = icmp sgt i32 %43, 79
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0))
br label %59
47: ; preds = %40
%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 ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0))
br label %58
52: ; preds = %47
%53 = load i32, i32* %2
%54 = icmp sge i32 %53, 70
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
br label %57
57: ; preds = %55, %52
br label %58
58: ; preds = %57, %50
br label %59
59: ; preds = %58, %45
%60 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%61 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%62 = load i32, i32* %2
%63 = icmp sgt i32 %62, 69
br i1 %63, label %64, label %66
64: ; preds = %59
%65 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.9, i64 0, i64 0))
br label %78
66: ; preds = %59
%67 = load i32, i32* %2
%68 = icmp slt i32 %67, 60
br i1 %68, label %69, label %71
69: ; preds = %66
%70 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.9, i64 0, i64 0))
br label %77
71: ; preds = %66
%72 = load i32, i32* %2
%73 = icmp sge i32 %72, 60
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %76
76: ; preds = %74, %71
br label %77
77: ; preds = %76, %69
br label %78
78: ; preds = %77, %64
%79 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%80 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%81 = load i32, i32* %2
%82 = icmp sgt i32 %81, 59
br i1 %82, label %83, label %85
83: ; preds = %78
%84 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0))
br label %97
85: ; preds = %78
%86 = load i32, i32* %2
%87 = icmp slt i32 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0))
br label %96
90: ; preds = %85
%91 = load i32, i32* %2
%92 = icmp sge i32 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %90
%94 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
br label %95
95: ; preds = %93, %90
br label %96
96: ; preds = %95, %88
br label %97
97: ; preds = %96, %83
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Enter the student's grade: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [19 x i8] c"Letter grade is: A\00"
@str.13 = [19 x i8] c"Letter grade is: B\00"
@str.14 = [19 x i8] c"Letter grade is: C\00"
@str.15 = [19 x i8] c"Letter grade is: D\00"
@str.16 = [19 x i8] c"Letter grade is: F\00"
@str.18 = [49 x i8] c"Invalid grade entered. Expected 0 <= grade <= 59\00"
@str.20 = [50 x i8] c"Invalid grade entered. Expected 60 <= grade <= 69\00"
@str.22 = [50 x i8] c"Invalid grade entered. Expected 70 <= grade <= 79\00"
@str.24 = [50 x i8] c"Invalid grade entered. Expected 80 <= grade <= 89\00"
@str.25 = [52 x i8] c"Invalid grade entered. Expected 90 <= grade <= 100\00"
@str.26 = [49 x i8] c"Invalid grade entered.Expected 0 <= grade <= 100\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 sgt i32 %5, 100
%7 = icmp slt i32 %5, 90
%8 = select i1 %7, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @str.25, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0)
%9 = select i1 %6, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @str.26, i64 0, i64 0), i8* %8
%10 = call i32 @puts(i8* dereferenceable(1) %9)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 89
%15 = icmp slt i32 %13, 80
%16 = select i1 %15, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.24, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0)
%17 = select i1 %14, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.24, i64 0, i64 0), i8* %16
%18 = call i32 @puts(i8* dereferenceable(1) %17)
%19 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = icmp sgt i32 %21, 79
%23 = icmp slt i32 %21, 70
%24 = select i1 %23, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.22, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0)
%25 = select i1 %22, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.22, i64 0, i64 0), i8* %24
%26 = call i32 @puts(i8* dereferenceable(1) %25)
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
%30 = icmp sgt i32 %29, 69
%31 = icmp slt i32 %29, 60
%32 = select i1 %31, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.20, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.15, i64 0, i64 0)
%33 = select i1 %30, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.20, i64 0, i64 0), i8* %32
%34 = call i32 @puts(i8* dereferenceable(1) %33)
%35 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%37 = load i32, i32* %1
%38 = icmp sgt i32 %37, 59
%39 = icmp slt i32 %37, 0
%40 = select i1 %39, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @str.18, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.16, i64 0, i64 0)
%41 = select i1 %38, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @str.18, i64 0, i64 0), i8* %40
%42 = call i32 @puts(i8* dereferenceable(1) %41)
ret i32 0
}