// File: 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
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x38(%rbp)
xorl %eax, %eax
cmpl $0x0, (%rcx)
movb %al, -0x2d(%rbp)
jne 0x114ccb
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpl $0x1, 0x4(%rcx)
movb %al, -0x2d(%rbp)
jg 0x114ccb
movb $0x1, %al
movb %al, -0x2d(%rbp)
jmp 0x114ccb
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x114cd4
jmp 0x114cd6
jmp 0x114cf5
leaq 0x756ac(%rip), %rdi     # 0x18a389
leaq 0x75492(%rip), %rsi     # 0x18a176
movl $0x5d5, %edx            # imm = 0x5D5
leaq 0x7571b(%rip), %rcx     # 0x18a40b
callq 0xd180
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x114d27
movq -0x38(%rbp), %rdi
addq $0x8, %rdi
movl -0x14(%rbp), %esi
callq 0x1274b0
movq -0x38(%rbp), %rdi
addq $0x8, %rdi
movl -0x14(%rbp), %esi
callq 0x127530
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, 0x4(%rdi)
addq $0x8, %rdi
xorl %esi, %esi
callq 0x127430
movq %rax, %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0xd2f0
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x114e0a
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x114dc2
movq -0x38(%rbp), %rdi
addq $0x8, %rdi
movl -0x1c(%rbp), %esi
callq 0x127430
movq %rax, %rsi
movq %rsi, %rax
movq %rax, -0x48(%rbp)
movl $0x20, %edi
callq 0xe9510
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
callq 0x127580
jmp 0x114da5
jmp 0x114dfa
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0xea550
jmp 0x114e10
movq -0x38(%rbp), %rdi
addq $0x8, %rdi
movl -0x1c(%rbp), %esi
callq 0x127430
movq %rax, %rdi
xorl %esi, %esi
callq 0x126c60
movq -0x38(%rbp), %rdi
addq $0x8, %rdi
movl -0x1c(%rbp), %esi
callq 0x127430
movq %rax, %rdi
addq $0x10, %rdi
xorl %esi, %esi
callq 0xe7f00
jmp 0x114dfc
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x114d52
addq $0x50, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0xd620
nopl (%rax)