// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::Shutdown()
void ImGui::Shutdown()
{
    ImGuiState& g = *GImGui;
    if (!g.Initialized)
        return;

    SaveSettings();

    for (int i = 0; i < g.Windows.Size; i++)
    {
        g.Windows[i]->~ImGuiWindow();
        ImGui::MemFree(g.Windows[i]);
    }
    g.Windows.clear();
    g.WindowsSortBuffer.clear();
    g.CurrentWindowStack.clear();
    g.FocusedWindow = NULL;
    g.HoveredWindow = NULL;
    g.HoveredRootWindow = NULL;
    for (int i = 0; i < g.Settings.Size; i++)
        ImGui::MemFree(g.Settings[i].Name);
    g.Settings.clear();
    g.ColorModifiers.clear();
    g.StyleModifiers.clear();
    g.FontStack.clear();
    g.OpenedPopupStack.clear();
    g.CurrentPopupStack.clear();
    for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
        g.RenderDrawLists[i].clear();
    g.OverlayDrawList.ClearFreeMemory();
    g.ColorEditModeStorage.Clear();
    if (g.PrivateClipboard)
    {
        ImGui::MemFree(g.PrivateClipboard);
        g.PrivateClipboard = NULL;
    }
    g.InputTextState.Text.clear();
    g.InputTextState.InitialText.clear();
    g.InputTextState.TempTextBuffer.clear();

    if (g.LogFile && g.LogFile != stdout)
    {
        fclose(g.LogFile);
        g.LogFile = NULL;
    }
    if (g.LogClipboard)
    {
        g.LogClipboard->~ImGuiTextBuffer();
        ImGui::MemFree(g.LogClipboard);
    }

    if (g.IO.Fonts) // Testing for NULL to allow user to NULLify in case of running Shutdown() on multiple contexts. Bit hacky.
        g.IO.Fonts->Clear();

    g.Initialized = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x45376(%rip), %r15     # 0x50480
cmpb $0x1, (%r15)
jne 0xb2c8
callq 0xae36
leaq 0x1738(%r15), %rbx
xorl %r14d, %r14d
cmpl (%rbx), %r14d
jge 0xb153
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1e6f4
movq (%rax), %rdi
callq 0x98a4
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1e6f4
movq (%rax), %rdi
callq 0x8d0c
incl %r14d
jmp 0xb123
movq %rbx, %rdi
callq 0x1e84a
leaq 0x1748(%r15), %rdi
callq 0x1e84a
leaq 0x1760(%r15), %rdi
callq 0x1e84a
leaq 0x17b0(%r15), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x1770(%r15)
andq $0x0, 0x1780(%r15)
xorl %r14d, %r14d
cmpl (%rbx), %r14d
jge 0xb1ad
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1e872
movq (%rax), %rdi
callq 0x8d0c
incl %r14d
jmp 0xb190
movq %rbx, %rdi
callq 0x1e8a6
leaq 0x17c8(%r15), %rdi
callq 0x1e8ce
leaq 0x17d8(%r15), %rdi
callq 0x1e8f6
leaq 0x17e8(%r15), %rdi
callq 0x1e91e
leaq 0x17f8(%r15), %rdi
callq 0x1e946
leaq 0x1808(%r15), %rdi
callq 0x1e946
movl $0x1870, %ebx           # imm = 0x1870
cmpq $0x18a0, %rbx           # imm = 0x18A0
je 0xb20e
leaq (%r15,%rbx), %rdi
callq 0x1e96e
addq $0x10, %rbx
jmp 0xb1f6
leaq 0x18a8(%r15), %rdi
callq 0x27af2
leaq 0x27a8(%r15), %rdi
callq 0x1e0e2
movq 0x2be0(%r15), %rdi
testq %rdi, %rdi
je 0xb24d
movq 0x45247(%rip), %rax     # 0x50480
decl 0x334(%rax)
callq *0xd8(%rax)
andq $0x0, 0x2be0(%r15)
leaq 0x1ab8(%r15), %rdi
callq 0x1e996
leaq 0x1ac8(%r15), %rdi
callq 0x1e9be
leaq 0x1ad8(%r15), %rdi
callq 0x1e9be
movq 0x2bf0(%r15), %rdi
testq %rdi, %rdi
je 0xb296
movq 0x44d54(%rip), %rax     # 0x4ffd8
cmpq (%rax), %rdi
je 0xb296
callq 0x7350
andq $0x0, 0x2bf0(%r15)
movq 0x2bf8(%r15), %rdi
testq %rdi, %rdi
je 0xb2b3
callq 0x1f7a4
movq 0x2bf8(%r15), %rdi
callq 0x8d0c
movq 0x90(%r15), %rdi
testq %rdi, %rdi
je 0xb2c4
callq 0x2a806
movb $0x0, (%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq