// File: /workspace/github_cpp_makefile_star2_O3/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
subq $0x18, %rsp
cmpl $0x2, 0x84(%rdi)
jl 0x2d8ba
movslq 0x80(%rdi), %rax
testq %rax, %rax
je 0x2d62b
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
xorl %r12d, %r12d
movl $0x0, %r13d
testq %rax, %rax
je 0x2d662
testl %eax, %eax
jle 0x2d8e8
movq 0x8(%rdi), %rcx
leaq (%rax,%rax,2), %rdx
shlq $0x4, %rdx
cmpl $0x0, -0x30(%rcx,%rdx)
je 0x2d65b
movl %eax, %r13d
jmp 0x2d662
leal -0x1(%rax), %r13d
movl %r13d, (%rdi)
movslq 0x84(%rdi), %rax
movl $0x0, %r15d
cmpq $0x2, %rax
jl 0x2d6f0
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 0x2d8c9
movl (%rcx,%rsi), %r10d
testq %r10, %r10
je 0x2d6d9
testl %r10d, %r10d
jle 0x2d8e8
movq 0x8(%rcx,%rsi), %r8
leaq (%r10,%r10,2), %r9
shlq $0x4, %r9
cmpl $0x0, -0x30(%r8,%r9)
jne 0x2d6dc
decl %r10d
movl %r10d, (%rcx,%rsi)
jmp 0x2d6dc
xorl %r10d, %r10d
addl %r10d, %r15d
addl 0x10(%rcx,%rsi), %r12d
addq $0x20, %rsi
cmpq %rsi, %rax
jne 0x2d6a0
movl (%rdi), %r13d
addl %r15d, %r13d
movl 0x4(%rdi), %ecx
cmpl %r13d, %ecx
movq %rdi, -0x30(%rbp)
jge 0x2d764
testl %ecx, %ecx
je 0x2d710
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
addl %ecx, %eax
jmp 0x2d715
movl $0x8, %eax
cmpl %r13d, %eax
cmovlel %r13d, %eax
cltq
movq %rax, -0x38(%rbp)
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
callq 0x8589
movq %rax, %r14
movq -0x30(%rbp), %rbx
movq 0x8(%rbx), %rsi
movslq (%rbx), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdx
movq %r14, %rdi
callq 0x7080
movq 0x8(%rbx), %rdi
callq 0x9019
movq %rbx, %rdi
movq %r14, 0x8(%rbx)
movq -0x38(%rbp), %rax
movl %eax, 0x4(%rbx)
movl %r13d, (%rdi)
movslq 0x10(%rdi), %r14
movslq %r12d, %rdx
addq %rdx, %r14
movl 0x14(%rdi), %ecx
cmpl %r14d, %ecx
jge 0x2d78e
testl %ecx, %ecx
movq %rdx, -0x38(%rbp)
je 0x2d794
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
addl %ecx, %eax
jmp 0x2d799
movq 0x18(%rdi), %r12
jmp 0x2d7e2
movl $0x8, %eax
cmpl %r14d, %eax
cmovlel %r14d, %eax
movslq %eax, %rbx
leaq (%rbx,%rbx), %rdi
callq 0x8589
movq %rax, %r12
movq -0x30(%rbp), %r13
movq 0x18(%r13), %rsi
movslq 0x10(%r13), %rdx
addq %rdx, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x18(%r13), %rdi
callq 0x9019
movq %r13, %rdi
movq %r12, 0x18(%r13)
movl %ebx, 0x14(%r13)
movl (%r13), %r13d
movq -0x38(%rbp), %rdx
movl %r14d, 0x10(%rdi)
movq 0x8(%rdi), %rax
leaq (%r12,%r14,2), %rcx
addq %rdx, %rdx
subq %rdx, %rcx
movq %rcx, 0x48(%rdi)
cmpl $0x2, 0x84(%rdi)
jl 0x2d8a8
movslq %r13d, %rcx
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 0x2d8c9
movq 0x90(%rdi), %rbx
movslq -0x18(%rbx,%r13), %rax
testq %rax, %rax
je 0x2d870
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 0x2d895
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 0x2d830
movq %rdi, %rbx
callq 0x2cc3e
movl $0x1, 0x84(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11510(%rip), %rdi     # 0x3ede0
leaq 0x111ec(%rip), %rsi     # 0x3eac3
leaq 0x199d0(%rip), %rcx     # 0x472ae
movl $0x31c, %edx            # imm = 0x31C
callq 0x7140
leaq 0x19246(%rip), %rdi     # 0x46b35
leaq 0x111cd(%rip), %rsi     # 0x3eac3
leaq 0x112cc(%rip), %rcx     # 0x3ebc9
movl $0x326, %edx            # imm = 0x326
callq 0x7140
nop