// File: /workspace/github_c_makefile_star2_O1/arkanis[P]process-map/./deps/raygui.h
// Function: GuiColorPanelEx
Color GuiColorPanelEx(Rectangle bounds, Color color, float hue)
{
    GuiControlState state = guiState;
    Vector2 pickerSelector = { 0 };

    Vector3 vcolor = { (float)color.r/255.0f, (float)color.g/255.0f, (float)color.b/255.0f };
    Vector3 hsv = ConvertRGBtoHSV(vcolor);

    pickerSelector.x = bounds.x + (float)hsv.y*bounds.width;            // HSV: Saturation
    pickerSelector.y = bounds.y + (1.0f - (float)hsv.z)*bounds.height;  // HSV: Value

    Vector3 maxHue = { hue >= 0.0f ? hue : hsv.x, 1.0f, 1.0f };
    Vector3 rgbHue = ConvertHSVtoRGB(maxHue);
    Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x),
                      (unsigned char)(255.0f*rgbHue.y),
                      (unsigned char)(255.0f*rgbHue.z), 255 };

    const Color colWhite = { 255, 255, 255, 255 };
    const Color colBlack = { 0, 0, 0, 255 };

    // Update control
    //--------------------------------------------------------------------
    if ((state != GUI_STATE_DISABLED) && !guiLocked)
    {
        Vector2 mousePoint = GetMousePosition();

        if (CheckCollisionPointRec(mousePoint, bounds))
        {
            if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
            {
                state = GUI_STATE_PRESSED;
                pickerSelector = mousePoint;

                // Calculate color from picker
                Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y };

                colorPick.x /= (float)bounds.width;     // Get normalized value on x
                colorPick.y /= (float)bounds.height;    // Get normalized value on y

                hsv.y = colorPick.x;
                hsv.z = 1.0f - colorPick.y;

                Vector3 rgb = ConvertHSVtoRGB(hsv);

                // NOTE: Vector3ToColor() only available on raylib 1.8.1
                color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x),
                                 (unsigned char)(255.0f*rgb.y),
                                 (unsigned char)(255.0f*rgb.z),
                                 (unsigned char)(255.0f*(float)color.a/255.0f) };

            }
            else state = GUI_STATE_FOCUSED;
        }
    }
    //--------------------------------------------------------------------

    // Draw control
    //--------------------------------------------------------------------
    if (state != GUI_STATE_DISABLED)
    {
        DrawRectangleGradientEx(bounds, Fade(colWhite, guiAlpha), Fade(colWhite, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha));
        DrawRectangleGradientEx(bounds, Fade(colBlack, 0), Fade(colBlack, guiAlpha), Fade(colBlack, guiAlpha), Fade(colBlack, 0));

        // Draw color picker: selector
        Rectangle selector = { pickerSelector.x - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, pickerSelector.y - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE), (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE) };
        GuiDrawRectangle(selector, 0, BLANK, Fade(colWhite, guiAlpha));
    }
    else
    {
        DrawRectangleGradientEx(bounds, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.6f), guiAlpha));
    }

    GuiDrawRectangle(bounds, 1, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK);
    //--------------------------------------------------------------------

    return color;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movaps %xmm2, (%rsp)
