// File: /workspace/github_c_makefile_star2_O2/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 $0x68, %rsp
movaps %xmm2, 0x30(%rsp)
movl %edi, %ebx
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl %edi, %r15d
shrl $0x8, %r15d
movl %edi, %esi
shrl $0x10, %esi
movl %edi, %r14d
shrl $0x18, %r14d
movl 0x8e403(%rip), %ebp     # 0x9b280
movl $0xff, %eax
movl %r15d, %ecx
andl %eax, %ecx
movl %edi, %edx
andl %eax, %edx
movd %edx, %xmm0
pinsrw $0x2, %ecx, %xmm0
cvtdq2ps %xmm0, %xmm0
movl %esi, 0x4(%rsp)
movl %esi, %ecx
andl %eax, %ecx
cvtsi2ss %ecx, %xmm1
divps 0x4c296(%rip), %xmm0    # 0x59140
divss 0x4c17e(%rip), %xmm1    # 0x59030
callq 0xd2f8
movss %xmm1, (%rsp)
movss 0x4c140(%rip), %xmm1    # 0x59004
xorps %xmm4, %xmm4
movaps 0x30(%rsp), %xmm3
cmpless %xmm3, %xmm4
movaps %xmm4, %xmm2
movaps %xmm0, 0x40(%rsp)
andnps %xmm0, %xmm2
andps %xmm3, %xmm4
orps %xmm2, %xmm4
movaps 0x4c1d7(%rip), %xmm0    # 0x590c0
movss %xmm4, %xmm0            # xmm0 = xmm4[0],xmm0[1,2,3]
callq 0xd3a4
cmpl $0x3, %ebp
movl %r14d, 0xc(%rsp)
movl %r15d, 0x8(%rsp)
jne 0xcfd5
pushq $0xd
popq %r14
pushq $0xa
popq %rsi
movl %r14d, %edi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movss 0x4c111(%rip), %xmm0    # 0x59034
movl %eax, %edi
callq 0x380d5
movss 0x8d50e(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
movl %eax, %ebp
movss 0x4c0f5(%rip), %xmm0    # 0x59038
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x380d5
movss 0x8d4eb(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
movl %eax, %r12d
movl $0xff000000, %edi       # imm = 0xFF000000
movss 0x4c0cc(%rip), %xmm0    # 0x59038
callq 0x380d5
movss 0x8d4c7(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
movl %eax, %r13d
pushq $0x9
popq %r15
movl %r14d, %edi
movl %r15d, %esi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movl %eax, %edi
movss 0x4c095(%rip), %xmm0    # 0x59038
callq 0x380d5
movss 0x8d490(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl %ebp, %edi
movl %r12d, %esi
movl %r13d, %edx
movl %eax, %ecx
callq 0x2709f
jmp 0xd291
movss 0x4c027(%rip), %xmm2    # 0x59004
subss (%rsp), %xmm2
movaps 0x40(%rsp), %xmm3
shufps $0xd4, %xmm3, %xmm2     # xmm2 = xmm2[0,1],xmm3[1,3]
shufps $0x52, %xmm3, %xmm2     # xmm2 = xmm2[2,0],xmm3[1,1]
mulps 0x20(%rsp), %xmm2
addps 0x10(%rsp), %xmm2
movaps %xmm2, 0x30(%rsp)
movaps %xmm0, %xmm2
movss 0x4c027(%rip), %xmm3    # 0x59030
mulss %xmm3, %xmm2
cvttss2si %xmm2, %eax
movl %eax, (%rsp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
mulss %xmm3, %xmm0
cvttss2si %xmm0, %r13d
mulss %xmm3, %xmm1
cvttss2si %xmm1, %r12d
cmpb $0x0, 0x8e253(%rip)     # 0x9b284
jne 0xd102
callq 0x1fd8b
movaps %xmm0, 0x50(%rsp)
movaps 0x10(%rsp), %xmm1
movaps 0x20(%rsp), %xmm2
callq 0x2a643
testb %al, %al
je 0xd102
xorl %edi, %edi
callq 0x1fdb3
testb %al, %al
je 0xd0ff
movaps 0x20(%rsp), %xmm3
movaps %xmm3, %xmm1
shufps $0x55, %xmm3, %xmm1     # xmm1 = xmm1[1,1],xmm3[1,1]
movaps 0x50(%rsp), %xmm0
subps 0x10(%rsp), %xmm0
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
divss %xmm3, %xmm0
divss %xmm1, %xmm2
movss 0x4bf70(%rip), %xmm1    # 0x59004
subss %xmm2, %xmm1
movaps 0x40(%rsp), %xmm2
movlhps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
shufps $0xe2, %xmm2, %xmm0     # xmm0 = xmm0[2,0],xmm2[2,3]
callq 0xd3a4
movaps %xmm0, %xmm2
movss 0x4bf7c(%rip), %xmm3    # 0x59030
mulss %xmm3, %xmm2
cvttss2si %xmm2, %ebx
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
mulss %xmm3, %xmm0
cvttss2si %xmm0, %eax
movl %eax, 0x8(%rsp)
mulss %xmm3, %xmm1
movzbl %r14b, %eax
cvtsi2ss %eax, %xmm0
cvttss2si %xmm1, %eax
movl %eax, 0x4(%rsp)
mulss %xmm3, %xmm0
divss %xmm3, %xmm0
cvttss2si %xmm0, %eax
movl %eax, 0xc(%rsp)
pushq $0x2
popq %rbp
movaps 0x50(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
jmp 0xd102
pushq $0x1
popq %rbp
movss 0x8d336(%rip), %xmm0    # 0x9a440
pushq $-0x1
popq %r15
movl %r15d, %edi
callq 0x380d5
movl %eax, %r14d
movss 0x8d31f(%rip), %xmm0    # 0x9a440
movl %r15d, %edi
callq 0x380d5
movl %eax, %r15d
movss 0x8d30c(%rip), %xmm0    # 0x9a440
movzbl %r12b, %eax
shll $0x10, %eax
movzbl %r13b, %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzbl (%rsp), %r12d
orl %ecx, %r12d
orl $0xff000000, %r12d      # imm = 0xFF000000
movl %r12d, %edi
callq 0x380d5
movl %eax, %r13d
movss 0x8d2da(%rip), %xmm0    # 0x9a440
movl %r12d, %edi
callq 0x380d5
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl %r14d, %edi
movl %r15d, %esi
movl %r13d, %edx
movl %eax, %ecx
callq 0x2709f
xorps %xmm0, %xmm0
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x380d5
movl %eax, %r14d
movss 0x8d2a0(%rip), %xmm0    # 0x9a440
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x380d5
movl %eax, %r15d
movss 0x8d28b(%rip), %xmm0    # 0x9a440
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x380d5
movl %eax, %r12d
xorps %xmm0, %xmm0
movl $0xff000000, %edi       # imm = 0xFF000000
callq 0x380d5
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl %r14d, %edi
movl %r15d, %esi
movl %r12d, %edx
movl %eax, %ecx
callq 0x2709f
pushq $0xd
popq %r14
pushq $0x10
popq %r15
movl %r14d, %edi
movl %r15d, %esi
callq 0x6e93
movl %eax, %r12d
movl %r14d, %edi
movl %r15d, %esi
callq 0x6e93
movd %r12d, %xmm0
movd %eax, %xmm1
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movdqa %xmm0, %xmm1
psrld $0x1f, %xmm1
paddd %xmm0, %xmm1
psrad $0x1, %xmm1
cvtdq2ps %xmm1, %xmm0
movaps 0x30(%rsp), %xmm1
subps %xmm0, %xmm1
movaps %xmm1, 0x30(%rsp)
movl %r14d, %edi
movl %r15d, %esi
callq 0x6e93
movl %eax, %r12d
movl %r14d, %edi
movl %r15d, %esi
callq 0x6e93
movd %r12d, %xmm0
movd %eax, %xmm1
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtdq2ps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movss 0x8d1d1(%rip), %xmm0    # 0x9a440
pushq $-0x1
popq %rdi
callq 0x380d5
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
xorl %edi, %edi
xorl %esi, %esi
movl %eax, %edx
callq 0x7476
leal (%rbp,%rbp,2), %r15d
pushq $0xd
popq %rdi
movl %r15d, %esi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movss 0x8d195(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
pushq $0x1
popq %rdi
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl %eax, %esi
xorl %edx, %edx
callq 0x7476
movzbl 0xc(%rsp), %eax
shll $0x18, %eax
movzbl 0x4(%rsp), %ecx
shll $0x10, %ecx
orl %eax, %ecx
movzbl 0x8(%rsp), %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl %bl, %eax
orl %edx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq