// File: /workspace/github_cpp_makefile_star2_O1/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 0x5c5f8
movq 0x8(%r12), %rax
imulq $0x38, %r14, %rcx
cmpl $0x0, -0x18(%rax,%rcx)
jne 0x5c5f8
addq %rcx, %rax
cmpq $0x1, -0x10(%rax)
sbbl $0x0, %r14d
movq 0xa16d1(%rip), %rax     # 0xfdcd0
movq %rax, -0x58(%rbp)
movq 0x40(%r12), %rax
testq %rax, %rax
leaq 0x5a90b(%rip), %rcx     # 0xb6f1d
cmovneq %rax, %rcx
movl 0x10(%r12), %r9d
movl 0x20(%r12), %r8d
movl %r14d, (%rsp)
leaq 0x5ea74(%rip), %rsi     # 0xbb09f
movq %r12, %rdi
xorl %eax, %eax
callq 0xa21c9
movl %eax, %r15d
movq 0xa1691(%rip), %rcx     # 0xfdcd0
movq 0x1ae0(%rcx), %rax
movb $0x1, 0x90(%rax)
cmpq %r12, 0x2b8(%rax)
je 0x5cb65
movq %rcx, -0x90(%rbp)
leaq 0x1f38(%rcx), %rax
movq %rax, -0x78(%rbp)
testq %rbx, %rbx
je 0x5c6c0
xorl %edi, %edi
callq 0x46d03
testb %al, %al
je 0x5c6c0
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 0x5a93b(%rip), %xmm1    # 0xb6fe4
xorps %xmm0, %xmm0
movq -0x78(%rbp), %rdi
movl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
movl $0xf, %r8d
callq 0x79c80
testb %r15b, %r15b
je 0x5cbe4
testq %rbx, %rbx
je 0x5c6e5
cmpb $0x0, 0x8f(%rbx)
jne 0x5c6e5
leaq 0x5e9fa(%rip), %rdi     # 0xbb0d8
xorl %eax, %eax
callq 0x921f2
testl %r14d, %r14d
jle 0x5cbdf
movslq %r14d, %rax
movq 0x8(%r12), %rbx
imulq $0x38, %rax, %rax
movq %rax, -0x88(%rbp)
movq %r12, -0x80(%rbp)
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
je 0x5c725
movq 0x30(%rbx), %rdx
leaq 0x5ea08(%rip), %rdi     # 0xbb121
xorl %eax, %eax
callq 0x92645
jmp 0x5cb4a
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 0x5e9cd(%rip), %rdx     # 0xbb13b
movb $0x4, %al
callq 0x427cb
movq %rbx, %rdi
subq 0x8(%r12), %rdi
sarq $0x3, %rdi
movabsq $0x6db6db6db6db6db7, %rax # imm = 0x6DB6DB6DB6DB6DB7
imulq %rax, %rdi
leaq 0x5e3c1(%rip), %rsi     # 0xbab57
movq %r14, %rdx
xorl %eax, %eax
callq 0xa21c9
movl %eax, %r13d
xorl %edi, %edi
callq 0x46d03
testb %al, %al
je 0x5c7e3
movq -0x58(%rbp), %rax
movb 0x3177(%rax), %al
testb %al, %al
jne 0x5c7c9
movq -0x58(%rbp), %rcx
cmpb $0x1, 0x3178(%rcx)
jne 0x5c7e3
movq -0x58(%rbp), %rcx
movzbl 0x3178(%rcx), %r8d
movzbl %al, %ecx
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5d09e
testb %r13b, %r13b
je 0x5cb4a
cmpl $0x0, 0x10(%r12)
jle 0x5c7fb
movq 0x18(%r12), %rdi
jmp 0x5c7fd
xorl %edi, %edi
movl 0x18(%rbx), %ecx
movl 0x1c(%rbx), %eax
leaq (%rcx,%rcx,4), %r15
shlq $0x2, %r15
addq 0x28(%r12), %r15
movl 0x20(%rbx), %ecx
leal (%rcx,%rax), %edx
xorps %xmm0, %xmm0
cmpl %edx, %eax
jae 0x5c8c4
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movl %eax, %eax
xorl %edx, %edx
leaq (%rax,%rdx), %rcx
testq %rdi, %rdi
je 0x5c846
movl %ecx, %ecx
movzwl (%rdi,%rcx,2), %ecx
movl %ecx, %ecx
leaq (%rcx,%rcx,4), %rcx
movq (%r15,%rcx,4), %rcx
movq %rcx, -0x50(%rbp,%rdx,8)
incq %rdx
cmpq $0x3, %rdx
jne 0x5c837
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 0x5af36(%rip), %xmm1    # 0xb77d0
mulss 0x5a762(%rip), %xmm1    # 0xb7004
addss %xmm1, %xmm0
movl 0x1c(%rbx), %r9d
movl 0x20(%rbx), %ecx
leal (%rcx,%r9), %esi
addl %edx, %eax
cmpl %esi, %eax
jb 0x5c824
movq %rdi, %r13
cvtss2sd %xmm0, %xmm0
jmp 0x5c8ca
movq %rdi, %r13
movl %eax, %r9d
movl 0x18(%rbx), %r8d
movl $0x12c, %esi            # imm = 0x12C
leaq -0x1f0(%rbp), %r14
movq %r14, %rdi
leaq 0x5e898(%rip), %rdx     # 0xbb17c
movb $0x1, %al
callq 0x427cb
movq $0x0, -0x50(%rbp)
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq -0x50(%rbp), %rcx
callq 0x962c5
xorl %edi, %edi
callq 0x46d03
testb %al, %al
je 0x5c921
movq %r12, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x5d09e
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movups %xmm0, -0x44(%rbp)
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movq %rbx, -0x70(%rbp)
movl 0x20(%rbx), %ebx
movq 0xa138f(%rip), %rax     # 0xfdcd0
movq 0x1ae0(%rax), %r14
movq 0x20a8(%rax), %rdi
testq %rdi, %rdi
je 0x5c962
cmpb $0x1, 0x249(%rdi)
jne 0x5c962
callq 0x8b7ea
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)
leaq -0x50(%rbp), %rdi
callq 0x44316
testb %al, %al
je 0x5cb33
movl -0x50(%rbp), %ecx
movl -0x4c(%rbp), %eax
movl %eax, -0x64(%rbp)
cmpl %eax, %ecx
jge 0x5c998
leal (%rcx,%rcx,2), %ebx
movq -0x70(%rbp), %rax
addl 0x1c(%rax), %ebx
movq %rcx, -0x98(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xc0(%rbp)
movq $0x0, -0xb0(%rbp)
movslq %ebx, %rax
movq %r13, %r12
leaq (%r13,%rax,2), %rcx
movq %rcx, -0x60(%rbp)
movq %rax, -0xa0(%rbp)
movl %eax, %ebx
xorl %r14d, %r14d
leaq -0x1f0(%rbp), %r13
testq %r12, %r12
je 0x5ca0e
movq -0x60(%rbp), %rax
movzwl (%rax,%r14,2), %eax
jmp 0x5ca18
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 0x5e7be(%rip), %rcx     # 0xbb1fc
leaq 0x5e7b1(%rip), %rdx     # 0xbb1f6
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
xorps %xmm3, %xmm3
cvtss2sd 0xc(%r15,%rax,4), %xmm3
movl 0x10(%r15,%rax,4), %r9d
leal (%rbx,%r14), %r8d
movq %r13, %rdi
leaq 0x5e73d(%rip), %rdx     # 0xbb1c0
movb $0x4, %al
callq 0x427cb
cltq
addq %rax, %r13
incq %r14
cmpq $0x3, %r14
jne 0x5c9fe
movq $0x0, -0xa8(%rbp)
leaq -0x1f0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq -0xa8(%rbp), %rcx
callq 0x962c5
xorl %edi, %edi
callq 0x46d03
testb %al, %al
je 0x5cb16
movq -0x90(%rbp), %r13
movl 0x1f68(%r13), %eax
movl %eax, -0x60(%rbp)
andl $-0x2, %eax
movl %eax, 0x1f68(%r13)
movq -0x78(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movl $0x3, %edx
movl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
movl $0x1, %r8d
movss 0x5a4dd(%rip), %xmm0    # 0xb6fe4
callq 0x77886
movl -0x60(%rbp), %eax
movl %eax, 0x1f68(%r13)
addq %r14, %rbx
movq -0x98(%rbp), %rcx
incl %ecx
cmpl -0x64(%rbp), %ecx
movq %r12, %r13
jne 0x5c9c0
jmp 0x5c998
callq 0xa2f4e
cmpl $-0x1, -0x48(%rbp)
movq -0x80(%rbp), %r12
jne 0x5cc0a
movq -0x70(%rbp), %rbx
addq $0x38, %rbx
movq 0x8(%r12), %rax
addq -0x88(%rbp), %rax
cmpq %rax, %rbx
jb 0x5c705
jmp 0x5cbdf
movb $0x1, 0x90(%rax)
cmpb $0x0, 0x93(%rax)
jne 0x5cbbb
movss 0x15a8(%rcx), %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 0x5ac5e(%rip), %xmm0    # 0xb7820
leaq -0x1f0(%rbp), %rdi
movups %xmm0, (%rdi)
leaq 0x5e4f1(%rip), %rsi     # 0xbb0c4
xorl %eax, %eax
callq 0x92104
testb %r15b, %r15b
je 0x5cbe4
callq 0xa2f4e
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5cbfc
jmp 0x5cbfc
jmp 0x5cbfc
cmpl $-0x1, -0x48(%rbp)
jne 0x5cc0a
movq %rax, %rdi
callq 0xc560
leaq 0x5b6c8(%rip), %rdi     # 0xb82d9
leaq 0x5b54d(%rip), %rsi     # 0xb8165
leaq 0x5b700(%rip), %rcx     # 0xb831f
movl $0x8b8, %edx            # imm = 0x8B8
callq 0xc140