movl %edi, %ebx
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
movaps %xmm2, 0x50(%rsp)
movaps %xmm1, %xmm0
shufps $0x55, %xmm1, %xmm0     # xmm0 = xmm0[1,1],xmm1[1,1]
movaps %xmm0, 0x60(%rsp)
movl %edi, %r13d
shrl $0x8, %r13d
movl %edi, %r14d
shrl $0x10, %r14d
movl %edi, %r12d
shrl $0x18, %r12d
movl $0xff, %eax
movl %edi, %ecx
andl %eax, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movl 0x98b7d(%rip), %ebp     # 0xa7250
movss 0x59961(%rip), %xmm2    # 0x6803c
divss %xmm2, %xmm0
movl %r13d, %ecx
andl %eax, %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
divss %xmm2, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movl %r14d, %ecx
andl %eax, %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
divss %xmm2, %xmm1
callq 0xebba
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
mulss 0x20(%rsp), %xmm2
addss 0x10(%rsp), %xmm2
movss 0x598e2(%rip), %xmm4    # 0x68004
movaps %xmm4, %xmm3
subss %xmm1, %xmm3
mulss 0x60(%rsp), %xmm3
addss 0x50(%rsp), %xmm3
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movaps %xmm2, 0x50(%rsp)
xorps %xmm1, %xmm1
movaps (%rsp), %xmm3
cmpless %xmm3, %xmm1
movaps %xmm1, %xmm2
movaps %xmm0, 0x70(%rsp)
andnps %xmm0, %xmm2
andps %xmm3, %xmm1
orps %xmm2, %xmm1
movaps 0x5998f(%rip), %xmm0    # 0x680f0
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
movaps %xmm4, %xmm1
callq 0xec66
movaps %xmm1, %xmm2
movl $0x3, %ecx
cmpl $0x3, %ebp
je 0xe865
cmpb $0x0, 0x98acf(%rip)     # 0xa7254
je 0xe78e
movl %ebp, %ecx
jmp 0xe865
movaps %xmm0, 0x30(%rsp)
movss %xmm2, (%rsp)
callq 0x2867d
movaps %xmm0, 0x40(%rsp)
movaps 0x10(%rsp), %xmm1
movaps 0x20(%rsp), %xmm2
callq 0x34d6b
testb %al, %al
je 0xe859
xorl %edi, %edi
callq 0x286ba
movl $0x1, %ecx
testb %al, %al
je 0xe85b
movaps 0x40(%rsp), %xmm0
subps 0x10(%rsp), %xmm0
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
divss 0x20(%rsp), %xmm0
divss 0x60(%rsp), %xmm2
movss 0x59812(%rip), %xmm1    # 0x68004
subss %xmm2, %xmm1
movaps 0x70(%rsp), %xmm2
movlhps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
shufps $0xe2, %xmm2, %xmm0     # xmm0 = xmm0[2,0],xmm2[2,3]
callq 0xec66
movaps %xmm0, %xmm2
movss 0x5982a(%rip), %xmm3    # 0x6803c
mulss %xmm3, %xmm2
cvttss2si %xmm2, %ebx
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
mulss %xmm3, %xmm0
cvttss2si %xmm0, %r13d
mulss %xmm3, %xmm1
movzbl %r12b, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
cvttss2si %xmm1, %r14d
mulss %xmm3, %xmm0
divss %xmm3, %xmm0
cvttss2si %xmm0, %r12d
movl $0x2, %ecx
movaps 0x40(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
jmp 0xe85b
movl %ebp, %ecx
movss (%rsp), %xmm2
movaps 0x30(%rsp), %xmm0
movq %rcx, (%rsp)
cmpl $0x3, %ecx
movl %r14d, 0x60(%rsp)
jne 0xe94d
cmpb $0x0, 0x989d7(%rip)     # 0xa7255
jne 0xe885
callq 0x6a18
movl 0x98f0d(%rip), %edi     # 0xa7798
callq 0x44152
movss 0x597a8(%rip), %xmm0    # 0x68040
movl %eax, %edi
callq 0x43e1c
movss 0x97b89(%rip), %xmm0    # 0xa6430
movl %eax, %edi
callq 0x43e1c
movl %eax, %ebp
movss 0x5978c(%rip), %xmm0    # 0x68044
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x43e1c
movss 0x97b66(%rip), %xmm0    # 0xa6430
movl %eax, %edi
callq 0x43e1c
movl %eax, %r14d
movl $0xff000000, %edi       # imm = 0xFF000000
movss 0x59763(%rip), %xmm0    # 0x68044
callq 0x43e1c
movss 0x97b42(%rip), %xmm0    # 0xa6430
movl %eax, %edi
callq 0x43e1c
movl %eax, %r15d
cmpb $0x0, 0x98956(%rip)     # 0xa7255
jne 0xe906
callq 0x6a18
movl 0x98e88(%rip), %edi     # 0xa7794
callq 0x44152
movss 0x5972b(%rip), %xmm0    # 0x68044
movl %eax, %edi
callq 0x43e1c
movss 0x97b08(%rip), %xmm0    # 0xa6430
movl %eax, %edi
callq 0x43e1c
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl %ebp, %edi
movl %r14d, %esi
movl %r15d, %edx
movl %eax, %ecx
callq 0x3148c
jmp 0xeb38
movl %r13d, 0x30(%rsp)
movl %r12d, 0x70(%rsp)
movaps %xmm0, %xmm3
shufps $0x55, %xmm0, %xmm3     # xmm3 = xmm3[1,1],xmm0[1,1]
movss 0x596d6(%rip), %xmm1    # 0x6803c
mulss %xmm1, %xmm0
mulss %xmm1, %xmm3
cvttss2si %xmm0, %r15d
cvttss2si %xmm3, %r12d
mulss %xmm1, %xmm2
cvttss2si %xmm2, %r13d
movss 0x97aa7(%rip), %xmm0    # 0xa6430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43e1c
movl %eax, %ebp
movss 0x97a93(%rip), %xmm0    # 0xa6430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43e1c
movl %eax, %r14d
movss 0x97a7e(%rip), %xmm0    # 0xa6430
movzbl %r13b, %eax
shll $0x10, %eax
movzbl %r12b, %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzbl %r15b, %r15d
orl %ecx, %r15d
orl $0xff000000, %r15d      # imm = 0xFF000000
movl %r15d, %edi
callq 0x43e1c
movl %eax, %r12d
movss 0x97a4d(%rip), %xmm0    # 0xa6430
movl %r15d, %edi
callq 0x43e1c
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl %ebp, %edi
movl %r14d, %esi
movl %r12d, %edx
movl %eax, %ecx
callq 0x3148c
xorps %xmm0, %xmm0
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x43e1c
movl %eax, %ebp
movss 0x97a15(%rip), %xmm0    # 0xa6430
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x43e1c
movl %eax, %r14d
movss 0x97a00(%rip), %xmm0    # 0xa6430
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x43e1c
movl %eax, %r15d
xorps %xmm0, %xmm0
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x43e1c
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl %ebp, %edi
movl %r14d, %esi
movl %r15d, %edx
movl %eax, %ecx
callq 0x3148c
cmpb $0x0, 0x987eb(%rip)     # 0xa7255
jne 0xea71
callq 0x6a18
movl 0x98d39(%rip), %ebp     # 0xa77b0
cmpb $0x0, 0x987d7(%rip)     # 0xa7255
jne 0xea85
callq 0x6a18
movl 0x98d24(%rip), %r14d    # 0xa77b0
cmpb $0x0, 0x987c2(%rip)     # 0xa7255
movl 0x70(%rsp), %r12d
movl 0x30(%rsp), %r13d
jne 0xeaa4
callq 0x6a18
xorps %xmm0, %xmm0
cvtsi2ssl 0x98d01(%rip), %xmm0 # 0xa77b0
movss %xmm0, 0x40(%rsp)
cmpb $0x0, 0x98799(%rip)     # 0xa7255
jne 0xeac3
callq 0x6a18
movl 0x98ce6(%rip), %r15d    # 0xa77b0
movss 0x9795e(%rip), %xmm0    # 0xa6430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43e1c
cmpl $0x1000000, %eax        # imm = 0x1000000
jb 0xeb38
movl %ebp, %ecx
shrl $0x1f, %ecx
movl %r14d, %edx
shrl $0x1f, %edx
addl %ebp, %ecx
addl %r14d, %edx
sarl %ecx
movaps 0x50(%rsp), %xmm3
movaps %xmm3, %xmm0
shufps $0x55, %xmm3, %xmm0     # xmm0 = xmm0[1,1],xmm3[1,1]
sarl %edx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
cvtsi2ss %edx, %xmm2
subss %xmm1, %xmm3
subss %xmm2, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %r15d, %xmm1
cvttss2si %xmm3, %edi
cvttss2si %xmm0, %esi
cvttss2si 0x40(%rsp), %edx
cvttss2si %xmm1, %ecx
movl %eax, %r8d
callq 0x31115
cmpb $0x0, 0x98716(%rip)     # 0xa7255
jne 0xeb46
callq 0x6a18
movq (%rsp), %rax
leal (%rax,%rax,2), %eax
cltq
leaq 0x9873a(%rip), %rcx     # 0xa7290
movl 0x4e0(%rcx,%rax,4), %edi
callq 0x44152
movss 0x978c6(%rip), %xmm0    # 0xa6430
movl %eax, %edi
callq 0x43e1c
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl $0x1, %edi
movl %eax, %esi
xorl %edx, %edx
callq 0x7546
movzbl %r12b, %eax
shll $0x18, %eax
movzbl 0x60(%rsp), %ecx
shll $0x10, %ecx
orl %eax, %ecx
movzbl %r13b, %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl %bl, %eax
orl %edx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq