#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ _hsv2rgb(float *, float *);
int /*<<< orphan*/ _set_rgba_from_rgb(int /*<<< orphan*/ *, float, float,
                                      float);
void _set_rgba_from_hsv(uint32_t *rgba, float h, float s, float v) {
  float hsv[3], rgb[3];
  hsv[0] = h;
  hsv[1] = s;
  hsv[2] = v;
  _hsv2rgb(rgb, hsv);
  _set_rgba_from_rgb(rgba, rgb[0], rgb[1], rgb[2]);
}


x86 assembly (clang, -O0):
<_set_rgba_from_hsv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
lea    -0x2c(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <_hsv2rgb@plt>
mov    -0x8(%rbp),%rdi
movss  -0x2c(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
call   1040 <_set_rgba_from_rgb@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_rgba_from_hsv>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movss  %xmm0,0x14(%rsp)
movss  %xmm1,0x18(%rsp)
movss  %xmm2,0x1c(%rsp)
lea    0x8(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1030 <_hsv2rgb@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
mov    %rbx,%rdi
call   1040 <_set_rgba_from_rgb@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @_set_rgba_from_hsv(i32* %0, float %1, float %2, float %3) {
%5 = alloca i32*
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca [3 x float]
%10 = alloca [3 x float]
store i32* %0, i32** %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%11 = load float, float* %6
%12 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
store float %11, float* %12
%13 = load float, float* %7
%14 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
store float %13, float* %14
%15 = load float, float* %8
%16 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 2
store float %15, float* %16
%17 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%18 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%19 = call i32 @_hsv2rgb(float* %17, float* %18)
%20 = load i32*, i32** %5
%21 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%22 = load float, float* %21
%23 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 1
%24 = load float, float* %23
%25 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 2
%26 = load float, float* %25
%27 = call i32 @_set_rgba_from_rgb(i32* %20, float %22, float %24, float %26)
ret void
}

LLVM IR (-O2):
define void @_set_rgba_from_hsv(i32* %0, float %1, float %2, float %3) {
%5 = alloca [3 x float]
%6 = alloca [3 x float]
%7 = bitcast [3 x float]* %5 to i8*
%8 = bitcast [3 x float]* %6 to i8*
%9 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
store float %1, float* %9
%10 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
store float %2, float* %10
%11 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
store float %3, float* %11
%12 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 0
%13 = call i32 @_hsv2rgb(float* %12, float* %9)
%14 = load float, float* %12
%15 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 1
%16 = load float, float* %15
%17 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 2
%18 = load float, float* %17
%19 = call i32 @_set_rgba_from_rgb(i32* %0, float %14, float %16, float %18)
ret void
}