// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_draw.cpp
// Function: ImDrawListSplitter::Split(ImDrawList*, int)
void ImDrawListSplitter::Split(ImDrawList* draw_list, int channels_count)
{
    IM_UNUSED(draw_list);
    IM_ASSERT(_Current == 0 && _Count <= 1 && "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter.");
    int old_channels_count = _Channels.Size;
    if (old_channels_count < channels_count)
    {
        _Channels.reserve(channels_count); // Avoid over reserving since this is likely to stay stable
        _Channels.resize(channels_count);
    }
    _Count = channels_count;

    // Channels[] (24/32 bytes each) hold storage that we'll swap with draw_list->_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 draw_list->_CmdBuffer/_IdxBuffer into Channels[0] and then Channels[1] into draw_list->CmdBuffer/_IdxBuffer
    memset(&_Channels[0], 0, sizeof(ImDrawChannel));
    for (int i = 1; i < channels_count; i++)
    {
        if (i >= old_channels_count)
        {
            IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel();
        }
        else
        {
            _Channels[i]._CmdBuffer.resize(0);
            _Channels[i]._IdxBuffer.resize(0);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x0, (%rdi)
jne 0x7be49
movq %rdi, %rbx
cmpl $0x2, 0x4(%rdi)
jge 0x7be49
movl %edx, %r14d
movslq 0x8(%rbx), %rcx
cmpl %edx, %ecx
movq %rcx, -0x38(%rbp)
jge 0x7bca4
cmpl %r14d, 0xc(%rbx)
jge 0x7bc33
movslq %r14d, %rdi
shlq $0x5, %rdi
callq 0x424fb
movq %rax, %r15
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x7bc27
movslq 0x8(%rbx), %rdx
shlq $0x5, %rdx
movq %r15, %rdi
callq 0xc080
movq 0x10(%rbx), %rdi
callq 0x425d4
movq %r15, 0x10(%rbx)
movl %r14d, 0xc(%rbx)
movq -0x38(%rbp), %rcx
movl 0xc(%rbx), %eax
cmpl %r14d, %eax
jge 0x7bca0
testl %eax, %eax
je 0x7bc51
movl %eax, %r12d
shrl $0x1f, %r12d
addl %eax, %r12d
sarl %r12d
addl %eax, %r12d
jmp 0x7bc57
movl $0x8, %r12d
cmpl %r14d, %r12d
cmovlel %r14d, %r12d
cmpl %r12d, %eax
jge 0x7bca0
movslq %r12d, %rdi
shlq $0x5, %rdi
callq 0x424fb
movq %rax, %r15
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x7bc94
movslq 0x8(%rbx), %rdx
shlq $0x5, %rdx
movq %r15, %rdi
callq 0xc080
movq 0x10(%rbx), %rdi
callq 0x425d4
movq %r15, 0x10(%rbx)
movl %r12d, 0xc(%rbx)
movq -0x38(%rbp), %rcx
movl %r14d, 0x8(%rbx)
movl %r14d, 0x4(%rbx)
cmpl $0x0, 0x8(%rbx)
jle 0x7be2a
movq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
cmpl $0x2, %r14d
jl 0x7be1b
movl %r14d, %edx
movl $0x1, %r13d
movl $0x38, %r12d
movq %rdx, -0x40(%rbp)
movslq 0x8(%rbx), %rax
cmpq %rcx, %r13
jge 0x7bdf3
cmpq %rax, %r13
jge 0x7be2a
movq 0x10(%rbx), %r15
movl -0x14(%r15,%r12), %eax
testl %eax, %eax
jns 0x7bd65
movl %eax, %r14d
shrl $0x1f, %r14d
addl %eax, %r14d
sarl %r14d
addl %eax, %r14d
testl %r14d, %r14d
movl $0x0, %eax
cmovlel %eax, %r14d
imulq $0x38, %r14, %rdi
callq 0x424fb
movq -0x10(%r15,%r12), %rsi
testq %rsi, %rsi
je 0x7bd53
movslq -0x18(%r15,%r12), %rcx
imulq $0x38, %rcx, %rdx
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xc080
movq -0x10(%r15,%r12), %rdi
callq 0x425d4
movq -0x30(%rbp), %rax
movq %rax, -0x10(%r15,%r12)
movl %r14d, -0x14(%r15,%r12)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rdx
movl $0x0, -0x18(%r15,%r12)
movslq 0x8(%rbx), %rax
cmpq %rax, %r13
jge 0x7be2a
movq 0x10(%rbx), %r15
movl -0x4(%r15,%r12), %eax
testl %eax, %eax
jns 0x7bde8
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 0x424fb
movq (%r15,%r12), %rsi
testq %rsi, %rsi
je 0x7bdd7
movslq -0x8(%r15,%r12), %rdx
addq %rdx, %rdx
movq %rax, %rdi
movq %rax, -0x30(%rbp)
callq 0xc080
movq (%r15,%r12), %rdi
callq 0x425d4
movq -0x30(%rbp), %rax
movq %rax, (%r15,%r12)
movl %r14d, -0x4(%r15,%r12)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rdx
movl $0x0, -0x8(%r15,%r12)
jmp 0x7be0b
cmpq %rax, %r13
jge 0x7be2a
movq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, -0x8(%rax,%r12)
movups %xmm0, -0x18(%rax,%r12)
incq %r13
addq $0x20, %r12
cmpq %r13, %rdx
jne 0x7bcdd
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f847(%rip), %rdi     # 0xbb678
leaq 0x3f853(%rip), %rsi     # 0xbb68b
leaq 0x54d40(%rip), %rcx     # 0xd0b7f
movl $0x65c, %edx            # imm = 0x65C
callq 0xc140
leaq 0x53539(%rip), %rdi     # 0xcf389
leaq 0x5337f(%rip), %rsi     # 0xcf1d6
leaq 0x535ad(%rip), %rcx     # 0xcf40b
movl $0x5d5, %edx            # imm = 0x5D5
callq 0xc140