#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 mod(float, double);
float hue_to_rgb(float v1, float v2, float vH) {
  float vh = mod(vH, 1.0), out = 0.0;
  if (vh * 6.0 < 1.0) {
    out = v1 + (v2 - v1) * 6.0 * vh;
  } else if (vh * 2.0 < 1.0) {
    out = v2;
  } else if (vh * 3.0 < 2.0) {
    out = v1 + (v2 - v1) * ((2.0 / 3.0) - vh) * 6.0;
  } else {
    out = v1;
  }
  return out;
}


x86 assembly (clang, -O0):
<hue_to_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movsd  0xecc(%rip),%xmm1
call   1030 <mod@plt>
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb1(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe9d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11af <hue_to_rgb+0x9f>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7c(%rip),%xmm2
mulsd  %xmm2,%xmm0
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    126e <hue_to_rgb+0x15e>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe50(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe34(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e5 <hue_to_rgb+0xd5>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1269 <hue_to_rgb+0x159>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe22(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe0e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    125a <hue_to_rgb+0x14a>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movsd  0xdec(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
movsd  0xdc4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1264 <hue_to_rgb+0x154>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1269 <hue_to_rgb+0x159>
jmp    126e <hue_to_rgb+0x15e>
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hue_to_rgb>:
push   %rax
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
movsd  0xedc(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <mod@plt>
movsd  0xecc(%rip),%xmm2
cvtss2sd %xmm0,%xmm0
movsd  0xec8(%rip),%xmm1
mulsd  %xmm0,%xmm1
ucomisd %xmm1,%xmm2
jbe    1176 <hue_to_rgb+0x66>
movss  (%rsp),%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
movss  0x4(%rsp),%xmm2
subss  %xmm3,%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  0xe9c(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
jmp    11dc <hue_to_rgb+0xcc>
movss  (%rsp),%xmm4
movss  0x4(%rsp),%xmm3
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
ucomisd %xmm1,%xmm2
jbe    1194 <hue_to_rgb+0x84>
movaps %xmm3,%xmm0
pop    %rax
ret
movsd  0xe74(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe70(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    11e5 <hue_to_rgb+0xd5>
subss  %xmm4,%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
movsd  0xe5f(%rip),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0xe37(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
addsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
pop    %rax
ret
movaps %xmm4,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define float @hue_to_rgb(float %0, float %1, float %2) {
%4 = tail call float @mod(float %2, double 1.000000e+00)
%5 = fpext float %4 to double
%6 = fmul double %5, 6.000000e+00
%7 = fcmp olt double %6, 1.000000e+00
br i1 %7, label %8, label %15
8: ; preds = %3
%9 = fpext float %0 to double
%10 = fsub float %1, %0
%11 = fpext float %10 to double
%12 = fmul double %11, 6.000000e+00
%13 = tail call double @llvm.fmuladd.f64(double %12, double %5, double %9)
%14 = fptrunc double %13 to float
br label %29
15: ; preds = %3
%16 = fmul double %5, 2.000000e+00
%17 = fcmp olt double %16, 1.000000e+00
br i1 %17, label %29, label %18
18: ; preds = %15
%19 = fmul double %5, 3.000000e+00
%20 = fcmp olt double %19, 2.000000e+00
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = fpext float %0 to double
%23 = fsub float %1, %0
%24 = fpext float %23 to double
%25 = fsub double 0x3FE5555555555555, %5
%26 = fmul double %25, %24
%27 = tail call double @llvm.fmuladd.f64(double %26, double 6.000000e+00, double %22)
%28 = fptrunc double %27 to float
br label %29
29: ; preds = %18, %15, %21, %8
%30 = phi float [ %14, %8 ], [ %28, %21 ], [ %1, %15 ], [ %0, %18 ]
ret float %30
}