// File: /workspace/github_cpp_makefile_star2_O2/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 0xa26b1(%rip), %r15     # 0xe3ce0
testb $0x10, 0x1b88(%r15)
je 0x41713
movss 0x1bc4(%r15), %xmm3
movss 0x1bc8(%r15), %xmm2
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm3
jb 0x4167f
movss 0x1bcc(%r15), %xmm4
ucomiss %xmm1, %xmm4
jb 0x4167f
minss %xmm0, %xmm4
movaps %xmm0, %xmm1
cmpltss %xmm3, %xmm1
movaps %xmm1, %xmm5
andnps %xmm4, %xmm5
andps %xmm3, %xmm1
orps %xmm5, %xmm1
jmp 0x41684
movss 0x20(%rbx), %xmm1
xorps %xmm4, %xmm4
ucomiss %xmm4, %xmm2
jb 0x416b8
movss 0x1bd0(%r15), %xmm3
ucomiss %xmm4, %xmm3
jb 0x416b8
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 0x416bd
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 0x416fe
movq 0x1be0(%r15), %rcx
leaq -0x60(%rbp), %r14
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]
testl $0x1000040, 0xc(%rbx)   # imm = 0x1000040
jne 0x417c2
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)
movq %rbx, %rdi
callq 0x4b4aa
movss %xmm0, -0x1c(%rbp)
movq %rbx, %rdi
callq 0x4b4de
addss -0x1c(%rbp), %xmm0
movss 0x156c(%r15), %xmm1
addss 0x5a862(%rip), %xmm1    # 0x9bff0
xorps %xmm2, %xmm2
movaps %xmm1, %xmm3
cmpless %xmm2, %xmm3
andnps %xmm1, %xmm3
addss %xmm0, %xmm3
movaps %xmm3, %xmm0
movaps -0x30(%rbp), %xmm2
cmpless %xmm2, %xmm0
movaps %xmm0, %xmm1
andps %xmm2, %xmm1
andnps %xmm3, %xmm0
orps %xmm1, %xmm0
movaps -0x40(%rbp), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movaps %xmm1, %xmm0
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq