// File: /workspace/github_cpp_makefile_star2_O1/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImDrawList::ChannelsMerge()
void ImDrawList::ChannelsMerge()
{
    // Note that we never use or rely on channels.Size because it is merely a buffer that we never shrink back to 0 to keep all sub-buffers ready for use.
    if (_ChannelsCount <= 1)
        return;

    ChannelsSetCurrent(0);
    if (CmdBuffer.Size && CmdBuffer.back().ElemCount == 0)
        CmdBuffer.pop_back();

    int new_cmd_buffer_count = 0, new_idx_buffer_count = 0;
    for (int i = 1; i < _ChannelsCount; i++)
    {
        ImDrawChannel& ch = _Channels[i];
        if (ch.CmdBuffer.Size && ch.CmdBuffer.back().ElemCount == 0)
            ch.CmdBuffer.pop_back();
        new_cmd_buffer_count += ch.CmdBuffer.Size;
        new_idx_buffer_count += ch.IdxBuffer.Size;
    }
    CmdBuffer.resize(CmdBuffer.Size + new_cmd_buffer_count);
    IdxBuffer.resize(IdxBuffer.Size + new_idx_buffer_count);

    ImDrawCmd* cmd_write = CmdBuffer.Data + CmdBuffer.Size - new_cmd_buffer_count;
    _IdxWritePtr = IdxBuffer.Data + IdxBuffer.Size - new_idx_buffer_count;
    for (int i = 1; i < _ChannelsCount; i++)
    {
        ImDrawChannel& ch = _Channels[i];
        if (int sz = ch.CmdBuffer.Size) { memcpy(cmd_write, ch.CmdBuffer.Data, sz * sizeof(ImDrawCmd)); cmd_write += sz; }
        if (int sz = ch.IdxBuffer.Size) { memcpy(_IdxWritePtr, ch.IdxBuffer.Data, sz * sizeof(ImDrawIdx)); _IdxWritePtr += sz; }
    }
    AddDrawCmd();
    _ChannelsCount = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, 0x84(%rdi)
jl 0x2de33
movslq 0x80(%rdi), %rax
testq %rax, %rax
je 0x2dba4
movq 0x90(%rdi), %rcx
shlq $0x5, %rax
movups (%rdi), %xmm0
movups %xmm0, (%rcx,%rax)
movq 0x90(%rdi), %rax
movslq 0x80(%rdi), %rcx
shlq $0x5, %rcx
movups 0x10(%rdi), %xmm0
movups %xmm0, 0x10(%rax,%rcx)
movl $0x0, 0x80(%rdi)
movq 0x90(%rdi), %rax
movups (%rax), %xmm0
movups %xmm0, (%rdi)
movups 0x10(%rax), %xmm0
movups %xmm0, 0x10(%rdi)
movslq 0x10(%rdi), %rax
addq %rax, %rax
addq 0x18(%rdi), %rax
movq %rax, 0x48(%rdi)
movl (%rdi), %eax
testq %rax, %rax
je 0x2dbca
testl %eax, %eax
jle 0x2de61
movq 0x8(%rdi), %rcx
leaq (%rax,%rax,2), %rdx
shlq $0x4, %rdx
cmpl $0x0, -0x30(%rcx,%rdx)
jne 0x2dbca
decl %eax
movl %eax, (%rdi)
movslq 0x84(%rdi), %rax
xorl %r12d, %r12d
movl $0x0, %r15d
cmpq $0x2, %rax
jl 0x2dc54
movl 0x88(%rdi), %esi
movq 0x90(%rdi), %rcx
cmpl $0x2, %esi
movl $0x1, %edx
cmovgel %esi, %edx
shlq $0x5, %rdx
shlq $0x5, %rax
xorl %r15d, %r15d
movl $0x20, %esi
xorl %r12d, %r12d
cmpq %rsi, %rdx
je 0x2de42
movl (%rcx,%rsi), %r10d
testq %r10, %r10
je 0x2dc42
testl %r10d, %r10d
jle 0x2de61
movq 0x8(%rcx,%rsi), %r8
leaq (%r10,%r10,2), %r9
shlq $0x4, %r9
cmpl $0x0, -0x30(%r8,%r9)
jne 0x2dc42
decl %r10d
movl %r10d, (%rcx,%rsi)
addl (%rcx,%rsi), %r15d
addl 0x10(%rcx,%rsi), %r12d
addq $0x20, %rsi
cmpq %rsi, %rax
jne 0x2dc0b
movl (%rdi), %r13d
addl %r15d, %r13d
movl 0x4(%rdi), %eax
cmpl %r13d, %eax
movq %rdi, -0x30(%rbp)
jge 0x2dcd9
testl %eax, %eax
je 0x2dc7c
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
addl %eax, %r14d
jmp 0x2dc82
movl $0x8, %r14d
cmpl %r13d, %r14d
cmovlel %r13d, %r14d
cmpl %r14d, %eax
jge 0x2dcd9
movslq %r14d, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
callq 0x85d9
movq %rax, %rbx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rax
movslq (%rax), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdx
movq %rbx, %rdi
callq 0x7080
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x9065
movq -0x30(%rbp), %rdi
movq %rbx, 0x8(%rdi)
movl %r14d, 0x4(%rdi)
movl %r13d, (%rdi)
movslq 0x10(%rdi), %r13
movslq %r12d, %r12
addq %r12, %r13
movl 0x14(%rdi), %eax
cmpl %r13d, %eax
jge 0x2dd58
testl %eax, %eax
je 0x2dd04
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
addl %eax, %r14d
jmp 0x2dd0a
movl $0x8, %r14d
cmpl %r13d, %r14d
cmovlel %r13d, %r14d
cmpl %r14d, %eax
jge 0x2dd58
movslq %r14d, %rdi
addq %rdi, %rdi
callq 0x85d9
movq %rax, %rbx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x30(%rbp), %rax
movslq 0x10(%rax), %rdx
addq %rdx, %rdx
movq %rbx, %rdi
callq 0x7080
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x9065
movq -0x30(%rbp), %rdi
movq %rbx, 0x18(%rdi)
movl %r14d, 0x14(%rdi)
movl %r13d, 0x10(%rdi)
movq 0x8(%rdi), %rax
movslq (%rdi), %rcx
addq %r13, %r13
addq 0x18(%rdi), %r13
addq %r12, %r12
subq %r12, %r13
movq %r13, 0x48(%rdi)
cmpl $0x2, 0x84(%rdi)
jl 0x2de21
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movslq %r15d, %rcx
negq %rcx
leaq (%rcx,%rcx,2), %r14
shlq $0x4, %r14
addq %rax, %r14
movl $0x1, %r12d
movl $0x38, %r13d
movslq 0x88(%rdi), %rax
cmpq %rax, %r12
jge 0x2de42
movq 0x90(%rdi), %rbx
movslq -0x18(%rbx,%r13), %rax
testq %rax, %rax
je 0x2dde9
movq -0x10(%rbx,%r13), %rsi
shlq $0x4, %rax
leaq (%rax,%rax,2), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x7080
movq -0x30(%rbp), %rdi
addq %r15, %r14
movslq -0x8(%rbx,%r13), %r15
testq %r15, %r15
je 0x2de0e
movq 0x48(%rdi), %rdi
movq (%rbx,%r13), %rsi
addq %r15, %r15
movq %r15, %rdx
callq 0x7080
movq -0x30(%rbp), %rdi
addq %r15, 0x48(%rdi)
incq %r12
movslq 0x84(%rdi), %rax
addq $0x20, %r13
cmpq %rax, %r12
jl 0x2dda9
movq %rdi, %rbx
callq 0x2d104
movl $0x1, 0x84(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10f67(%rip), %rdi     # 0x3edb0
leaq 0x10c43(%rip), %rsi     # 0x3ea93
leaq 0x194d7(%rip), %rcx     # 0x4732e
movl $0x31c, %edx            # imm = 0x31C
callq 0x7140
leaq 0x18d4d(%rip), %rdi     # 0x46bb5
leaq 0x10c24(%rip), %rsi     # 0x3ea93
leaq 0x10d23(%rip), %rcx     # 0x3eb99
movl $0x326, %edx            # imm = 0x326
callq 0x7140