// File: /workspace/github_c_makefile_star2_O3/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 $0x88, %rsp
movl %edi, %ebx
movaps %xmm2, 0x40(%rsp)
movaps %xmm1, 0x50(%rsp)
movaps %xmm0, 0x10(%rsp)
movl 0x92454(%rip), %ebp     # 0xa4250
callq 0x26136
cmpl $0x3, %ebp
jne 0x11e12
movaps 0x533d3(%rip), %xmm0    # 0x651e0
jmp 0x1203a
movaps %xmm0, %xmm1
movaps 0x533c4(%rip), %xmm0    # 0x651e0
cmpb $0x0, 0x92431(%rip)     # 0xa4254
jne 0x11e60
movaps %xmm1, %xmm0
movaps %xmm1, 0x30(%rsp)
movaps 0x10(%rsp), %xmm1
movaps 0x50(%rsp), %xmm2
callq 0x320c1
movaps 0x5339d(%rip), %xmm0    # 0x651e0
testb %al, %al
je 0x11e60
movaps 0x30(%rsp), %xmm1
subps 0x10(%rsp), %xmm1
movaps 0x40(%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 0x1203a
movaps %xmm0, 0x60(%rsp)
movaps 0x50(%rsp), %xmm1
movaps %xmm1, %xmm0
shufps $0x55, %xmm1, %xmm0     # xmm0 = xmm0[1,1],xmm1[1,1]
movaps 0x40(%rsp), %xmm3
divss %xmm3, %xmm1
movaps %xmm0, %xmm2
cvttss2si %xmm1, %r13d
divss %xmm3, %xmm2
cvttss2si %xmm2, %r12d
imull %ebx, %r13d
imull %ebx, %r12d
movaps 0x10(%rsp), %xmm1
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
movaps %xmm1, 0x70(%rsp)
testl %r13d, %r13d
js 0x11f73
xorps %xmm1, %xmm1
cvtsi2ss %ebx, %xmm1
movss %xmm1, 0xc(%rsp)
cvttss2si 0x70(%rsp), %eax
movl %eax, 0x8(%rsp)
cvttss2si %xmm0, %eax
movl %eax, 0x2c(%rsp)
incl %r13d
xorl %r15d, %r15d
movl %r15d, %eax
xorl %edx, %edx
divl %ebx
xorl %r14d, %r14d
testl %edx, %edx
sete %bpl
cmpb $0x0, 0x9235d(%rip)     # 0xa4255
jne 0x11eff
callq 0x6a3c
movb %bpl, %r14b
leaq 0x5346f(%rip), %rax     # 0x65378
movss (%rax,%r14,4), %xmm0
movss %xmm0, 0x30(%rsp)
movl 0x923bd(%rip), %edi     # 0xa42d8
callq 0x4144d
movl %eax, %edi
movss 0x30(%rsp), %xmm0
callq 0x41122
cmpl $0x1000000, %eax        # imm = 0x1000000
jb 0x11f67
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
mulss 0x40(%rsp), %xmm0
divss 0xc(%rsp), %xmm0
addss 0x10(%rsp), %xmm0
cvttss2si %xmm0, %edi
movl 0x8(%rsp), %esi
movl $0x1, %edx
movl 0x2c(%rsp), %ecx
movl %eax, %r8d
callq 0x2e4dc
incl %r15d
cmpl %r15d, %r13d
jne 0x11ee1
testl %r12d, %r12d
js 0x12035
xorps %xmm0, %xmm0
cvtsi2ss %ebx, %xmm0
movss %xmm0, 0xc(%rsp)
cvttss2si 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
cvttss2si 0x50(%rsp), %eax
movl %eax, 0x8(%rsp)
incl %r12d
xorl %r15d, %r15d
leaq 0x533ce(%rip), %r13     # 0x65378
movl %r15d, %eax
xorl %edx, %edx
divl %ebx
xorl %ebp, %ebp
testl %edx, %edx
sete %r14b
cmpb $0x0, 0x92295(%rip)     # 0xa4255
jne 0x11fc7
callq 0x6a3c
movb %r14b, %bpl
movss (%r13,%rbp,4), %xmm0
movss %xmm0, 0x30(%rsp)
movl 0x922fb(%rip), %edi     # 0xa42d8
callq 0x4144d
movl %eax, %edi
movss 0x30(%rsp), %xmm0
callq 0x41122
cmpl $0x1000000, %eax        # imm = 0x1000000
jb 0x12029
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
mulss 0x40(%rsp), %xmm0
divss 0xc(%rsp), %xmm0
addss 0x70(%rsp), %xmm0
cvttss2si %xmm0, %esi
movl 0x10(%rsp), %edi
movl 0x8(%rsp), %edx
movl $0x1, %ecx
movl %eax, %r8d
callq 0x2e4dc
incl %r15d
cmpl %r15d, %r12d
jne 0x11faa
movaps 0x60(%rsp), %xmm0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq