#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 */
unsigned int bm_rgb(unsigned char, unsigned char, unsigned char);
double fabs(double);
double fmod(double, double);
unsigned int bm_hsl(double H, double S, double L) {
  double R = 0, G = 0, B = 0;
  double C, X, m;
  if (H > 0)
    H = fmod(H, 360.0);
  if (S < 0)
    S = 0;
  if (S > 100.0)
    S = 100.0;
  S /= 100.0;
  if (L < 0)
    L = 0;
  if (L > 100.0)
    L = 100;
  L /= 100.0;
  C = (1.0 - fabs(2.0 * L - 1.0)) * S;
  H = H / 60.0;
  X = C * (1.0 - fabs(fmod(H, 2.0) - 1.0));
  if (H >= 0 && H < 1) {
    R = C;
    G = X;
    B = 0;
  } else if (H < 2) {
    R = X;
    G = C;
    B = 0;
  } else if (H < 3) {
    R = 0;
    G = C;
    B = X;
  } else if (H < 4) {
    R = 0;
    G = X;
    B = C;
  } else if (H < 5) {
    R = X;
    G = 0;
    B = C;
  } else if (H < 6) {
    R = C;
    G = 0;
    B = X;
  }
  m = L - 0.5 * C;
  return bm_rgb((unsigned char)((R + m) * 255.0),
                (unsigned char)((G + m) * 255.0),
                (unsigned char)((B + m) * 255.0));
}


