#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 */
int fabs(int);
int fmod(float, int);
void NSColorHSBToRGB(float hue, float saturation, float brightness, float *redp,
                     float *greenp, float *bluep) {
  float red = brightness, green = brightness, blue = brightness;
  float H = hue * 360.f;
  float S = saturation;
  float V = brightness;
  float m = 0;
  if (V != 0) {
    float C = V * S;
    H = fmod(H, 360.f);
    H /= 60.f;
    int hueFace = H;
    float X = C * (1 - fabs(fmod(H, 2) - 1));
    switch (hueFace) {
    case 0:
      red = C;
      green = X;
      blue = 0;
      break;
    case 1:
      red = X;
      green = C;
      blue = 0;
      break;
    case 2:
      red = 0;
      green = C;
      blue = X;
      break;
    case 3:
      red = 0;
      green = X;
      blue = C;
      break;
    case 4:
      red = X;
      green = 0;
      blue = C;
      break;
    case 5:
      red = C;
      green = 0;
      blue = X;
      break;
    }
    m = V - C;
  }
  *redp = red + m;
  *greenp = green + m;
  *bluep = blue + m;
}


x86 assembly (clang, -O0):
<NSColorHSBToRGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  0xe97(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11ab <NSColorHSBToRGB+0x8b>
jp     11ab <NSColorHSBToRGB+0x8b>
jmp    1327 <NSColorHSBToRGB+0x207>
movss  -0x40(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x38(%rbp),%xmm0
mov    $0x168,%edi
call   1030 <fmod@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
movss  0xe21(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
cvttss2si -0x38(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x38(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <fmod@plt>
mov    %eax,%edi
add    $0xffffffff,%edi
call   1040 <fabs@plt>
movss  -0x5c(%rbp),%xmm0
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x4c(%rbp),%eax
mov    %rax,-0x58(%rbp)
sub    $0x5,%rax
ja     1318 <NSColorHSBToRGB+0x1f8>
mov    -0x58(%rbp),%rax
lea    0xdba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    1318 <NSColorHSBToRGB+0x1f8>
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    1318 <NSColorHSBToRGB+0x1f8>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    1318 <NSColorHSBToRGB+0x1f8>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    1318 <NSColorHSBToRGB+0x1f8>
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    1318 <NSColorHSBToRGB+0x1f8>
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x40(%rbp),%xmm0
subss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x2c(%rbp),%xmm0
addss  -0x44(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x30(%rbp),%xmm0
addss  -0x44(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x34(%rbp),%xmm0
addss  -0x44(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NSColorHSBToRGB>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm2
jne    113f <NSColorHSBToRGB+0x1f>
jnp    11c8 <NSColorHSBToRGB+0xa8>
mulss  0xeb9(%rip),%xmm0
mulss  %xmm2,%xmm1
movss  %xmm1,(%rsp)
mov    $0x168,%edi
movss  %xmm2,0x4(%rsp)
call   1030 <fmod@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0xe95(%rip),%xmm0
cvttss2si %xmm0,%ebx
mov    $0x2,%edi
call   1030 <fmod@plt>
lea    -0x1(%rax),%edi
call   1040 <fabs@plt>
movss  (%rsp),%xmm4
movss  0x4(%rsp),%xmm3
movaps %xmm3,%xmm2
movaps %xmm3,%xmm1
movaps %xmm3,%xmm0
cmp    $0x5,%ebx
ja     11ff <NSColorHSBToRGB+0xdf>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
mulss  %xmm4,%xmm0
lea    0xe51(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm1
jmp    11fc <NSColorHSBToRGB+0xdc>
movaps %xmm2,%xmm1
movaps %xmm2,%xmm0
jmp    1203 <NSColorHSBToRGB+0xe3>
xorps  %xmm2,%xmm2
movaps %xmm4,%xmm1
jmp    11ff <NSColorHSBToRGB+0xdf>
movaps %xmm0,%xmm2
movaps %xmm4,%xmm1
xorps  %xmm0,%xmm0
jmp    11ff <NSColorHSBToRGB+0xdf>
movaps %xmm4,%xmm2
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
jmp    11ff <NSColorHSBToRGB+0xdf>
xorps  %xmm1,%xmm1
movaps %xmm4,%xmm2
jmp    11ff <NSColorHSBToRGB+0xdf>
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
movaps %xmm4,%xmm0
subss  %xmm4,%xmm3
addss  %xmm3,%xmm0
movss  %xmm0,(%r12)
addss  %xmm3,%xmm1
movss  %xmm1,(%r15)
addss  %xmm3,%xmm2
movss  %xmm2,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @NSColorHSBToRGB(float %0, float %1, float %2, float* %3, float* %4, float* %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca i32
%22 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float* %3, float** %10
store float* %4, float** %11
store float* %5, float** %12
%23 = load float, float* %9
store float %23, float* %13
%24 = load float, float* %9
store float %24, float* %14
%25 = load float, float* %9
store float %25, float* %15
%26 = load float, float* %7
%27 = fmul float %26, 3.600000e+02
store float %27, float* %16
%28 = load float, float* %8
store float %28, float* %17
%29 = load float, float* %9
store float %29, float* %18
store float 0.000000e+00, float* %19
%30 = load float, float* %18
%31 = fcmp une float %30, 0.000000e+00
br i1 %31, label %32, label %74
32: ; preds = %6
%33 = load float, float* %18
%34 = load float, float* %17
%35 = fmul float %33, %34
store float %35, float* %20
%36 = load float, float* %16
%37 = call i32 @fmod(float %36, i32 360)
%38 = sitofp i32 %37 to float
store float %38, float* %16
%39 = load float, float* %16
%40 = fdiv float %39, 6.000000e+01
store float %40, float* %16
%41 = load float, float* %16
%42 = fptosi float %41 to i32
store i32 %42, i32* %21
%43 = load float, float* %20
%44 = load float, float* %16
%45 = call i32 @fmod(float %44, i32 2)
%46 = sub nsw i32 %45, 1
%47 = call i32 @fabs(i32 %46)
%48 = sub nsw i32 1, %47
%49 = sitofp i32 %48 to float
%50 = fmul float %43, %49
store float %50, float* %22
%51 = load i32, i32* %21
switch i32 %51, label %70 [
i32 0, label %52
i32 1, label %55
i32 2, label %58
i32 3, label %61
i32 4, label %64
i32 5, label %67
]
52: ; preds = %32
%53 = load float, float* %20
store float %53, float* %13
%54 = load float, float* %22
store float %54, float* %14
store float 0.000000e+00, float* %15
br label %70
55: ; preds = %32
%56 = load float, float* %22
store float %56, float* %13
%57 = load float, float* %20
store float %57, float* %14
store float 0.000000e+00, float* %15
br label %70
58: ; preds = %32
store float 0.000000e+00, float* %13
%59 = load float, float* %20
store float %59, float* %14
%60 = load float, float* %22
store float %60, float* %15
br label %70
61: ; preds = %32
store float 0.000000e+00, float* %13
%62 = load float, float* %22
store float %62, float* %14
%63 = load float, float* %20
store float %63, float* %15
br label %70
64: ; preds = %32
%65 = load float, float* %22
store float %65, float* %13
store float 0.000000e+00, float* %14
%66 = load float, float* %20
store float %66, float* %15
br label %70
67: ; preds = %32
%68 = load float, float* %20
store float %68, float* %13
store float 0.000000e+00, float* %14
%69 = load float, float* %22
store float %69, float* %15
br label %70
70: ; preds = %32, %67, %64, %61, %58, %55, %52
%71 = load float, float* %18
%72 = load float, float* %20
%73 = fsub float %71, %72
store float %73, float* %19
br label %74
74: ; preds = %70, %6
%75 = load float, float* %13
%76 = load float, float* %19
%77 = fadd float %75, %76
%78 = load float*, float** %10
store float %77, float* %78
%79 = load float, float* %14
%80 = load float, float* %19
%81 = fadd float %79, %80
%82 = load float*, float** %11
store float %81, float* %82
%83 = load float, float* %15
%84 = load float, float* %19
%85 = fadd float %83, %84
%86 = load float*, float** %12
store float %85, float* %86
ret void
}

LLVM IR (-O2):
define void @NSColorHSBToRGB(float %0, float %1, float %2, float* nocapture writeonly %3, float* nocapture writeonly %4, float* nocapture writeonly %5) {
%7 = fcmp une float %2, 0.000000e+00
br i1 %7, label %8, label %32
8: ; preds = %6
%9 = fmul float %0, 3.600000e+02
%10 = fmul float %1, %2
%11 = tail call i32 @fmod(float %9, i32 360)
%12 = sitofp i32 %11 to float
%13 = fdiv float %12, 6.000000e+01
%14 = fptosi float %13 to i32
%15 = tail call i32 @fmod(float %13, i32 2)
%16 = add nsw i32 %15, -1
%17 = tail call i32 @fabs(i32 %16)
%18 = sub nsw i32 1, %17
%19 = sitofp i32 %18 to float
%20 = fmul float %10, %19
switch i32 %14, label %27 [
i32 0, label %21
i32 1, label %22
i32 2, label %23
i32 3, label %24
i32 4, label %25
i32 5, label %26
]
21: ; preds = %8
br label %27
22: ; preds = %8
br label %27
23: ; preds = %8
br label %27
24: ; preds = %8
br label %27
25: ; preds = %8
br label %27
26: ; preds = %8
br label %27
27: ; preds = %8, %26, %25, %24, %23, %22, %21
%28 = phi float [ %2, %8 ], [ %20, %26 ], [ %10, %25 ], [ %10, %24 ], [ %20, %23 ], [ 0.000000e+00, %22 ], [ 0.000000e+00, %21 ]
%29 = phi float [ %2, %8 ], [ 0.000000e+00, %26 ], [ 0.000000e+00, %25 ], [ %20, %24 ], [ %10, %23 ], [ %10, %22 ], [ %20, %21 ]
%30 = phi float [ %2, %8 ], [ %10, %26 ], [ %20, %25 ], [ 0.000000e+00, %24 ], [ 0.000000e+00, %23 ], [ %20, %22 ], [ %10, %21 ]
%31 = fsub float %2, %10
br label %32
32: ; preds = %27, %6
%33 = phi float [ %31, %27 ], [ 0.000000e+00, %6 ]
%34 = phi float [ %28, %27 ], [ %2, %6 ]
%35 = phi float [ %29, %27 ], [ %2, %6 ]
%36 = phi float [ %30, %27 ], [ %2, %6 ]
%37 = fadd float %33, %36
store float %37, float* %3
%38 = fadd float %33, %35
store float %38, float* %4
%39 = fadd float %33, %34
store float %39, float* %5
ret void
}