double _hue_to_rgb(double p, double q, double t) {
  if (t < 0.0)
    t++;
  if (t > 1.0)
    t--;
  if (t < 1.0 / 6.0)
    return p + (q - p) * 6 * t;
  if (t < 1.0 / 2.0)
    return q;
  if (t < 2.0 / 3.0)
    return p + (q - p) * (2.0 / 3.0 - t) * 6.0;
  return p;
}


x86 assembly (clang, -O0):
<_hue_to_rgb>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1133 <_hue_to_rgb+0x33>
movsd  0xed7(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xec0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115c <_hue_to_rgb+0x5c>
movsd  0xeb6(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeac(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11a1 <_hue_to_rgb+0xa1>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xea2(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121a <_hue_to_rgb+0x11a>
movsd  0xe6f(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11c3 <_hue_to_rgb+0xc3>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121a <_hue_to_rgb+0x11a>
movsd  0xe55(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1210 <_hue_to_rgb+0x110>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xe33(%rip),%xmm2
subsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xe2a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    121a <_hue_to_rgb+0x11a>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hue_to_rgb>:
movsd  0xef8(%rip),%xmm3
movapd %xmm2,%xmm4
addsd  %xmm3,%xmm4
xorpd  %xmm5,%xmm5
movapd %xmm2,%xmm6
cmpltsd %xmm5,%xmm6
andpd  %xmm6,%xmm4
andnpd %xmm2,%xmm6
orpd   %xmm4,%xmm6
cmpltsd %xmm6,%xmm3
movapd %xmm6,%xmm2
addsd  0xece(%rip),%xmm2
andpd  %xmm3,%xmm2
andnpd %xmm6,%xmm3
orpd   %xmm2,%xmm3
movsd  0xec2(%rip),%xmm2
ucomisd %xmm3,%xmm2
jbe    116d <_hue_to_rgb+0x6d>
subsd  %xmm0,%xmm1
mulsd  0xec8(%rip),%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret
movsd  0xea3(%rip),%xmm2
ucomisd %xmm3,%xmm2
ja     11a9 <_hue_to_rgb+0xa9>
movsd  0xe9d(%rip),%xmm2
ucomisd %xmm3,%xmm2
jbe    11a6 <_hue_to_rgb+0xa6>
subsd  %xmm0,%xmm1
subsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0xe8b(%rip),%xmm2
addsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
ret
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @_hue_to_rgb(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %7
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load double, double* %7
%12 = fadd double %11, 1.000000e+00
store double %12, double* %7
br label %13
13: ; preds = %10, %3
%14 = load double, double* %7
%15 = fcmp ogt double %14, 1.000000e+00
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load double, double* %7
%18 = fadd double %17, -1.000000e+00
store double %18, double* %7
br label %19
19: ; preds = %16, %13
%20 = load double, double* %7
%21 = fcmp olt double %20, 0x3FC5555555555555
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load double, double* %5
%24 = load double, double* %6
%25 = load double, double* %5
%26 = fsub double %24, %25
%27 = fmul double %26, 6.000000e+00
%28 = load double, double* %7
%29 = call double @llvm.fmuladd.f64(double %27, double %28, double %23)
store double %29, double* %4
br label %49
30: ; preds = %19
%31 = load double, double* %7
%32 = fcmp olt double %31, 5.000000e-01
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = load double, double* %6
store double %34, double* %4
br label %49
35: ; preds = %30
%36 = load double, double* %7
%37 = fcmp olt double %36, 0x3FE5555555555555
br i1 %37, label %38, label %47
38: ; preds = %35
%39 = load double, double* %5
%40 = load double, double* %6
%41 = load double, double* %5
%42 = fsub double %40, %41
%43 = load double, double* %7
%44 = fsub double 0x3FE5555555555555, %43
%45 = fmul double %42, %44
%46 = call double @llvm.fmuladd.f64(double %45, double 6.000000e+00, double %39)
store double %46, double* %4
br label %49
47: ; preds = %35
%48 = load double, double* %5
store double %48, double* %4
br label %49
49: ; preds = %47, %38, %33, %22
%50 = load double, double* %4
ret double %50
}

LLVM IR (-O2):
define double @_hue_to_rgb(double %0, double %1, double %2) {
%4 = fcmp olt double %2, 0.000000e+00
%5 = fadd double %2, 1.000000e+00
%6 = select i1 %4, double %5, double %2
%7 = fcmp ogt double %6, 1.000000e+00
%8 = fadd double %6, -1.000000e+00
%9 = select i1 %7, double %8, double %6
%10 = fcmp olt double %9, 0x3FC5555555555555
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = fsub double %1, %0
%13 = fmul double %12, 6.000000e+00
%14 = tail call double @llvm.fmuladd.f64(double %13, double %9, double %0)
br label %24
15: ; preds = %3
%16 = fcmp olt double %9, 5.000000e-01
br i1 %16, label %24, label %17
17: ; preds = %15
%18 = fcmp olt double %9, 0x3FE5555555555555
br i1 %18, label %19, label %24
19: ; preds = %17
%20 = fsub double %1, %0
%21 = fsub double 0x3FE5555555555555, %9
%22 = fmul double %20, %21
%23 = tail call double @llvm.fmuladd.f64(double %22, double 6.000000e+00, double %0)
br label %24
24: ; preds = %17, %15, %19, %11
%25 = phi double [ %14, %11 ], [ %23, %19 ], [ %1, %15 ], [ %0, %17 ]
ret double %25
}