#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("Yay! You got an A!");
  } else if ((grade >= 80) && (grade <= 89)) {
    printf("Good job, you got a B!");
  } else if ((grade >= 70) && (grade <= 79)) {
    printf("You got a C.");
  } else if ((grade >= 60) && (grade <= 69)) {
    printf("You got a D.");
  } else if (grade <= 59) {
    printf("You failed, you a 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    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jge    1170 <main+0x50>
cmpl   $0x5a,-0x8(%rbp)
jl     1170 <main+0x50>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
jmp    1209 <main+0xe9>
cmpl   $0x50,-0x8(%rbp)
jl     1195 <main+0x75>
cmpl   $0x59,-0x8(%rbp)
jg     1195 <main+0x75>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    1204 <main+0xe4>
cmpl   $0x46,-0x8(%rbp)
jl     11ba <main+0x9a>
cmpl   $0x4f,-0x8(%rbp)
jg     11ba <main+0x9a>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    11ff <main+0xdf>
cmpl   $0x3c,-0x8(%rbp)
jl     11df <main+0xbf>
cmpl   $0x45,-0x8(%rbp)
jg     11df <main+0xbf>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    11fa <main+0xda>
cmpl   $0x3b,-0x8(%rbp)
jg     11f5 <main+0xd5>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
jmp    11fa <main+0xda>
jmp    11ff <main+0xdf>
jmp    1204 <main+0xe4>
jmp    1209 <main+0xe9>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x5a(%rax),%ecx
cmp    $0xa,%ecx
jae    1153 <main+0x33>
lea    0xece(%rip),%rdi
jmp    1192 <main+0x72>
lea    -0x50(%rax),%ecx
cmp    $0xa,%ecx
jae    1164 <main+0x44>
lea    0xed0(%rip),%rdi
jmp    1192 <main+0x72>
lea    -0x46(%rax),%ecx
cmp    $0xa,%ecx
jae    1175 <main+0x55>
lea    0xed6(%rip),%rdi
jmp    1192 <main+0x72>
lea    -0x3c(%rax),%ecx
cmp    $0xa,%ecx
jae    1186 <main+0x66>
lea    0xed2(%rip),%rdi
jmp    1192 <main+0x72>
cmp    $0x3b,%eax
jg     1197 <main+0x77>
lea    0xed1(%rip),%rdi
call   1030 <printf@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 = [19 x i8] c"Yay! You got an A!\00"
@.str.3 = [23 x i8] c"Good job, you got a B!\00"
@.str.4 = [13 x i8] c"You got a C.\00"
@.str.5 = [13 x i8] c"You got a D.\00"
@.str.6 = [21 x i8] c"You failed, you a F.\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 slt 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 ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %45
12: ; preds = %7, %0
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 80
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sle i32 %16, 89
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %44
20: ; preds = %15, %12
%21 = load i32, i32* %2
%22 = icmp sge i32 %21, 70
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %2
%25 = icmp sle i32 %24, 79
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %43
28: ; preds = %23, %20
%29 = load i32, i32* %2
%30 = icmp sge i32 %29, 60
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp sle i32 %32, 69
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %42
36: ; preds = %31, %28
%37 = load i32, i32* %2
%38 = icmp sle i32 %37, 59
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
br label %42
42: ; preds = %41, %34
br label %43
43: ; preds = %42, %26
br label %44
44: ; preds = %43, %18
br label %45
45: ; preds = %44, %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.2 = [19 x i8] c"Yay! You got an A!\00"
@.str.3 = [23 x i8] c"Good job, you got a B!\00"
@.str.4 = [13 x i8] c"You got a C.\00"
@.str.5 = [13 x i8] c"You got a D.\00"
@.str.6 = [21 x i8] c"You failed, you a F.\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, 10
br i1 %7, label %19, label %8
8: ; preds = %0
%9 = add i32 %5, -80
%10 = icmp ult i32 %9, 10
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = add i32 %5, -70
%13 = icmp ult i32 %12, 10
br i1 %13, label %19, label %14
14: ; preds = %11
%15 = add i32 %5, -60
%16 = icmp ult i32 %15, 10
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = icmp slt i32 %5, 60
br i1 %18, label %19, label %22
19: ; preds = %17, %14, %11, %8, %0
%20 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %0 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), %11 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), %14 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), %17 ]
%21 = call i32 @printf(i8* dereferenceable(1) %20)
br label %22
22: ; preds = %19, %17
ret i32 0
}