#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("Please enter your numerical grade\n");
  scanf("%d", &grade);
  if (grade > 100) {
    printf("Invalid grade entered. Expected 0 <= grade <= 100");
  } else if (grade < 0) {
    printf("Invalid grade entered. Expected 0 <= grade <= 100");
  } else if (grade >= 90) {
    printf("\nYou got an A!!!\n");
  } else if (grade >= 80) {
    printf("\nYou got a B!!\n");
  } else if (grade >= 70) {
    printf("\nYou got a C!\n");
  } else if (grade >= 60) {
    printf("\nYou got a D...\n");
  } else {
    printf("\nYou got an 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    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jle    1166 <main+0x46>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    1212 <main+0xf2>
cmpl   $0x0,-0x8(%rbp)
jge    1181 <main+0x61>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    120d <main+0xed>
cmpl   $0x5a,-0x8(%rbp)
jl     119c <main+0x7c>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
jmp    1208 <main+0xe8>
cmpl   $0x50,-0x8(%rbp)
jl     11b7 <main+0x97>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    1203 <main+0xe3>
cmpl   $0x46,-0x8(%rbp)
jl     11d2 <main+0xb2>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xde>
cmpl   $0x3c,-0x8(%rbp)
jl     11ed <main+0xcd>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    11f9 <main+0xd9>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xde>
jmp    1203 <main+0xe3>
jmp    1208 <main+0xe8>
jmp    120d <main+0xed>
jmp    1212 <main+0xf2>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x65,%eax
jge    1169 <main+0x39>
test   %eax,%eax
js     1169 <main+0x39>
cmp    $0x5a,%eax
jb     1177 <main+0x47>
lea    0xf2e(%rip),%rdi
jmp    11a8 <main+0x78>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
jmp    11ad <main+0x7d>
cmp    $0x50,%eax
jb     1185 <main+0x55>
lea    0xf03(%rip),%rdi
jmp    11a8 <main+0x78>
cmp    $0x46,%eax
jb     1193 <main+0x63>
lea    0xee7(%rip),%rdi
jmp    11a8 <main+0x78>
cmp    $0x3c,%eax
jb     11a1 <main+0x71>
lea    0xec9(%rip),%rdi
jmp    11a8 <main+0x78>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Please enter your numerical grade\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"Invalid grade entered. Expected 0 <= grade <= 100\00"
@.str.3 = [18 x i8] c"\0AYou got an A!!!\0A\00"
@.str.4 = [16 x i8] c"\0AYou got a B!!\0A\00"
@.str.5 = [15 x i8] c"\0AYou got a C!\0A\00"
@.str.6 = [17 x i8] c"\0AYou got a D...\0A\00"
@.str.7 = [18 x i8] c"\0AYou got an F...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 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 %41
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 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %40
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 ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %39
19: ; preds = %14
%20 = load i32, i32* %2
%21 = icmp sge i32 %20, 80
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %38
24: ; preds = %19
%25 = load i32, i32* %2
%26 = icmp sge i32 %25, 70
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %37
29: ; preds = %24
%30 = load i32, i32* %2
%31 = icmp sge i32 %30, 60
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %36
34: ; preds = %29
%35 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %37
37: ; preds = %36, %27
br label %38
38: ; preds = %37, %22
br label %39
39: ; preds = %38, %17
br label %40
40: ; preds = %39, %12
br label %41
41: ; preds = %40, %7
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [50 x i8] c"Invalid grade entered. Expected 0 <= grade <= 100\00"
@str = [34 x i8] c"Please enter your numerical grade\00"
@str.8 = [17 x i8] c"\0AYou got an F...\00"
@str.9 = [16 x i8] c"\0AYou got a D...\00"
@str.10 = [14 x i8] c"\0AYou got a C!\00"
@str.11 = [15 x i8] c"\0AYou got a B!!\00"
@str.12 = [17 x i8] c"\0AYou got an A!!!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 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
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %31
9: ; preds = %0
%10 = icmp slt i32 %5, 0
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %31
13: ; preds = %9
%14 = icmp ugt i32 %5, 89
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
br label %31
17: ; preds = %13
%18 = icmp ugt i32 %5, 79
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.11, i64 0, i64 0))
br label %31
21: ; preds = %17
%22 = icmp ugt i32 %5, 69
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.10, i64 0, i64 0))
br label %31
25: ; preds = %21
%26 = icmp ugt i32 %5, 59
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.9, i64 0, i64 0))
br label %31
29: ; preds = %25
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
br label %31
31: ; preds = %11, %19, %27, %29, %23, %15, %7
ret i32 0
}