// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::DebugNodeDrawList(ImGuiWindow*, ImDrawList const*, char const*)
void ImGui::DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label)
{
    ImGuiContext& g = *GImGui;
    ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
    int cmd_count = draw_list->CmdBuffer.Size;
    if (cmd_count > 0 && draw_list->CmdBuffer.back().ElemCount == 0 && draw_list->CmdBuffer.back().UserCallback == NULL)
        cmd_count--;
    bool node_open = TreeNode(draw_list, "%s: '%s' %d vtx, %d indices, %d cmds", label, draw_list->_OwnerName ? draw_list->_OwnerName : "", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, cmd_count);
    if (draw_list == GetWindowDrawList())
    {
        SameLine();
        TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f), "CURRENTLY APPENDING"); // Can't display stats for active draw list! (we don't have the data double-buffered)
        if (node_open)
            TreePop();
        return;
    }

    ImDrawList* fg_draw_list = GetForegroundDrawList(window); // Render additional visuals into the top-most draw list
    if (window && IsItemHovered())
        fg_draw_list->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255));
    if (!node_open)
        return;

    if (window && !window->WasActive)
        TextDisabled("Warning: owning Window is inactive. This DrawList is not being rendered!");

    for (const ImDrawCmd* pcmd = draw_list->CmdBuffer.Data; pcmd < draw_list->CmdBuffer.Data + cmd_count; pcmd++)
    {
        if (pcmd->UserCallback)
        {
            BulletText("Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
            continue;
        }

        char buf[300];
        ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd:%5d tris, Tex 0x%p, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
            pcmd->ElemCount / 3, (void*)(intptr_t)pcmd->TextureId,
            pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
        bool pcmd_node_open = TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
        if (IsItemHovered() && (cfg->ShowDrawCmdMesh || cfg->ShowDrawCmdBoundingBoxes) && fg_draw_list)
            DebugNodeDrawCmdShowMeshAndBoundingBox(window, draw_list, pcmd, cfg->ShowDrawCmdMesh, cfg->ShowDrawCmdBoundingBoxes);
        if (!pcmd_node_open)
            continue;

        // Calculate approximate coverage area (touched pixel count)
        // This will be in pixels squared as long there's no post-scaling happening to the renderer output.
        const ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
        const ImDrawVert* vtx_buffer = draw_list->VtxBuffer.Data + pcmd->VtxOffset;
        float total_area = 0.0f;
        for (unsigned int idx_n = pcmd->IdxOffset; idx_n < pcmd->IdxOffset + pcmd->ElemCount; )
        {
            ImVec2 triangle[3];
            for (int n = 0; n < 3; n++, idx_n++)
                triangle[n] = vtx_buffer[idx_buffer ? idx_buffer[idx_n] : idx_n].pos;
            total_area += ImTriangleArea(triangle[0], triangle[1], triangle[2]);
        }

        // Display vertex information summary. Hover to get all triangles drawn in wire-frame
        ImFormatString(buf, IM_ARRAYSIZE(buf), "Mesh: ElemCount: %d, VtxOffset: +%d, IdxOffset: +%d, Area: ~%0.f px", pcmd->ElemCount, pcmd->VtxOffset, pcmd->IdxOffset, total_area);
        Selectable(buf);
        if (IsItemHovered() && fg_draw_list)
            DebugNodeDrawCmdShowMeshAndBoundingBox(window, draw_list, pcmd, true, false);

        // Display individual triangles/vertices. Hover on to get the corresponding triangle highlighted.
        ImGuiListClipper clipper;
        clipper.Begin(pcmd->ElemCount / 3); // Manually coarse clip our print out of individual vertices to save CPU, only items that may be visible.
        while (clipper.Step())
            for (int prim = clipper.DisplayStart, idx_i = pcmd->IdxOffset + clipper.DisplayStart * 3; prim < clipper.DisplayEnd; prim++)
            {
                char* buf_p = buf, * buf_end = buf + IM_ARRAYSIZE(buf);
                ImVec2 triangle[3];
                for (int n = 0; n < 3; n++, idx_i++)
                {
                    const ImDrawVert& v = vtx_buffer[idx_buffer ? idx_buffer[idx_i] : idx_i];
                    triangle[n] = v.pos;
                    buf_p += ImFormatString(buf_p, buf_end - buf_p, "%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n",
                        (n == 0) ? "Vert:" : "     ", idx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
                }

                Selectable(buf, false);
                if (fg_draw_list && IsItemHovered())
                {
                    ImDrawListFlags backup_flags = fg_draw_list->Flags;
                    fg_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines is more readable for very large and thin triangles.
                    fg_draw_list->AddPolyline(triangle, 3, IM_COL32(255, 255, 0, 255), true, 1.0f);
                    fg_draw_list->Flags = backup_flags;
                }
            }
        TreePop();
    }
    TreePop();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rsi, %r12
movq %rdi, %rbx
movslq (%rsi), %r14
testq %r14, %r14
jle 0x5b44c
movq 0x8(%r12), %rax
imulq $0x38, %r14, %rcx
cmpl $0x0, -0x18(%rax,%rcx)
jne 0x5b44c
addq %rcx, %rax
cmpq $0x1, -0x10(%rax)
sbbl $0x0, %r14d
movq 0xa087d(%rip), %rax     # 0xfbcd0
movq %rax, -0x80(%rbp)
movq 0x40(%r12), %rax
testq %rax, %rax
leaq 0x59ab7(%rip), %rcx     # 0xb4f1d
cmovneq %rax, %rcx
movl 0x10(%r12), %r9d
movl 0x20(%r12), %r8d
movl %r14d, (%rsp)
leaq 0x5dc20(%rip), %rsi     # 0xb909f
movq %r12, %rdi
xorl %eax, %eax
callq 0xa086e
movl %eax, %r15d
movq 0xa083d(%rip), %r13     # 0xfbcd0
movq 0x1ae0(%r13), %rax
movb $0x1, 0x90(%rax)
cmpq %r12, 0x2b8(%rax)
je 0x5b53a
leaq 0x1f38(%r13), %rax
movq %rax, -0x70(%rbp)
testq %rbx, %rbx
je 0x5b5b7
xorl %edi, %edi
callq 0x461ed
testb %al, %al
je 0x5b511
movss 0x10(%rbx), %xmm0
movss 0x14(%rbx), %xmm1
addss 0x18(%rbx), %xmm0
addss 0x1c(%rbx), %xmm1
leaq 0x10(%rbx), %rsi
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
leaq -0x1f0(%rbp), %rdx
movlps %xmm0, (%rdx)
movss 0x59aea(%rip), %xmm1    # 0xb4fe4
xorps %xmm0, %xmm0
movq -0x70(%rbp), %rdi
movl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
movl $0xf, %r8d
callq 0x7851c
testb %r15b, %r15b
je 0x5ba2f
cmpb $0x0, 0x8f(%rbx)
jne 0x5b5c0
leaq 0x5dbaa(%rip), %rdi     # 0xb90d8
xorl %eax, %eax
callq 0x904f1
jmp 0x5b5c0
cmpb $0x0, 0x93(%rax)
jne 0x5b58a
movss 0x15a8(%r13), %xmm0
addss 0xe0(%rax), %xmm0
movss %xmm0, 0xd8(%rax)
movss 0xe4(%rax), %xmm0
movss %xmm0, 0xdc(%rax)
movq 0x108(%rax), %rcx
movq %rcx, 0x100(%rax)
movss 0x114(%rax), %xmm0
movss %xmm0, 0x110(%rax)
movaps 0x5a28f(%rip), %xmm0    # 0xb5820
leaq -0x1f0(%rbp), %rdi
movups %xmm0, (%rdi)
leaq 0x5db22(%rip), %rsi     # 0xb90c4
xorl %eax, %eax
callq 0x90403
testb %r15b, %r15b
jne 0x5ba2a
jmp 0x5ba2f
testb %r15b, %r15b
je 0x5ba2f
testl %r14d, %r14d
jle 0x5ba2a
movslq %r14d, %rax
movq 0x8(%r12), %rbx
imulq $0x38, %rax, %rax
movq %rax, -0x88(%rbp)
movq %r12, -0x78(%rbp)
movq %r13, -0x90(%rbp)
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
je 0x5b607
movq 0x30(%rbx), %rdx
leaq 0x5db26(%rip), %rdi     # 0xb9121
xorl %eax, %eax
callq 0x90944
jmp 0x5ba11
movl 0x20(%rbx), %ecx
movl $0xaaaaaaab, %eax       # imm = 0xAAAAAAAB
imulq %rax, %rcx
shrq $0x21, %rcx
movq 0x10(%rbx), %r8
xorps %xmm0, %xmm0
cvtss2sd (%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x4(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x8(%rbx), %xmm2
xorps %xmm3, %xmm3
cvtss2sd 0xc(%rbx), %xmm3
movl $0x12c, %esi            # imm = 0x12C
leaq -0x1f0(%rbp), %r14
movq %r14, %rdi
leaq 0x5daeb(%rip), %rdx     # 0xb913b
movb $0x4, %al
callq 0x41f22
movq %rbx, %rdi
subq 0x8(%r12), %rdi
sarq $0x3, %rdi
movabsq $0x6db6db6db6db6db7, %rax # imm = 0x6DB6DB6DB6DB6DB7
imulq %rax, %rdi
leaq 0x5d4df(%rip), %rsi     # 0xb8b57
movq %r14, %rdx
xorl %eax, %eax
callq 0xa086e
movl %eax, %r13d
xorl %edi, %edi
callq 0x461ed
testb %al, %al
je 0x5b6c3
movq -0x80(%rbp), %rcx
movb 0x3177(%rcx), %al
movb 0x3178(%rcx), %dl
movl %eax, %ecx
orb %dl, %cl
testb $0x1, %cl
je 0x5b6c3
movzbl %al, %ecx
notb %al
orb %dl, %al
movzbl %al, %r8d
andl $0x1, %r8d
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5beff
testb %r13b, %r13b
je 0x5ba11
cmpl $0x0, 0x10(%r12)
jle 0x5b6db
movq 0x18(%r12), %r10
jmp 0x5b6de
xorl %r10d, %r10d
movl 0x18(%rbx), %r8d
movl 0x1c(%rbx), %r9d
leaq (%r8,%r8,4), %r15
shlq $0x2, %r15
addq 0x28(%r12), %r15
movl 0x20(%rbx), %ecx
leal (%rcx,%r9), %eax
xorps %xmm0, %xmm0
cmpl %eax, %r9d
jae 0x5b79d
xorps %xmm0, %xmm0
movl %r9d, %edx
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movl %edx, %edx
xorl %esi, %esi
leaq (%rdx,%rsi), %rdi
testq %r10, %r10
je 0x5b72f
movl %edi, %edi
movzwl (%r10,%rdi,2), %edi
movl %edi, %edi
leaq (%rdi,%rdi,4), %rdi
movq (%r15,%rdi,4), %rdi
movq %rdi, -0x50(%rbp,%rsi,8)
incq %rsi
cmpq $0x3, %rsi
jne 0x5b71f
movss -0x4c(%rbp), %xmm1
movss -0x44(%rbp), %xmm2
movss -0x3c(%rbp), %xmm3
movaps %xmm2, %xmm4
subss %xmm3, %xmm4
subss %xmm1, %xmm3
mulss -0x48(%rbp), %xmm3
mulss -0x50(%rbp), %xmm4
addss %xmm3, %xmm4
subss %xmm2, %xmm1
mulss -0x40(%rbp), %xmm1
addss %xmm4, %xmm1
andps 0x5a04d(%rip), %xmm1    # 0xb57d0
mulss 0x59879(%rip), %xmm1    # 0xb5004
addss %xmm1, %xmm0
addl %esi, %edx
cmpl %eax, %edx
jb 0x5b70c
cvtss2sd %xmm0, %xmm0
movq %r10, -0x58(%rbp)
movl $0x12c, %esi            # imm = 0x12C
leaq -0x1f0(%rbp), %r14
movq %r14, %rdi
leaq 0x5d9c5(%rip), %rdx     # 0xb917c
movb $0x1, %al
callq 0x41f22
movq $0x0, -0x50(%rbp)
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq -0x50(%rbp), %rcx
callq 0x94650
xorl %edi, %edi
callq 0x461ed
testb %al, %al
je 0x5b7f4
movq %r12, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x5beff
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movups %xmm0, -0x44(%rbp)
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movq %rbx, -0x68(%rbp)
movl 0x20(%rbx), %ebx
movq 0xa04bc(%rip), %rax     # 0xfbcd0
movq 0x1ae0(%rax), %r14
movq 0x20a8(%rax), %rdi
testq %rdi, %rdi
je 0x5b835
cmpb $0x1, 0x249(%rdi)
jne 0x5b835
callq 0x89b8c
movl $0xaaaaaaab, %eax       # imm = 0xAAAAAAAB
imulq %rax, %rbx
shrq $0x21, %rbx
movss 0xdc(%r14), %xmm0
movss %xmm0, -0x38(%rbp)
movl $0xbf800000, -0x3c(%rbp) # imm = 0xBF800000
movl %ebx, -0x48(%rbp)
movq $0x0, -0x44(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %r14
leaq -0x50(%rbp), %rdi
callq 0x43932
testb %al, %al
je 0x5b9fe
movl -0x50(%rbp), %ecx
movl -0x4c(%rbp), %eax
movl %eax, -0x5c(%rbp)
cmpl %eax, %ecx
jge 0x5b86f
leal (%rcx,%rcx,2), %ebx
movq -0x68(%rbp), %rax
addl 0x1c(%rax), %ebx
movq %rcx, -0x98(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xc0(%rbp)
movq $0x0, -0xb0(%rbp)
movslq %ebx, %rax
leaq (%r14,%rax,2), %r12
movq %rax, -0xa0(%rbp)
movl %eax, %ebx
xorl %r14d, %r14d
leaq -0x1f0(%rbp), %r13
cmpq $0x0, -0x58(%rbp)
je 0x5b8db
movzwl (%r12,%r14,2), %eax
jmp 0x5b8e5
movq -0xa0(%rbp), %rax
addq %r14, %rax
cltq
leaq (%rax,%rax,4), %rax
movq (%r15,%rax,4), %rcx
movq %rcx, -0xc0(%rbp,%r14,8)
leaq -0xc4(%rbp), %rsi
subq %r13, %rsi
testq %r14, %r14
leaq 0x5d8f1(%rip), %rcx     # 0xb91fc
leaq 0x5d8e4(%rip), %rdx     # 0xb91f6
cmoveq %rdx, %rcx
xorps %xmm0, %xmm0
cvtss2sd (%r15,%rax,4), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x4(%r15,%rax,4), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x8(%r15,%rax,4), %xmm2
leaq (%rbx,%r14), %r8
xorps %xmm3, %xmm3
cvtss2sd 0xc(%r15,%rax,4), %xmm3
movl 0x10(%r15,%rax,4), %r9d
movq %r13, %rdi
leaq 0x5d870(%rip), %rdx     # 0xb91c0
movb $0x4, %al
callq 0x41f22
cltq
addq %rax, %r13
incq %r14
cmpq $0x3, %r14
jne 0x5b8cd
movq $0x0, -0xa8(%rbp)
leaq -0x1f0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq -0xa8(%rbp), %rcx
callq 0x94650
movq -0x90(%rbp), %r13
xorl %edi, %edi
callq 0x461ed
testb %al, %al
je 0x5b9e0
movl 0x1f68(%r13), %r12d
movl %r12d, %eax
andl $-0x2, %eax
movl %eax, 0x1f68(%r13)
movq -0x70(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movl $0x3, %edx
movl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
movl $0x1, %r8d
movss 0x59610(%rip), %xmm0    # 0xb4fe4
callq 0x76296
movl %r12d, 0x1f68(%r13)
addq %r14, %rbx
movq -0x98(%rbp), %rcx
incl %ecx
cmpl -0x5c(%rbp), %ecx
movq -0x58(%rbp), %r14
jne 0x5b897
jmp 0x5b86f
callq 0xa1609
cmpl $-0x1, -0x48(%rbp)
movq -0x78(%rbp), %r12
jne 0x5ba55
movq -0x68(%rbp), %rbx
addq $0x38, %rbx
movq 0x8(%r12), %rax
addq -0x88(%rbp), %rax
cmpq %rax, %rbx
jb 0x5b5e7
callq 0xa1609
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5ba47
jmp 0x5ba47
jmp 0x5ba47
cmpl $-0x1, -0x48(%rbp)
jne 0x5ba55
movq %rax, %rdi
callq 0xc560
leaq 0x5a87d(%rip), %rdi     # 0xb62d9
leaq 0x5a702(%rip), %rsi     # 0xb6165
leaq 0x5a8b5(%rip), %rcx     # 0xb631f
movl $0x8b8, %edx            # imm = 0x8B8
callq 0xc140