// File: /workspace/github_cpp_makefile_star2_O2/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 %rdx, %r14
movq %rdi, %rbx
movq 0x9bc3b(%rip), %rax     # 0xe3ce0
movq %rax, -0x80(%rbp)
movl (%rsi), %r13d
testl %r13d, %r13d
movq %rsi, -0x68(%rbp)
jle 0x480d7
movq %rsi, %r15
movq %rsi, %rdi
callq 0x4bbc8
cmpl $0x0, 0x20(%rax)
jne 0x480d7
movq %r15, %rdi
callq 0x4bbc8
cmpq $0x1, 0x28(%rax)
sbbl $0x0, %r13d
movq -0x68(%rbp), %rdi
movq 0x40(%rdi), %rax
testq %rax, %rax
leaq 0x53e38(%rip), %rcx     # 0x9bf21
cmovneq %rax, %rcx
movl 0x10(%rdi), %r9d
movl 0x20(%rdi), %r8d
movl %r13d, (%rsp)
leaq 0x57fcf(%rip), %rsi     # 0xa00cf
movq %r14, %rdx
movq %rdi, %r14
xorl %eax, %eax
callq 0x88935
movl %eax, %r15d
movq 0x9bbc9(%rip), %rcx     # 0xe3ce0
movq 0x1ae0(%rcx), %rax
movb $0x1, 0x90(%rax)
cmpq %r14, 0x2b8(%rax)
je 0x481b4
movq %rcx, %r12
leaq 0x1f38(%rcx), %rax
movq %rax, -0x70(%rbp)
testq %rbx, %rbx
je 0x481ff
xorl %edi, %edi
callq 0x374fd
testb %al, %al
je 0x48196
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)
pushq $0xf
popq %r8
movss 0x53e73(%rip), %xmm1    # 0x9bff8
xorps %xmm0, %xmm0
movq -0x70(%rbp), %rdi
movl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
callq 0x63f6c
testb %r15b, %r15b
je 0x481ed
cmpb $0x0, 0x8f(%rbx)
jne 0x48204
leaq 0x57f5d(%rip), %rdi     # 0xa0108
xorl %eax, %eax
callq 0x79774
jmp 0x48204
movss 0x53e34(%rip), %xmm1    # 0x9bff0
xorps %xmm0, %xmm0
callq 0x437ec
movaps 0x54675(%rip), %xmm0    # 0x9c840
leaq -0x1f0(%rbp), %rdi
movups %xmm0, (%rdi)
leaq 0x57f18(%rip), %rsi     # 0xa00f4
xorl %eax, %eax
callq 0x7968a
testb %r15b, %r15b
je 0x481ed
callq 0x89637
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %r15b, %r15b
je 0x481ed
movq 0x8(%r14), %rax
movslq %r13d, %rcx
imulq $0x38, %rcx, %rbx
movq %rax, %r15
movq %rbx, -0x78(%rbp)
movq %r12, -0x88(%rbp)
addq %rbx, %rax
cmpq %rax, %r15
jae 0x481e8
movq 0x28(%r15), %rsi
testq %rsi, %rsi
je 0x48245
movq 0x30(%r15), %rdx
leaq 0x57f18(%rip), %rdi     # 0xa0151
xorl %eax, %eax
callq 0x79bb3
jmp 0x485ee
movl 0x20(%r15), %eax
xorl %edx, %edx
pushq $0x3
popq %rcx
divl %ecx
cvtss2sd (%r15), %xmm0
cvtss2sd 0x4(%r15), %xmm1
cvtss2sd 0x8(%r15), %xmm2
movq 0x10(%r15), %r8
cvtss2sd 0xc(%r15), %xmm3
movl $0x12c, %esi            # imm = 0x12C
leaq -0x1f0(%rbp), %r12
movq %r12, %rdi
leaq 0x57eea(%rip), %rdx     # 0xa016b
movl %eax, %ecx
movb $0x4, %al
callq 0x3468c
movq %r15, -0x30(%rbp)
subq 0x8(%r14), %r15
movq %r15, %rax
cqto
pushq $0x38
popq %rcx
idivq %rcx
movq %rax, %rdi
leaq 0x578e0(%rip), %rsi     # 0x9fb87
movq %r12, %rdx
xorl %eax, %eax
callq 0x88935
movl %eax, %r13d
xorl %edi, %edi
callq 0x374fd
testb %al, %al
je 0x482f3
movq -0x80(%rbp), %rcx
movb 0x3177(%rcx), %al
movb 0x3178(%rcx), %dl
movl %eax, %ecx
orb %dl, %cl
testb $0x1, %cl
je 0x482f3
movzbl %al, %ecx
notb %al
orb %dl, %al
movzbl %al, %r8d
andl $0x1, %r8d
movq %r14, %rsi
movq -0x30(%rbp), %rdx
callq 0x489a0
testb %r13b, %r13b
movaps 0x544f3(%rip), %xmm5    # 0x9c7f0
movss 0x53d13(%rip), %xmm6    # 0x9c018
je 0x485ea
cmpl $0x0, 0x10(%r14)
jle 0x48318
movq 0x18(%r14), %r13
jmp 0x4831b
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
movl 0x18(%rax), %r8d
movl 0x1c(%rax), %r9d
imulq $0x14, %r8, %r15
addq 0x28(%r14), %r15
movl 0x20(%rax), %ecx
leal (%rcx,%r9), %eax
xorps %xmm0, %xmm0
movl %r9d, %edx
cmpl %eax, %edx
jae 0x483c8
andq $0x0, -0x40(%rbp)
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movl %edx, %edi
xorl %esi, %esi
cmpq $0x3, %rsi
je 0x48381
leaq (%rdi,%rsi), %r10
testq %r13, %r13
je 0x4836c
movl %r10d, %r10d
movzwl (%r13,%r10,2), %r10d
movl %r10d, %r10d
imulq $0x14, %r10, %r10
movq (%r15,%r10), %r10
movq %r10, -0x50(%rbp,%rsi,8)
incq %rsi
jmp 0x48354
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 %xmm5, %xmm1
mulss %xmm6, %xmm1
addss %xmm1, %xmm0
addl %esi, %edx
jmp 0x4833c
cvtss2sd %xmm0, %xmm0
movl $0x12c, %esi            # imm = 0x12C
leaq -0x1f0(%rbp), %rbx
movq %rbx, %rdi
leaq 0x57dca(%rip), %rdx     # 0xa01ac
movb $0x1, %al
callq 0x3468c
andq $0x0, -0x50(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq -0x50(%rbp), %rcx
callq 0x7d81c
xorl %edi, %edi
callq 0x374fd
testb %al, %al
je 0x4841b
movq %r14, %rsi
movq -0x30(%rbp), %rdx
pushq $0x1
popq %rcx
xorl %r8d, %r8d
callq 0x489a0
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movups %xmm0, -0x44(%rbp)
orl $-0x1, -0x48(%rbp)
movq -0x30(%rbp), %rax
movl 0x20(%rax), %eax
xorl %edx, %edx
pushq $0x3
popq %rcx
divl %ecx
leaq -0x50(%rbp), %rdi
movl %eax, %esi
movss 0x53baa(%rip), %xmm0    # 0x9bff0
callq 0x35904
leaq -0x50(%rbp), %rdi
callq 0x35aa6
testb %al, %al
je 0x485d4
movl -0x50(%rbp), %ecx
movl -0x4c(%rbp), %eax
movl %eax, -0x5c(%rbp)
leal (%rcx,%rcx,2), %r14d
movq -0x30(%rbp), %rax
addl 0x1c(%rax), %r14d
cmpl -0x5c(%rbp), %ecx
jge 0x4844b
movq %rcx, -0x90(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xc0(%rbp)
andq $0x0, -0xb0(%rbp)
movslq %r14d, %rax
movl %eax, %r14d
movq %r13, %r12
movq %rax, -0x98(%rbp)
leaq (,%rax,2), %rax
addq %r13, %rax
movq %rax, -0x58(%rbp)
xorl %ebx, %ebx
leaq -0x1f0(%rbp), %r13
cmpq $0x3, %rbx
je 0x4854d
testq %r12, %r12
je 0x484d0
movq -0x58(%rbp), %rax
movzwl (%rax,%rbx,2), %eax
jmp 0x484da
movq -0x98(%rbp), %rax
addq %rbx, %rax
cltq
imulq $0x14, %rax, %rax
movq (%r15,%rax), %rcx
movq %rcx, -0xc0(%rbp,%rbx,8)
leaq -0xc4(%rbp), %rsi
subq %r13, %rsi
testq %rbx, %rbx
leaq 0x57d2c(%rip), %rcx     # 0xa022c
leaq 0x57d1f(%rip), %rdx     # 0xa0226
cmoveq %rdx, %rcx
cvtss2sd (%r15,%rax), %xmm0
cvtss2sd 0x4(%r15,%rax), %xmm1
cvtss2sd 0x8(%r15,%rax), %xmm2
leaq (%r14,%rbx), %r8
cvtss2sd 0xc(%r15,%rax), %xmm3
movl 0x10(%r15,%rax), %r9d
movq %r13, %rdi
leaq 0x57cb7(%rip), %rdx     # 0xa01f0
movb $0x4, %al
callq 0x3468c
cltq
addq %rax, %r13
incq %rbx
jmp 0x484b7
andq $0x0, -0xa0(%rbp)
leaq -0x1f0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq -0xa0(%rbp), %rcx
callq 0x7d81c
xorl %edi, %edi
callq 0x374fd
testb %al, %al
movq -0x88(%rbp), %r13
je 0x485c0
movl 0x1f68(%r13), %eax
movl %eax, -0x58(%rbp)
andl $-0x2, %eax
movl %eax, 0x1f68(%r13)
movq -0x70(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
pushq $0x3
popq %rdx
movl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
pushq $0x1
popq %r8
movss 0x53a47(%rip), %xmm0    # 0x9bff8
callq 0x6270a
movl -0x58(%rbp), %eax
movl %eax, 0x1f68(%r13)
addq %rbx, %r14
movq -0x90(%rbp), %rcx
incl %ecx
movq %r12, %r13
jmp 0x48471
callq 0x89637
leaq -0x50(%rbp), %rdi
callq 0x358da
movq -0x68(%rbp), %r14
movq -0x78(%rbp), %rbx
movq -0x30(%rbp), %r15
addq $0x38, %r15
movq 0x8(%r14), %rax
jmp 0x4821d
jmp 0x48601
jmp 0x48601
jmp 0x48601
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x358da
movq %rbx, %rdi
callq 0xc580