#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 *, float *, float *, float *);
int main() {
  float a, b, c, d;
  double per;
  printf("Enter thresholds for A, B, C, D\n");
  printf("in that order, decreasing percentages > ");
  scanf("%f"
        "%f"
        "%f"
        "%f",
        &a, &b, &c, &d);
  per = (a + b + c + d) / 4;
  if (per < 60)
    printf("Thank you. Now enter student score (percent) >Student has an B "
           "grade\n");
  else if (per >= 60 && per < 70)
    printf("Thank you. Now enter student score (percent) >Student has an B "
           "grade\n");
  else if (per >= 70 && per < 80)
    printf("Thank you. Now enter student score (percent) >Student has an B "
           "grade\n");
  else if (per >= 80)
    printf("Thank you. Now enter student score (percent) >Student has an B "
           "grade\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  0xe99(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe6c(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11b0 <main+0x90>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    1258 <main+0x138>
movsd  -0x20(%rbp),%xmm0
movsd  0xe43(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11eb <main+0xcb>
movsd  0xe39(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11eb <main+0xcb>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    1253 <main+0x133>
movsd  -0x20(%rbp),%xmm0
movsd  0xe10(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1226 <main+0x106>
movsd  0xe06(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1226 <main+0x106>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
jmp    124e <main+0x12e>
movsd  -0x20(%rbp),%xmm0
movsd  0xddd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1249 <main+0x129>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    124e <main+0x12e>
jmp    1253 <main+0x133>
jmp    1258 <main+0x138>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <scanf@plt>
movss  0x14(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
mulss  0xe74(%rip),%xmm0
movss  0xe70(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     11ce <main+0x9e>
ucomiss 0xe64(%rip),%xmm0
jb     11af <main+0x7f>
movss  0xe5e(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     11ce <main+0x9e>
ucomiss 0xe52(%rip),%xmm0
jb     11c5 <main+0x95>
movss  0xe4c(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     11ce <main+0x9e>
ucomiss 0xe40(%rip),%xmm0
jb     11da <main+0xaa>
lea    0xe8d(%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 = [70 x i8] c"Thank you. Now enter student score (percent) >Student has an B grade\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca double
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 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), float* %2, float* %3, float* %4, float* %5)
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fadd float %10, %11
%13 = load float, float* %4
%14 = fadd float %12, %13
%15 = load float, float* %5
%16 = fadd float %14, %15
%17 = fdiv float %16, 4.000000e+00
%18 = fpext float %17 to double
store double %18, double* %6
%19 = load double, double* %6
%20 = fcmp olt double %19, 6.000000e+01
br i1 %20, label %21, label %23
21: ; preds = %0
%22 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
br label %47
23: ; preds = %0
%24 = load double, double* %6
%25 = fcmp oge double %24, 6.000000e+01
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load double, double* %6
%28 = fcmp olt double %27, 7.000000e+01
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
br label %46
31: ; preds = %26, %23
%32 = load double, double* %6
%33 = fcmp oge double %32, 7.000000e+01
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load double, double* %6
%36 = fcmp olt double %35, 8.000000e+01
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
br label %45
39: ; preds = %34, %31
%40 = load double, double* %6
%41 = fcmp oge double %40, 8.000000e+01
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %42, %39
br label %45
45: ; preds = %44, %37
br label %46
46: ; preds = %45, %29
br label %47
47: ; preds = %46, %21
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 = [32 x i8] c"Enter thresholds for A, B, C, D\00"
@str.7 = [69 x i8] c"Thank you. Now enter student score (percent) >Student has an B grade\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), float* %1, float* %2, float* %3, float* %4)
%12 = load float, float* %1
%13 = load float, float* %2
%14 = fadd float %12, %13
%15 = load float, float* %3
%16 = fadd float %14, %15
%17 = load float, float* %4
%18 = fadd float %16, %17
%19 = fmul float %18, 2.500000e-01
%20 = fcmp olt float %19, 6.000000e+01
br i1 %20, label %31, label %21
21: ; preds = %0
%22 = fcmp oge float %19, 6.000000e+01
%23 = fcmp olt float %19, 7.000000e+01
%24 = and i1 %22, %23
br i1 %24, label %31, label %25
25: ; preds = %21
%26 = fcmp oge float %19, 7.000000e+01
%27 = fcmp olt float %19, 8.000000e+01
%28 = and i1 %26, %27
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = fcmp ult float %19, 8.000000e+01
br i1 %30, label %34, label %31
31: ; preds = %29, %25, %21, %0
%32 = phi i8* [ getelementptr inbounds ([69 x i8], [69 x i8]* @str.7, i64 0, i64 0), %0 ], [ getelementptr inbounds ([69 x i8], [69 x i8]* @str.7, i64 0, i64 0), %21 ], [ getelementptr inbounds ([69 x i8], [69 x i8]* @str.7, i64 0, i64 0), %25 ], [ getelementptr inbounds ([69 x i8], [69 x i8]* @str.7, i64 0, i64 0), %29 ]
%33 = call i32 @puts(i8* dereferenceable(1) %32)
br label %34
34: ; preds = %31, %29
ret i32 0
}