char determine_letter_grade(double percentage) {
  char letter_grade = '\0';
  if (percentage >= 90.0) {
    letter_grade = 'A';
  } else if (percentage >= 80.0) {
    letter_grade = 'B';
  } else if (percentage >= 70.0) {
    letter_grade = 'C';
  } else if (percentage >= 60.0) {
    letter_grade = 'D';
  } else {
    letter_grade = 'F';
  }
  return letter_grade;
}


x86 assembly (clang, -O0):
<determine_letter_grade>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     112d <determine_letter_grade+0x2d>
movb   $0x41,-0x9(%rbp)
jmp    11a0 <determine_letter_grade+0xa0>
movsd  -0x8(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     114d <determine_letter_grade+0x4d>
movb   $0x42,-0x9(%rbp)
jmp    119b <determine_letter_grade+0x9b>
movsd  -0x8(%rbp),%xmm0
movsd  0xeb6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     116d <determine_letter_grade+0x6d>
movb   $0x43,-0x9(%rbp)
jmp    1196 <determine_letter_grade+0x96>
movsd  -0x8(%rbp),%xmm0
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     118d <determine_letter_grade+0x8d>
movb   $0x44,-0x9(%rbp)
jmp    1191 <determine_letter_grade+0x91>
movb   $0x46,-0x9(%rbp)
jmp    1196 <determine_letter_grade+0x96>
jmp    119b <determine_letter_grade+0x9b>
jmp    11a0 <determine_letter_grade+0xa0>
movsbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<determine_letter_grade>:
mov    $0x41,%al
ucomisd 0xef6(%rip),%xmm0
jae    1133 <determine_letter_grade+0x33>
mov    $0x42,%al
ucomisd 0xef2(%rip),%xmm0
jae    1133 <determine_letter_grade+0x33>
mov    $0x43,%al
ucomisd 0xeee(%rip),%xmm0
jae    1133 <determine_letter_grade+0x33>
ucomisd 0xeec(%rip),%xmm0
setb   %al
add    %al,%al
or     $0x44,%al
ret

LLVM IR (-O0):
define signext i8 @determine_letter_grade(double %0) {
%2 = alloca double
%3 = alloca i8
store double %0, double* %2
store i8 0, i8* %3
%4 = load double, double* %2
%5 = fcmp oge double %4, 9.000000e+01
br i1 %5, label %6, label %7
6: ; preds = %1
store i8 65, i8* %3
br label %23
7: ; preds = %1
%8 = load double, double* %2
%9 = fcmp oge double %8, 8.000000e+01
br i1 %9, label %10, label %11
10: ; preds = %7
store i8 66, i8* %3
br label %22
11: ; preds = %7
%12 = load double, double* %2
%13 = fcmp oge double %12, 7.000000e+01
br i1 %13, label %14, label %15
14: ; preds = %11
store i8 67, i8* %3
br label %21
15: ; preds = %11
%16 = load double, double* %2
%17 = fcmp oge double %16, 6.000000e+01
br i1 %17, label %18, label %19
18: ; preds = %15
store i8 68, i8* %3
br label %20
19: ; preds = %15
store i8 70, i8* %3
br label %20
20: ; preds = %19, %18
br label %21
21: ; preds = %20, %14
br label %22
22: ; preds = %21, %10
br label %23
23: ; preds = %22, %6
%24 = load i8, i8* %3
ret i8 %24
}

LLVM IR (-O2):
define signext i8 @determine_letter_grade(double %0) {
%2 = fcmp ult double %0, 9.000000e+01
br i1 %2, label %3, label %10
3: ; preds = %1
%4 = fcmp ult double %0, 8.000000e+01
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = fcmp ult double %0, 7.000000e+01
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = fcmp ult double %0, 6.000000e+01
%9 = select i1 %8, i8 70, i8 68
br label %10
10: ; preds = %7, %5, %3, %1
%11 = phi i8 [ 65, %1 ], [ 66, %3 ], [ 67, %5 ], [ %9, %7 ]
ret i8 %11
}