#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 hsl_value_int(double, double, double);
void hsl_to_rgb_int(unsigned int *hue, unsigned int *saturation,
                    unsigned int *lightness) {
  double h, s, l;
  h = *hue;
  s = *saturation;
  l = *lightness;
  if (s == 0) {
    *hue = (int)l;
    *lightness = (int)l;
    *saturation = (int)l;
  } else {
    double m1, m2;
    if (l < 128)
      m2 = (l * (255 + s)) / 65025.0;
    else
      m2 = (l + s - (l * s) / 255.0) / 255.0;
    m1 = (l / 127.5) - m2;
    *hue = hsl_value_int(m1, m2, h + 85);
    *saturation = hsl_value_int(m1, m2, h);
    *lightness = hsl_value_int(m1, m2, h - 85);
  }
}


x86 assembly (clang, -O0):
<hsl_to_rgb_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1192 <hsl_to_rgb_int+0x82>
jp     1192 <hsl_to_rgb_int+0x82>
cvttsd2si -0x30(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
cvttsd2si -0x30(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
cvttsd2si -0x30(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1289 <hsl_to_rgb_int+0x179>
movsd  0xe66(%rip),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11d1 <hsl_to_rgb_int+0xc1>
movsd  -0x30(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1206 <hsl_to_rgb_int+0xf6>
movsd  -0x30(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  0xe1b(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  0xe0b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe0d(%rip),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  0xde5(%rip),%xmm2
addsd  -0x20(%rbp),%xmm2
call   1030 <hsl_value_int@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <hsl_value_int@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  0xda0(%rip),%xmm3
subsd  %xmm3,%xmm2
call   1030 <hsl_value_int@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hsl_to_rgb_int>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rsi),%ecx
mov    (%rdx),%eax
test   %ecx,%ecx
je     1157 <hsl_to_rgb_int+0x47>
mov    (%r15),%edx
cvtsi2sd %rdx,%xmm3
cvtsi2sd %rcx,%xmm1
cvtsi2sd %rax,%xmm2
cmp    $0x7f,%eax
ja     1164 <hsl_to_rgb_int+0x54>
addsd  0xeb7(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  0xeb3(%rip),%xmm1
jmp    1188 <hsl_to_rgb_int+0x78>
mov    %eax,(%r15)
mov    %eax,(%r14)
mov    %eax,(%rbx)
jmp    11f9 <hsl_to_rgb_int+0xe9>
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm1
movsd  0xe88(%rip),%xmm4
divsd  %xmm4,%xmm1
subsd  %xmm1,%xmm0
divsd  %xmm4,%xmm0
movapd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
divsd  0xe7a(%rip),%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
movsd  %xmm2,0x18(%rsp)
movsd  0xe6c(%rip),%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm3,0x8(%rsp)
call   1030 <hsl_value_int@plt>
mov    %eax,(%r15)
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1030 <hsl_value_int@plt>
mov    %eax,(%rbx)
movsd  0x8(%rsp),%xmm2
addsd  0xe3b(%rip),%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <hsl_value_int@plt>
mov    %eax,(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @hsl_to_rgb_int(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = uitofp i32 %13 to double
store double %14, double* %7
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = uitofp i32 %16 to double
store double %17, double* %8
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = uitofp i32 %19 to double
store double %20, double* %9
%21 = load double, double* %8
%22 = fcmp oeq double %21, 0.000000e+00
br i1 %22, label %23, label %33
23: ; preds = %3
%24 = load double, double* %9
%25 = fptosi double %24 to i32
%26 = load i32*, i32** %4
store i32 %25, i32* %26
%27 = load double, double* %9
%28 = fptosi double %27 to i32
%29 = load i32*, i32** %6
store i32 %28, i32* %29
%30 = load double, double* %9
%31 = fptosi double %30 to i32
%32 = load i32*, i32** %5
store i32 %31, i32* %32
br label %74
33: ; preds = %3
%34 = load double, double* %9
%35 = fcmp olt double %34, 1.280000e+02
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = load double, double* %9
%38 = load double, double* %8
%39 = fadd double 2.550000e+02, %38
%40 = fmul double %37, %39
%41 = fdiv double %40, 6.502500e+04
store double %41, double* %11
br label %52
42: ; preds = %33
%43 = load double, double* %9
%44 = load double, double* %8
%45 = fadd double %43, %44
%46 = load double, double* %9
%47 = load double, double* %8
%48 = fmul double %46, %47
%49 = fdiv double %48, 2.550000e+02
%50 = fsub double %45, %49
%51 = fdiv double %50, 2.550000e+02
store double %51, double* %11
br label %52
52: ; preds = %42, %36
%53 = load double, double* %9
%54 = fdiv double %53, 1.275000e+02
%55 = load double, double* %11
%56 = fsub double %54, %55
store double %56, double* %10
%57 = load double, double* %10
%58 = load double, double* %11
%59 = load double, double* %7
%60 = fadd double %59, 8.500000e+01
%61 = call i32 @hsl_value_int(double %57, double %58, double %60)
%62 = load i32*, i32** %4
store i32 %61, i32* %62
%63 = load double, double* %10
%64 = load double, double* %11
%65 = load double, double* %7
%66 = call i32 @hsl_value_int(double %63, double %64, double %65)
%67 = load i32*, i32** %5
store i32 %66, i32* %67
%68 = load double, double* %10
%69 = load double, double* %11
%70 = load double, double* %7
%71 = fsub double %70, 8.500000e+01
%72 = call i32 @hsl_value_int(double %68, double %69, double %71)
%73 = load i32*, i32** %6
store i32 %72, i32* %73
br label %74
74: ; preds = %52, %23
ret void
}

LLVM IR (-O2):
define void @hsl_to_rgb_int(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = uitofp i32 %4 to double
%6 = load i32, i32* %1
%7 = uitofp i32 %6 to double
%8 = load i32, i32* %2
%9 = uitofp i32 %8 to double
%10 = icmp eq i32 %6, 0
br i1 %10, label %11, label %12
11: ; preds = %3
store i32 %8, i32* %0
store i32 %8, i32* %2
store i32 %8, i32* %1
br label %33
12: ; preds = %3
%13 = icmp ult i32 %8, 128
br i1 %13, label %14, label %18
14: ; preds = %12
%15 = fadd double %7, 2.550000e+02
%16 = fmul double %15, %9
%17 = fdiv double %16, 6.502500e+04
br label %24
18: ; preds = %12
%19 = fadd double %7, %9
%20 = fmul double %7, %9
%21 = fdiv double %20, 2.550000e+02
%22 = fsub double %19, %21
%23 = fdiv double %22, 2.550000e+02
br label %24
24: ; preds = %18, %14
%25 = phi double [ %17, %14 ], [ %23, %18 ]
%26 = fdiv double %9, 1.275000e+02
%27 = fsub double %26, %25
%28 = fadd double %5, 8.500000e+01
%29 = tail call i32 @hsl_value_int(double %27, double %25, double %28)
store i32 %29, i32* %0
%30 = tail call i32 @hsl_value_int(double %27, double %25, double %5)
store i32 %30, i32* %1
%31 = fadd double %5, -8.500000e+01
%32 = tail call i32 @hsl_value_int(double %27, double %25, double %31)
store i32 %32, i32* %2
br label %33
33: ; preds = %24, %11
ret void
}