#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(void) {
  float A, B, C, D, avg;
  printf("Enter thresholds for A, B, C, D\nin that order, decreasing "
         "percentages > ");
  scanf("%f", &A);
  scanf("%f", &B);
  scanf("%f", &C);
  scanf("%f", &D);
  printf("Thank you. Now enter student score (perrcent) >");
  scanf("%f", &avg);
  if (avg >= A)
    printf("Student has an A grade\n");
  if (avg >= B && avg < A)
    printf("Student has an B grade\n");
  if (avg >= C && avg < B)
    printf("Student has an C grade\n");
  if (avg >= D && avg < C) {
    printf("Student has an D grade\n");
  }
  if (avg < D) {
    printf("Student has an F 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    0xf07(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed7(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     11b2 <main+0x92>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     11e0 <main+0xc0>
movss  -0x18(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11e0 <main+0xc0>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     120e <main+0xee>
movss  -0x18(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    120e <main+0xee>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     123c <main+0x11c>
movss  -0x18(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    123c <main+0x11c>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    125b <main+0x13b>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xf01(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  0x1c(%rsp),%xmm2
ucomiss %xmm2,%xmm0
jb     11be <main+0x8e>
lea    0xf2b(%rip),%rdi
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
movss  0x1c(%rsp),%xmm2
movss  0x18(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jb     11e6 <main+0xb6>
ucomiss %xmm0,%xmm2
jbe    11e6 <main+0xb6>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
movss  0x18(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
ucomiss %xmm2,%xmm0
jb     120e <main+0xde>
ucomiss %xmm0,%xmm1
jbe    120e <main+0xde>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
movss  0x14(%rsp),%xmm2
movss  0x10(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jb     1236 <main+0x106>
ucomiss %xmm0,%xmm2
jbe    1236 <main+0x106>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    1247 <main+0x117>
lea    0xe3a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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