// File: /workspace/github_c_makefile_star2_O1/arkanis[P]process-map/./deps/raygui.h
// Function: GetTextBounds
static Rectangle GetTextBounds(int control, Rectangle bounds)
{
    Rectangle textBounds = bounds;

    textBounds.x = bounds.x + GuiGetStyle(control, BORDER_WIDTH);
    textBounds.y = bounds.y + GuiGetStyle(control, BORDER_WIDTH);
    textBounds.width = bounds.width - 2*GuiGetStyle(control, BORDER_WIDTH);
    textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH);

    // Consider TEXT_PADDING properly, depends on control type and TEXT_ALIGNMENT
    switch (control)
    {
        case COMBOBOX: bounds.width -= (GuiGetStyle(control, COMBO_BUTTON_WIDTH) + GuiGetStyle(control, COMBO_BUTTON_PADDING)); break;
        case VALUEBOX: break;   // NOTE: ValueBox text value always centered, text padding applies to label
        default:
        {
            if (GuiGetStyle(control, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT) textBounds.x -= GuiGetStyle(control, TEXT_PADDING);
            else textBounds.x += GuiGetStyle(control, TEXT_PADDING);
        } break;
    }

    // TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW (scrollbar?)
    // More special cases (label side): CHECKBOX, SLIDER, VALUEBOX, SPINNER

    return textBounds;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movaps %xmm1, 0x20(%rsp)
movl %edi, %ebx
cmpb $0x0, 0x9da0e(%rip)     # 0xa7255
jne 0x9856
movaps %xmm0, (%rsp)
callq 0x6a18
movaps (%rsp), %xmm0
leal (,%rbx,8), %eax
leal (%rax,%rax,2), %eax
movslq %eax, %r15
leaq 0xc(%r15), %r14
leaq 0x9da22(%rip), %r12     # 0xa7290
xorps %xmm1, %xmm1
cvtsi2ssl 0x30(%r12,%r15,4), %xmm1
addss %xmm0, %xmm1
movaps %xmm1, 0x10(%rsp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
cmpb $0x0, 0x9d9c9(%rip)     # 0xa7255
jne 0x989b
movaps %xmm0, (%rsp)
callq 0x6a18
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl (%r12,%r14,4), %xmm1
addss %xmm1, %xmm0
cmpb $0x0, 0x9d9a6(%rip)     # 0xa7255
jne 0x98be
movaps %xmm0, (%rsp)
callq 0x6a18
movaps (%rsp), %xmm0
unpcklpd 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movl (%r12,%r14,4), %ebp
cmpb $0x0, 0x9d986(%rip)     # 0xa7255
jne 0x98de
movaps %xmm0, (%rsp)
callq 0x6a18
movaps (%rsp), %xmm0
shufps $0xe2, 0x10(%rsp), %xmm0 # xmm0 = xmm0[2,0],mem[2,3]
movl (%r12,%r14,4), %r14d
cmpl $0xa, %ebx
je 0x9986
cmpl $0x7, %ebx
movaps %xmm0, (%rsp)
jne 0x9920
cmpb $0x0, 0x9d954(%rip)     # 0xa7255
jne 0x990c
callq 0x6a18
movaps (%rsp), %xmm0
cmpb $0x0, 0x9d942(%rip)     # 0xa7255
jne 0x9986
callq 0x6a18
movaps (%rsp), %xmm0
jmp 0x9986
cmpb $0x0, 0x9d92e(%rip)     # 0xa7255
jne 0x9932
callq 0x6a18
movaps (%rsp), %xmm0
cmpl $0x2, 0x38(%r12,%r15,4)
movb 0x9d917(%rip), %al      # 0xa7255
jne 0x9962
testb $0x1, %al
jne 0x994d
callq 0x6a18
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x34(%r12,%r15,4), %xmm1
movaps 0x10(%rsp), %xmm2
subss %xmm1, %xmm2
jmp 0x9982
testb $0x1, %al
jne 0x996f
callq 0x6a18
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x34(%r12,%r15,4), %xmm1
movaps 0x10(%rsp), %xmm2
addss %xmm1, %xmm2
movss %xmm2, %xmm0            # xmm0 = xmm2[0],xmm0[1,2,3]
addl %ebp, %ebp
xorps %xmm2, %xmm2
cvtsi2ss %ebp, %xmm2
movaps 0x20(%rsp), %xmm3
movaps %xmm3, %xmm1
subss %xmm2, %xmm1
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
addl %r14d, %r14d
xorps %xmm2, %xmm2
cvtsi2ss %r14d, %xmm2
subss %xmm2, %xmm3
unpcklps %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq