// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xa8(%rdi), %rdi
testq %rdi, %rdi
je 0x37be9
cmpb $0x1, 0x1(%rbx)
jne 0x37be9
movb $0x0, (%rdi)
callq 0x4af68
andq $0x0, 0xa8(%rbx)
cmpb $0x1, (%rbx)
jne 0x37dd9
cmpb $0x1, 0x30e1(%rbx)
jne 0x37c26
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x37c26
movq 0xac0cd(%rip), %r14     # 0xe3ce0
movq %rbx, 0xac0c6(%rip)     # 0xe3ce0
callq 0x3efe8
movq %r14, 0xac0ba(%rip)     # 0xe3ce0
pushq $0x6
popq %rsi
movq %rbx, %rdi
callq 0x37e1a
leaq 0x1a88(%rbx), %r14
xorl %r15d, %r15d
cmpl (%r14), %r15d
jge 0x37c58
movq %r14, %rdi
movl %r15d, %esi
callq 0x4ad62
movq (%rax), %rdi
callq 0x4af8a
incl %r15d
jmp 0x37c3b
movq %r14, %rdi
callq 0x4a1f8
leaq 0x1a98(%rbx), %rdi
callq 0x4a1f8
leaq 0x1aa8(%rbx), %rdi
callq 0x4a1f8
andq $0x0, 0x1ae0(%rbx)
leaq 0x1ab8(%rbx), %rdi
callq 0x4a1f8
leaq 0x1ac8(%rbx), %rdi
callq 0x4c0b0
andq $0x0, 0x1c90(%rbx)
andq $0x0, 0x1b78(%rbx)
andq $0x0, 0x1b60(%rbx)
leaq 0x1c10(%rbx), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x1ae8(%rbx)
movups %xmm0, 0x1af8(%rbx)
callq 0x4afac
leaq 0x1c20(%rbx), %rdi
callq 0x4afd4
leaq 0x1c30(%rbx), %rdi
callq 0x4affc
leaq 0x1c70(%rbx), %rdi
callq 0x4b024
leaq 0x1c80(%rbx), %rdi
callq 0x4b024
leaq 0x1e48(%rbx), %rdi
callq 0x4b04c
leaq 0x1e70(%rbx), %rdi
callq 0x61dd0
leaq 0x1f38(%rbx), %rdi
callq 0x61dd0
leaq 0x2110(%rbx), %rdi
callq 0x4b074
leaq 0x2138(%rbx), %rdi
callq 0x4b0d4
leaq 0x2148(%rbx), %rdi
callq 0x4b0fc
leaq 0x20b0(%rbx), %rdi
callq 0x4b124
leaq 0x20d8(%rbx), %rdi
callq 0x4b0d4
leaq 0x20f8(%rbx), %rdi
callq 0x4b184
leaq 0x30b0(%rbx), %rdi
callq 0x4b1ac
leaq 0x30c0(%rbx), %rdi
callq 0x4a1d0
leaq 0x2160(%rbx), %rdi
callq 0x4b1d4
leaq 0x3108(%rbx), %rdi
callq 0x4b1ac
leaq 0x30f8(%rbx), %rdi
callq 0x4b202
movq 0x3140(%rbx), %rdi
testq %rdi, %rdi
je 0x37dca
movq 0xa7160(%rip), %rax     # 0xdef18
cmpq (%rax), %rdi
je 0x37dc2
callq 0x3483a
andq $0x0, 0x3140(%rbx)
leaq 0x3148(%rbx), %rdi
callq 0x4b1ac
movb $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq