// File: /workspace/github_c_makefile_star2_O2/arkanis[P]process-map/./deps/raygui.h
// Function: GuiValueBox
bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
{
    #if !defined(VALUEBOX_MAX_CHARS)
        #define VALUEBOX_MAX_CHARS  32
    #endif

    static int framesCounter = 0;           // Required for blinking cursor

    GuiControlState state = guiState;
    bool pressed = false;

    char textValue[VALUEBOX_MAX_CHARS + 1] = "\0";
    sprintf(textValue, "%i", *value);

    Rectangle textBounds = { 0 };
    if (text != NULL)
    {
        textBounds.width = (float)GetTextWidth(text);
        textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
        textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING);
        textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
        if (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(VALUEBOX, TEXT_PADDING);
    }

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

        bool valueHasChanged = false;

        if (editMode)
        {
            state = GUI_STATE_PRESSED;

            framesCounter++;

            int keyCount = (int)strlen(textValue);

            // Only allow keys in range [48..57]
            if (keyCount < VALUEBOX_MAX_CHARS)
            {
                if (GetTextWidth(textValue) < bounds.width)
                {
                    int key = GetCharPressed();
                    if ((key >= 48) && (key <= 57))
                    {
                        textValue[keyCount] = (char)key;
                        keyCount++;
                        valueHasChanged = true;
                    }
                }
            }

            // Delete text
            if (keyCount > 0)
            {
                if (IsKeyPressed(KEY_BACKSPACE))
                {
                    keyCount--;
                    textValue[keyCount] = '\0';
                    framesCounter = 0;
                    if (keyCount < 0) keyCount = 0;
                    valueHasChanged = true;
                }
                else if (IsKeyDown(KEY_BACKSPACE))
                {
                    if ((framesCounter > TEXTEDIT_CURSOR_BLINK_FRAMES) && (framesCounter%2) == 0) keyCount--;
                    textValue[keyCount] = '\0';
                    if (keyCount < 0) keyCount = 0;
                    valueHasChanged = true;
                }
            }

            if (valueHasChanged) *value = TextToInteger(textValue);

            if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true;
        }
        else
        {
            if (*value > maxValue) *value = maxValue;
            else if (*value < minValue) *value = minValue;

            if (CheckCollisionPointRec(mousePoint, bounds))
            {
                state = GUI_STATE_FOCUSED;
                if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
            }
        }

        if (pressed) framesCounter = 0;
    }
    //--------------------------------------------------------------------

    // Draw control
    //--------------------------------------------------------------------
    Color baseColor = BLANK;
    if (state == GUI_STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED));
    else if (state == GUI_STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED));

    // WARNING: BLANK color does not work properly with Fade()
    GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), guiAlpha), baseColor);
    GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3))), guiAlpha));

    // Draw blinking cursor
    if ((state == GUI_STATE_PRESSED) && (editMode && ((framesCounter/20)%2 == 0)))
    {
        // NOTE: ValueBox internal text is always centered
        Rectangle cursor = { bounds.x + GetTextWidth(textValue)/2 + bounds.width/2 + 2, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 1, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH) };
        GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
    }

    // Draw text label if provided
    if (text != NULL) GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT)? GUI_TEXT_ALIGN_LEFT : GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
    //--------------------------------------------------------------------

    return pressed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %r8d, 0x1c(%rsp)
