// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::Shutdown(ImGuiContext*)
void ImGui::Shutdown(ImGuiContext* context)
{
    // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame)
    ImGuiContext& g = *context;
    if (g.IO.Fonts && g.FontAtlasOwnedByContext)
    {
        g.IO.Fonts->Locked = false;
        IM_DELETE(g.IO.Fonts);
    }
    g.IO.Fonts = NULL;

    // Cleanup of other data are conditional on actually having initialized Dear ImGui.
    if (!g.Initialized)
        return;

    // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file)
    if (g.SettingsLoaded && g.IO.IniFilename != NULL)
    {
        ImGuiContext* backup_context = GImGui;
        SetCurrentContext(&g);
        SaveIniSettingsToDisk(g.IO.IniFilename);
        SetCurrentContext(backup_context);
    }

    CallContextHooks(&g, ImGuiContextHookType_Shutdown);

    // Clear everything else
    for (int i = 0; i < g.Windows.Size; i++)
        IM_DELETE(g.Windows[i]);
    g.Windows.clear();
    g.WindowsFocusOrder.clear();
    g.WindowsTempSortBuffer.clear();
    g.CurrentWindow = NULL;
    g.CurrentWindowStack.clear();
    g.WindowsById.Clear();
    g.NavWindow = NULL;
    g.HoveredWindow = g.HoveredRootWindow = g.HoveredWindowUnderMovingWindow = NULL;
    g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL;
    g.MovingWindow = NULL;
    g.ColorStack.clear();
    g.StyleVarStack.clear();
    g.FontStack.clear();
    g.OpenPopupStack.clear();
    g.BeginPopupStack.clear();
    g.DrawDataBuilder.ClearFreeMemory();
    g.BackgroundDrawList._ClearFreeMemory();
    g.ForegroundDrawList._ClearFreeMemory();

    g.TabBars.Clear();
    g.CurrentTabBarStack.clear();
    g.ShrinkWidthBuffer.clear();

    g.Tables.Clear();
    g.CurrentTableStack.clear();
    g.DrawChannelsTempMergeBuffer.clear();

    g.ClipboardHandlerData.clear();
    g.MenusIdSubmittedThisFrame.clear();
    g.InputTextState.ClearFreeMemory();

    g.SettingsWindows.clear();
    g.SettingsHandlers.clear();

    if (g.LogFile)
    {
#ifndef IMGUI_DISABLE_TTY_FUNCTIONS
        if (g.LogFile != stdout)
#endif
            ImFileClose(g.LogFile);
        g.LogFile = NULL;
    }
    g.LogBuffer.clear();

    g.Initialized = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0xcad9a
movq -0x10(%rbp), %rax
testb $0x1, 0x1(%rax)
je 0xcad9a
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rdi
callq 0xeac40
movq -0x10(%rbp), %rax
movq $0x0, 0xa8(%rax)
movq -0x10(%rbp), %rax
testb $0x1, (%rax)
jne 0xcadb7
jmp 0xcb096
movq -0x10(%rbp), %rax
testb $0x1, 0x30e1(%rax)
je 0xcadf9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xcadf9
movq 0x14816a(%rip), %rax    # 0x212f40
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0xcab10
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xd3330
movq -0x18(%rbp), %rdi
callq 0xcab10
movq -0x10(%rbp), %rdi
movl $0x6, %esi
callq 0xcb100
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1a88(%rcx), %eax
jge 0xcae43
movq -0x10(%rbp), %rdi
addq $0x1a88, %rdi           # imm = 0x1A88
movl -0x1c(%rbp), %esi
callq 0xea8d0
movq (%rax), %rdi
callq 0xeac70
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xcae0e
movq -0x10(%rbp), %rdi
addq $0x1a88, %rdi           # imm = 0x1A88
callq 0xe9280
movq -0x10(%rbp), %rdi
addq $0x1a98, %rdi           # imm = 0x1A98
callq 0xe9280
movq -0x10(%rbp), %rdi
addq $0x1aa8, %rdi           # imm = 0x1AA8
callq 0xe9280
movq -0x10(%rbp), %rax
movq $0x0, 0x1ae0(%rax)
movq -0x10(%rbp), %rdi
addq $0x1ab8, %rdi           # imm = 0x1AB8
callq 0xe9280
movq -0x10(%rbp), %rdi
addq $0x1ac8, %rdi           # imm = 0x1AC8
callq 0xeaca0
movq -0x10(%rbp), %rax
movq $0x0, 0x1c90(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x1af8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x1af0(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x1ae8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x1b78(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x1b60(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x1b00(%rax)
movq -0x10(%rbp), %rdi
addq $0x1c10, %rdi           # imm = 0x1C10
callq 0xeacc0
movq -0x10(%rbp), %rdi
addq $0x1c20, %rdi           # imm = 0x1C20
callq 0xead10
movq -0x10(%rbp), %rdi
addq $0x1c30, %rdi           # imm = 0x1C30
callq 0xead60
movq -0x10(%rbp), %rdi
addq $0x1c70, %rdi           # imm = 0x1C70
callq 0xeadb0
movq -0x10(%rbp), %rdi
addq $0x1c80, %rdi           # imm = 0x1C80
callq 0xeadb0
movq -0x10(%rbp), %rdi
addq $0x1e48, %rdi           # imm = 0x1E48
callq 0xeae00
movq -0x10(%rbp), %rdi
addq $0x1e70, %rdi           # imm = 0x1E70
callq 0x10ee60
movq -0x10(%rbp), %rdi
addq $0x1f38, %rdi           # imm = 0x1F38
callq 0x10ee60
movq -0x10(%rbp), %rdi
addq $0x2110, %rdi           # imm = 0x2110
callq 0xeae50
movq -0x10(%rbp), %rdi
addq $0x2138, %rdi           # imm = 0x2138
callq 0xeaee0
movq -0x10(%rbp), %rdi
addq $0x2148, %rdi           # imm = 0x2148
callq 0xeaf30
movq -0x10(%rbp), %rdi
addq $0x20b0, %rdi           # imm = 0x20B0
callq 0xeaf80
movq -0x10(%rbp), %rdi
addq $0x20d8, %rdi           # imm = 0x20D8
callq 0xeaee0
movq -0x10(%rbp), %rdi
addq $0x20f8, %rdi           # imm = 0x20F8
callq 0xeb010
movq -0x10(%rbp), %rdi
addq $0x30b0, %rdi           # imm = 0x30B0
callq 0xeb060
movq -0x10(%rbp), %rdi
addq $0x30c0, %rdi           # imm = 0x30C0
callq 0xe9230
movq -0x10(%rbp), %rdi
addq $0x2160, %rdi           # imm = 0x2160
callq 0xeb0b0
movq -0x10(%rbp), %rdi
addq $0x3108, %rdi           # imm = 0x3108
callq 0xeb0f0
movq -0x10(%rbp), %rdi
addq $0x30f8, %rdi           # imm = 0x30F8
callq 0xeb110
movq -0x10(%rbp), %rax
cmpq $0x0, 0x3140(%rax)
je 0xcb07f
movq -0x10(%rbp), %rax
movq 0x3140(%rax), %rax
movq 0x142ead(%rip), %rcx    # 0x20df08
cmpq (%rcx), %rax
je 0xcb070
movq -0x10(%rbp), %rax
movq 0x3140(%rax), %rdi
callq 0xc5080
movq -0x10(%rbp), %rax
movq $0x0, 0x3140(%rax)
movq -0x10(%rbp), %rdi
addq $0x3148, %rdi           # imm = 0x3148
callq 0xeb160
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)