// File: Ciaxur[P]yagb-emu/include/imgui/imgui_demo.cpp
// Function: ShowExampleAppConstrainedResize(bool*)
static void ShowExampleAppConstrainedResize(bool* p_open)
{
    struct CustomConstraints
    {
        // Helper functions to demonstrate programmatic constraints
        static void Square(ImGuiSizeCallbackData* data) { data->DesiredSize.x = data->DesiredSize.y = IM_MAX(data->DesiredSize.x, data->DesiredSize.y); }
        static void Step(ImGuiSizeCallbackData* data)   { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); }
    };

    const char* test_desc[] =
    {
        "Resize vertical only",
        "Resize horizontal only",
        "Width > 100, Height > 100",
        "Width 400-500",
        "Height 400-500",
        "Custom: Always Square",
        "Custom: Fixed Steps (100)",
    };

    static bool auto_resize = false;
    static int type = 0;
    static int display_lines = 10;
    if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0),    ImVec2(-1, FLT_MAX));      // Vertical only
    if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1),    ImVec2(FLT_MAX, -1));      // Horizontal only
    if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100
    if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1),  ImVec2(500, -1));          // Width 400-500
    if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 400),  ImVec2(-1, 500));          // Height 400-500
    if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0),     ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square);                     // Always Square
    if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0),     ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)(intptr_t)100); // Fixed Step

    ImGuiWindowFlags flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0;
    if (ImGui::Begin("Example: Constrained Resize", p_open, flags))
    {
        if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine();
        if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine();
        if (ImGui::Button("800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); }
        ImGui::SetNextItemWidth(200);
        ImGui::Combo("Constraint", &type, test_desc, IM_ARRAYSIZE(test_desc));
        ImGui::SetNextItemWidth(200);
        ImGui::DragInt("Lines", &display_lines, 0.2f, 1, 100);
        ImGui::Checkbox("Auto-resize", &auto_resize);
        for (int i = 0; i < display_lines; i++)
            ImGui::Text("%*sHello, sailor! Making this line long enough for the example.", i * 4, "");
    }
    ImGui::End();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x40(%rbp), %rdi
leaq 0x11bd96(%rip), %rsi    # 0x20dac0
movl $0x38, %edx
callq 0xd0a0
cmpl $0x0, 0x12270d(%rip)    # 0x214448
jne 0xf1d7e
leaq -0x48(%rbp), %rdi
movss 0x80237(%rip), %xmm0    # 0x171f80
xorps %xmm1, %xmm1
callq 0xbf4c0
leaq -0x50(%rbp), %rdi
movss 0x80223(%rip), %xmm0    # 0x171f80
movss 0x8024f(%rip), %xmm1    # 0x171fb4
callq 0xbf4c0
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0xdac00
cmpl $0x1, 0x1226c3(%rip)    # 0x214448
jne 0xf1dc8
leaq -0x58(%rbp), %rdi
xorps %xmm0, %xmm0
movss 0x801ea(%rip), %xmm1    # 0x171f80
callq 0xbf4c0
leaq -0x60(%rbp), %rdi
movss 0x8020d(%rip), %xmm0    # 0x171fb4
movss 0x801d1(%rip), %xmm1    # 0x171f80
callq 0xbf4c0
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0xdac00
cmpl $0x2, 0x122679(%rip)    # 0x214448
jne 0xf1e0d
leaq -0x68(%rbp), %rdi
movss 0x8099b(%rip), %xmm1    # 0x172778
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0x70(%rbp), %rdi
movss 0x801c3(%rip), %xmm1    # 0x171fb4
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0xdac00
cmpl $0x3, 0x122634(%rip)    # 0x214448
jne 0xf1e5c
leaq -0x78(%rbp), %rdi
movss 0x8015a(%rip), %xmm0    # 0x171f7c
movss 0x80156(%rip), %xmm1    # 0x171f80
callq 0xbf4c0
leaq -0x80(%rbp), %rdi
movss 0x86735(%rip), %xmm0    # 0x178570
movss 0x8013d(%rip), %xmm1    # 0x171f80
callq 0xbf4c0
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0xdac00
cmpl $0x4, 0x1225e5(%rip)    # 0x214448
jne 0xf1eb7
leaq -0x88(%rbp), %rdi
movss 0x8010c(%rip), %xmm0    # 0x171f80
movss 0x80100(%rip), %xmm1    # 0x171f7c
callq 0xbf4c0
leaq -0x90(%rbp), %rdi
movss 0x800f0(%rip), %xmm0    # 0x171f80
movss 0x866d8(%rip), %xmm1    # 0x178570
callq 0xbf4c0
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0xdac00
cmpl $0x5, 0x12258a(%rip)    # 0x214448
jne 0xf1f07
leaq -0x98(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0xa0(%rbp), %rdi
movss 0x800d3(%rip), %xmm1    # 0x171fb4
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq 0x16f22(%rip), %rdx     # 0x108e20
xorl %eax, %eax
movl %eax, %ecx
callq 0xdac00
cmpl $0x6, 0x12253a(%rip)    # 0x214448
jne 0xf1f58
leaq -0xa8(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0xb0(%rbp), %rdi
movss 0x80083(%rip), %xmm1    # 0x171fb4
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0xa8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq 0x16f32(%rip), %rdx     # 0x108e80
movl $0x64, %ecx
callq 0xdac00
movb 0x1224e6(%rip), %dl     # 0x214444
xorl %eax, %eax
movl $0x40, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0xb4(%rbp)
movq -0x8(%rbp), %rsi
movl -0xb4(%rbp), %edx
leaq 0x912c4(%rip), %rdi     # 0x183246
callq 0xd0170
testb $0x1, %al
jne 0xf1f90
jmp 0xf216c
leaq -0xbc(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq 0x912b9(%rip), %rdi     # 0x183262
leaq -0xbc(%rbp), %rsi
callq 0x13a930
testb $0x1, %al
jne 0xf1fbb
jmp 0xf1fe0
leaq -0xc4(%rbp), %rdi
movss 0x865be(%rip), %xmm1    # 0x178588
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0xc4(%rbp), %rdi
xorl %esi, %esi
callq 0xda8d0
xorps %xmm0, %xmm0
movss 0x7ff95(%rip), %xmm1    # 0x171f80
callq 0xdc1c0
leaq -0xcc(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq 0x91261(%rip), %rdi     # 0x18326a
leaq -0xcc(%rbp), %rsi
callq 0x13a930
testb $0x1, %al
jne 0xf201b
jmp 0xf2040
leaq -0xd4(%rbp), %rdi
movss 0x86546(%rip), %xmm1    # 0x178570
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0xd4(%rbp), %rdi
xorl %esi, %esi
callq 0xda8d0
xorps %xmm0, %xmm0
movss 0x7ff35(%rip), %xmm1    # 0x171f80
callq 0xdc1c0
leaq -0xdc(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq 0x91209(%rip), %rdi     # 0x183272
leaq -0xdc(%rbp), %rsi
callq 0x13a930
testb $0x1, %al
jne 0xf207b
jmp 0xf20a5
leaq -0xe4(%rbp), %rdi
movss 0x8076a(%rip), %xmm0    # 0x1727f4
movss 0x864f6(%rip), %xmm1    # 0x178588
callq 0xbf4c0
leaq -0xe4(%rbp), %rdi
xorl %esi, %esi
callq 0xda8d0
movss 0x864db(%rip), %xmm0    # 0x178588
callq 0xc6860
leaq -0x40(%rbp), %rdx
leaq 0x911bd(%rip), %rdi     # 0x18327a
leaq 0x122384(%rip), %rsi    # 0x214448
movl $0x7, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x13fac0
movss 0x864ac(%rip), %xmm0    # 0x178588
callq 0xc6860
leaq 0x814cb(%rip), %rdi     # 0x1735b3
leaq 0x120b75(%rip), %rsi    # 0x212c64
movss 0x7fed9(%rip), %xmm0    # 0x171fd0
movl $0x1, %edx
movl $0x64, %ecx
leaq 0x878bf(%rip), %r8      # 0x1799c7
xorl %r9d, %r9d
callq 0x143390
leaq 0x9116e(%rip), %rdi     # 0x183285
leaq 0x122326(%rip), %rsi    # 0x214444
callq 0x13c7c0
movl $0x0, -0xe8(%rbp)
movl -0xe8(%rbp), %eax
cmpl 0x120b2b(%rip), %eax    # 0x212c64
jge 0xf216a
movl -0xe8(%rbp), %esi
shll $0x2, %esi
leaq 0x91146(%rip), %rdi     # 0x183291
leaq 0x7fdb7(%rip), %rdx     # 0x171f09
movb $0x0, %al
callq 0x139160
movl -0xe8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe8(%rbp)
jmp 0xf212d
jmp 0xf216c
callq 0xd3b60
addq $0xf0, %rsp
popq %rbp
retq
nopw (%rax,%rax)