// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
cmpl $0x0, 0x80(%rdi)
jne 0x2db03
movq %rdi, %rbx
cmpl $0x1, 0x84(%rdi)
jne 0x2db03
movl %esi, %r14d
movslq 0x88(%rbx), %rdi
cmpl %esi, %edi
movq %rdi, -0x38(%rbp)
jge 0x2d79f
movl 0x8c(%rbx), %eax
cmpl %r14d, %eax
jge 0x2d798
testl %eax, %eax
je 0x2d73f
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
addl %eax, %r12d
jmp 0x2d745
movl $0x8, %r12d
cmpl %r14d, %r12d
cmovlel %r14d, %r12d
cmpl %r12d, %eax
jge 0x2d798
movslq %r12d, %rdi
shlq $0x5, %rdi
callq 0x85d9
movq %rax, %r15
movq 0x90(%rbx), %rsi
movslq 0x88(%rbx), %rdx
shlq $0x5, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x90(%rbx), %rdi
callq 0x9065
movq -0x38(%rbp), %rdi
movq %r15, 0x90(%rbx)
movl %r12d, 0x8c(%rbx)
movl %r14d, 0x88(%rbx)
movl %r14d, 0x84(%rbx)
cmpl $0x0, 0x88(%rbx)
jle 0x2daae
movq 0x90(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
cmpl $0x2, %r14d
jl 0x2da9f
movl %r14d, %r8d
movl $0x1, %r13d
movl $0x38, %r12d
movq %r8, -0x40(%rbp)
movslq 0x88(%rbx), %rax
cmpq %rdi, %r13
jge 0x2d909
cmpq %rax, %r13
jge 0x2daae
movq 0x90(%rbx), %r15
movl -0x14(%r15,%r12), %eax
testl %eax, %eax
jns 0x2d877
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
addl %eax, %r14d
testl %r14d, %r14d
movl $0x0, %eax
cmovlel %eax, %r14d
movq %r14, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
callq 0x85d9
movq %rax, %rdi
movq %rax, -0x30(%rbp)
movq -0x10(%r15,%r12), %rsi
movslq -0x18(%r15,%r12), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdx
callq 0x7080
movq -0x10(%r15,%r12), %rdi
callq 0x9065
movq -0x40(%rbp), %r8
xorps %xmm0, %xmm0
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
movq %rax, -0x10(%r15,%r12)
movl %r14d, -0x14(%r15,%r12)
movl $0x0, -0x18(%r15,%r12)
movslq 0x88(%rbx), %rax
cmpq %rax, %r13
jge 0x2daae
movq 0x90(%rbx), %r15
movl -0x4(%r15,%r12), %eax
testl %eax, %eax
jns 0x2d8fe
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
addl %eax, %r14d
testl %r14d, %r14d
movl $0x0, %eax
cmovlel %eax, %r14d
leal (%r14,%r14), %edi
callq 0x85d9
movq %rax, -0x30(%rbp)
movq (%r15,%r12), %rsi
movslq -0x8(%r15,%r12), %rdx
addq %rdx, %rdx
movq %rax, %rdi
callq 0x7080
movq (%r15,%r12), %rdi
callq 0x9065
movq -0x40(%rbp), %r8
xorps %xmm0, %xmm0
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
movq %rax, (%r15,%r12)
movl %r14d, -0x4(%r15,%r12)
movl $0x0, -0x8(%r15,%r12)
jmp 0x2d925
cmpq %rax, %r13
jge 0x2daae
movq 0x90(%rbx), %rax
movups %xmm0, -0x8(%rax,%r12)
movups %xmm0, -0x18(%rax,%r12)
movslq 0x88(%rbx), %rax
cmpq %rax, %r13
jge 0x2daae
movq 0x90(%rbx), %r15
movl -0x18(%r15,%r12), %ecx
testl %ecx, %ecx
jne 0x2da8f
movslq 0x50(%rbx), %rax
testq %rax, %rax
jle 0x2dacd
movslq 0x60(%rbx), %rdx
testq %rdx, %rdx
jle 0x2dae4
movq 0x58(%rbx), %rsi
shlq $0x4, %rax
movss -0x10(%rsi,%rax), %xmm1
movss -0xc(%rsi,%rax), %xmm2
movss -0x8(%rsi,%rax), %xmm3
movss -0x4(%rsi,%rax), %xmm4
movq 0x68(%rbx), %rax
movq -0x8(%rax,%rdx,8), %rsi
movl -0x14(%r15,%r12), %eax
cmpl %eax, %ecx
jne 0x2da4c
testl %eax, %eax
je 0x2d9af
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
addl %eax, %r14d
jmp 0x2d9b5
movl $0x8, %r14d
cmpl $0x2, %r14d
movl $0x1, %ecx
cmovll %ecx, %r14d
cmpl %r14d, %eax
jge 0x2da4c
movl %r14d, %eax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
movss %xmm1, -0x30(%rbp)
movss %xmm2, -0x4c(%rbp)
movss %xmm3, -0x48(%rbp)
movss %xmm4, -0x44(%rbp)
movq %rsi, -0x60(%rbp)
callq 0x85d9
movq %rax, %rdi
movq %rax, -0x58(%rbp)
movq -0x10(%r15,%r12), %rsi
movslq -0x18(%r15,%r12), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdx
callq 0x7080
movq -0x10(%r15,%r12), %rdi
callq 0x9065
movq -0x60(%rbp), %rsi
movss -0x44(%rbp), %xmm4
movss -0x48(%rbp), %xmm3
movss -0x4c(%rbp), %xmm2
movss -0x30(%rbp), %xmm1
movq -0x40(%rbp), %r8
xorps %xmm0, %xmm0
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rax
movq %rax, -0x10(%r15,%r12)
movl %r14d, -0x14(%r15,%r12)
movq -0x10(%r15,%r12), %rax
movslq -0x18(%r15,%r12), %rcx
leal 0x1(%rcx), %edx
movl %edx, -0x18(%r15,%r12)
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movl $0x0, (%rax,%rcx)
movss %xmm1, 0x4(%rax,%rcx)
movss %xmm2, 0x8(%rax,%rcx)
movss %xmm3, 0xc(%rax,%rcx)
movss %xmm4, 0x10(%rax,%rcx)
movq %rsi, 0x18(%rax,%rcx)
movups %xmm0, 0x20(%rax,%rcx)
incq %r13
addq $0x20, %r12
cmpq %r13, %r8
jne 0x2d7e1
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x112fb(%rip), %rdi     # 0x3edb0
leaq 0x10fd7(%rip), %rsi     # 0x3ea93
leaq 0x1986b(%rip), %rcx     # 0x4732e
movl $0x31c, %edx            # imm = 0x31C
callq 0x7140
leaq 0x190e1(%rip), %rdi     # 0x46bb5
leaq 0x10fb8(%rip), %rsi     # 0x3ea93
leaq 0x11238(%rip), %rcx     # 0x3ed1a
jmp 0x2daf9
leaq 0x190ca(%rip), %rdi     # 0x46bb5
leaq 0x10fa1(%rip), %rsi     # 0x3ea93
leaq 0x1987e(%rip), %rcx     # 0x47377
movl $0x326, %edx            # imm = 0x326
callq 0x7140
leaq 0x18db1(%rip), %rdi     # 0x468bb
leaq 0x18d05(%rip), %rsi     # 0x46816
leaq 0x18dd0(%rip), %rcx     # 0x468e8
movl $0xe3, %edx
callq 0x7140