#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*/ strcpy(char *, char *);
char *grad_to_ec(char *target, double grad) {
  if (grad < 5.0)
    strcpy(target, "9");
  else if (grad < 6.5)
    strcpy(target, "8");
  else if (grad < 8.0)
    strcpy(target, "7");
  else if (grad < 10.5)
    strcpy(target, "6");
  else if (grad < 13.5)
    strcpy(target, "5");
  else if (grad < 17.5)
    strcpy(target, "4");
  else if (grad < 25.0)
    strcpy(target, "3");
  else if (grad < 40.0)
    strcpy(target, "2");
  else if (grad >= 45.0)
    strcpy(target, "1");
  else
    strcpy(target, "0");
  return target;
}


x86 assembly (clang, -O0):
<grad_to_ec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  0xed7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1149 <grad_to_ec+0x39>
mov    -0x8(%rbp),%rdi
lea    0xf09(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12c5 <grad_to_ec+0x1b5>
movsd  0xeb7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1171 <grad_to_ec+0x61>
mov    -0x8(%rbp),%rdi
lea    0xee3(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12c0 <grad_to_ec+0x1b0>
movsd  0xe97(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1199 <grad_to_ec+0x89>
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12bb <grad_to_ec+0x1ab>
movsd  0xe77(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11c1 <grad_to_ec+0xb1>
mov    -0x8(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12b6 <grad_to_ec+0x1a6>
movsd  0xe57(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11e9 <grad_to_ec+0xd9>
mov    -0x8(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12b1 <grad_to_ec+0x1a1>
movsd  0xe37(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1211 <grad_to_ec+0x101>
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ac <grad_to_ec+0x19c>
movsd  0xe17(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1239 <grad_to_ec+0x129>
mov    -0x8(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12a7 <grad_to_ec+0x197>
movsd  0xdf7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1261 <grad_to_ec+0x151>
mov    -0x8(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12a2 <grad_to_ec+0x192>
movsd  -0x10(%rbp),%xmm0
movsd  0xdd2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     128d <grad_to_ec+0x17d>
mov    -0x8(%rbp),%rdi
lea    0xdd5(%rip),%rsi
call   1030 <strcpy@plt>
jmp    129d <grad_to_ec+0x18d>
mov    -0x8(%rbp),%rdi
lea    0xdc2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12a2 <grad_to_ec+0x192>
jmp    12a7 <grad_to_ec+0x197>
jmp    12ac <grad_to_ec+0x19c>
jmp    12b1 <grad_to_ec+0x1a1>
jmp    12b6 <grad_to_ec+0x1a6>
jmp    12bb <grad_to_ec+0x1ab>
jmp    12c0 <grad_to_ec+0x1b0>
jmp    12c5 <grad_to_ec+0x1b5>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grad_to_ec>:
push   %rbx
mov    %rdi,%rbx
movsd  0xee4(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    112e <grad_to_ec+0x1e>
lea    0xf1f(%rip),%rsi
jmp    11ef <grad_to_ec+0xdf>
movsd  0xed2(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1148 <grad_to_ec+0x38>
lea    0xf07(%rip),%rsi
jmp    11ef <grad_to_ec+0xdf>
movsd  0xec0(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1162 <grad_to_ec+0x52>
lea    0xeef(%rip),%rsi
jmp    11ef <grad_to_ec+0xdf>
movsd  0xeae(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1179 <grad_to_ec+0x69>
lea    0xed7(%rip),%rsi
jmp    11ef <grad_to_ec+0xdf>
movsd  0xe9f(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1190 <grad_to_ec+0x80>
lea    0xec2(%rip),%rsi
jmp    11ef <grad_to_ec+0xdf>
movsd  0xe90(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a7 <grad_to_ec+0x97>
lea    0xead(%rip),%rsi
jmp    11ef <grad_to_ec+0xdf>
movsd  0xe81(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11be <grad_to_ec+0xae>
lea    0xe98(%rip),%rsi
jmp    11ef <grad_to_ec+0xdf>
movsd  0xe72(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11d5 <grad_to_ec+0xc5>
lea    0xe83(%rip),%rsi
jmp    11ef <grad_to_ec+0xdf>
ucomisd 0xe63(%rip),%xmm0
lea    0xe76(%rip),%rax
lea    0xe6d(%rip),%rsi
cmovb  %rax,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"9\00"
@.str.1 = [2 x i8] c"8\00"
@.str.2 = [2 x i8] c"7\00"
@.str.3 = [2 x i8] c"6\00"
@.str.4 = [2 x i8] c"5\00"
@.str.5 = [2 x i8] c"4\00"
@.str.6 = [2 x i8] c"3\00"
@.str.7 = [2 x i8] c"2\00"
@.str.8 = [2 x i8] c"1\00"
@.str.9 = [2 x i8] c"0\00"
define i8* @grad_to_ec(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp olt double %5, 5.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %69
10: ; preds = %2
%11 = load double, double* %4
%12 = fcmp olt double %11, 6.500000e+00
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %68
16: ; preds = %10
%17 = load double, double* %4
%18 = fcmp olt double %17, 8.000000e+00
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i8*, i8** %3
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %67
22: ; preds = %16
%23 = load double, double* %4
%24 = fcmp olt double %23, 1.050000e+01
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i8*, i8** %3
%27 = call i32 @strcpy(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %66
28: ; preds = %22
%29 = load double, double* %4
%30 = fcmp olt double %29, 1.350000e+01
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i8*, i8** %3
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %65
34: ; preds = %28
%35 = load double, double* %4
%36 = fcmp olt double %35, 1.750000e+01
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i8*, i8** %3
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %64
40: ; preds = %34
%41 = load double, double* %4
%42 = fcmp olt double %41, 2.500000e+01
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i8*, i8** %3
%45 = call i32 @strcpy(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %63
46: ; preds = %40
%47 = load double, double* %4
%48 = fcmp olt double %47, 4.000000e+01
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i8*, i8** %3
%51 = call i32 @strcpy(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %62
52: ; preds = %46
%53 = load double, double* %4
%54 = fcmp oge double %53, 4.500000e+01
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i8*, i8** %3
%57 = call i32 @strcpy(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %61
58: ; preds = %52
%59 = load i8*, i8** %3
%60 = call i32 @strcpy(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %61
61: ; preds = %58, %55
br label %62
62: ; preds = %61, %49
br label %63
63: ; preds = %62, %43
br label %64
64: ; preds = %63, %37
br label %65
65: ; preds = %64, %31
br label %66
66: ; preds = %65, %25
br label %67
67: ; preds = %66, %19
br label %68
68: ; preds = %67, %13
br label %69
69: ; preds = %68, %7
%70 = load i8*, i8** %3
ret i8* %70
}

LLVM IR (-O2):
@.str = [2 x i8] c"9\00"
@.str.1 = [2 x i8] c"8\00"
@.str.2 = [2 x i8] c"7\00"
@.str.3 = [2 x i8] c"6\00"
@.str.4 = [2 x i8] c"5\00"
@.str.5 = [2 x i8] c"4\00"
@.str.6 = [2 x i8] c"3\00"
@.str.7 = [2 x i8] c"2\00"
@.str.8 = [2 x i8] c"1\00"
@.str.9 = [2 x i8] c"0\00"
define i8* @grad_to_ec(i8* returned %0, double %1) {
%3 = fcmp olt double %1, 5.000000e+00
br i1 %3, label %21, label %4
4: ; preds = %2
%5 = fcmp olt double %1, 6.500000e+00
br i1 %5, label %21, label %6
6: ; preds = %4
%7 = fcmp olt double %1, 8.000000e+00
br i1 %7, label %21, label %8
8: ; preds = %6
%9 = fcmp olt double %1, 1.050000e+01
br i1 %9, label %21, label %10
10: ; preds = %8
%11 = fcmp olt double %1, 1.350000e+01
br i1 %11, label %21, label %12
12: ; preds = %10
%13 = fcmp olt double %1, 1.750000e+01
br i1 %13, label %21, label %14
14: ; preds = %12
%15 = fcmp olt double %1, 2.500000e+01
br i1 %15, label %21, label %16
16: ; preds = %14
%17 = fcmp olt double %1, 4.000000e+01
br i1 %17, label %21, label %18
18: ; preds = %16
%19 = fcmp ult double %1, 4.500000e+01
%20 = select i1 %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0)
br label %21
21: ; preds = %18, %16, %14, %12, %10, %8, %6, %4, %2
%22 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), %10 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %12 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %14 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), %16 ], [ %20, %18 ]
%23 = tail call i32 @strcpy(i8* %0, i8* %22)
ret i8* %0
}