#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 */
float fmod(float, float);
float HueToRGB(float v1, float v2, float vH) {
  float fResult = v1;
  vH = fmod(vH + 1.0f, 1.0f);
  if ((6.0f * vH) < 1.0f) {
    fResult = (v1 + (v2 - v1) * 6.0f * vH);
  } else if ((2.0f * vH) < 1.0f) {
    fResult = (v2);
  } else if ((3.0f * vH) < 2.0f) {
    fResult = (v1 + (v2 - v1) * ((2.0f / 3.0f) - vH) * 6.0f);
  }
  return fResult;
}


x86 assembly (clang, -O0):
<HueToRGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xec7(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  0xeba(%rip),%xmm1
call   1030 <fmod@plt>
movss  %xmm0,-0xc(%rbp)
movss  0xeac(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  0xe9b(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11a0 <HueToRGB+0x90>
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  0xe7f(%rip),%xmm2
mulss  %xmm2,%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    122a <HueToRGB+0x11a>
movss  0xe60(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  0xe4b(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11cd <HueToRGB+0xbd>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1225 <HueToRGB+0x115>
movss  0xe37(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  0xe26(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    1220 <HueToRGB+0x110>
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  0xe0e(%rip),%xmm2
subss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
movss  0xdf1(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1225 <HueToRGB+0x115>
jmp    122a <HueToRGB+0x11a>
movss  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HueToRGB>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
movss  0xedc(%rip),%xmm1
addss  %xmm1,%xmm2
movaps %xmm2,%xmm0
call   1030 <fmod@plt>
movss  0xec8(%rip),%xmm2
movss  0xec4(%rip),%xmm1
mulss  %xmm0,%xmm1
ucomiss %xmm1,%xmm2
jbe    116a <HueToRGB+0x5a>
movss  0x4(%rsp),%xmm1
movss  (%rsp),%xmm2
subss  %xmm2,%xmm1
mulss  0xea4(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  %xmm2,%xmm1
jmp    11bf <HueToRGB+0xaf>
movss  (%rsp),%xmm4
movss  0x4(%rsp),%xmm3
movaps %xmm0,%xmm1
addss  %xmm0,%xmm1
ucomiss %xmm1,%xmm2
jbe    1186 <HueToRGB+0x76>
movaps %xmm3,%xmm0
pop    %rax
ret
movss  0xe7a(%rip),%xmm1
mulss  %xmm0,%xmm1
movss  0xe72(%rip),%xmm2
ucomiss %xmm1,%xmm2
jbe    11c4 <HueToRGB+0xb4>
subss  %xmm4,%xmm3
movss  0xe65(%rip),%xmm1
subss  %xmm0,%xmm1
mulss  %xmm3,%xmm1
mulss  0xe49(%rip),%xmm1
addss  %xmm4,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret
movaps %xmm4,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define float @HueToRGB(float %0, float %1, float %2) {
%4 = fadd float %2, 1.000000e+00
%5 = tail call float @fmod(float %4, float 1.000000e+00)
%6 = fmul float %5, 6.000000e+00
%7 = fcmp olt float %6, 1.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = fsub float %1, %0
%10 = fmul float %9, 6.000000e+00
%11 = tail call float @llvm.fmuladd.f32(float %10, float %5, float %0)
br label %23
12: ; preds = %3
%13 = fmul float %5, 2.000000e+00
%14 = fcmp olt float %13, 1.000000e+00
br i1 %14, label %23, label %15
15: ; preds = %12
%16 = fmul float %5, 3.000000e+00
%17 = fcmp olt float %16, 2.000000e+00
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = fsub float %1, %0
%20 = fsub float 0x3FE5555560000000, %5
%21 = fmul float %19, %20
%22 = tail call float @llvm.fmuladd.f32(float %21, float 6.000000e+00, float %0)
br label %23
23: ; preds = %12, %18, %15, %8
%24 = phi float [ %11, %8 ], [ %22, %18 ], [ %0, %15 ], [ %1, %12 ]
ret float %24
}