movl %ecx, %r15d
movl %edx, 0xb0(%rsp)
movq %rsi, %r14
movq %rdi, %r13
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, (%rsp)
movl 0x90406(%rip), %ebx     # 0x9b280
xorps %xmm1, %xmm1
leaq 0x80(%rsp), %rdi
movaps %xmm1, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, (%rdi)
movb $0x0, 0x20(%rdi)
movl (%rsi), %edx
leaq 0x53d29(%rip), %rsi     # 0x5ebca
xorl %eax, %eax
callq 0x6360
pushq $0x2
popq %r12
movaps 0x20(%rsp), %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm0, 0x70(%rsp)
xorps %xmm0, %xmm0
movq %r13, 0x68(%rsp)
testq %r13, %r13
je 0xafb5
movq 0x68(%rsp), %rdi
callq 0x76f6
movl %eax, %r13d
pushq $0x10
popq %rbp
xorl %edi, %edi
movl %ebp, %esi
callq 0x6e93
movd %eax, %xmm0
movd %r13d, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtdq2ps %xmm1, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps (%rsp), %xmm0
addss 0x20(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
pushq $0xa
popq %r13
pushq $0xd
popq %rsi
movl %r13d, %edi
callq 0x6e93
cvtsi2ss %eax, %xmm0
addss 0x30(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movaps (%rsp), %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss 0x4e0d6(%rip), %xmm1    # 0x5900c
mulss 0x70(%rsp), %xmm1
addss %xmm0, %xmm1
movaps %xmm1, 0x40(%rsp)
xorl %edi, %edi
movl %ebp, %esi
callq 0x6e93
cltd
idivl %r12d
cvtsi2ss %eax, %xmm0
movaps 0x40(%rsp), %xmm1
subss %xmm0, %xmm1
movaps 0x30(%rsp), %xmm0
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movaps %xmm0, 0x30(%rsp)
pushq $0xe
popq %rsi
movl %r13d, %edi
callq 0x6e93
testl %eax, %eax
jne 0xafb0
movaps (%rsp), %xmm0
subss 0x50(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
pushq $0xa
popq %rdi
pushq $0xd
popq %rsi
callq 0x6e93
cvtsi2ss %eax, %xmm0
movaps 0x40(%rsp), %xmm1
subss %xmm0, %xmm1
movaps 0x30(%rsp), %xmm0
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
movaps %xmm0, 0x30(%rsp)
movaps 0x50(%rsp), %xmm0
cmpl $0x3, %ebx
movaps %xmm0, 0x50(%rsp)
jne 0xafe1
pushq $0xa
popq %rdi
movl %edi, %esi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movl %eax, %r15d
pushq $0x3
popq %rbx
xorl %r13d, %r13d
xorl %r14d, %r14d
jmp 0xb17e
cmpb $0x0, 0x9029c(%rip)     # 0x9b284
je 0xaff2
xorl %r14d, %r14d
jmp 0xb152
callq 0x1fd8b
cmpb $0x0, 0x1c(%rsp)
je 0xb060
movaps %xmm0, 0x40(%rsp)
incl 0x908bb(%rip)           # 0x9b8c4
leaq 0x80(%rsp), %rdi
callq 0x6300
movq %rax, %r15
cmpl $0x1f, %r15d
jg 0xb0bf
leaq 0x80(%rsp), %rdi
callq 0x76f6
cvtsi2ss %eax, %xmm0
movaps 0x20(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0xb0c3
callq 0x2435e
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0xb0c3
movslq %r15d, %rcx
movb %al, 0x80(%rsp,%rcx)
incl %r15d
movb $0x1, %bl
jmp 0xb0c5
movl (%r14), %eax
cmpl %r15d, %eax
jg 0xb076
movl 0xb0(%rsp), %ecx
movl %ecx, %r15d
cmpl %ecx, %eax
jge 0xb079
movl %r15d, (%r14)
movaps (%rsp), %xmm1
movaps 0x20(%rsp), %xmm2
callq 0x2a643
xorl %r15d, %r15d
movl $0x0, %r14d
testb %al, %al
je 0xb152
xorl %edi, %edi
callq 0x2459e
pushq $0x1
popq %r12
movl $0x0, %r13d
movl %r12d, %ebx
movl $0x0, %r14d
testb %al, %al
jne 0xb145
jmp 0xb17e
xorl %ebx, %ebx
jmp 0xb0ca
xorl %ebx, %ebx
testl %r15d, %r15d
jle 0xb11f
movl $0x103, %edi            # imm = 0x103
callq 0x242af
testb %al, %al
je 0xb0ed
decl %r15d
movb $0x0, 0x80(%rsp,%r15)
andl $0x0, 0x907d9(%rip)     # 0x9b8c4
jmp 0xb123
movl $0x103, %edi            # imm = 0x103
callq 0x1fdd6
testb %al, %al
je 0xb11f
movl 0x907c3(%rip), %eax     # 0x9b8c4
cmpl $0x15, %eax
setge %cl
testb $0x1, %al
sete %al
andb %cl, %al
movzbl %al, %eax
subl %eax, %r15d
movb $0x0, 0x80(%rsp,%r15)
jmp 0xb123
testb %bl, %bl
je 0xb133
leaq 0x80(%rsp), %rdi
callq 0x448c2
movl %eax, (%r14)
movl $0x101, %edi            # imm = 0x101
callq 0x242af
testb %al, %al
je 0xb37c
andl $0x0, 0x90778(%rip)     # 0x9b8c4
movb $0x1, %r14b
movl %r12d, %ebx
movl $0x0, %r13d
movl $0x0, %r15d
cmpl $0x2, %ebx
jne 0xb17e
pushq $0xa
popq %rdi
pushq $0x7
popq %rsi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movl %eax, %r15d
pushq $0x2
popq %rbx
movb $0x1, %r13b
pushq $0xa
popq %r12
pushq $0xc
popq %rsi
movl %r12d, %edi
callq 0x6e93
movl %eax, %ebp
leal (%rbx,%rbx,2), %esi
movl %r12d, %edi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movss 0x8f297(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
movaps (%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movl %ebp, %edi
movl %eax, %esi
movl %r15d, %edx
callq 0x7476
movl %r12d, %edi
movaps (%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
callq 0x8f04
movaps %xmm0, 0x40(%rsp)
movaps %xmm1, 0xb0(%rsp)
leal (%rbx,%rbx,2), %r15d
addl $0x2, %r15d
movl %r12d, %edi
movl %r15d, %esi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movss 0x8f23b(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
leaq 0x80(%rsp), %rdi
pushq $0x1
popq %rsi
movaps 0x40(%rsp), %xmm0
movaps 0xb0(%rsp), %xmm1
movl %eax, %edx
callq 0x8d31
andb 0x1c(%rsp), %r13b
cmpb $0x1, %r13b
jne 0xb310
movl 0x90684(%rip), %eax     # 0x9b8c4
pushq $0x14
popq %rcx
cltd
idivl %ecx
testb $0x1, %al
jne 0xb310
leaq 0x80(%rsp), %rdi
callq 0x76f6
pushq $0x2
popq %rcx
cltd
idivl %ecx
cvtsi2ss %eax, %xmm0
addss (%rsp), %xmm0
movss 0x4dd9a(%rip), %xmm1    # 0x5900c
mulss 0x20(%rsp), %xmm1
addss %xmm0, %xmm1
movaps %xmm1, 0x20(%rsp)
pushq $0xa
popq %rbp
pushq $0xc
popq %r12
movl %ebp, %edi
movl %r12d, %esi
callq 0x6e93
addl %eax, %eax
cvtsi2ss %eax, %xmm0
movaps (%rsp), %xmm2
movaps 0x20(%rsp), %xmm1
movss %xmm1, %xmm2            # xmm2 = xmm1[0],xmm2[1,2,3]
movaps 0x4de84(%rip), %xmm1    # 0x59130
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
addps %xmm2, %xmm1
movaps %xmm1, (%rsp)
movl %ebp, %edi
movl %r12d, %esi
callq 0x6e93
shll $0x2, %eax
cvtsi2ss %eax, %xmm0
movaps 0x70(%rsp), %xmm1
subss %xmm0, %xmm1
movaps %xmm1, 0x70(%rsp)
pushq $0x6
popq %rsi
movl %ebp, %edi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movss 0x8f152(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
movaps 0x4ddb4(%rip), %xmm1    # 0x590b0
unpcklps 0x70(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
movaps (%rsp), %xmm0
xorl %edi, %edi
xorl %esi, %esi
movl %eax, %edx
callq 0x7476
movq 0x68(%rsp), %rbx
testq %rbx, %rbx
je 0xb367
pushq $0xa
popq %rdi
pushq $0xe
popq %rsi
callq 0x6e93
xorl %ebp, %ebp
cmpl $0x2, %eax
setne %bpl
addl %ebp, %ebp
pushq $0x1
popq %rdi
movl %r15d, %esi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movss 0x8f0f6(%rip), %xmm0    # 0x9a440
movl %eax, %edi
callq 0x380d5
movq %rbx, %rdi
movaps 0x30(%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movl %ebp, %esi
movl %eax, %edx
callq 0x8d31
movl %r14d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movaps 0x40(%rsp), %xmm0
movaps (%rsp), %xmm1
movaps 0x20(%rsp), %xmm2
callq 0x2a643
xorl %r14d, %r14d
testb %al, %al
jne 0xb163
xorl %edi, %edi
callq 0x2459e
testb %al, %al
jne 0xb145
jmp 0xb163