// File: /workspace/github_cpp_makefile_star2_O3/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 0x7a53b
movq %rdi, %rbx
cmpl $0x2, 0x4(%rdi)
jge 0x7a53b
movl %edx, %r14d
movl 0x8(%rbx), %r12d
movl %r12d, %eax
cmpl %edx, %r12d
jge 0x7a3d2
cmpl %r14d, 0xc(%rbx)
jge 0x7a3cb
movslq %r14d, %rdi
shlq $0x5, %rdi
callq 0x41c63
movq %rax, %r15
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x7a3c3
movslq 0x8(%rbx), %rdx
shlq $0x5, %rdx
movq %r15, %rdi
callq 0xc080
movq 0x10(%rbx), %rdi
callq 0x41d3c
movq %r15, 0x10(%rbx)
movl %r14d, 0xc(%rbx)
movl %r14d, 0x8(%rbx)
movl %r14d, %eax
movl %r14d, 0x4(%rbx)
testl %eax, %eax
jle 0x7a51c
movq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
cmpl $0x2, %r14d
jl 0x7a50d
movslq %r12d, %rcx
movl %r14d, %edx
movl $0x1, %r13d
movl $0x38, %r15d
movq %rcx, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
movslq 0x8(%rbx), %rax
cmpq %rcx, %r13
jge 0x7a4e5
cmpq %rax, %r13
jge 0x7a51c
movq 0x10(%rbx), %r12
cmpl $0x0, -0x14(%r12,%r15)
jns 0x7a477
xorl %edi, %edi
callq 0x41c63
movq %rax, %r14
movq -0x10(%r12,%r15), %rsi
testq %rsi, %rsi
je 0x7a461
movslq -0x18(%r12,%r15), %rax
imulq $0x38, %rax, %rdx
movq %r14, %rdi
callq 0xc080
movq -0x10(%r12,%r15), %rdi
callq 0x41d3c
movq %r14, -0x10(%r12,%r15)
movl $0x0, -0x14(%r12,%r15)
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
movl $0x0, -0x18(%r12,%r15)
movslq 0x8(%rbx), %rax
cmpq %rax, %r13
jge 0x7a51c
movq 0x10(%rbx), %r12
cmpl $0x0, -0x4(%r12,%r15)
jns 0x7a4da
xorl %edi, %edi
callq 0x41c63
movq %rax, %r14
movq (%r12,%r15), %rsi
testq %rsi, %rsi
je 0x7a4c5
movslq -0x8(%r12,%r15), %rdx
addq %rdx, %rdx
movq %r14, %rdi
callq 0xc080
movq (%r12,%r15), %rdi
callq 0x41d3c
movq %r14, (%r12,%r15)
movl $0x0, -0x4(%r12,%r15)
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
movl $0x0, -0x8(%r12,%r15)
jmp 0x7a4fd
cmpq %rax, %r13
jge 0x7a51c
movq 0x10(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, -0x8(%rax,%r15)
movups %xmm0, -0x18(%rax,%r15)
incq %r13
addq $0x20, %r15
cmpq %r13, %rdx
jne 0x7a410
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f155(%rip), %rdi     # 0xb9678
leaq 0x3f161(%rip), %rsi     # 0xb968b
leaq 0x545ea(%rip), %rcx     # 0xceb1b
movl $0x65c, %edx            # imm = 0x65C
callq 0xc140
leaq 0x52e17(%rip), %rdi     # 0xcd359
leaq 0x52c5d(%rip), %rsi     # 0xcd1a6
leaq 0x52e8b(%rip), %rcx     # 0xcd3db
movl $0x5d5, %edx            # imm = 0x5D5
callq 0xc140