#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 floor(float);
void HSVtoRGB(float *r, float *g, float *b, float h, float s, float v) {
  int i;
  float f, p, q, t;
  if (s == 0) {
    *r = *g = *b = v;
    return;
  }
  h /= 60;
  i = floor(h);
  f = h - i;
  p = v * (1 - s);
  q = v * (1 - s * f);
  t = v * (1 - s * (1 - f));
  switch (i) {
  case 0:
    *r = v;
    *g = t;
    *b = p;
    break;
  case 1:
    *r = q;
    *g = v;
    *b = p;
    break;
  case 2:
    *r = p;
    *g = v;
    *b = t;
    break;
  case 3:
    *r = p;
    *g = q;
    *b = v;
    break;
  case 4:
    *r = t;
    *g = p;
    *b = v;
    break;
  default:
    *r = v;
    *g = p;
    *b = q;
    break;
  }
}


x86 assembly (clang, -O0):
<HSVtoRGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
movss  %xmm1,-0x20(%rbp)
movss  %xmm2,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    116c <HSVtoRGB+0x5c>
jp     116c <HSVtoRGB+0x5c>
movss  -0x24(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1336 <HSVtoRGB+0x226>
movss  -0x1c(%rbp),%xmm0
movss  0xe87(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <floor@plt>
mov    %eax,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtsi2ssl -0x28(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x20(%rbp),%xmm3
movss  0xe50(%rip),%xmm1
movaps %xmm1,%xmm2
subss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x20(%rbp),%xmm3
movss  -0x2c(%rbp),%xmm2
mulss  %xmm2,%xmm3
movaps %xmm1,%xmm2
subss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm4
movaps %xmm1,%xmm3
subss  %xmm4,%xmm3
mulss  %xmm3,%xmm2
subss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%eax
mov    %rax,-0x40(%rbp)
sub    $0x4,%rax
ja     130f <HSVtoRGB+0x1ff>
mov    -0x40(%rbp),%rax
lea    0xdde(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x24(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1336 <HSVtoRGB+0x226>
movss  -0x34(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x24(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1336 <HSVtoRGB+0x226>
movss  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x24(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1336 <HSVtoRGB+0x226>
movss  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x34(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x24(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1336 <HSVtoRGB+0x226>
movss  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x24(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1336 <HSVtoRGB+0x226>
movss  -0x24(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x34(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HSVtoRGB>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm1
jne    1144 <HSVtoRGB+0x34>
jp     1144 <HSVtoRGB+0x34>
movss  %xmm2,(%r14)
movss  %xmm2,(%r15)
movss  %xmm2,(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
divss  0xeb4(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
call   1030 <floor@plt>
movss  0x4(%rsp),%xmm6
movss  0x8(%rsp),%xmm5
movss  0xc(%rsp),%xmm4
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
subss  %xmm0,%xmm6
movss  0xe7c(%rip),%xmm1
movaps %xmm1,%xmm0
subss  %xmm5,%xmm0
mulss  %xmm4,%xmm0
movaps %xmm5,%xmm3
mulss  %xmm6,%xmm3
movaps %xmm1,%xmm2
subss  %xmm3,%xmm2
mulss  %xmm4,%xmm2
cmp    $0x4,%eax
ja     11e2 <HSVtoRGB+0xd2>
movaps %xmm1,%xmm3
subss  %xmm6,%xmm3
mulss  %xmm3,%xmm5
subss  %xmm5,%xmm1
mulss  %xmm4,%xmm1
mov    %eax,%eax
lea    0xe42(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  %xmm4,(%rbx)
movss  %xmm1,(%r15)
movss  %xmm0,(%r14)
jmp    113a <HSVtoRGB+0x2a>
movss  %xmm4,(%rbx)
movss  %xmm0,(%r15)
movss  %xmm2,(%r14)
jmp    113a <HSVtoRGB+0x2a>
movss  %xmm2,(%rbx)
movss  %xmm4,(%r15)
movss  %xmm0,(%r14)
jmp    113a <HSVtoRGB+0x2a>
movss  %xmm0,(%rbx)
movss  %xmm4,(%r15)
movss  %xmm1,(%r14)
jmp    113a <HSVtoRGB+0x2a>
movss  %xmm0,(%rbx)
movss  %xmm2,(%r15)
movss  %xmm4,(%r14)
jmp    113a <HSVtoRGB+0x2a>
movss  %xmm1,(%rbx)
movss  %xmm0,(%r15)
movss  %xmm4,(%r14)
jmp    113a <HSVtoRGB+0x2a>

LLVM IR (-O0):
define void @HSVtoRGB(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 i32
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = 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
%18 = load float, float* %11
%19 = fcmp oeq float %18, 0.000000e+00
br i1 %19, label %20, label %25
20: ; preds = %6
%21 = load float, float* %12
%22 = load float*, float** %9
store float %21, float* %22
%23 = load float*, float** %8
store float %21, float* %23
%24 = load float*, float** %7
store float %21, float* %24
br label %94
25: ; preds = %6
%26 = load float, float* %10
%27 = fdiv float %26, 6.000000e+01
store float %27, float* %10
%28 = load float, float* %10
%29 = call i32 @floor(float %28)
store i32 %29, i32* %13
%30 = load float, float* %10
%31 = load i32, i32* %13
%32 = sitofp i32 %31 to float
%33 = fsub float %30, %32
store float %33, float* %14
%34 = load float, float* %12
%35 = load float, float* %11
%36 = fsub float 1.000000e+00, %35
%37 = fmul float %34, %36
store float %37, float* %15
%38 = load float, float* %12
%39 = load float, float* %11
%40 = load float, float* %14
%41 = fneg float %39
%42 = call float @llvm.fmuladd.f32(float %41, float %40, float 1.000000e+00)
%43 = fmul float %38, %42
store float %43, float* %16
%44 = load float, float* %12
%45 = load float, float* %11
%46 = load float, float* %14
%47 = fsub float 1.000000e+00, %46
%48 = fneg float %45
%49 = call float @llvm.fmuladd.f32(float %48, float %47, float 1.000000e+00)
%50 = fmul float %44, %49
store float %50, float* %17
%51 = load i32, i32* %13
switch i32 %51, label %87 [
i32 0, label %52
i32 1, label %59
i32 2, label %66
i32 3, label %73
i32 4, label %80
]
52: ; preds = %25
%53 = load float, float* %12
%54 = load float*, float** %7
store float %53, float* %54
%55 = load float, float* %17
%56 = load float*, float** %8
store float %55, float* %56
%57 = load float, float* %15
%58 = load float*, float** %9
store float %57, float* %58
br label %94
59: ; preds = %25
%60 = load float, float* %16
%61 = load float*, float** %7
store float %60, float* %61
%62 = load float, float* %12
%63 = load float*, float** %8
store float %62, float* %63
%64 = load float, float* %15
%65 = load float*, float** %9
store float %64, float* %65
br label %94
66: ; preds = %25
%67 = load float, float* %15
%68 = load float*, float** %7
store float %67, float* %68
%69 = load float, float* %12
%70 = load float*, float** %8
store float %69, float* %70
%71 = load float, float* %17
%72 = load float*, float** %9
store float %71, float* %72
br label %94
73: ; preds = %25
%74 = load float, float* %15
%75 = load float*, float** %7
store float %74, float* %75
%76 = load float, float* %16
%77 = load float*, float** %8
store float %76, float* %77
%78 = load float, float* %12
%79 = load float*, float** %9
store float %78, float* %79
br label %94
80: ; preds = %25
%81 = load float, float* %17
%82 = load float*, float** %7
store float %81, float* %82
%83 = load float, float* %15
%84 = load float*, float** %8
store float %83, float* %84
%85 = load float, float* %12
%86 = load float*, float** %9
store float %85, float* %86
br label %94
87: ; preds = %25
%88 = load float, float* %12
%89 = load float*, float** %7
store float %88, float* %89
%90 = load float, float* %15
%91 = load float*, float** %8
store float %90, float* %91
%92 = load float, float* %16
%93 = load float*, float** %9
store float %92, float* %93
br label %94
94: ; preds = %20, %87, %80, %73, %66, %59, %52
ret void
}

LLVM IR (-O2):
define void @HSVtoRGB(float* nocapture writeonly %0, float* nocapture writeonly %1, float* nocapture writeonly %2, float %3, float %4, float %5) {
%7 = fcmp oeq float %4, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %6
store float %5, float* %2
store float %5, float* %1
store float %5, float* %0
br label %28
9: ; preds = %6
%10 = fdiv float %3, 6.000000e+01
%11 = tail call i32 @floor(float %10)
%12 = sitofp i32 %11 to float
%13 = fsub float %10, %12
%14 = fsub float 1.000000e+00, %4
%15 = fmul float %14, %5
%16 = fneg float %4
%17 = tail call float @llvm.fmuladd.f32(float %16, float %13, float 1.000000e+00)
%18 = fmul float %17, %5
%19 = fsub float 1.000000e+00, %13
%20 = tail call float @llvm.fmuladd.f32(float %16, float %19, float 1.000000e+00)
%21 = fmul float %20, %5
switch i32 %11, label %27 [
i32 0, label %22
i32 1, label %23
i32 2, label %24
i32 3, label %25
i32 4, label %26
]
22: ; preds = %9
store float %5, float* %0
store float %21, float* %1
store float %15, float* %2
br label %28
23: ; preds = %9
store float %18, float* %0
store float %5, float* %1
store float %15, float* %2
br label %28
24: ; preds = %9
store float %15, float* %0
store float %5, float* %1
store float %21, float* %2
br label %28
25: ; preds = %9
store float %15, float* %0
store float %18, float* %1
store float %5, float* %2
br label %28
26: ; preds = %9
store float %21, float* %0
store float %15, float* %1
store float %5, float* %2
br label %28
27: ; preds = %9
store float %5, float* %0
store float %15, float* %1
store float %18, float* %2
br label %28
28: ; preds = %22, %23, %24, %25, %26, %27, %8
ret void
}