#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 fabsolute(float);
float ffract(float const);
float const flerp(float, int /*<<< orphan*/, float const);
int /*<<< orphan*/ fsaturate(float const);
void hsvToRgb(float _rgb[3], const float _hsv[3]) {
  const float hh = _hsv[0];
  const float ss = _hsv[1];
  const float vv = _hsv[2];
  const float px = fabsolute(ffract(hh + 1.0f) * 6.0f - 3.0f);
  const float py = fabsolute(ffract(hh + 2.0f / 3.0f) * 6.0f - 3.0f);
  const float pz = fabsolute(ffract(hh + 1.0f / 3.0f) * 6.0f - 3.0f);
  _rgb[0] = vv * flerp(1.0f, fsaturate(px - 1.0f), ss);
  _rgb[1] = vv * flerp(1.0f, fsaturate(py - 1.0f), ss);
  _rgb[2] = vv * flerp(1.0f, fsaturate(pz - 1.0f), ss);
}


x86 assembly (clang, -O0):
<hsvToRgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe7f(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
call   1060 <ffract@plt>
movss  0xe71(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe69(%rip),%xmm1
addss  %xmm1,%xmm0
call   1040 <fabsolute@plt>
movss  %xmm0,-0x20(%rbp)
movss  0xe5b(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
call   1060 <ffract@plt>
movss  0xe3d(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe35(%rip),%xmm1
addss  %xmm1,%xmm0
call   1040 <fabsolute@plt>
movss  %xmm0,-0x24(%rbp)
movss  0xe23(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
call   1060 <ffract@plt>
movss  0xe09(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe01(%rip),%xmm1
addss  %xmm1,%xmm0
call   1040 <fabsolute@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x20(%rbp),%xmm0
movss  0xdd4(%rip),%xmm1
subss  %xmm1,%xmm0
call   1050 <fsaturate@plt>
mov    %eax,%edi
movss  -0x18(%rbp),%xmm1
movss  0xdbc(%rip),%xmm0
call   1030 <flerp@plt>
movaps %xmm0,%xmm1
movss  -0x34(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x24(%rbp),%xmm0
movss  0xd8c(%rip),%xmm1
subss  %xmm1,%xmm0
call   1050 <fsaturate@plt>
mov    %eax,%edi
movss  -0x18(%rbp),%xmm1
movss  0xd74(%rip),%xmm0
call   1030 <flerp@plt>
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x28(%rbp),%xmm0
movss  0xd43(%rip),%xmm1
subss  %xmm1,%xmm0
call   1050 <fsaturate@plt>
mov    %eax,%edi
movss  -0x18(%rbp),%xmm1
movss  0xd2b(%rip),%xmm0
call   1030 <flerp@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hsvToRgb>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movss  (%rsi),%xmm1
movss  %xmm1,0xc(%rsp)
movss  0x4(%rsi),%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x8(%rsi),%xmm0
movss  %xmm0,0x14(%rsp)
movaps %xmm1,%xmm0
addss  0xe8d(%rip),%xmm0
call   1060 <ffract@plt>
mulss  0xe84(%rip),%xmm0
addss  0xe80(%rip),%xmm0
call   1040 <fabsolute@plt>
movss  %xmm0,0x1c(%rsp)
movss  0xe71(%rip),%xmm0
addss  0xc(%rsp),%xmm0
call   1060 <ffract@plt>
mulss  0xe56(%rip),%xmm0
addss  0xe52(%rip),%xmm0
call   1040 <fabsolute@plt>
movss  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm0
addss  0xe41(%rip),%xmm0
call   1060 <ffract@plt>
mulss  0xe28(%rip),%xmm0
addss  0xe24(%rip),%xmm0
call   1040 <fabsolute@plt>
movss  %xmm0,0xc(%rsp)
movss  0x1c(%rsp),%xmm0
addss  0xe17(%rip),%xmm0
call   1050 <fsaturate@plt>
movss  0xdf6(%rip),%xmm0
mov    %eax,%edi
movss  0x10(%rsp),%xmm1
call   1030 <flerp@plt>
mulss  0x14(%rsp),%xmm0
movss  %xmm0,(%rbx)
movss  0x18(%rsp),%xmm0
addss  0xde5(%rip),%xmm0
call   1050 <fsaturate@plt>
movss  0xdc4(%rip),%xmm0
mov    %eax,%edi
movss  0x10(%rsp),%xmm1
call   1030 <flerp@plt>
mulss  0x14(%rsp),%xmm0
movss  %xmm0,0x4(%rbx)
movss  0xc(%rsp),%xmm0
addss  0xdb2(%rip),%xmm0
call   1050 <fsaturate@plt>
movss  0xd91(%rip),%xmm0
mov    %eax,%edi
movss  0x10(%rsp),%xmm1
call   1030 <flerp@plt>
mulss  0x14(%rsp),%xmm0
movss  %xmm0,0x8(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @hsvToRgb(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%11 = load float*, float** %4
%12 = getelementptr inbounds float, float* %11, i64 0
%13 = load float, float* %12
store float %13, float* %5
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
store float %16, float* %6
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 2
%19 = load float, float* %18
store float %19, float* %7
%20 = load float, float* %5
%21 = fadd float %20, 1.000000e+00
%22 = call float @ffract(float %21)
%23 = call float @llvm.fmuladd.f32(float %22, float 6.000000e+00, float -3.000000e+00)
%24 = call float @fabsolute(float %23)
store float %24, float* %8
%25 = load float, float* %5
%26 = fadd float %25, 0x3FE5555560000000
%27 = call float @ffract(float %26)
%28 = call float @llvm.fmuladd.f32(float %27, float 6.000000e+00, float -3.000000e+00)
%29 = call float @fabsolute(float %28)
store float %29, float* %9
%30 = load float, float* %5
%31 = fadd float %30, 0x3FD5555560000000
%32 = call float @ffract(float %31)
%33 = call float @llvm.fmuladd.f32(float %32, float 6.000000e+00, float -3.000000e+00)
%34 = call float @fabsolute(float %33)
store float %34, float* %10
%35 = load float, float* %7
%36 = load float, float* %8
%37 = fsub float %36, 1.000000e+00
%38 = call i32 @fsaturate(float %37)
%39 = load float, float* %6
%40 = call float @flerp(float 1.000000e+00, i32 %38, float %39)
%41 = fmul float %35, %40
%42 = load float*, float** %3
%43 = getelementptr inbounds float, float* %42, i64 0
store float %41, float* %43
%44 = load float, float* %7
%45 = load float, float* %9
%46 = fsub float %45, 1.000000e+00
%47 = call i32 @fsaturate(float %46)
%48 = load float, float* %6
%49 = call float @flerp(float 1.000000e+00, i32 %47, float %48)
%50 = fmul float %44, %49
%51 = load float*, float** %3
%52 = getelementptr inbounds float, float* %51, i64 1
store float %50, float* %52
%53 = load float, float* %7
%54 = load float, float* %10
%55 = fsub float %54, 1.000000e+00
%56 = call i32 @fsaturate(float %55)
%57 = load float, float* %6
%58 = call float @flerp(float 1.000000e+00, i32 %56, float %57)
%59 = fmul float %53, %58
%60 = load float*, float** %3
%61 = getelementptr inbounds float, float* %60, i64 2
store float %59, float* %61
ret void
}

LLVM IR (-O2):
define void @hsvToRgb(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds float, float* %1, i64 2
%7 = load float, float* %6
%8 = fadd float %3, 1.000000e+00
%9 = tail call float @ffract(float %8)
%10 = tail call float @llvm.fmuladd.f32(float %9, float 6.000000e+00, float -3.000000e+00)
%11 = tail call float @fabsolute(float %10)
%12 = fadd float %3, 0x3FE5555560000000
%13 = tail call float @ffract(float %12)
%14 = tail call float @llvm.fmuladd.f32(float %13, float 6.000000e+00, float -3.000000e+00)
%15 = tail call float @fabsolute(float %14)
%16 = fadd float %3, 0x3FD5555560000000
%17 = tail call float @ffract(float %16)
%18 = tail call float @llvm.fmuladd.f32(float %17, float 6.000000e+00, float -3.000000e+00)
%19 = tail call float @fabsolute(float %18)
%20 = fadd float %11, -1.000000e+00
%21 = tail call i32 @fsaturate(float %20)
%22 = tail call float @flerp(float 1.000000e+00, i32 %21, float %5)
%23 = fmul float %7, %22
store float %23, float* %0
%24 = fadd float %15, -1.000000e+00
%25 = tail call i32 @fsaturate(float %24)
%26 = tail call float @flerp(float 1.000000e+00, i32 %25, float %5)
%27 = fmul float %7, %26
%28 = getelementptr inbounds float, float* %0, i64 1
store float %27, float* %28
%29 = fadd float %19, -1.000000e+00
%30 = tail call i32 @fsaturate(float %29)
%31 = tail call float @flerp(float 1.000000e+00, i32 %30, float %5)
%32 = fmul float %7, %31
%33 = getelementptr inbounds float, float* %0, i64 2
store float %32, float* %33
ret void
}