#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) && (grade >= 90)) {
    printf("Congrats, you got a A!\n\n");
  } else if ((grade <= 89) && (grade >= 80)) {
    printf("You got a B!\n\n");
  } else if ((grade <= 79) && (grade >= 70)) {
    printf("You got a C\n\n");
  } else if ((grade <= 69) && (grade >= 60)) {
    printf("You got a D\n\n");
  } else if ((grade <= 59) && (grade >= 0)) {
    printf("You got a F\n\n");
  } else if (grade < 0) {
    printf("Invalid grade entered.  Expected 0 <= grade <= 100\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)
jg     1170 <main+0x50>
cmpl   $0x5a,-0x8(%rbp)
jl     1170 <main+0x50>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
jmp    1233 <main+0x113>
cmpl   $0x59,-0x8(%rbp)
jg     1195 <main+0x75>
cmpl   $0x50,-0x8(%rbp)
jl     1195 <main+0x75>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <main+0x10e>
cmpl   $0x4f,-0x8(%rbp)
jg     11ba <main+0x9a>
cmpl   $0x46,-0x8(%rbp)
jl     11ba <main+0x9a>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    1229 <main+0x109>
cmpl   $0x45,-0x8(%rbp)
jg     11df <main+0xbf>
cmpl   $0x3c,-0x8(%rbp)
jl     11df <main+0xbf>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <main+0x104>
cmpl   $0x3b,-0x8(%rbp)
jg     1204 <main+0xe4>
cmpl   $0x0,-0x8(%rbp)
jl     1204 <main+0xe4>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
jmp    121f <main+0xff>
cmpl   $0x0,-0x8(%rbp)
jge    121a <main+0xfa>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
jmp    121f <main+0xff>
jmp    1224 <main+0x104>
jmp    1229 <main+0x109>
jmp    122e <main+0x10e>
jmp    1233 <main+0x113>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x5a(%rax),%ecx
cmp    $0xb,%ecx
jae    1163 <main+0x33>
lea    0xf26(%rip),%rdi
jmp    11af <main+0x7f>
lea    -0x50(%rax),%ecx
cmp    $0xa,%ecx
jae    1174 <main+0x44>
lea    0xf07(%rip),%rdi
jmp    11af <main+0x7f>
lea    -0x46(%rax),%ecx
cmp    $0xa,%ecx
jae    1185 <main+0x55>
lea    0xee9(%rip),%rdi
jmp    11af <main+0x7f>
lea    -0x3c(%rax),%ecx
cmp    $0xa,%ecx
jae    1196 <main+0x66>
lea    0xecb(%rip),%rdi
jmp    11af <main+0x7f>
cmp    $0x3c,%eax
jae    11a4 <main+0x74>
lea    0xeb0(%rip),%rdi
jmp    11af <main+0x7f>
test   %eax,%eax
jns    11b4 <main+0x84>
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
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 = [25 x i8] c"Congrats, you got a A!\0A\0A\00"
@.str.3 = [15 x i8] c"You got a B!\0A\0A\00"
@.str.4 = [14 x i8] c"You got a C\0A\0A\00"
@.str.5 = [14 x i8] c"You got a D\0A\0A\00"
@.str.6 = [14 x i8] c"You got a F\0A\0A\00"
@.str.7 = [52 x i8] c"Invalid grade entered. Expected 0 <= grade <= 100\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 sle i32 %5, 100
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp sge i32 %8, 90
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %54
12: ; preds = %7, %0
%13 = load i32, i32* %2
%14 = icmp sle i32 %13, 89
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sge i32 %16, 80
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %53
20: ; preds = %15, %12
%21 = load i32, i32* %2
%22 = icmp sle i32 %21, 79
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %2
%25 = icmp sge i32 %24, 70
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %52
28: ; preds = %23, %20
%29 = load i32, i32* %2
%30 = icmp sle i32 %29, 69
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp sge i32 %32, 60
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %51
36: ; preds = %31, %28
%37 = load i32, i32* %2
%38 = icmp sle i32 %37, 59
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = load i32, i32* %2
%41 = icmp sge i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %50
44: ; preds = %39, %36
%45 = load i32, i32* %2
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
br label %50
50: ; preds = %49, %42
br label %51
51: ; preds = %50, %34
br label %52
52: ; preds = %51, %26
br label %53
53: ; preds = %52, %18
br label %54
54: ; preds = %53, %10
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 = [51 x i8] c"Invalid grade entered. Expected 0 <= grade <= 100\00"
@str.8 = [13 x i8] c"You got a F\0A\00"
@str.9 = [13 x i8] c"You got a D\0A\00"
@str.10 = [13 x i8] c"You got a C\0A\00"
@str.11 = [14 x i8] c"You got a B!\0A\00"
@str.12 = [24 x i8] c"Congrats, you got a A!\0A\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 = add i32 %5, -90
%7 = icmp ult i32 %6, 11
br i1 %7, label %21, label %8
8: ; preds = %0
%9 = add i32 %5, -80
%10 = icmp ult i32 %9, 10
br i1 %10, label %21, label %11
11: ; preds = %8
%12 = add i32 %5, -70
%13 = icmp ult i32 %12, 10
br i1 %13, label %21, label %14
14: ; preds = %11
%15 = add i32 %5, -60
%16 = icmp ult i32 %15, 10
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = icmp ult i32 %5, 60
br i1 %18, label %21, label %19
19: ; preds = %17
%20 = icmp slt i32 %5, 0
br i1 %20, label %21, label %24
21: ; preds = %19, %17, %14, %11, %8, %0
%22 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @str.12, i64 0, i64 0), %0 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str.11, i64 0, i64 0), %8 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str.9, i64 0, i64 0), %14 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0), %17 ], [ getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0), %19 ]
%23 = call i32 @puts(i8* dereferenceable(1) %22)
br label %24
24: ; preds = %21, %19
ret i32 0
}