// File: /workspace/github_c_makefile_star2_O2/arkanis[P]process-map/./deps/raygui.h
// Function: GuiGrid
Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
{
    #if !defined(GRID_COLOR_ALPHA)
        #define GRID_COLOR_ALPHA    0.15f           // Grid lines alpha amount
    #endif

    GuiControlState state = guiState;
    Vector2 mousePoint = GetMousePosition();
    Vector2 currentCell = { -1, -1 };

    int linesV = ((int)(bounds.width/spacing))*subdivs + 1;
    int linesH = ((int)(bounds.height/spacing))*subdivs + 1;

    // Update control
    //--------------------------------------------------------------------
    if ((state != GUI_STATE_DISABLED) && !guiLocked)
    {
        if (CheckCollisionPointRec(mousePoint, bounds))
        {
            currentCell.x = (mousePoint.x - bounds.x) / spacing;
            currentCell.y = (mousePoint.y - bounds.y) / spacing;
        }
    }
    //--------------------------------------------------------------------

    // Draw control
    //--------------------------------------------------------------------
    switch (state)
    {
        case GUI_STATE_NORMAL:
        {
            if (subdivs > 0)
            {
                // Draw vertical grid lines
                for (int i = 0; i < linesV; i++)
                {
                    Rectangle lineV = { bounds.x + spacing * i / subdivs, bounds.y, 1, bounds.height };
                    GuiDrawRectangle(lineV, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA * 4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA));
                }

                // Draw horizontal grid lines
                for (int i = 0; i < linesH; i++)
                {
                    Rectangle lineH = { bounds.x, bounds.y + spacing * i / subdivs, bounds.width, 1 };
                    GuiDrawRectangle(lineH, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA * 4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA));
                }
            }
        } break;
        default: break;
    }

    return currentCell;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edi, %ebx
movaps %xmm2, 0x30(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
movl 0x8cbd4(%rip), %ebp     # 0x9b280
callq 0x1fd8b
cmpl $0x3, %ebp
jne 0xe6c2
movaps 0x4ab03(%rip), %xmm0    # 0x591c0
jmp 0xe880
movaps %xmm0, %xmm1
movaps 0x4aaf4(%rip), %xmm0    # 0x591c0
cmpb $0x0, 0x8cbb1(%rip)     # 0x9b284
jne 0xe70e
movaps %xmm1, %xmm0
movaps %xmm1, 0x20(%rsp)
movaps (%rsp), %xmm1
movaps 0x10(%rsp), %xmm2
callq 0x2a643
movaps 0x4aace(%rip), %xmm0    # 0x591c0
testb %al, %al
je 0xe70e
movaps 0x20(%rsp), %xmm1
subps (%rsp), %xmm1
movaps 0x30(%rsp), %xmm0
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
divps %xmm0, %xmm1
movaps %xmm1, %xmm0
testl %ebp, %ebp
setne %al
testl %ebx, %ebx
setle %cl
orb %al, %cl
jne 0xe880
movaps %xmm0, 0x60(%rsp)
movaps 0x10(%rsp), %xmm1
movaps %xmm1, %xmm0
shufps $0x55, %xmm1, %xmm0     # xmm0 = xmm0[1,1],xmm1[1,1]
movaps 0x30(%rsp), %xmm2
divss %xmm2, %xmm1
movaps 0x4a96f(%rip), %xmm3    # 0x590b0
unpcklps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
movaps %xmm3, 0x40(%rsp)
divss %xmm2, %xmm0
cvttss2si %xmm1, %r13d
cvttss2si %xmm0, %r15d
imull %ebx, %r13d
cvtsi2ss %ebx, %xmm0
movss %xmm0, 0x20(%rsp)
imull %ebx, %r15d
xorl %ebp, %ebp
leaq 0x4ac0e(%rip), %r12     # 0x59380
cmpl %r13d, %ebp
jg 0xe7df
cvtsi2ss %ebp, %xmm0
mulss 0x30(%rsp), %xmm0
divss 0x20(%rsp), %xmm0
addss (%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movl %ebp, %eax
xorl %edx, %edx
divl %ebx
xorl %r14d, %r14d
testl %edx, %edx
sete %r14b
xorl %edi, %edi
pushq $0x12
popq %rsi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movss (%r12,%r14,4), %xmm0
movl %eax, %edi
callq 0x380d5
movaps (%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
movaps 0x40(%rsp), %xmm1
xorl %edi, %edi
xorl %esi, %esi
movl %eax, %edx
callq 0x7476
incl %ebp
jmp 0xe772
movaps (%rsp), %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm0, 0x40(%rsp)
movaps 0x4a8cd(%rip), %xmm1    # 0x590c0
movaps 0x10(%rsp), %xmm0
movss %xmm0, %xmm1            # xmm1 = xmm0[0],xmm1[1,2,3]
movaps %xmm1, 0x10(%rsp)
xorl %ebp, %ebp
pushq $0x12
popq %r14
cmpl %r15d, %ebp
jg 0xe87b
cvtsi2ss %ebp, %xmm0
mulss 0x30(%rsp), %xmm0
divss 0x20(%rsp), %xmm0
addss 0x40(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movl %ebp, %eax
xorl %edx, %edx
divl %ebx
xorl %r13d, %r13d
testl %edx, %edx
sete %r13b
xorl %edi, %edi
movl %r14d, %esi
callq 0x6e93
movl %eax, %edi
callq 0x38400
movss (%r12,%r13,4), %xmm0
movl %eax, %edi
callq 0x380d5
movaps (%rsp), %xmm0
movaps 0x50(%rsp), %xmm1
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
shufps $0xe2, %xmm0, %xmm1     # xmm1 = xmm1[2,0],xmm0[2,3]
movaps %xmm1, %xmm0
movaps 0x10(%rsp), %xmm1
xorl %edi, %edi
xorl %esi, %esi
movl %eax, %edx
callq 0x7476
incl %ebp
jmp 0xe807
movaps 0x60(%rsp), %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq