char find_grade(float student_score, float a, float b, float c, float d) {
  char grade;
  if (student_score >= a)
    grade = 'A';
  else if (student_score >= b)
    grade = 'B';
  else if (student_score >= c)
    grade = 'C';
  else if (student_score >= d)
    grade = 'D';
  else
    grade = 'F';
  return (grade);
}


x86 assembly (clang, -O0):
<find_grade>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1135 <find_grade+0x35>
movb   $0x41,-0x15(%rbp)
jmp    1190 <find_grade+0x90>
movss  -0x4(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     114d <find_grade+0x4d>
movb   $0x42,-0x15(%rbp)
jmp    118b <find_grade+0x8b>
movss  -0x4(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     1165 <find_grade+0x65>
movb   $0x43,-0x15(%rbp)
jmp    1186 <find_grade+0x86>
movss  -0x4(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     117d <find_grade+0x7d>
movb   $0x44,-0x15(%rbp)
jmp    1181 <find_grade+0x81>
movb   $0x46,-0x15(%rbp)
jmp    1186 <find_grade+0x86>
jmp    118b <find_grade+0x8b>
jmp    1190 <find_grade+0x90>
movsbl -0x15(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_grade>:
mov    $0x41,%al
ucomiss %xmm1,%xmm0
jae    111f <find_grade+0x1f>
mov    $0x42,%al
ucomiss %xmm2,%xmm0
jae    111f <find_grade+0x1f>
mov    $0x43,%al
ucomiss %xmm3,%xmm0
jae    111f <find_grade+0x1f>
ucomiss %xmm4,%xmm0
setb   %al
add    %al,%al
or     $0x44,%al
ret

LLVM IR (-O0):
define signext i8 @find_grade(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca i8
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%12 = load float, float* %6
%13 = load float, float* %7
%14 = fcmp oge float %12, %13
br i1 %14, label %15, label %16
15: ; preds = %5
store i8 65, i8* %11
br label %35
16: ; preds = %5
%17 = load float, float* %6
%18 = load float, float* %8
%19 = fcmp oge float %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i8 66, i8* %11
br label %34
21: ; preds = %16
%22 = load float, float* %6
%23 = load float, float* %9
%24 = fcmp oge float %22, %23
br i1 %24, label %25, label %26
25: ; preds = %21
store i8 67, i8* %11
br label %33
26: ; preds = %21
%27 = load float, float* %6
%28 = load float, float* %10
%29 = fcmp oge float %27, %28
br i1 %29, label %30, label %31
30: ; preds = %26
store i8 68, i8* %11
br label %32
31: ; preds = %26
store i8 70, i8* %11
br label %32
32: ; preds = %31, %30
br label %33
33: ; preds = %32, %25
br label %34
34: ; preds = %33, %20
br label %35
35: ; preds = %34, %15
%36 = load i8, i8* %11
ret i8 %36
}

LLVM IR (-O2):
define signext i8 @find_grade(float %0, float %1, float %2, float %3, float %4) {
%6 = fcmp ult float %0, %1
br i1 %6, label %7, label %14
7: ; preds = %5
%8 = fcmp ult float %0, %2
br i1 %8, label %9, label %14
9: ; preds = %7
%10 = fcmp ult float %0, %3
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = fcmp ult float %0, %4
%13 = select i1 %12, i8 70, i8 68
br label %14
14: ; preds = %11, %9, %7, %5
%15 = phi i8 [ 65, %5 ], [ 66, %7 ], [ 67, %9 ], [ %13, %11 ]
ret i8 %15
}