#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 */
double fmod(double, double);
double vc_hue_rgb(double n1, double n2, double h) {
  h = fmod(h, 6.0);
  if (h < 1.0)
    return n1 + ((n2 - n1) * h);
  if (h < 3.0)
    return n2;
  if (h < 4.0)
    return n1 + ((n2 - n1) * (4.0 - h));
  return n1;
}


x86 assembly (clang, -O0):
<vc_hue_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xed4(%rip),%xmm1
call   1030 <fmod@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xeba(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1177 <vc_hue_rgb+0x67>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e4 <vc_hue_rgb+0xd4>
movsd  0xe91(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1199 <vc_hue_rgb+0x89>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e4 <vc_hue_rgb+0xd4>
movsd  0xe77(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11da <vc_hue_rgb+0xca>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xe55(%rip),%xmm2
subsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e4 <vc_hue_rgb+0xd4>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vc_hue_rgb>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movsd  0xed8(%rip),%xmm1
movapd %xmm2,%xmm0
call   1030 <fmod@plt>
movsd  0xecf(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1159 <vc_hue_rgb+0x49>
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
jmp    119a <vc_hue_rgb+0x8a>
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
movsd  0xea3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    117c <vc_hue_rgb+0x6c>
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret
movsd  0xe94(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a3 <vc_hue_rgb+0x93>
subsd  %xmm3,%xmm2
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define double @vc_hue_rgb(double %0, double %1, double %2) {
%4 = tail call double @fmod(double %2, double 6.000000e+00)
%5 = fcmp olt double %4, 1.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = fsub double %1, %0
%8 = tail call double @llvm.fmuladd.f64(double %7, double %4, double %0)
br label %17
9: ; preds = %3
%10 = fcmp olt double %4, 3.000000e+00
br i1 %10, label %17, label %11
11: ; preds = %9
%12 = fcmp olt double %4, 4.000000e+00
br i1 %12, label %13, label %17
13: ; preds = %11
%14 = fsub double %1, %0
%15 = fsub double 4.000000e+00, %4
%16 = tail call double @llvm.fmuladd.f64(double %14, double %15, double %0)
br label %17
17: ; preds = %11, %9, %13, %6
%18 = phi double [ %8, %6 ], [ %16, %13 ], [ %1, %9 ], [ %0, %11 ]
ret double %18
}