// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::Render()
void ImGui::Render()
{
    ImGuiState& g = *GImGui;
    IM_ASSERT(g.Initialized);   // Forgot to call ImGui::NewFrame()

    if (g.FrameCountEnded != g.FrameCount)
        ImGui::EndFrame();
    g.FrameCountRendered = g.FrameCount;

    // Skip render altogether if alpha is 0.0
    // Note that vertex buffers have been created and are wasted, so it is best practice that you don't create windows in the first place, or consistently respond to Begin() returning false.
    if (g.Style.Alpha > 0.0f)
    {
        // Render tooltip
        if (g.Tooltip[0])
        {
            ImGui::BeginTooltip();
            ImGui::TextUnformatted(g.Tooltip);
            ImGui::EndTooltip();
        }

        // Gather windows to render
        g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0;
        for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
            g.RenderDrawLists[i].resize(0);
        for (int i = 0; i != g.Windows.Size; i++)
        {
            ImGuiWindow* window = g.Windows[i];
            if (window->Active && window->HiddenFrames <= 0 && (window->Flags & (ImGuiWindowFlags_ChildWindow)) == 0)
            {
                // FIXME: Generalize this with a proper layering system so e.g. user can draw in specific layers, below text, ..
                g.IO.MetricsActiveWindows++;
                if (window->Flags & ImGuiWindowFlags_Popup)
                    AddWindowToRenderList(g.RenderDrawLists[1], window);
                else if (window->Flags & ImGuiWindowFlags_Tooltip)
                    AddWindowToRenderList(g.RenderDrawLists[2], window);
                else
                    AddWindowToRenderList(g.RenderDrawLists[0], window);
            }
        }

        // Flatten layers
        int n = g.RenderDrawLists[0].Size;
        int flattened_size = n;
        for (int i = 1; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
            flattened_size += g.RenderDrawLists[i].Size;
        g.RenderDrawLists[0].resize(flattened_size);
        for (int i = 1; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
        {
            ImVector<ImDrawList*>& layer = g.RenderDrawLists[i];
            if (layer.empty())
                continue;
            memcpy(&g.RenderDrawLists[0][n], &layer[0], layer.Size * sizeof(ImDrawList*));
            n += layer.Size;
        }

        // Draw software mouse cursor if requested
        if (g.IO.MouseDrawCursor)
        {
            const ImGuiMouseCursorData& cursor_data = g.MouseCursorData[g.MouseCursor];
            const ImVec2 pos = g.IO.MousePos - cursor_data.HotOffset;
            const ImVec2 size = cursor_data.Size;
            const ImTextureID tex_id = g.IO.Fonts->TexID;
            g.OverlayDrawList.PushTextureID(tex_id);
            g.OverlayDrawList.AddImage(tex_id, pos+ImVec2(1,0), pos+ImVec2(1,0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], 0x30000000); // Shadow
            g.OverlayDrawList.AddImage(tex_id, pos+ImVec2(2,0), pos+ImVec2(2,0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], 0x30000000); // Shadow
            g.OverlayDrawList.AddImage(tex_id, pos,             pos + size,             cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], 0xFF000000); // Black border
            g.OverlayDrawList.AddImage(tex_id, pos,             pos + size,             cursor_data.TexUvMin[0], cursor_data.TexUvMax[0], 0xFFFFFFFF); // White fill
            g.OverlayDrawList.PopTextureID();
        }
        if (!g.OverlayDrawList.VtxBuffer.empty())
            AddDrawListToRenderList(g.RenderDrawLists[0], &g.OverlayDrawList);

        // Setup draw data
        g.RenderDrawData.Valid = true;
        g.RenderDrawData.CmdLists = (g.RenderDrawLists[0].Size > 0) ? &g.RenderDrawLists[0][0] : NULL;
        g.RenderDrawData.CmdListsCount = g.RenderDrawLists[0].Size;
        g.RenderDrawData.TotalVtxCount = g.IO.MetricsRenderVertices;
        g.RenderDrawData.TotalIdxCount = g.IO.MetricsRenderIndices;

        // Render. If user hasn't set a callback then they may retrieve the draw data via GetDrawData()
        if (g.RenderDrawData.CmdListsCount > 0 && g.IO.RenderDrawListsFn != NULL)
            g.IO.RenderDrawListsFn(&g.RenderDrawData);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq 0x6a38e(%rip), %rax     # 0x794c0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
testb $0x1, (%rax)
je 0xf141
jmp 0xf160
leaq 0x4c399(%rip), %rdi     # 0x5b4e1
leaq 0x4c176(%rip), %rsi     # 0x5b2c5
movl $0x917, %edx            # imm = 0x917
leaq 0x4c417(%rip), %rcx     # 0x5b572
callq 0x7160
movq -0x8(%rbp), %rax
movl 0x1730(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x172c(%rcx), %eax
je 0xf17b
callq 0xeb10
movq -0x8(%rbp), %rax
movl 0x172c(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1734(%rax)
movq -0x8(%rbp), %rax
movss 0x13e8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xf84f
movq -0x8(%rbp), %rax
cmpb $0x0, 0x27e0(%rax)
je 0xf1d2
callq 0xf860
movq -0x8(%rbp), %rdi
addq $0x27e0, %rdi           # imm = 0x27E0
xorl %eax, %eax
movl %eax, %esi
callq 0xf8c0
callq 0xfe50
movq -0x8(%rbp), %rax
movl $0x0, 0x340(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x33c(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x338(%rax)
movl $0x0, -0xc(%rbp)
cmpl $0x3, -0xc(%rbp)
jge 0xf231
movq -0x8(%rbp), %rdi
addq $0x1870, %rdi           # imm = 0x1870
movslq -0xc(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x2e950
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xf203
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1738(%rcx), %eax
je 0xf32a
movq -0x8(%rbp), %rdi
addq $0x1738, %rdi           # imm = 0x1738
movl -0x10(%rbp), %esi
callq 0x2e1c0
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
testb $0x1, 0x70(%rax)
je 0xf31a
movq -0x18(%rbp), %rax
cmpl $0x0, 0x90(%rax)
jg 0xf31a
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
jne 0xf31a
movq -0x8(%rbp), %rax
movl 0x340(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x340(%rax)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x2000000, %eax        # imm = 0x2000000
cmpl $0x0, %eax
je 0xf2d7
movq -0x8(%rbp), %rdi
addq $0x1870, %rdi           # imm = 0x1870
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
callq 0xfe90
jmp 0xf318
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x0, %eax
je 0xf302
movq -0x8(%rbp), %rdi
addq $0x1870, %rdi           # imm = 0x1870
addq $0x20, %rdi
movq -0x18(%rbp), %rsi
callq 0xfe90
jmp 0xf316
movq -0x8(%rbp), %rdi
addq $0x1870, %rdi           # imm = 0x1870
movq -0x18(%rbp), %rsi
callq 0xfe90
jmp 0xf318
jmp 0xf31a
jmp 0xf31c
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xf238
movq -0x8(%rbp), %rax
movl 0x1870(%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
cmpl $0x3, -0x24(%rbp)
jge 0xf372
movq -0x8(%rbp), %rax
addq $0x1870, %rax           # imm = 0x1870
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xf344
movq -0x8(%rbp), %rdi
addq $0x1870, %rdi           # imm = 0x1870
movl -0x20(%rbp), %esi
callq 0x2e950
movl $0x1, -0x28(%rbp)
cmpl $0x3, -0x28(%rbp)
jge 0xf419
movq -0x8(%rbp), %rax
addq $0x1870, %rax           # imm = 0x1870
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2e9a0
testb $0x1, %al
jne 0xf3be
jmp 0xf3c0
jmp 0xf40b
movq -0x8(%rbp), %rdi
addq $0x1870, %rdi           # imm = 0x1870
movl -0x1c(%rbp), %esi
callq 0x2e9c0
movq %rax, -0xb8(%rbp)
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x2e9c0
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rax
movslq (%rax), %rdx
shlq $0x3, %rdx
callq 0x7080
movq -0x30(%rbp), %rax
movl (%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xf38c
movq -0x8(%rbp), %rax
testb $0x1, 0x104(%rax)
je 0xf75b
movq -0x8(%rbp), %rax
movslq 0x1940(%rax), %rcx
imulq $0x34, %rcx, %rcx
leaq 0x1944(%rax,%rcx), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
addq $0xf0, %rdi
movq -0x38(%rbp), %rsi
addq $0x4, %rsi
callq 0xdf20
movlpd %xmm0, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0xc(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
addq $0x18a8, %rdi           # imm = 0x18A8
leaq -0x50(%rbp), %rsi
callq 0x3d2c0
movq -0x8(%rbp), %rax
addq $0x18a8, %rax           # imm = 0x18A8
movq %rax, -0x120(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x138(%rbp)
movss 0x4bb55(%rip), %xmm0    # 0x5b018
movss %xmm0, -0x12c(%rbp)
xorps %xmm1, %xmm1
movss %xmm1, -0x108(%rbp)
callq 0x2d280
movq -0x138(%rbp), %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0xc7e0
movss -0x108(%rbp), %xmm1
movaps %xmm0, %xmm2
movss -0x12c(%rbp), %xmm0
movlpd %xmm2, -0x58(%rbp)
leaq -0x78(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x2d280
movq -0x128(%rbp), %rsi
movq -0xd8(%rbp), %rdi
callq 0xc7e0
movlpd %xmm0, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movq %rsi, -0xd0(%rbp)
callq 0xc7e0
movq -0x120(%rbp), %rdi
movq -0x118(%rbp), %rsi
movlpd %xmm0, -0x68(%rbp)
movq -0x38(%rbp), %r9
movq %r9, %r8
addq $0x1c, %r8
addq $0x2c, %r9
movq %rsp, %rax
movl $0x30000000, (%rax)     # imm = 0x30000000
leaq -0x58(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x41720
movss -0x108(%rbp), %xmm1
movq -0x8(%rbp), %rax
addq $0x18a8, %rax           # imm = 0x18A8
movq %rax, -0xf8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0x88(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movss 0x4bb00(%rip), %xmm0    # 0x5b0b8
movss %xmm0, -0x104(%rbp)
callq 0x2d280
movq -0x110(%rbp), %rsi
movq -0xd8(%rbp), %rdi
callq 0xc7e0
movss -0x108(%rbp), %xmm1
movaps %xmm0, %xmm2
movss -0x104(%rbp), %xmm0
movlpd %xmm2, -0x80(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x2d280
movq -0x100(%rbp), %rsi
movq -0xd8(%rbp), %rdi
callq 0xc7e0
movq -0xd0(%rbp), %rsi
movlpd %xmm0, -0x98(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xc7e0
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
movlpd %xmm0, -0x90(%rbp)
movq -0x38(%rbp), %r9
movq %r9, %r8
addq $0x1c, %r8
addq $0x2c, %r9
movq %rsp, %rax
movl $0x30000000, (%rax)     # imm = 0x30000000
leaq -0x80(%rbp), %rdx
leaq -0x90(%rbp), %rcx
callq 0x41720
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq -0x8(%rbp), %rax
addq $0x18a8, %rax           # imm = 0x18A8
movq %rax, -0xe8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xe0(%rbp)
callq 0xc7e0
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movlpd %xmm0, -0xa8(%rbp)
movq -0x38(%rbp), %r9
movq %r9, %r8
addq $0x1c, %r8
addq $0x2c, %r9
movq %rsp, %rax
movl $0xff000000, (%rax)     # imm = 0xFF000000
leaq -0xa8(%rbp), %rcx
callq 0x41720
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq -0x8(%rbp), %rax
addq $0x18a8, %rax           # imm = 0x18A8
movq %rax, -0xc8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xc0(%rbp)
callq 0xc7e0
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movlpd %xmm0, -0xb0(%rbp)
movq -0x38(%rbp), %r8
addq $0x14, %r8
movq -0x38(%rbp), %r9
addq $0x24, %r9
leaq -0x40(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
callq 0x41720
movq -0x8(%rbp), %rdi
addq $0x18a8, %rdi           # imm = 0x18A8
callq 0x3d300
movq -0x8(%rbp), %rdi
addq $0x18a8, %rdi           # imm = 0x18A8
addq $0x20, %rdi
callq 0x2ea20
testb $0x1, %al
jne 0xf78e
movq -0x8(%rbp), %rdi
addq $0x1870, %rdi           # imm = 0x1870
movq -0x8(%rbp), %rsi
addq $0x18a8, %rsi           # imm = 0x18A8
callq 0xff40
movq -0x8(%rbp), %rax
movb $0x1, 0x1850(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1870(%rax)
jle 0xf7c1
movq -0x8(%rbp), %rdi
addq $0x1870, %rdi           # imm = 0x1870
xorl %esi, %esi
callq 0x2e9c0
movq %rax, -0x140(%rbp)
jmp 0xf7cc
xorl %eax, %eax
movq %rax, -0x140(%rbp)
jmp 0xf7cc
movq -0x140(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x1858(%rax)
movq -0x8(%rbp), %rax
movl 0x1870(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1860(%rax)
movq -0x8(%rbp), %rax
movl 0x338(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1864(%rax)
movq -0x8(%rbp), %rax
movl 0x33c(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1868(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1860(%rax)
jle 0xf84d
movq -0x8(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
je 0xf84d
movq -0x8(%rbp), %rax
movq 0xb8(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x1850, %rdi           # imm = 0x1850
callq *%rax
jmp 0xf84f
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopl (%rax,%rax)