x86 assembly (clang, -O0):
<bm_hsl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1178 <bm_hsl+0x58>
movsd  -0x8(%rbp),%xmm0
movsd  0xe92(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    118e <bm_hsl+0x6e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b2 <bm_hsl+0x92>
movsd  0xe5b(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe49(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11de <bm_hsl+0xbe>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1202 <bm_hsl+0xe2>
movsd  0xe0b(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xdf9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xdff(%rip),%xmm0
addsd  %xmm0,%xmm1
movaps 0xe2c(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xdd0(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xdc5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd9d(%rip),%xmm1
call   1030 <fmod@plt>
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movsd  0xd80(%rip),%xmm1
subsd  %xmm1,%xmm2
movaps 0xdc5(%rip),%xmm1
pand   %xmm1,%xmm2
movsd  0xd69(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12fa <bm_hsl+0x1da>
movsd  0xd42(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    12fa <bm_hsl+0x1da>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1412 <bm_hsl+0x2f2>
movsd  0xd16(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    132e <bm_hsl+0x20e>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    140d <bm_hsl+0x2ed>
movsd  0xcfa(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1362 <bm_hsl+0x242>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1408 <bm_hsl+0x2e8>
movsd  0xcce(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1396 <bm_hsl+0x276>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1403 <bm_hsl+0x2e3>
movsd  0xca2(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    13ca <bm_hsl+0x2aa>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    13fe <bm_hsl+0x2de>
movsd  0xc76(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    13f9 <bm_hsl+0x2d9>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    13fe <bm_hsl+0x2de>
jmp    1403 <bm_hsl+0x2e3>
jmp    1408 <bm_hsl+0x2e8>
jmp    140d <bm_hsl+0x2ed>
jmp    1412 <bm_hsl+0x2f2>
movsd  -0x18(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xc2c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
addsd  %xmm2,%xmm0
movsd  0xc11(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %al,%dl
movsd  -0x28(%rbp),%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %al,%cl
movsd  -0x30(%rbp),%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movzbl %dl,%edi
movzbl %cl,%esi
movzbl %al,%edx
call   1040 <bm_rgb@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bm_hsl>:
sub    $0x18,%rsp
movapd %xmm1,%xmm4
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1155 <bm_hsl+0x35>
movsd  0xec6(%rip),%xmm1
movsd  %xmm2,0x8(%rsp)
movsd  %xmm4,(%rsp)
call   1030 <fmod@plt>
movsd  (%rsp),%xmm4
movsd  0x8(%rsp),%xmm2
xorpd  %xmm3,%xmm3
maxsd  %xmm4,%xmm3
movsd  0xea3(%rip),%xmm1
movapd %xmm1,%xmm5
minsd  %xmm3,%xmm5
divsd  %xmm1,%xmm5
xorpd  %xmm4,%xmm4
maxsd  %xmm2,%xmm4
movapd %xmm1,%xmm3
minsd  %xmm4,%xmm3
divsd  %xmm1,%xmm3
movsd  %xmm3,0x8(%rsp)
movapd %xmm3,%xmm1
addsd  %xmm3,%xmm1
addsd  0xe75(%rip),%xmm1
andpd  0xecd(%rip),%xmm1
movsd  0xe6d(%rip),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm5,%xmm2
movsd  %xmm2,0x10(%rsp)
divsd  0xe5f(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe5a(%rip),%xmm1
call   1030 <fmod@plt>
movsd  0xe3d(%rip),%xmm2
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
addsd  0xe22(%rip),%xmm0
andpd  0xe7a(%rip),%xmm0
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm4,%xmm1
ucomisd 0xe56(%rip),%xmm3
jb     121c <bm_hsl+0xfc>
ucomisd %xmm3,%xmm2
jbe    121c <bm_hsl+0xfc>
movapd %xmm4,%xmm2
movapd %xmm1,%xmm0
jmp    1232 <bm_hsl+0x112>
movsd  0xe04(%rip),%xmm0
ucomisd %xmm3,%xmm0
jbe    1282 <bm_hsl+0x162>
movapd %xmm1,%xmm2
movapd %xmm4,%xmm0
xorpd  %xmm1,%xmm1
mulsd  0xe12(%rip),%xmm4
addsd  0x8(%rsp),%xmm4
addsd  %xmm4,%xmm2
movsd  0xe08(%rip),%xmm3
mulsd  %xmm3,%xmm2
cvttsd2si %xmm2,%eax
addsd  %xmm4,%xmm0
mulsd  %xmm3,%xmm0
cvttsd2si %xmm0,%ecx
addsd  %xmm1,%xmm4
mulsd  %xmm3,%xmm4
cvttsd2si %xmm4,%edx
movzbl %al,%edi
movzbl %cl,%esi
movzbl %dl,%edx
add    $0x18,%rsp
jmp    1040 <bm_rgb@plt>
xorpd  %xmm2,%xmm2
movsd  0xda2(%rip),%xmm0
ucomisd %xmm3,%xmm0
jbe    129a <bm_hsl+0x17a>
movapd %xmm4,%xmm0
jmp    1236 <bm_hsl+0x116>
movsd  0xd96(%rip),%xmm0
ucomisd %xmm3,%xmm0
jbe    12b2 <bm_hsl+0x192>
movapd %xmm1,%xmm0
movapd %xmm4,%xmm1
jmp    1236 <bm_hsl+0x116>
xorpd  %xmm0,%xmm0
movsd  0xd82(%rip),%xmm2
ucomisd %xmm3,%xmm2
jbe    12d1 <bm_hsl+0x1b1>
movapd %xmm1,%xmm2
movapd %xmm4,%xmm1
jmp    1236 <bm_hsl+0x116>
xorpd  %xmm0,%xmm0
movsd  0xd6b(%rip),%xmm2
ucomisd %xmm3,%xmm2
jbe    12ec <bm_hsl+0x1cc>
movapd %xmm4,%xmm2
jmp    1236 <bm_hsl+0x116>
xorpd  %xmm2,%xmm2
jmp    1232 <bm_hsl+0x112>

LLVM IR (-O0):
define i32 @bm_hsl(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
%13 = load double, double* %4
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = load double, double* %4
%17 = call double @fmod(double %16, double 3.600000e+02)
store double %17, double* %4
br label %18
18: ; preds = %15, %3
%19 = load double, double* %5
%20 = fcmp olt double %19, 0.000000e+00
br i1 %20, label %21, label %22
21: ; preds = %18
store double 0.000000e+00, double* %5
br label %22
22: ; preds = %21, %18
%23 = load double, double* %5
%24 = fcmp ogt double %23, 1.000000e+02
br i1 %24, label %25, label %26
25: ; preds = %22
store double 1.000000e+02, double* %5
br label %26
26: ; preds = %25, %22
%27 = load double, double* %5
%28 = fdiv double %27, 1.000000e+02
store double %28, double* %5
%29 = load double, double* %6
%30 = fcmp olt double %29, 0.000000e+00
br i1 %30, label %31, label %32
31: ; preds = %26
store double 0.000000e+00, double* %6
br label %32
32: ; preds = %31, %26
%33 = load double, double* %6
%34 = fcmp ogt double %33, 1.000000e+02
br i1 %34, label %35, label %36
35: ; preds = %32
store double 1.000000e+02, double* %6
br label %36
36: ; preds = %35, %32
%37 = load double, double* %6
%38 = fdiv double %37, 1.000000e+02
store double %38, double* %6
%39 = load double, double* %6
%40 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %39, double -1.000000e+00)
%41 = call double @llvm.fabs.f64(double %40)
%42 = fsub double 1.000000e+00, %41
%43 = load double, double* %5
%44 = fmul double %42, %43
store double %44, double* %10
%45 = load double, double* %4
%46 = fdiv double %45, 6.000000e+01
store double %46, double* %4
%47 = load double, double* %10
%48 = load double, double* %4
%49 = call double @fmod(double %48, double 2.000000e+00)
%50 = fsub double %49, 1.000000e+00
%51 = call double @llvm.fabs.f64(double %50)
%52 = fsub double 1.000000e+00, %51
%53 = fmul double %47, %52
store double %53, double* %11
%54 = load double, double* %4
%55 = fcmp oge double %54, 0.000000e+00
br i1 %55, label %56, label %62
56: ; preds = %36
%57 = load double, double* %4
%58 = fcmp olt double %57, 1.000000e+00
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load double, double* %10
store double %60, double* %7
%61 = load double, double* %11
store double %61, double* %8
store double 0.000000e+00, double* %9
br label %97
62: ; preds = %56, %36
%63 = load double, double* %4
%64 = fcmp olt double %63, 2.000000e+00
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = load double, double* %11
store double %66, double* %7
%67 = load double, double* %10
store double %67, double* %8
store double 0.000000e+00, double* %9
br label %96
68: ; preds = %62
%69 = load double, double* %4
%70 = fcmp olt double %69, 3.000000e+00
br i1 %70, label %71, label %74
71: ; preds = %68
store double 0.000000e+00, double* %7
%72 = load double, double* %10
store double %72, double* %8
%73 = load double, double* %11
store double %73, double* %9
br label %95
74: ; preds = %68
%75 = load double, double* %4
%76 = fcmp olt double %75, 4.000000e+00
br i1 %76, label %77, label %80
77: ; preds = %74
store double 0.000000e+00, double* %7
%78 = load double, double* %11
store double %78, double* %8
%79 = load double, double* %10
store double %79, double* %9
br label %94
80: ; preds = %74
%81 = load double, double* %4
%82 = fcmp olt double %81, 5.000000e+00
br i1 %82, label %83, label %86
83: ; preds = %80
%84 = load double, double* %11
store double %84, double* %7
store double 0.000000e+00, double* %8
%85 = load double, double* %10
store double %85, double* %9
br label %93
86: ; preds = %80
%87 = load double, double* %4
%88 = fcmp olt double %87, 6.000000e+00
br i1 %88, label %89, label %92
89: ; preds = %86
%90 = load double, double* %10
store double %90, double* %7
store double 0.000000e+00, double* %8
%91 = load double, double* %11
store double %91, double* %9
br label %92
92: ; preds = %89, %86
br label %93
93: ; preds = %92, %83
br label %94
94: ; preds = %93, %77
br label %95
95: ; preds = %94, %71
br label %96
96: ; preds = %95, %65
br label %97
97: ; preds = %96, %59
%98 = load double, double* %6
%99 = load double, double* %10
%100 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %99, double %98)
store double %100, double* %12
%101 = load double, double* %7
%102 = load double, double* %12
%103 = fadd double %101, %102
%104 = fmul double %103, 2.550000e+02
%105 = fptoui double %104 to i8
%106 = load double, double* %8
%107 = load double, double* %12
%108 = fadd double %106, %107
%109 = fmul double %108, 2.550000e+02
%110 = fptoui double %109 to i8
%111 = load double, double* %9
%112 = load double, double* %12
%113 = fadd double %111, %112
%114 = fmul double %113, 2.550000e+02
%115 = fptoui double %114 to i8
%116 = call i32 @bm_rgb(i8 zeroext %105, i8 zeroext %110, i8 zeroext %115)
ret i32 %116
}

LLVM IR (-O2):
define i32 @bm_hsl(double %0, double %1, double %2) {
%4 = fcmp ogt double %0, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call double @fmod(double %0, double 3.600000e+02)
br label %7
7: ; preds = %5, %3
%8 = phi double [ %6, %5 ], [ %0, %3 ]
%9 = fcmp olt double %1, 0.000000e+00
%10 = select i1 %9, double 0.000000e+00, double %1
%11 = fcmp ogt double %10, 1.000000e+02
%12 = select i1 %11, double 1.000000e+02, double %10
%13 = fdiv double %12, 1.000000e+02
%14 = fcmp olt double %2, 0.000000e+00
%15 = select i1 %14, double 0.000000e+00, double %2
%16 = fcmp ogt double %15, 1.000000e+02
%17 = select i1 %16, double 1.000000e+02, double %15
%18 = fdiv double %17, 1.000000e+02
%19 = tail call double @llvm.fmuladd.f64(double %18, double 2.000000e+00, double -1.000000e+00)
%20 = tail call double @llvm.fabs.f64(double %19)
%21 = fsub double 1.000000e+00, %20
%22 = fmul double %13, %21
%23 = fdiv double %8, 6.000000e+01
%24 = tail call double @fmod(double %23, double 2.000000e+00)
%25 = fadd double %24, -1.000000e+00
%26 = tail call double @llvm.fabs.f64(double %25)
%27 = fsub double 1.000000e+00, %26
%28 = fmul double %22, %27
%29 = fcmp oge double %23, 0.000000e+00
%30 = fcmp olt double %23, 1.000000e+00
%31 = and i1 %29, %30
br i1 %31, label %43, label %32
32: ; preds = %7
%33 = fcmp olt double %23, 2.000000e+00
br i1 %33, label %43, label %34
34: ; preds = %32
%35 = fcmp olt double %23, 3.000000e+00
br i1 %35, label %43, label %36
36: ; preds = %34
%37 = fcmp olt double %23, 4.000000e+00
br i1 %37, label %43, label %38
38: ; preds = %36
%39 = fcmp olt double %23, 5.000000e+00
br i1 %39, label %43, label %40
40: ; preds = %38
%41 = fcmp olt double %23, 6.000000e+00
br i1 %41, label %42, label %43
42: ; preds = %40
br label %43
43: ; preds = %38, %36, %34, %32, %7, %40, %42
%44 = phi double [ %22, %42 ], [ 0.000000e+00, %40 ], [ %22, %7 ], [ %28, %32 ], [ 0.000000e+00, %34 ], [ 0.000000e+00, %36 ], [ %28, %38 ]
%45 = phi double [ 0.000000e+00, %42 ], [ 0.000000e+00, %40 ], [ %28, %7 ], [ %22, %32 ], [ %22, %34 ], [ %28, %36 ], [ 0.000000e+00, %38 ]
%46 = phi double [ %28, %42 ], [ 0.000000e+00, %40 ], [ 0.000000e+00, %7 ], [ 0.000000e+00, %32 ], [ %28, %34 ], [ %22, %36 ], [ %22, %38 ]
%47 = tail call double @llvm.fmuladd.f64(double %22, double -5.000000e-01, double %18)
%48 = fadd double %47, %44
%49 = fmul double %48, 2.550000e+02
%50 = fptoui double %49 to i8
%51 = fadd double %47, %45
%52 = fmul double %51, 2.550000e+02
%53 = fptoui double %52 to i8
%54 = fadd double %47, %46
%55 = fmul double %54, 2.550000e+02
%56 = fptoui double %55 to i8
%57 = tail call i32 @bm_rgb(i8 zeroext %50, i8 zeroext %53, i8 zeroext %56)
ret i32 %57
}