#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 */
double _hue_to_rgb(double, double, double);
void hsl_to_rgb(double hsl[3], double rgb[3]) {
  double H = hsl[0], S = hsl[1], L = hsl[2];
  if (S == 0) {
    rgb[0] = rgb[1] = rgb[2] = L;
  } else {
    double q = (L < 0.5) ? L * (S + 1) : L + S - L * S;
    double p = 2 * L - q;
    rgb[0] = _hue_to_rgb(p, q, H + 1.0 / 3.0);
    rgb[1] = _hue_to_rgb(p, q, H);
    rgb[2] = _hue_to_rgb(p, q, H - 1.0 / 3.0);
  }
}


x86 assembly (clang, -O0):
<hsl_to_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1185 <hsl_to_rgb+0x75>
jp     1185 <hsl_to_rgb+0x75>
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1292 <hsl_to_rgb+0x182>
movsd  0xe73(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11b8 <hsl_to_rgb+0xa8>
movsd  -0x28(%rbp),%xmm0
movsd  0xe63(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11f0 <hsl_to_rgb+0xe0>
movsd  -0x28(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xdd6(%rip),%xmm2
addsd  -0x18(%rbp),%xmm2
call   1030 <_hue_to_rgb@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1030 <_hue_to_rgb@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  0xd90(%rip),%xmm3
subsd  %xmm3,%xmm2
call   1030 <_hue_to_rgb@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hsl_to_rgb>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
movsd  0x8(%rdi),%xmm2
movsd  0x10(%rdi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm2
jne    1141 <hsl_to_rgb+0x31>
jp     1141 <hsl_to_rgb+0x31>
movsd  %xmm0,0x10(%rbx)
movsd  %xmm0,0x8(%rbx)
movsd  %xmm0,(%rbx)
jmp    11e4 <hsl_to_rgb+0xd4>
movsd  (%rdi),%xmm3
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1161 <hsl_to_rgb+0x51>
addsd  0xead(%rip),%xmm2
mulsd  %xmm0,%xmm2
jmp    1171 <hsl_to_rgb+0x61>
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm2
subsd  %xmm1,%xmm2
addsd  %xmm0,%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
movapd %xmm2,%xmm1
movsd  %xmm2,0x10(%rsp)
movsd  0xe7f(%rip),%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm3,0x8(%rsp)
call   1030 <_hue_to_rgb@plt>
movsd  %xmm0,(%rbx)
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1030 <_hue_to_rgb@plt>
movsd  %xmm0,0x8(%rbx)
movsd  0x8(%rsp),%xmm2
addsd  0xe4a(%rip),%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <_hue_to_rgb@plt>
movsd  %xmm0,0x10(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @hsl_to_rgb(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
store double %12, double* %5
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double, double* %14
store double %15, double* %6
%16 = load double*, double** %3
%17 = getelementptr inbounds double, double* %16, i64 2
%18 = load double, double* %17
store double %18, double* %7
%19 = load double, double* %6
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %29
21: ; preds = %2
%22 = load double, double* %7
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 2
store double %22, double* %24
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 1
store double %22, double* %26
%27 = load double*, double** %4
%28 = getelementptr inbounds double, double* %27, i64 0
store double %22, double* %28
br label %71
29: ; preds = %2
%30 = load double, double* %7
%31 = fcmp olt double %30, 5.000000e-01
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load double, double* %7
%34 = load double, double* %6
%35 = fadd double %34, 1.000000e+00
%36 = fmul double %33, %35
br label %45
37: ; preds = %29
%38 = load double, double* %7
%39 = load double, double* %6
%40 = fadd double %38, %39
%41 = load double, double* %7
%42 = load double, double* %6
%43 = fneg double %41
%44 = call double @llvm.fmuladd.f64(double %43, double %42, double %40)
br label %45
45: ; preds = %37, %32
%46 = phi double [ %36, %32 ], [ %44, %37 ]
store double %46, double* %8
%47 = load double, double* %7
%48 = load double, double* %8
%49 = fneg double %48
%50 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %47, double %49)
store double %50, double* %9
%51 = load double, double* %9
%52 = load double, double* %8
%53 = load double, double* %5
%54 = fadd double %53, 0x3FD5555555555555
%55 = call double @_hue_to_rgb(double %51, double %52, double %54)
%56 = load double*, double** %4
%57 = getelementptr inbounds double, double* %56, i64 0
store double %55, double* %57
%58 = load double, double* %9
%59 = load double, double* %8
%60 = load double, double* %5
%61 = call double @_hue_to_rgb(double %58, double %59, double %60)
%62 = load double*, double** %4
%63 = getelementptr inbounds double, double* %62, i64 1
store double %61, double* %63
%64 = load double, double* %9
%65 = load double, double* %8
%66 = load double, double* %5
%67 = fsub double %66, 0x3FD5555555555555
%68 = call double @_hue_to_rgb(double %64, double %65, double %67)
%69 = load double*, double** %4
%70 = getelementptr inbounds double, double* %69, i64 2
store double %68, double* %70
br label %71
71: ; preds = %45, %21
ret void
}

LLVM IR (-O2):
define void @hsl_to_rgb(double* nocapture %0, double* nocapture writeonly %1) {
%3 = load double, double* %0
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = fcmp oeq double %5, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = getelementptr inbounds double, double* %1, i64 2
store double %7, double* %10
%11 = getelementptr inbounds double, double* %1, i64 1
store double %7, double* %11
store double %7, double* %1
br label %32
12: ; preds = %2
%13 = fcmp olt double %7, 5.000000e-01
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = fadd double %5, 1.000000e+00
%16 = fmul double %7, %15
br label %21
17: ; preds = %12
%18 = fadd double %5, %7
%19 = fneg double %7
%20 = tail call double @llvm.fmuladd.f64(double %19, double %5, double %18)
br label %21
21: ; preds = %17, %14
%22 = phi double [ %16, %14 ], [ %20, %17 ]
%23 = fneg double %22
%24 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %23)
%25 = fadd double %3, 0x3FD5555555555555
%26 = tail call double @_hue_to_rgb(double %24, double %22, double %25)
store double %26, double* %1
%27 = tail call double @_hue_to_rgb(double %24, double %22, double %3)
%28 = getelementptr inbounds double, double* %1, i64 1
store double %27, double* %28
%29 = fadd double %3, 0xBFD5555555555555
%30 = tail call double @_hue_to_rgb(double %24, double %22, double %29)
%31 = getelementptr inbounds double, double* %1, i64 2
store double %30, double* %31
br label %32
32: ; preds = %21, %9
ret void
}