#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 const);
float flerp(float const, float const, float const);
float const fmin(float const, float const);
float fstep(float const, float const);
void rgbToHsv(float _hsv[3], const float _rgb[3]) {
  const float rr = _rgb[0];
  const float gg = _rgb[1];
  const float bb = _rgb[2];
  const float s0 = fstep(bb, gg);
  const float px = flerp(bb, gg, s0);
  const float py = flerp(gg, bb, s0);
  const float pz = flerp(-1.0f, 0.0f, s0);
  const float pw = flerp(2.0f / 3.0f, -1.0f / 3.0f, s0);
  const float s1 = fstep(px, rr);
  const float qx = flerp(px, rr, s1);
  const float qy = py;
  const float qz = flerp(pw, pz, s1);
  const float qw = flerp(rr, px, s1);
  const float dd = qx - fmin(qw, qy);
  const float ee = 1.0e-10f;
  _hsv[0] = fabsolute(qz + (qw - qy) / (6.0f * dd + ee));
  _hsv[1] = dd / (qx + ee);
  _hsv[2] = qx;
}


x86 assembly (clang, -O0):
<rgbToHsv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1030 <fstep@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
call   1040 <flerp@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
call   1040 <flerp@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x20(%rbp),%xmm2
movss  0xe44(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1040 <flerp@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x20(%rbp),%xmm2
movss  0xe22(%rip),%xmm0
movss  0xe1e(%rip),%xmm1
call   1040 <flerp@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
call   1030 <fstep@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
call   1040 <flerp@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x30(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
call   1040 <flerp@plt>
movss  %xmm0,-0x40(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
call   1040 <flerp@plt>
movss  %xmm0,-0x44(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x44(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm1
call   1060 <fmin@plt>
movaps %xmm0,%xmm1
movss  -0x50(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  0xd6d(%rip),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x40(%rbp),%xmm0
movss  -0x44(%rbp),%xmm1
subss  -0x3c(%rbp),%xmm1
movss  -0x48(%rbp),%xmm2
movss  0xd50(%rip),%xmm3
mulss  %xmm3,%xmm2
movss  0xd40(%rip),%xmm3
addss  %xmm3,%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
call   1050 <fabsolute@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x48(%rbp),%xmm0
movss  0xd1a(%rip),%xmm1
addss  -0x38(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgbToHsv>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movss  (%rsi),%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsi),%xmm1
movss  %xmm1,0x20(%rsp)
movss  0x8(%rsi),%xmm0
movss  %xmm0,0xc(%rsp)
call   1030 <fstep@plt>
movaps %xmm0,%xmm2
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x20(%rsp),%xmm1
call   1040 <flerp@plt>
movss  %xmm0,0x18(%rsp)
movss  0x20(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm2
call   1040 <flerp@plt>
movaps %xmm0,0x20(%rsp)
movss  0xe5f(%rip),%xmm0
xorps  %xmm1,%xmm1
movss  0x8(%rsp),%xmm2
call   1040 <flerp@plt>
movss  %xmm0,0x14(%rsp)
movss  0xe47(%rip),%xmm0
movss  0xe43(%rip),%xmm1
movss  0x8(%rsp),%xmm2
call   1040 <flerp@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x18(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1030 <fstep@plt>
movaps %xmm0,%xmm2
movss  %xmm0,0xc(%rsp)
movss  0x18(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1040 <flerp@plt>
movss  %xmm0,0x8(%rsp)
movss  0x1c(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
call   1040 <flerp@plt>
movss  %xmm0,0x14(%rsp)
movss  0x10(%rsp),%xmm0
movss  0x18(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
call   1040 <flerp@plt>
movaps 0x20(%rsp),%xmm4
movaps %xmm4,%xmm1
minss  %xmm0,%xmm1
movaps %xmm0,%xmm2
cmpunordss %xmm0,%xmm2
movaps %xmm2,%xmm3
andnps %xmm1,%xmm3
andps  %xmm4,%xmm2
orps   %xmm3,%xmm2
movss  0x8(%rsp),%xmm3
subss  %xmm2,%xmm3
movss  %xmm3,0x10(%rsp)
subss  %xmm4,%xmm0
movss  0xd95(%rip),%xmm1
mulss  %xmm3,%xmm1
addss  0xd8d(%rip),%xmm1
divss  %xmm1,%xmm0
addss  0x14(%rsp),%xmm0
call   1050 <fabsolute@plt>
movss  %xmm0,(%rbx)
movss  0x8(%rsp),%xmm0
movss  0xd6c(%rip),%xmm2
addss  %xmm0,%xmm2
movss  0x10(%rsp),%xmm1
divss  %xmm2,%xmm1
movss  %xmm1,0x4(%rbx)
movss  %xmm0,0x8(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @rgbToHsv(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
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%20 = load float*, float** %4
%21 = getelementptr inbounds float, float* %20, i64 0
%22 = load float, float* %21
store float %22, float* %5
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 1
%25 = load float, float* %24
store float %25, float* %6
%26 = load float*, float** %4
%27 = getelementptr inbounds float, float* %26, i64 2
%28 = load float, float* %27
store float %28, float* %7
%29 = load float, float* %7
%30 = load float, float* %6
%31 = call float @fstep(float %29, float %30)
store float %31, float* %8
%32 = load float, float* %7
%33 = load float, float* %6
%34 = load float, float* %8
%35 = call float @flerp(float %32, float %33, float %34)
store float %35, float* %9
%36 = load float, float* %6
%37 = load float, float* %7
%38 = load float, float* %8
%39 = call float @flerp(float %36, float %37, float %38)
store float %39, float* %10
%40 = load float, float* %8
%41 = call float @flerp(float -1.000000e+00, float 0.000000e+00, float %40)
store float %41, float* %11
%42 = load float, float* %8
%43 = call float @flerp(float 0x3FE5555560000000, float 0xBFD5555560000000, float %42)
store float %43, float* %12
%44 = load float, float* %9
%45 = load float, float* %5
%46 = call float @fstep(float %44, float %45)
store float %46, float* %13
%47 = load float, float* %9
%48 = load float, float* %5
%49 = load float, float* %13
%50 = call float @flerp(float %47, float %48, float %49)
store float %50, float* %14
%51 = load float, float* %10
store float %51, float* %15
%52 = load float, float* %12
%53 = load float, float* %11
%54 = load float, float* %13
%55 = call float @flerp(float %52, float %53, float %54)
store float %55, float* %16
%56 = load float, float* %5
%57 = load float, float* %9
%58 = load float, float* %13
%59 = call float @flerp(float %56, float %57, float %58)
store float %59, float* %17
%60 = load float, float* %14
%61 = load float, float* %17
%62 = load float, float* %15
%63 = call float @fmin(float %61, float %62)
%64 = fsub float %60, %63
store float %64, float* %18
store float 0x3DDB7CDFE0000000, float* %19
%65 = load float, float* %16
%66 = load float, float* %17
%67 = load float, float* %15
%68 = fsub float %66, %67
%69 = load float, float* %18
%70 = call float @llvm.fmuladd.f32(float 6.000000e+00, float %69, float 0x3DDB7CDFE0000000)
%71 = fdiv float %68, %70
%72 = fadd float %65, %71
%73 = call float @fabsolute(float %72)
%74 = load float*, float** %3
%75 = getelementptr inbounds float, float* %74, i64 0
store float %73, float* %75
%76 = load float, float* %18
%77 = load float, float* %14
%78 = fadd float %77, 0x3DDB7CDFE0000000
%79 = fdiv float %76, %78
%80 = load float*, float** %3
%81 = getelementptr inbounds float, float* %80, i64 1
store float %79, float* %81
%82 = load float, float* %14
%83 = load float*, float** %3
%84 = getelementptr inbounds float, float* %83, i64 2
store float %82, float* %84
ret void
}

LLVM IR (-O2):
define void @rgbToHsv(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 = tail call float @fstep(float %7, float %5)
%9 = tail call float @flerp(float %7, float %5, float %8)
%10 = tail call float @flerp(float %5, float %7, float %8)
%11 = tail call float @flerp(float -1.000000e+00, float 0.000000e+00, float %8)
%12 = tail call float @flerp(float 0x3FE5555560000000, float 0xBFD5555560000000, float %8)
%13 = tail call float @fstep(float %9, float %3)
%14 = tail call float @flerp(float %9, float %3, float %13)
%15 = tail call float @flerp(float %12, float %11, float %13)
%16 = tail call float @flerp(float %3, float %9, float %13)
%17 = tail call nsz float @llvm.minnum.f32(float %16, float %10)
%18 = fsub float %14, %17
%19 = fsub float %16, %10
%20 = tail call float @llvm.fmuladd.f32(float %18, float 6.000000e+00, float 0x3DDB7CDFE0000000)
%21 = fdiv float %19, %20
%22 = fadd float %15, %21
%23 = tail call float @fabsolute(float %22)
store float %23, float* %0
%24 = fadd float %14, 0x3DDB7CDFE0000000
%25 = fdiv float %18, %24
%26 = getelementptr inbounds float, float* %0, i64 1
store float %25, float* %26
%27 = getelementptr inbounds float, float* %0, i64 2
store float %14, float* %27
ret void
}