// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: CalcWindowSizeAfterConstraint(ImGuiWindow*, ImVec2)
static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size)
{
    ImGuiContext& g = *GImGui;
    if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint)
    {
        // Using -1,-1 on either X/Y axis to preserve the current size.
        ImRect cr = g.NextWindowData.SizeConstraintRect;
        new_size.x = (cr.Min.x >= 0 && cr.Max.x >= 0) ? ImClamp(new_size.x, cr.Min.x, cr.Max.x) : window->SizeFull.x;
        new_size.y = (cr.Min.y >= 0 && cr.Max.y >= 0) ? ImClamp(new_size.y, cr.Min.y, cr.Max.y) : window->SizeFull.y;
        if (g.NextWindowData.SizeCallback)
        {
            ImGuiSizeCallbackData data;
            data.UserData = g.NextWindowData.SizeCallbackUserData;
            data.Pos = window->Pos;
            data.CurrentSize = window->SizeFull;
            data.DesiredSize = new_size;
            g.NextWindowData.SizeCallback(&data);
            new_size = data.DesiredSize;
        }
        new_size.x = IM_FLOOR(new_size.x);
        new_size.y = IM_FLOOR(new_size.y);
    }

    // Minimum size
    if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize)))
    {
        ImGuiWindow* window_for_height = window;
        new_size = ImMax(new_size, g.Style.WindowMinSize);
        new_size.y = ImMax(new_size.y, window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows
    }
    return new_size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0xa9ffa(%rip), %r15     # 0xfdcd0
testb $0x10, 0x1b88(%r15)
je 0x53dca
movss 0x1bc4(%r15), %xmm3
movss 0x1bc8(%r15), %xmm2
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm3
jb 0x53d26
movss 0x1bcc(%r15), %xmm4
ucomiss %xmm1, %xmm4
jb 0x53d26
minss %xmm0, %xmm4
movaps %xmm0, %xmm1
cmpltss %xmm3, %xmm1
movaps %xmm1, %xmm5
andnps %xmm4, %xmm5
andps %xmm3, %xmm1
orps %xmm5, %xmm1
jmp 0x53d2b
movss 0x20(%rbx), %xmm1
xorps %xmm4, %xmm4
ucomiss %xmm4, %xmm2
jb 0x53d5f
movss 0x1bd0(%r15), %xmm3
ucomiss %xmm4, %xmm3
jb 0x53d5f
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
minss %xmm0, %xmm3
cmpltss %xmm2, %xmm0
movaps %xmm0, %xmm4
andnps %xmm3, %xmm4
andps %xmm2, %xmm0
orps %xmm4, %xmm0
movaps %xmm0, %xmm2
jmp 0x53d64
movss 0x24(%rbx), %xmm2
movlhps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
shufps $0xe2, %xmm1, %xmm2     # xmm2 = xmm2[2,0],xmm1[2,3]
movq 0x1bd8(%r15), %rax
testq %rax, %rax
je 0x53db5
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %r14
movups %xmm0, 0x8(%r14)
movq $0x0, 0x18(%r14)
movq 0x1be0(%r15), %rcx
movq %rcx, (%r14)
movq 0x10(%rbx), %rcx
movq %rcx, 0x8(%r14)
movq 0x20(%rbx), %rcx
movq %rcx, 0x10(%r14)
movlps %xmm2, 0x18(%r14)
movq %r14, %rdi
callq *%rax
movsd 0x18(%r14), %xmm2
cvttps2dq %xmm2, %xmm0
cvtdq2ps %xmm0, %xmm0
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
cvttps2dq %xmm2, %xmm1
cvtdq2ps %xmm1, %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movl 0xc(%rbx), %eax
testl $0x1000040, %eax        # imm = 0x1000040
jne 0x53eb6
movss 0x1574(%r15), %xmm1
movss 0x1578(%r15), %xmm2
movaps %xmm1, %xmm4
cmpless %xmm0, %xmm4
movaps %xmm4, %xmm3
andps %xmm0, %xmm3
andnps %xmm1, %xmm4
orps %xmm3, %xmm4
movaps %xmm4, -0x40(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm2, %xmm1
cmpless %xmm0, %xmm1
andps %xmm1, %xmm0
andnps %xmm2, %xmm1
orps %xmm0, %xmm1
movaps %xmm1, -0x30(%rbp)
xorps %xmm1, %xmm1
testb $0x1, %al
jne 0x53e5d
movq 0xa9ea7(%rip), %rax     # 0xfdcd0
movss 0x1984(%rax), %xmm0
mulss 0x2b0(%rbx), %xmm0
movq 0x388(%rbx), %rcx
testq %rcx, %rcx
je 0x53e4d
mulss 0x2b0(%rcx), %xmm0
movss 0x159c(%rax), %xmm1
addss %xmm1, %xmm1
addss %xmm0, %xmm1
movss %xmm1, -0x1c(%rbp)
movq %rbx, %rdi
callq 0x5f48e
addss -0x1c(%rbp), %xmm0
movss 0x156c(%r15), %xmm1
addss 0x63150(%rip), %xmm1    # 0xb6fd0
movaps %xmm1, %xmm2
cmpless 0x639b8(%rip), %xmm2    # 0xb7844
andnps %xmm1, %xmm2
addss %xmm0, %xmm2
movaps %xmm2, %xmm0
movaps -0x30(%rbp), %xmm3
cmpless %xmm3, %xmm0
movaps %xmm0, %xmm1
andnps %xmm2, %xmm1
andps %xmm3, %xmm0
orps %xmm1, %xmm0
movaps -0x40(%rbp), %xmm1
movlhps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
shufps $0xe2, %xmm1, %xmm0     # xmm0 = xmm0[2,0],xmm1[2,3]
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq