// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImGuiWindow*, ImDrawList const*, ImDrawCmd const*, bool, bool)
void ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImGuiWindow* window, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb)
{
    IM_ASSERT(show_mesh || show_aabb);
    ImDrawList* fg_draw_list = GetForegroundDrawList(window); // Render additional visuals into the top-most draw list
    ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
    ImDrawVert* vtx_buffer = draw_list->VtxBuffer.Data + draw_cmd->VtxOffset;

    // Draw wire-frame version of all triangles
    ImRect clip_rect = draw_cmd->ClipRect;
    ImRect vtxs_rect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
    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.
    for (unsigned int idx_n = draw_cmd->IdxOffset; idx_n < draw_cmd->IdxOffset + draw_cmd->ElemCount; )
    {
        ImVec2 triangle[3];
        for (int n = 0; n < 3; n++, idx_n++)
            vtxs_rect.Add((triangle[n] = vtx_buffer[idx_buffer ? idx_buffer[idx_n] : idx_n].pos));
        if (show_mesh)
            fg_draw_list->AddPolyline(triangle, 3, IM_COL32(255, 255, 0, 255), true, 1.0f); // In yellow: mesh triangles
    }
    // Draw bounding boxes
    if (show_aabb)
    {
        fg_draw_list->AddRect(ImFloor(clip_rect.Min), ImFloor(clip_rect.Max), IM_COL32(255, 0, 255, 255)); // In pink: clipping rectangle submitted to GPU
        fg_draw_list->AddRect(ImFloor(vtxs_rect.Min), ImFloor(vtxs_rect.Max), IM_COL32(0, 255, 255, 255)); // In cyan: bounding box of triangles
    }
    fg_draw_list->Flags = backup_flags;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %cl
movb %cl, -0x19(%rbp)
andb $0x1, %al
movb %al, -0x1a(%rbp)
movb $0x1, %al
testb $0x1, -0x19(%rbp)
movb %al, -0xa5(%rbp)
jne 0xe482c
movb -0x1a(%rbp), %al
movb %al, -0xa5(%rbp)
movb -0xa5(%rbp), %al
testb $0x1, %al
jne 0xe4838
jmp 0xe483a
jmp 0xe4859
leaq 0x91a31(%rip), %rdi     # 0x176272
leaq 0x8e6c1(%rip), %rsi     # 0x172f09
movl $0x2ae5, %edx           # imm = 0x2AE5
leaq 0x91a35(%rip), %rcx     # 0x176289
callq 0xd180
movq -0x8(%rbp), %rdi
callq 0xec880
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0xe4881
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xb0(%rbp)
jmp 0xe488c
xorl %eax, %eax
movq %rax, -0xb0(%rbp)
jmp 0xe488c
movq -0xb0(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xeb300
leaq -0x58(%rbp), %rdi
movss 0x8d6ea(%rip), %xmm1    # 0x171fb4
movss 0x8de86(%rip), %xmm3    # 0x172758
movaps %xmm1, %xmm0
movaps %xmm3, %xmm2
callq 0xec090
movq -0x28(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x28(%rbp), %rax
movl 0x30(%rax), %ecx
andl $-0x2, %ecx
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movq -0x18(%rbp), %rcx
movl 0x1c(%rcx), %ecx
movq -0x18(%rbp), %rdx
addl 0x20(%rdx), %ecx
cmpl %ecx, %eax
jae 0xe4a2f
leaq -0x80(%rbp), %rax
movq %rax, %rcx
addq $0x18, %rcx
movq %rcx, -0xc0(%rbp)
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0xe7de0
movq -0xc8(%rbp), %rax
movq -0xc0(%rbp), %rcx
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0xb8(%rbp)
jne 0xe4930
movl $0x0, -0x84(%rbp)
cmpl $0x3, -0x84(%rbp)
jge 0xe49ff
movq -0x38(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xe499d
movq -0x30(%rbp), %rax
movl -0x60(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0xd4(%rbp)
jmp 0xe49a6
movl -0x60(%rbp), %eax
movl %eax, -0xd4(%rbp)
movq -0xd0(%rbp), %rcx
movl -0xd4(%rbp), %eax
movl %eax, %eax
imulq $0x14, %rax, %rax
addq %rax, %rcx
movslq -0x84(%rbp), %rax
leaq -0x80(%rbp), %rsi
movq %rax, %rdx
shlq $0x3, %rdx
addq %rdx, %rsi
movq (%rcx), %rcx
movq %rcx, -0x80(%rbp,%rax,8)
leaq -0x58(%rbp), %rdi
callq 0xeca30
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0xe496b
testb $0x1, -0x19(%rbp)
je 0xe4a2a
movq -0x28(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movl $0x3, %edx
movl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
movl $0x1, %r8d
movss 0x8c217(%rip), %xmm0    # 0x170c3c
callq 0x10fdd0
jmp 0xe48fe
testb $0x1, -0x1a(%rbp)
je 0xe4af3
movq -0x28(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xc2f10
movlpd %xmm0, -0x8c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xc2f10
movq -0xe8(%rbp), %rdi
movlpd %xmm0, -0x94(%rbp)
leaq -0x8c(%rbp), %rsi
leaq -0x94(%rbp), %rdx
movl $0xffff00ff, %ecx       # imm = 0xFFFF00FF
xorps %xmm0, %xmm0
movl $0xf, %r8d
movss 0x8c1ab(%rip), %xmm1    # 0x170c3c
callq 0x112ef0
movq -0x28(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xc2f10
movlpd %xmm0, -0x9c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xc2f10
movq -0xe0(%rbp), %rdi
movlpd %xmm0, -0xa4(%rbp)
leaq -0x9c(%rbp), %rsi
leaq -0xa4(%rbp), %rdx
movl $0xffffff00, %ecx       # imm = 0xFFFFFF00
xorps %xmm0, %xmm0
movl $0xf, %r8d
movss 0x8c14e(%rip), %xmm1    # 0x170c3c
callq 0x112ef0
movl -0x5c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x30(%rax)
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)