#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("What is you percent?\n");
  scanf("%d", &grade);
  if (grade > 100) {
    printf("Invalid grade entered. Expected 0 <= grade <= 100\n");
  } else if (grade < 0) {
    printf("Invalid grade entered. Expected 0 <- grade <= 100\n");
  } else if (grade >= 90) {
    printf("You got an A\n");
  } else if (grade >= 80 && grade <= 89) {
    printf("You got a B\n");
  } else if (grade >= 70 && grade <= 79) {
    printf("You got a C\n");
  } else if (grade >= 60 && grade < 69) {
    printf("You got a D\n");
  } else if (grade >= 0 && grade <= 59) {
    printf("You got an F");
  }
  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    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jle    1166 <main+0x46>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    1249 <main+0x129>
cmpl   $0x0,-0x8(%rbp)
jge    1181 <main+0x61>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
cmpl   $0x5a,-0x8(%rbp)
jl     119c <main+0x7c>
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
jmp    123f <main+0x11f>
cmpl   $0x50,-0x8(%rbp)
jl     11c1 <main+0xa1>
cmpl   $0x59,-0x8(%rbp)
jg     11c1 <main+0xa1>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
cmpl   $0x46,-0x8(%rbp)
jl     11e6 <main+0xc6>
cmpl   $0x4f,-0x8(%rbp)
jg     11e6 <main+0xc6>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    1235 <main+0x115>
cmpl   $0x3c,-0x8(%rbp)
jl     120b <main+0xeb>
cmpl   $0x45,-0x8(%rbp)
jge    120b <main+0xeb>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    1230 <main+0x110>
cmpl   $0x0,-0x8(%rbp)
jl     122b <main+0x10b>
cmpl   $0x3b,-0x8(%rbp)
jg     122b <main+0x10b>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    1230 <main+0x110>
jmp    1235 <main+0x115>
jmp    123a <main+0x11a>
jmp    123f <main+0x11f>
jmp    1244 <main+0x124>
jmp    1249 <main+0x129>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%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
jl     1165 <main+0x35>
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
jmp    11d9 <main+0xa9>
test   %eax,%eax
js     117c <main+0x4c>
cmp    $0x5a,%eax
jb     118a <main+0x5a>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
jmp    11d9 <main+0xa9>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
jmp    11d9 <main+0xa9>
cmp    $0x50,%eax
jb     119d <main+0x6d>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
jmp    11d9 <main+0xa9>
cmp    $0x46,%eax
jb     11b0 <main+0x80>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
jmp    11d9 <main+0xa9>
cmp    $0x3c,%eax
jb     11c8 <main+0x98>
cmp    $0x45,%eax
je     11c8 <main+0x98>
lea    0xe64(%rip),%rdi
call   1030 <puts@plt>
jmp    11d9 <main+0xa9>
cmp    $0x3b,%eax
ja     11d9 <main+0xa9>
lea    0xe2f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"What is you percent?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [51 x i8] c"Invalid grade entered. Expected 0 <= grade <= 100\0A\00"
@.str.3 = [51 x i8] c"Invalid grade entered. Expected 0 <- grade <= 100\0A\00"
@.str.4 = [14 x i8] c"You got an A\0A\00"
@.str.5 = [13 x i8] c"You got a B\0A\00"
@.str.6 = [13 x i8] c"You got a C\0A\00"
@.str.7 = [13 x i8] c"You got a D\0A\00"
@.str.8 = [13 x i8] c"You got an F\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 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 ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
br label %57
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 ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
br label %56
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 ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %55
19: ; preds = %14
%20 = load i32, i32* %2
%21 = icmp sge i32 %20, 80
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i32, i32* %2
%24 = icmp sle i32 %23, 89
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %54
27: ; preds = %22, %19
%28 = load i32, i32* %2
%29 = icmp sge i32 %28, 70
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load i32, i32* %2
%32 = icmp sle i32 %31, 79
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %53
35: ; preds = %30, %27
%36 = load i32, i32* %2
%37 = icmp sge i32 %36, 60
br i1 %37, label %38, label %43
38: ; preds = %35
%39 = load i32, i32* %2
%40 = icmp slt i32 %39, 69
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %52
43: ; preds = %38, %35
%44 = load i32, i32* %2
%45 = icmp sge i32 %44, 0
br i1 %45, label %46, label %51
46: ; preds = %43
%47 = load i32, i32* %2
%48 = icmp sle i32 %47, 59
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %51
51: ; preds = %49, %46, %43
br label %52
52: ; preds = %51, %41
br label %53
53: ; preds = %52, %33
br label %54
54: ; preds = %53, %25
br label %55
55: ; preds = %54, %17
br label %56
56: ; preds = %55, %12
br label %57
57: ; preds = %56, %7
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.8 = [13 x i8] c"You got an F\00"
@str = [21 x i8] c"What is you percent?\00"
@str.9 = [12 x i8] c"You got a D\00"
@str.10 = [12 x i8] c"You got a C\00"
@str.11 = [12 x i8] c"You got a B\00"
@str.12 = [13 x i8] c"You got an A\00"
@str.13 = [50 x i8] c"Invalid grade entered. Expected 0 <- grade <= 100\00"
@str.14 = [50 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.14, 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 ([50 x i8], [50 x i8]* @str.13, 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.12, i64 0, i64 0))
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 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0))
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 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.10, i64 0, i64 0))
br label %35
25: ; preds = %21
%26 = icmp ugt i32 %5, 59
%27 = icmp ne i32 %5, 69
%28 = and i1 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0))
br label %35
31: ; preds = %25
%32 = icmp ult i32 %5, 60
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %35
35: ; preds = %11, %19, %29, %33, %31, %23, %15, %7
ret i32 0
}