// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::End()
void ImGui::End()
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;

    // Error checking: verify that user hasn't called End() too many times!
    if (g.CurrentWindowStack.Size <= 1 && g.WithinFrameScopeWithImplicitWindow)
    {
        IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size > 1, "Calling End() too many times!");
        return;
    }
    IM_ASSERT(g.CurrentWindowStack.Size > 0);

    // Error checking: verify that user doesn't directly call End() on a child window.
    if (window->Flags & ImGuiWindowFlags_ChildWindow)
        IM_ASSERT_USER_ERROR(g.WithinEndChild, "Must call EndChild() and not End()!");

    // Close anything that is open
    if (window->DC.CurrentColumns)
        EndColumns();
    PopClipRect();   // Inner window clip rectangle

    // Stop logging
    if (!(window->Flags & ImGuiWindowFlags_ChildWindow))    // FIXME: add more options for scope of logging
        LogFinish();

    // Pop from window stack
    g.CurrentWindowStack.pop_back();
    if (window->Flags & ImGuiWindowFlags_Popup)
        g.BeginPopupStack.pop_back();
    window->DC.StackSizesOnBegin.CompareWithCurrentState();
    SetCurrentWindow(g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq 0x13f3d1(%rip), %rax    # 0x212f40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x1ab8(%rax)
jg 0xd3be4
movq -0x8(%rbp), %rax
testb $0x1, 0x1a75(%rax)
je 0xd3be4
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpl $0x1, 0x1ab8(%rcx)
movb %al, -0x11(%rbp)
jle 0xd3bb5
movb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0xd3bb5
movb -0x11(%rbp), %al
testb $0x1, %al
jne 0xd3bbe
jmp 0xd3bc0
jmp 0xd3bdf
leaq 0xa059e(%rip), %rdi     # 0x174165
leaq 0x9f33b(%rip), %rsi     # 0x172f09
movl $0x182e, %edx           # imm = 0x182E
leaq 0xa05ce(%rip), %rcx     # 0x1741a8
callq 0xd180
jmp 0xd3d1c
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1ab8(%rax)
jle 0xd3bf3
jmp 0xd3c12
leaq 0xa05c0(%rip), %rdi     # 0x1741ba
leaq 0x9f308(%rip), %rsi     # 0x172f09
movl $0x1831, %edx           # imm = 0x1831
leaq 0xa059b(%rip), %rcx     # 0x1741a8
callq 0xd180
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
je 0xd3c68
movq -0x8(%rbp), %rcx
xorl %eax, %eax
testb $0x1, 0x1a76(%rcx)
movb %al, -0x12(%rbp)
je 0xd3c3c
movb $0x1, %al
movb %al, -0x12(%rbp)
jmp 0xd3c3c
movb -0x12(%rbp), %al
testb $0x1, %al
jne 0xd3c45
jmp 0xd3c47
jmp 0xd3c66
leaq 0xa05ae(%rip), %rdi     # 0x1741fc
leaq 0x9f2b4(%rip), %rsi     # 0x172f09
movl $0x1835, %edx           # imm = 0x1835
leaq 0xa0547(%rip), %rcx     # 0x1741a8
callq 0xd180
jmp 0xd3c68
movq -0x10(%rbp), %rax
cmpq $0x0, 0x1b0(%rax)
je 0xd3c7b
callq 0x1363e0
callq 0xd3550
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
jne 0xd3c96
callq 0xd98d0
movq -0x8(%rbp), %rdi
addq $0x1ab8, %rdi           # imm = 0x1AB8
callq 0xebb50
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x4000000, %eax        # imm = 0x4000000
cmpl $0x0, %eax
je 0xd3cc7
movq -0x8(%rbp), %rdi
addq $0x1c80, %rdi           # imm = 0x1C80
callq 0xebba0
movq -0x10(%rbp), %rdi
addq $0xd8, %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0xd99e0
movq -0x8(%rbp), %rdi
addq $0x1ab8, %rdi           # imm = 0x1AB8
callq 0xeb5a0
testb $0x1, %al
jne 0xd3cf4
jmp 0xd3cfc
xorl %eax, %eax
movq %rax, -0x20(%rbp)
jmp 0xd3d13
movq -0x8(%rbp), %rdi
addq $0x1ab8, %rdi           # imm = 0x1AB8
callq 0xeb5c0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd7470
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)