#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_D(char *D, double grad) {
  if (grad >= 22.5 && grad < 67.5)
    strcpy(D, "1");
  else if (grad >= 67.5 && grad < 112.5)
    strcpy(D, "2");
  else if (grad >= 112.5 && grad < 157.5)
    strcpy(D, "3");
  else if (grad >= 157.5 && grad < 202.5)
    strcpy(D, "4");
  else if (grad >= 202.5 && grad < 247.5)
    strcpy(D, "5");
  else if (grad >= 247.5 && grad < 292.5)
    strcpy(D, "6");
  else if (grad >= 292.5 && grad < 337.5)
    strcpy(D, "7");
  else if ((grad >= 337.5 && grad <= 360.0) || (grad > 0.0 && grad < 22.5))
    strcpy(D, "8");
  else if (grad == 0.0)
    strcpy(D, "0");
  else
    strcpy(D, "9");
  return D;
}


x86 assembly (clang, -O0):
<grad_to_D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1160 <grad_to_D+0x50>
movsd  0xec8(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1160 <grad_to_D+0x50>
mov    -0x8(%rbp),%rdi
lea    0xef2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13a3 <grad_to_D+0x293>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     119f <grad_to_D+0x8f>
movsd  0xe91(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    119f <grad_to_D+0x8f>
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <strcpy@plt>
jmp    139e <grad_to_D+0x28e>
movsd  -0x10(%rbp),%xmm0
movsd  0xe64(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11de <grad_to_D+0xce>
movsd  0xe5a(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11de <grad_to_D+0xce>
mov    -0x8(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1399 <grad_to_D+0x289>
movsd  -0x10(%rbp),%xmm0
movsd  0xe2d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     121d <grad_to_D+0x10d>
movsd  0xe23(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    121d <grad_to_D+0x10d>
mov    -0x8(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1394 <grad_to_D+0x284>
movsd  -0x10(%rbp),%xmm0
movsd  0xdf6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     125c <grad_to_D+0x14c>
movsd  0xdec(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    125c <grad_to_D+0x14c>
mov    -0x8(%rbp),%rdi
lea    0xdfe(%rip),%rsi
call   1030 <strcpy@plt>
jmp    138f <grad_to_D+0x27f>
movsd  -0x10(%rbp),%xmm0
movsd  0xdbf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     129b <grad_to_D+0x18b>
movsd  0xdb5(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    129b <grad_to_D+0x18b>
mov    -0x8(%rbp),%rdi
lea    0xdc1(%rip),%rsi
call   1030 <strcpy@plt>
jmp    138a <grad_to_D+0x27a>
movsd  -0x10(%rbp),%xmm0
movsd  0xd88(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12da <grad_to_D+0x1ca>
movsd  0xd7e(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12da <grad_to_D+0x1ca>
mov    -0x8(%rbp),%rdi
lea    0xd84(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1385 <grad_to_D+0x275>
movsd  -0x10(%rbp),%xmm0
movsd  0xd51(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1304 <grad_to_D+0x1f4>
movsd  0xd47(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    1329 <grad_to_D+0x219>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    133e <grad_to_D+0x22e>
movsd  0xce2(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    133e <grad_to_D+0x22e>
mov    -0x8(%rbp),%rdi
lea    0xd22(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1380 <grad_to_D+0x270>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    136b <grad_to_D+0x25b>
jp     136b <grad_to_D+0x25b>
mov    -0x8(%rbp),%rdi
lea    0xcf7(%rip),%rsi
call   1030 <strcpy@plt>
jmp    137b <grad_to_D+0x26b>
mov    -0x8(%rbp),%rdi
lea    0xce4(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1380 <grad_to_D+0x270>
jmp    1385 <grad_to_D+0x275>
jmp    138a <grad_to_D+0x27a>
jmp    138f <grad_to_D+0x27f>
jmp    1394 <grad_to_D+0x284>
jmp    1399 <grad_to_D+0x289>
jmp    139e <grad_to_D+0x28e>
jmp    13a3 <grad_to_D+0x293>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grad_to_D>:
push   %rbx
mov    %rdi,%rbx
ucomisd 0xee4(%rip),%xmm0
jb     1138 <grad_to_D+0x28>
movsd  0xee2(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1138 <grad_to_D+0x28>
lea    0xf15(%rip),%rsi
jmp    125b <grad_to_D+0x14b>
ucomisd 0xec8(%rip),%xmm0
jb     115c <grad_to_D+0x4c>
movsd  0xec6(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    115c <grad_to_D+0x4c>
lea    0xef3(%rip),%rsi
jmp    125b <grad_to_D+0x14b>
ucomisd 0xeac(%rip),%xmm0
jb     1180 <grad_to_D+0x70>
movsd  0xeaa(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1180 <grad_to_D+0x70>
lea    0xed1(%rip),%rsi
jmp    125b <grad_to_D+0x14b>
ucomisd 0xe90(%rip),%xmm0
jb     11a4 <grad_to_D+0x94>
movsd  0xe8e(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a4 <grad_to_D+0x94>
lea    0xeaf(%rip),%rsi
jmp    125b <grad_to_D+0x14b>
ucomisd 0xe74(%rip),%xmm0
jb     11c8 <grad_to_D+0xb8>
movsd  0xe72(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11c8 <grad_to_D+0xb8>
lea    0xe8d(%rip),%rsi
jmp    125b <grad_to_D+0x14b>
ucomisd 0xe58(%rip),%xmm0
jb     11e9 <grad_to_D+0xd9>
movsd  0xe56(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11e9 <grad_to_D+0xd9>
lea    0xe6b(%rip),%rsi
jmp    125b <grad_to_D+0x14b>
ucomisd 0xe3f(%rip),%xmm0
jb     120a <grad_to_D+0xfa>
movsd  0xe3d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    120a <grad_to_D+0xfa>
lea    0xe4c(%rip),%rsi
jmp    125b <grad_to_D+0x14b>
ucomisd 0xe26(%rip),%xmm0
lea    0xe3d(%rip),%rsi
jb     1229 <grad_to_D+0x119>
movsd  0xe1d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    125b <grad_to_D+0x14b>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1241 <grad_to_D+0x131>
movsd  0xdc5(%rip),%xmm2
ucomisd %xmm0,%xmm2
ja     125b <grad_to_D+0x14b>
ucomisd %xmm1,%xmm0
lea    0xe0e(%rip),%rax
lea    0xe05(%rip),%rsi
cmovne %rax,%rsi
cmovp  %rax,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"2\00"
@.str.2 = [2 x i8] c"3\00"
@.str.3 = [2 x i8] c"4\00"
@.str.4 = [2 x i8] c"5\00"
@.str.5 = [2 x i8] c"6\00"
@.str.6 = [2 x i8] c"7\00"
@.str.7 = [2 x i8] c"8\00"
@.str.8 = [2 x i8] c"0\00"
@.str.9 = [2 x i8] c"9\00"
define i8* @grad_to_D(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 oge double %5, 2.250000e+01
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load double, double* %4
%9 = fcmp olt double %8, 6.750000e+01
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %99
13: ; preds = %7, %2
%14 = load double, double* %4
%15 = fcmp oge double %14, 6.750000e+01
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load double, double* %4
%18 = fcmp olt double %17, 1.125000e+02
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.1, i64 0, i64 0))
br label %98
22: ; preds = %16, %13
%23 = load double, double* %4
%24 = fcmp oge double %23, 1.125000e+02
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load double, double* %4
%27 = fcmp olt double %26, 1.575000e+02
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i8*, i8** %3
%30 = call i32 @strcpy(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %97
31: ; preds = %25, %22
%32 = load double, double* %4
%33 = fcmp oge double %32, 1.575000e+02
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load double, double* %4
%36 = fcmp olt double %35, 2.025000e+02
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.3, i64 0, i64 0))
br label %96
40: ; preds = %34, %31
%41 = load double, double* %4
%42 = fcmp oge double %41, 2.025000e+02
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load double, double* %4
%45 = fcmp olt double %44, 2.475000e+02
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i8*, i8** %3
%48 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %95
49: ; preds = %43, %40
%50 = load double, double* %4
%51 = fcmp oge double %50, 2.475000e+02
br i1 %51, label %52, label %58
52: ; preds = %49
%53 = load double, double* %4
%54 = fcmp olt double %53, 2.925000e+02
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.5, i64 0, i64 0))
br label %94
58: ; preds = %52, %49
%59 = load double, double* %4
%60 = fcmp oge double %59, 2.925000e+02
br i1 %60, label %61, label %67
61: ; preds = %58
%62 = load double, double* %4
%63 = fcmp olt double %62, 3.375000e+02
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = load i8*, i8** %3
%66 = call i32 @strcpy(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %93
67: ; preds = %61, %58
%68 = load double, double* %4
%69 = fcmp oge double %68, 3.375000e+02
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = load double, double* %4
%72 = fcmp ole double %71, 3.600000e+02
br i1 %72, label %79, label %73
73: ; preds = %70, %67
%74 = load double, double* %4
%75 = fcmp ogt double %74, 0.000000e+00
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = load double, double* %4
%78 = fcmp olt double %77, 2.250000e+01
br i1 %78, label %79, label %82
79: ; preds = %76, %70
%80 = load i8*, i8** %3
%81 = call i32 @strcpy(i8* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %92
82: ; preds = %76, %73
%83 = load double, double* %4
%84 = fcmp oeq double %83, 0.000000e+00
br i1 %84, label %85, label %88
85: ; preds = %82
%86 = load i8*, i8** %3
%87 = call i32 @strcpy(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %91
88: ; preds = %82
%89 = load i8*, i8** %3
%90 = call i32 @strcpy(i8* %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %91
91: ; preds = %88, %85
br label %92
92: ; preds = %91, %79
br label %93
93: ; preds = %92, %64
br label %94
94: ; preds = %93, %55
br label %95
95: ; preds = %94, %46
br label %96
96: ; preds = %95, %37
br label %97
97: ; preds = %96, %28
br label %98
98: ; preds = %97, %19
br label %99
99: ; preds = %98, %10
%100 = load i8*, i8** %3
ret i8* %100
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"2\00"
@.str.2 = [2 x i8] c"3\00"
@.str.3 = [2 x i8] c"4\00"
@.str.4 = [2 x i8] c"5\00"
@.str.5 = [2 x i8] c"6\00"
@.str.6 = [2 x i8] c"7\00"
@.str.7 = [2 x i8] c"8\00"
@.str.8 = [2 x i8] c"0\00"
@.str.9 = [2 x i8] c"9\00"
define i8* @grad_to_D(i8* returned %0, double %1) {
%3 = fcmp oge double %1, 2.250000e+01
%4 = fcmp olt double %1, 6.750000e+01
%5 = and i1 %3, %4
br i1 %5, label %41, label %6
6: ; preds = %2
%7 = fcmp oge double %1, 6.750000e+01
%8 = fcmp olt double %1, 1.125000e+02
%9 = and i1 %7, %8
br i1 %9, label %41, label %10
10: ; preds = %6
%11 = fcmp oge double %1, 1.125000e+02
%12 = fcmp olt double %1, 1.575000e+02
%13 = and i1 %11, %12
br i1 %13, label %41, label %14
14: ; preds = %10
%15 = fcmp oge double %1, 1.575000e+02
%16 = fcmp olt double %1, 2.025000e+02
%17 = and i1 %15, %16
br i1 %17, label %41, label %18
18: ; preds = %14
%19 = fcmp oge double %1, 2.025000e+02
%20 = fcmp olt double %1, 2.475000e+02
%21 = and i1 %19, %20
br i1 %21, label %41, label %22
22: ; preds = %18
%23 = fcmp oge double %1, 2.475000e+02
%24 = fcmp olt double %1, 2.925000e+02
%25 = and i1 %23, %24
br i1 %25, label %41, label %26
26: ; preds = %22
%27 = fcmp oge double %1, 2.925000e+02
%28 = fcmp olt double %1, 3.375000e+02
%29 = and i1 %27, %28
br i1 %29, label %41, label %30
30: ; preds = %26
%31 = fcmp oge double %1, 3.375000e+02
%32 = fcmp ole double %1, 3.600000e+02
%33 = and i1 %31, %32
br i1 %33, label %41, label %34
34: ; preds = %30
%35 = fcmp ogt double %1, 0.000000e+00
%36 = fcmp olt double %1, 2.250000e+01
%37 = and i1 %35, %36
br i1 %37, label %41, label %38
38: ; preds = %34
%39 = fcmp oeq double %1, 0.000000e+00
%40 = select i1 %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0)
br label %41
41: ; preds = %38, %30, %34, %26, %22, %18, %14, %10, %6, %2
%42 = 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), %6 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %10 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %14 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), %18 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %22 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %26 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), %34 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), %30 ], [ %40, %38 ]
%43 = tail call i32 @strcpy(i8* %0, i8* %42)
ret i8* %0
}