#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 *, float *, ...);
int main() {
  float A, B, C, D;
  float score;
  printf("Enter thresholds for A, B, C, D\nin that order, decreasing "
         "percentages > ");
  scanf("%f %f %f %f", &A, &B, &C, &D);
  printf("Thank you. Now enter student score (percent) >  ");
  scanf("%f", &score);
  if (score >= A) {
    printf("Student has an A grade");
  } else if (score < A && score >= B) {
    printf("Student has an B grade\n");
  } else if (score < B && score >= C) {
    printf("Studetn has an C grade\n");
  } else if (score < C && score >= D) {
    printf("Student has an D grade\n");
  } else {
    printf("Student has failed the course\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xef5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1197 <main+0x77>
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
jmp    124b <main+0x12b>
movss  -0x18(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11ca <main+0xaa>
movss  -0x18(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     11ca <main+0xaa>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
jmp    1246 <main+0x126>
movss  -0x18(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11fd <main+0xdd>
movss  -0x18(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     11fd <main+0xdd>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    1241 <main+0x121>
movss  -0x18(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1230 <main+0x110>
movss  -0x18(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     1230 <main+0x110>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    123c <main+0x11c>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
jmp    1241 <main+0x121>
jmp    1246 <main+0x126>
jmp    124b <main+0x12b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xf02(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeec(%rip),%rdi
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jae    11ab <main+0x7b>
ucomiss %xmm0,%xmm1
movss  0x10(%rsp),%xmm1
jbe    11b9 <main+0x89>
ucomiss %xmm1,%xmm0
jb     11b9 <main+0x89>
lea    0xf40(%rip),%rdi
jmp    11ee <main+0xbe>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
jmp    11f3 <main+0xc3>
ucomiss %xmm0,%xmm1
movss  0xc(%rsp),%xmm1
jbe    11d2 <main+0xa2>
ucomiss %xmm1,%xmm0
jb     11d2 <main+0xa2>
lea    0xf02(%rip),%rdi
jmp    11ee <main+0xbe>
ucomiss %xmm0,%xmm1
jbe    11e7 <main+0xb7>
ucomiss 0x8(%rsp),%xmm0
jb     11e7 <main+0xb7>
lea    0xed6(%rip),%rdi
jmp    11ee <main+0xbe>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [73 x i8] c"Enter thresholds for A, B, C, D\0Ain that order, decreasing percentages > \00"
@.str.1 = [12 x i8] c"%f %f %f %f\00"
@.str.2 = [49 x i8] c"Thank you. Now enter student score (percent) > \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [23 x i8] c"Student has an A grade\00"
@.str.5 = [24 x i8] c"Student has an B grade\0A\00"
@.str.6 = [24 x i8] c"Studetn has an C grade\0A\00"
@.str.7 = [24 x i8] c"Student has an D grade\0A\00"
@.str.8 = [31 x i8] c"Student has failed the course\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3, float* %4, float* %5)
%9 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %6)
%11 = load float, float* %6
%12 = load float, float* %2
%13 = fcmp oge float %11, %12
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %51
16: ; preds = %0
%17 = load float, float* %6
%18 = load float, float* %2
%19 = fcmp olt float %17, %18
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = load float, float* %6
%22 = load float, float* %3
%23 = fcmp oge float %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %50
26: ; preds = %20, %16
%27 = load float, float* %6
%28 = load float, float* %3
%29 = fcmp olt float %27, %28
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load float, float* %6
%32 = load float, float* %4
%33 = fcmp oge float %31, %32
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %49
36: ; preds = %30, %26
%37 = load float, float* %6
%38 = load float, float* %4
%39 = fcmp olt float %37, %38
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load float, float* %6
%42 = load float, float* %5
%43 = fcmp oge float %41, %42
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
br label %48
46: ; preds = %40, %36
%47 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
br label %49
49: ; preds = %48, %34
br label %50
50: ; preds = %49, %24
br label %51
51: ; preds = %50, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [73 x i8] c"Enter thresholds for A, B, C, D\0Ain that order, decreasing percentages > \00"
@.str.1 = [12 x i8] c"%f %f %f %f\00"
@.str.2 = [49 x i8] c"Thank you. Now enter student score (percent) > \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [23 x i8] c"Student has an A grade\00"
@str = [30 x i8] c"Student has failed the course\00"
@str.9 = [23 x i8] c"Student has an D grade\00"
@str.10 = [23 x i8] c"Studetn has an C grade\00"
@str.11 = [23 x i8] c"Student has an B grade\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast float* %3 to i8*
%9 = bitcast float* %4 to i8*
%10 = bitcast float* %5 to i8*
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2, float* %3, float* %4)
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %5)
%15 = load float, float* %5
%16 = load float, float* %1
%17 = fcmp ult float %15, %16
br i1 %17, label %20, label %18
18: ; preds = %0
%19 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %43
20: ; preds = %0
%21 = fcmp uge float %15, %16
%22 = load float, float* %2
%23 = fcmp ult float %15, %22
%24 = select i1 %21, i1 true, i1 %23
br i1 %24, label %27, label %25
25: ; preds = %20
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0))
br label %43
27: ; preds = %20
%28 = fcmp uge float %15, %22
%29 = load float, float* %3
%30 = fcmp ult float %15, %29
%31 = select i1 %28, i1 true, i1 %30
br i1 %31, label %34, label %32
32: ; preds = %27
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
br label %43
34: ; preds = %27
%35 = fcmp uge float %15, %29
%36 = load float, float* %4
%37 = fcmp ult float %15, %36
%38 = select i1 %35, i1 true, i1 %37
br i1 %38, label %41, label %39
39: ; preds = %34
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.9, i64 0, i64 0))
br label %43
41: ; preds = %34
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %43
43: ; preds = %25, %39, %41, %32, %18
ret i32 0
}