#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 n, a, b, c, d;
  printf("Enter thresholds for A, B, C, D\n");
  printf("in that order, decreasing percentages > ");
  scanf("%f%f%f%f", &a, &b, &c, &d);
  printf("Thank you. Now enter student score (percent) >");
  scanf("%f", &n);
  if (n >= a)
    printf("Student has an A grade\n");
  if ((n < a) && (n >= b))
    printf("Student has an B grade\n");
  if ((n < b) && (n >= c))
    printf("Student has an C grade\n");
  if ((n < c) && (n >= d))
    printf("Student has an D grade\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    0xedf(%rip),%rdi
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     119e <main+0x7e>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11cc <main+0xac>
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     11cc <main+0xac>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11fa <main+0xda>
movss  -0x8(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     11fa <main+0xda>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1228 <main+0x108>
movss  -0x8(%rbp),%xmm0
ucomiss -0x18(%rbp),%xmm0
jb     1228 <main+0x108>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf26(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x14(%rsp),%r8
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jb     11b6 <main+0x86>
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
ucomiss %xmm0,%xmm1
movss  0xc(%rsp),%xmm1
jbe    11de <main+0xae>
ucomiss %xmm1,%xmm0
jb     11de <main+0xae>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
movss  0x8(%rsp),%xmm1
jbe    1206 <main+0xd6>
ucomiss %xmm1,%xmm0
jb     1206 <main+0xd6>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    121e <main+0xee>
ucomiss 0x14(%rsp),%xmm0
jb     121e <main+0xee>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str.1 = [41 x i8] c"in that order, decreasing percentages > \00"
@.str.2 = [9 x i8] c"%f%f%f%f\00"
@.str.3 = [47 x i8] c"Thank you. Now enter student score (percent) >\00"
@.str.4 = [3 x i8] c"%f\00"
@str = [32 x i8] c"Enter thresholds for A, B, C, D\00"
@str.9 = [23 x i8] c"Student has an D grade\00"
@str.10 = [23 x i8] c"Student has an C grade\00"
@str.11 = [23 x i8] c"Student has an B grade\00"
@str.12 = [23 x i8] c"Student has an A 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), float* %2, float* %3, float* %4, float* %5)
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %1)
%16 = load float, float* %1
%17 = load float, float* %2
%18 = fcmp ult float %16, %17
br i1 %18, label %23, label %19
19: ; preds = %0
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.12, i64 0, i64 0))
%21 = load float, float* %1
%22 = load float, float* %2
br label %23
23: ; preds = %19, %0
%24 = phi float [ %22, %19 ], [ %17, %0 ]
%25 = phi float [ %21, %19 ], [ %16, %0 ]
%26 = fcmp uge float %25, %24
%27 = load float, float* %3
%28 = fcmp ult float %25, %27
%29 = select i1 %26, i1 true, i1 %28
br i1 %29, label %34, label %30
30: ; preds = %23
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0))
%32 = load float, float* %1
%33 = load float, float* %3
br label %34
34: ; preds = %30, %23
%35 = phi float [ %33, %30 ], [ %27, %23 ]
%36 = phi float [ %32, %30 ], [ %25, %23 ]
%37 = fcmp uge float %36, %35
%38 = load float, float* %4
%39 = fcmp ult float %36, %38
%40 = select i1 %37, i1 true, i1 %39
br i1 %40, label %45, label %41
41: ; preds = %34
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
%43 = load float, float* %1
%44 = load float, float* %4
br label %45
45: ; preds = %41, %34
%46 = phi float [ %44, %41 ], [ %38, %34 ]
%47 = phi float [ %43, %41 ], [ %36, %34 ]
%48 = fcmp uge float %47, %46
%49 = load float, float* %5
%50 = fcmp ult float %47, %49
%51 = select i1 %48, i1 true, i1 %50
br i1 %51, label %54, label %52
52: ; preds = %45
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.9, i64 0, i64 0))
br label %54
54: ; preds = %52, %45
ret i32 0
}