// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movaps %xmm1, 0x30(%rsp)
movl %edi, %ebx
movaps %xmm0, %xmm2
movb $0x1, %al
cmpb $0x0, 0x99b11(%rip)     # 0xa4255
jne 0xa763
movaps %xmm0, (%rsp)
movaps %xmm2, 0x10(%rsp)
callq 0x6a3c
movaps 0x10(%rsp), %xmm2
movaps (%rsp), %xmm0
movb 0x99af2(%rip), %al      # 0xa4255
leal (,%rbx,8), %ecx
leal (%rcx,%rcx,2), %ecx
movslq %ecx, %r14
leaq 0x99b19(%rip), %r15     # 0xa4290
movl 0x30(%r15,%r14,4), %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
addss %xmm1, %xmm2
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
testb $0x1, %al
je 0xa7a0
addss %xmm1, %xmm0
movlhps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
shufps $0xe2, %xmm2, %xmm0     # xmm0 = xmm0[2,0],xmm2[2,3]
movd %ecx, %xmm1
jmp 0xa7de
leaq 0xc(%r14), %r12
movaps %xmm0, (%rsp)
movaps %xmm2, 0x10(%rsp)
callq 0x6a3c
movaps 0x10(%rsp), %xmm2
movaps (%rsp), %xmm0
movl (%r15,%r12,4), %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
addss %xmm1, %xmm0
movlhps %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
shufps $0xe2, %xmm2, %xmm0     # xmm0 = xmm0[2,0],xmm2[2,3]
cmpb $0x0, 0x99a7d(%rip)     # 0xa4255
je 0xa7e5
movd %eax, %xmm1
pshufd $0x50, %xmm1, %xmm3     # xmm3 = xmm1[0,0,1,1]
jmp 0xa82a
movaps %xmm0, (%rsp)
callq 0x6a3c
movd (%r15,%r12,4), %xmm0
cmpb $0x0, 0x99a5a(%rip)     # 0xa4255
je 0xa804
pshufd $0x50, %xmm0, %xmm3     # xmm3 = xmm0[0,0,1,1]
jmp 0xa821
movdqa %xmm0, 0x20(%rsp)
callq 0x6a3c
movss (%r15,%r12,4), %xmm3
movaps 0x20(%rsp), %xmm0
movlhps %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
shufps $0xe2, %xmm0, %xmm3     # xmm3 = xmm3[2,0],xmm0[2,3]
movaps (%rsp), %xmm0
movaps 0x10(%rsp), %xmm2
cmpl $0xa, %ebx
je 0xa8f7
cmpl $0x7, %ebx
jne 0xa86f
cmpb $0x0, 0x99a16(%rip)     # 0xa4255
jne 0xa8f7
movaps %xmm3, 0x20(%rsp)
movaps %xmm0, (%rsp)
callq 0x6a3c
cmpb $0x0, 0x999fb(%rip)     # 0xa4255
jne 0xa861
callq 0x6a3c
movaps (%rsp), %xmm0
movaps 0x20(%rsp), %xmm3
jmp 0xa8f7
cmpb $0x0, 0x999df(%rip)     # 0xa4255
movaps %xmm0, (%rsp)
movaps %xmm2, 0x10(%rsp)
movaps %xmm3, 0x20(%rsp)
jne 0xa899
callq 0x6a3c
movaps 0x20(%rsp), %xmm3
movaps 0x10(%rsp), %xmm2
movaps (%rsp), %xmm0
cmpl $0x2, 0x38(%r15,%r14,4)
movb 0x999b0(%rip), %al      # 0xa4255
jne 0xa8ce
testb $0x1, %al
jne 0xa8be
callq 0x6a3c
movaps 0x20(%rsp), %xmm3
movaps 0x10(%rsp), %xmm2
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x34(%r15,%r14,4), %xmm1
subss %xmm1, %xmm2
jmp 0xa8f3
testb $0x1, %al
jne 0xa8e5
callq 0x6a3c
movaps 0x20(%rsp), %xmm3
movaps 0x10(%rsp), %xmm2
movaps (%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x34(%r15,%r14,4), %xmm1
addss %xmm1, %xmm2
movss %xmm2, %xmm0            # xmm0 = xmm2[0],xmm0[1,2,3]
paddd %xmm3, %xmm3
cvtdq2ps %xmm3, %xmm2
movaps 0x30(%rsp), %xmm1
subps %xmm2, %xmm1
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq