#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*/ die(char *);
char grade(double score) {
  if ((score < 0) || (score > 100))
    die("Score is outside range [0, 100].\n");
  if (score >= 85)
    return 'A';
  if (score >= 75)
    return 'B';
  if (score >= 65)
    return 'C';
  if (score >= 50)
    return 'D';
  if (score >= 0)
    return 'F';
}


x86 assembly (clang, -O0):
<grade>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     1142 <grade+0x32>
movsd  -0x10(%rbp),%xmm0
movsd  0xec8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    114e <grade+0x3e>
lea    0xedf(%rip),%rdi
call   1030 <die@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xead(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     116e <grade+0x5e>
movb   $0x41,-0x1(%rbp)
jmp    11e4 <grade+0xd4>
movsd  -0x10(%rbp),%xmm0
movsd  0xe95(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     118e <grade+0x7e>
movb   $0x42,-0x1(%rbp)
jmp    11e4 <grade+0xd4>
movsd  -0x10(%rbp),%xmm0
movsd  0xe7d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11ae <grade+0x9e>
movb   $0x43,-0x1(%rbp)
jmp    11e4 <grade+0xd4>
movsd  -0x10(%rbp),%xmm0
movsd  0xe65(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11ce <grade+0xbe>
movb   $0x44,-0x1(%rbp)
jmp    11e4 <grade+0xd4>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11e4 <grade+0xd4>
movb   $0x46,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grade>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1125 <grade+0x15>
ucomisd 0xedd(%rip),%xmm0
jbe    113b <grade+0x2b>
lea    0xefc(%rip),%rdi
movsd  %xmm0,(%rsp)
call   1030 <die@plt>
movsd  (%rsp),%xmm0
mov    $0x41,%al
ucomisd 0xec3(%rip),%xmm0
jae    116d <grade+0x5d>
mov    $0x42,%al
ucomisd 0xebf(%rip),%xmm0
jae    116d <grade+0x5d>
mov    $0x43,%al
ucomisd 0xebb(%rip),%xmm0
jae    116d <grade+0x5d>
mov    $0x44,%al
ucomisd 0xeb7(%rip),%xmm0
jae    116d <grade+0x5d>
mov    $0x46,%al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Score is outside range [0, 100].\0A\00"
define signext i8 @grade(double %0) {
%2 = alloca i8
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load double, double* %3
%8 = fcmp ogt double %7, 1.000000e+02
br i1 %8, label %9, label %11
9: ; preds = %6, %1
%10 = call i32 @die(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = load double, double* %3
%13 = fcmp oge double %12, 8.500000e+01
br i1 %13, label %14, label %15
14: ; preds = %11
store i8 65, i8* %2
br label %31
15: ; preds = %11
%16 = load double, double* %3
%17 = fcmp oge double %16, 7.500000e+01
br i1 %17, label %18, label %19
18: ; preds = %15
store i8 66, i8* %2
br label %31
19: ; preds = %15
%20 = load double, double* %3
%21 = fcmp oge double %20, 6.500000e+01
br i1 %21, label %22, label %23
22: ; preds = %19
store i8 67, i8* %2
br label %31
23: ; preds = %19
%24 = load double, double* %3
%25 = fcmp oge double %24, 5.000000e+01
br i1 %25, label %26, label %27
26: ; preds = %23
store i8 68, i8* %2
br label %31
27: ; preds = %23
%28 = load double, double* %3
%29 = fcmp oge double %28, 0.000000e+00
br i1 %29, label %30, label %31
30: ; preds = %27
store i8 70, i8* %2
br label %31
31: ; preds = %14, %18, %22, %26, %30, %27
%32 = load i8, i8* %2
ret i8 %32
}

LLVM IR (-O2):
@.str = [34 x i8] c"Score is outside range [0, 100].\0A\00"
define signext i8 @grade(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 1.000000e+02
%4 = or i1 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @die(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %1, %5
%8 = fcmp ult double %0, 8.500000e+01
br i1 %8, label %9, label %16
9: ; preds = %7
%10 = fcmp ult double %0, 7.500000e+01
br i1 %10, label %11, label %16
11: ; preds = %9
%12 = fcmp ult double %0, 6.500000e+01
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = fcmp ult double %0, 5.000000e+01
br i1 %14, label %15, label %16
15: ; preds = %13
br label %16
16: ; preds = %15, %13, %11, %9, %7
%17 = phi i8 [ 65, %7 ], [ 66, %9 ], [ 67, %11 ], [ 68, %13 ], [ 70, %15 ]
ret i8 %17
}