// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: AddDrawListToDrawData(ImVector<ImDrawList*>*, ImDrawList*)
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list)
{
    // Remove trailing command if unused.
    // Technically we could return directly instead of popping, but this make things looks neat in Metrics/Debugger window as well.
    draw_list->_PopUnusedDrawCmd();
    if (draw_list->CmdBuffer.Size == 0)
        return;

    // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
    // May trigger for you if you are using PrimXXX functions incorrectly.
    IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
    IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
    if (!(draw_list->Flags & ImDrawListFlags_AllowVtxOffset))
        IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);

    // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window)
    // If this assert triggers because you are drawing lots of stuff manually:
    // - First, make sure you are coarse clipping yourself and not trying to draw many things outside visible bounds.
    //   Be mindful that the ImDrawList API doesn't filter vertices. Use the Metrics/Debugger window to inspect draw list contents.
    // - If you want large meshes with more than 64K vertices, you can either:
    //   (A) Handle the ImDrawCmd::VtxOffset value in your renderer backend, and set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset'.
    //       Most example backends already support this from 1.71. Pre-1.71 backends won't.
    //       Some graphics API such as GL ES 1/2 don't have a way to offset the starting vertex so it is not supported for them.
    //   (B) Or handle 32-bit indices in your renderer backend, and uncomment '#define ImDrawIdx unsigned int' line in imconfig.h.
    //       Most example backends already support this. For example, the OpenGL example code detect index size at compile-time:
    //         glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
    //       Your own engine or render API may use different parameters or function calls to specify index sizes.
    //       2 and 4 bytes indices are generally supported by most graphics API.
    // - If for some reason neither of those solutions works for you, a workaround is to call BeginChild()/EndChild() before reaching
    //   the 64K limit to split your draw commands in multiple draw lists.
    if (sizeof(ImDrawIdx) == 2)
        IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above");

    out_list->push_back(draw_list);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10f130
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xd45f7
jmp 0xd474a
movq -0x10(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, 0x20(%rcx)
movb %al, -0x11(%rbp)
je 0xd462e
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x10(%rbp), %rdx
movslq 0x20(%rdx), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
sete %al
movb %al, -0x11(%rbp)
movb -0x11(%rbp), %al
testb $0x1, %al
jne 0xd4637
jmp 0xd4639
jmp 0xd4658
leaq 0xa216d(%rip), %rdi     # 0x1767ad
leaq 0x9e8c2(%rip), %rsi     # 0x172f09
movl $0x102c, %edx           # imm = 0x102C
leaq 0xa21cd(%rip), %rcx     # 0x176820
callq 0xd180
movq -0x10(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, 0x10(%rcx)
movb %al, -0x12(%rbp)
je 0xd468e
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq -0x10(%rbp), %rdx
movslq 0x10(%rdx), %rdx
shlq %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
sete %al
movb %al, -0x12(%rbp)
movb -0x12(%rbp), %al
testb $0x1, %al
jne 0xd4697
jmp 0xd4699
jmp 0xd46b8
leaq 0xa21c3(%rip), %rdi     # 0x176863
leaq 0x9e862(%rip), %rsi     # 0x172f09
movl $0x102d, %edx           # imm = 0x102D
leaq 0xa216d(%rip), %rcx     # 0x176820
callq 0xd180
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0xd46fa
movq -0x10(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jne 0xd46d9
jmp 0xd46f8
leaq 0xa21f6(%rip), %rdi     # 0x1768d6
leaq 0x9e822(%rip), %rsi     # 0x172f09
movl $0x102f, %edx           # imm = 0x102F
leaq 0xa212d(%rip), %rcx     # 0x176820
callq 0xd180
jmp 0xd46fa
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpl $0x10000, 0x34(%rcx)    # imm = 0x10000
movb %al, -0x13(%rbp)
jae 0xd4713
movb $0x1, %al
movb %al, -0x13(%rbp)
jmp 0xd4713
movb -0x13(%rbp), %al
testb $0x1, %al
jne 0xd471c
jmp 0xd471e
jmp 0xd473d
leaq 0xa2236(%rip), %rdi     # 0x17695b
leaq 0x9e7dd(%rip), %rsi     # 0x172f09
movl $0x1041, %edx           # imm = 0x1041
leaq 0xa20e8(%rip), %rcx     # 0x176820
callq 0xd180
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0xee030
addq $0x20, %rsp
popq %rbp
retq