// File: /workspace/github_cpp_makefile_star2_O3/donfreiday[P]gb/./imgui/imgui_draw.cpp
// Function: ImDrawList::ChannelsSplit(int)
void ImDrawList::ChannelsSplit(int channels_count)
{
    IM_ASSERT(_ChannelsCurrent == 0 && _ChannelsCount == 1);
    int old_channels_count = _Channels.Size;
    if (old_channels_count < channels_count)
        _Channels.resize(channels_count);
    _ChannelsCount = channels_count;

    // _Channels[] (24 bytes each) hold storage that we'll swap with this->_CmdBuffer/_IdxBuffer
    // The content of _Channels[0] at this point doesn't matter. We clear it to make state tidy in a debugger but we don't strictly need to.
    // When we switch to the next channel, we'll copy _CmdBuffer/_IdxBuffer into _Channels[0] and then _Channels[1] into _CmdBuffer/_IdxBuffer
    memset(&_Channels[0], 0, sizeof(ImDrawChannel));
    for (int i = 1; i < channels_count; i++)
    {
        if (i >= old_channels_count)
        {
            new(&_Channels[i]) ImDrawChannel();
        }
        else
        {
            _Channels[i].CmdBuffer.resize(0);
            _Channels[i].IdxBuffer.resize(0);
        }
        if (_Channels[i].CmdBuffer.Size == 0)
        {
            ImDrawCmd draw_cmd;
            draw_cmd.ClipRect = _ClipRectStack.back();
            draw_cmd.TextureId = _TextureIdStack.back();
            _Channels[i].CmdBuffer.push_back(draw_cmd);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x0, 0x80(%rdi)
jne 0x2d586
movq %rdi, %rbx
cmpl $0x1, 0x84(%rdi)
jne 0x2d586
movl %esi, %r14d
movl 0x88(%rbx), %r12d
movl %r12d, %eax
cmpl %esi, %r12d
jge 0x2d2a2
movl 0x8c(%rbx), %ecx
cmpl %r14d, %ecx
jge 0x2d298
testl %ecx, %ecx
je 0x2d246
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
addl %ecx, %eax
jmp 0x2d24b
movl $0x8, %eax
cmpl %r14d, %eax
cmovlel %r14d, %eax
movslq %eax, %r13
movq %r13, %rdi
shlq $0x5, %rdi
callq 0x8589
movq %rax, %r15
movq 0x90(%rbx), %rsi
movslq 0x88(%rbx), %rdx
shlq $0x5, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x90(%rbx), %rdi
callq 0x9019
movq %r15, 0x90(%rbx)
movl %r13d, 0x8c(%rbx)
movl %r14d, 0x88(%rbx)
movl %r14d, %eax
movl %r14d, 0x84(%rbx)
testl %eax, %eax
jle 0x2d531
movq 0x90(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
cmpl $0x2, %r14d
jl 0x2d522
movslq %r12d, %rsi
movl %r14d, %edi
movl $0x1, %r13d
movl $0x38, %r15d
movq %rsi, -0x38(%rbp)
movq %rdi, -0x30(%rbp)
movslq 0x88(%rbx), %rax
cmpq %rsi, %r13
jge 0x2d3c1
cmpq %rax, %r13
jge 0x2d531
movq 0x90(%rbx), %r12
cmpl $0x0, -0x14(%r12,%r15)
jns 0x2d359
xorl %edi, %edi
callq 0x8589
movq %rax, %r14
movq -0x10(%r12,%r15), %rsi
movslq -0x18(%r12,%r15), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdx
movq %r14, %rdi
callq 0x7080
movq -0x10(%r12,%r15), %rdi
callq 0x9019
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r14, -0x10(%r12,%r15)
movl $0x0, -0x14(%r12,%r15)
movslq 0x88(%rbx), %rax
movl $0x0, -0x18(%r12,%r15)
cmpq %r13, %rax
jle 0x2d531
movq 0x90(%rbx), %r12
cmpl $0x0, -0x4(%r12,%r15)
jns 0x2d3b6
xorl %edi, %edi
callq 0x8589
movq %rax, %r14
movq (%r12,%r15), %rsi
movslq -0x8(%r12,%r15), %rdx
addq %rdx, %rdx
movq %rax, %rdi
callq 0x7080
movq (%r12,%r15), %rdi
callq 0x9019
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r14, (%r12,%r15)
movl $0x0, -0x4(%r12,%r15)
movl $0x0, -0x8(%r12,%r15)
jmp 0x2d3e0
cmpq %rax, %r13
jge 0x2d531
movq 0x90(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, -0x8(%rax,%r15)
movups %xmm0, -0x18(%rax,%r15)
movslq 0x88(%rbx), %rax
cmpq %rax, %r13
jge 0x2d531
movq 0x90(%rbx), %r12
cmpl $0x0, -0x18(%r12,%r15)
jne 0x2d512
movslq 0x50(%rbx), %rax
testq %rax, %rax
jle 0x2d550
movslq 0x60(%rbx), %rcx
testq %rcx, %rcx
jle 0x2d567
movq 0x58(%rbx), %rdx
shlq $0x4, %rax
movl -0x10(%rdx,%rax), %r8d
movss -0xc(%rdx,%rax), %xmm0
movss -0x8(%rdx,%rax), %xmm1
movss -0x4(%rdx,%rax), %xmm2
movq 0x68(%rbx), %rax
movq -0x8(%rax,%rcx,8), %rdx
cmpl $0x0, -0x14(%r12,%r15)
je 0x2d456
movq -0x10(%r12,%r15), %r14
xorl %eax, %eax
jmp 0x2d4d0
movl $0x180, %edi            # imm = 0x180
movl %r8d, -0x48(%rbp)
movss %xmm0, -0x44(%rbp)
movss %xmm1, -0x40(%rbp)
movss %xmm2, -0x3c(%rbp)
movq %rdx, -0x50(%rbp)
callq 0x8589
movq %rax, %r14
movq -0x10(%r12,%r15), %rsi
movslq -0x18(%r12,%r15), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdx
movq %r14, %rdi
callq 0x7080
movq -0x10(%r12,%r15), %rdi
callq 0x9019
movq -0x50(%rbp), %rdx
movss -0x3c(%rbp), %xmm2
movss -0x40(%rbp), %xmm1
movss -0x44(%rbp), %xmm0
movl -0x48(%rbp), %r8d
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r14, -0x10(%r12,%r15)
movl $0x8, -0x14(%r12,%r15)
movl -0x18(%r12,%r15), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x18(%r12,%r15)
cltq
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
movl $0x0, (%r14,%rax)
movl %r8d, 0x4(%r14,%rax)
movss %xmm0, 0x8(%r14,%rax)
movss %xmm1, 0xc(%r14,%rax)
movss %xmm2, 0x10(%r14,%rax)
movq %rdx, 0x18(%r14,%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14,%rax)
incq %r13
addq $0x20, %r15
cmpq %r13, %rdi
jne 0x2d2e6
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x118a8(%rip), %rdi     # 0x3ede0
leaq 0x11584(%rip), %rsi     # 0x3eac3
leaq 0x19d68(%rip), %rcx     # 0x472ae
movl $0x31c, %edx            # imm = 0x31C
callq 0x7140
leaq 0x195de(%rip), %rdi     # 0x46b35
leaq 0x11565(%rip), %rsi     # 0x3eac3
leaq 0x117e5(%rip), %rcx     # 0x3ed4a
jmp 0x2d57c
leaq 0x195c7(%rip), %rdi     # 0x46b35
leaq 0x1154e(%rip), %rsi     # 0x3eac3
leaq 0x19d7b(%rip), %rcx     # 0x472f7
movl $0x326, %edx            # imm = 0x326
callq 0x7140
leaq 0x192ae(%rip), %rdi     # 0x4683b
leaq 0x19202(%rip), %rsi     # 0x46796
leaq 0x192cd(%rip), %rcx     # 0x46868
movl $0xe3, %edx
callq 0x7140
nop