int HSLValueInt(double n1, double n2, double Hue) {
  double Value;
  if (Hue > 255.0)
    Hue -= 255.0;
  else if (Hue < 0.0)
    Hue += 255.0;
  if (Hue < 42.5)
    Value = n1 + (n2 - n1) * (Hue / 42.5);
  else if (Hue < 127.5)
    Value = n2;
  else if (Hue < 170.0)
    Value = n1 + (n2 - n1) * ((170.0 - Hue) / 42.5);
  else
    Value = n1;
  return ((int)(((Value)*255.0) + 0.5));
}


x86 assembly (clang, -O0):
<HSLValueInt>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xee0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1145 <HSLValueInt+0x45>
movsd  -0x18(%rbp),%xmm0
movsd  0xec9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    116a <HSLValueInt+0x6a>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1165 <HSLValueInt+0x65>
movsd  0xea5(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    116a <HSLValueInt+0x6a>
movsd  0xe96(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11af <HSLValueInt+0xaf>
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe6f(%rip),%xmm3
divsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1232 <HSLValueInt+0x132>
movsd  0xe59(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11d1 <HSLValueInt+0xd1>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    122d <HSLValueInt+0x12d>
movsd  0xe3f(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    121e <HSLValueInt+0x11e>
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xe1d(%rip),%xmm2
subsd  -0x18(%rbp),%xmm2
movsd  0xe00(%rip),%xmm3
divsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1228 <HSLValueInt+0x128>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    122d <HSLValueInt+0x12d>
jmp    1232 <HSLValueInt+0x132>
movsd  -0x20(%rbp),%xmm0
movsd  0xdc1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd5(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HSLValueInt>:
ucomisd 0xef8(%rip),%xmm2
jbe    1114 <HSLValueInt+0x14>
addsd  0xef6(%rip),%xmm2
jmp    1126 <HSLValueInt+0x26>
xorpd  %xmm3,%xmm3
ucomisd %xmm2,%xmm3
jbe    1126 <HSLValueInt+0x26>
addsd  0xeda(%rip),%xmm2
movsd  0xee2(%rip),%xmm3
ucomisd %xmm2,%xmm3
jbe    114e <HSLValueInt+0x4e>
subsd  %xmm0,%xmm1
divsd  0xed0(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm2,%xmm1
jmp    118c <HSLValueInt+0x8c>
movsd  0xec2(%rip),%xmm3
ucomisd %xmm2,%xmm3
ja     118c <HSLValueInt+0x8c>
movsd  0xebc(%rip),%xmm3
ucomisd %xmm2,%xmm3
jbe    1188 <HSLValueInt+0x88>
subsd  %xmm0,%xmm1
subsd  %xmm2,%xmm3
divsd  0xe96(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm3,%xmm1
jmp    118c <HSLValueInt+0x8c>
movapd %xmm0,%xmm1
mulsd  0xe6c(%rip),%xmm1
addsd  0xe8c(%rip),%xmm1
cvttsd2si %xmm1,%eax
ret

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

LLVM IR (-O2):
define i32 @HSLValueInt(double %0, double %1, double %2) {
%4 = fcmp ogt double %2, 2.550000e+02
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = fadd double %2, -2.550000e+02
br label %11
7: ; preds = %3
%8 = fcmp olt double %2, 0.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = fadd double %2, 2.550000e+02
br label %11
11: ; preds = %7, %9, %5
%12 = phi double [ %6, %5 ], [ %10, %9 ], [ %2, %7 ]
%13 = fcmp olt double %12, 4.250000e+01
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = fsub double %1, %0
%16 = fdiv double %12, 4.250000e+01
%17 = tail call double @llvm.fmuladd.f64(double %15, double %16, double %0)
br label %27
18: ; preds = %11
%19 = fcmp olt double %12, 1.275000e+02
br i1 %19, label %27, label %20
20: ; preds = %18
%21 = fcmp olt double %12, 1.700000e+02
br i1 %21, label %22, label %27
22: ; preds = %20
%23 = fsub double %1, %0
%24 = fsub double 1.700000e+02, %12
%25 = fdiv double %24, 4.250000e+01
%26 = tail call double @llvm.fmuladd.f64(double %23, double %25, double %0)
br label %27
27: ; preds = %20, %18, %22, %14
%28 = phi double [ %17, %14 ], [ %26, %22 ], [ %1, %18 ], [ %0, %20 ]
%29 = tail call double @llvm.fmuladd.f64(double %28, double 2.550000e+02, double 5.000000e-01)
%30 = fptosi double %29 to i32
ret i32 %30
}