// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableSetupDrawChannels(ImGuiTable*)
void ImGui::TableSetupDrawChannels(ImGuiTable* table)
{
    const int freeze_row_multiplier = (table->FreezeRowsCount > 0) ? 2 : 1;
    const int channels_for_row = (table->Flags & ImGuiTableFlags_NoClip) ? 1 : table->ColumnsEnabledCount;
    const int channels_for_bg = 1 + 1 * freeze_row_multiplier;
    const int channels_for_dummy = (table->ColumnsEnabledCount < table->ColumnsCount || table->VisibleMaskByIndex != table->EnabledMaskByIndex) ? +1 : 0;
    const int channels_total = channels_for_bg + (channels_for_row * freeze_row_multiplier) + channels_for_dummy;
    table->DrawSplitter.Split(table->InnerWindow->DrawList, channels_total);
    table->DummyDrawChannel = (ImGuiTableDrawChannelIdx)((channels_for_dummy > 0) ? channels_total - 1 : -1);
    table->Bg2DrawChannelCurrent = TABLE_DRAW_CHANNEL_BG2_FROZEN;
    table->Bg2DrawChannelUnfrozen = (ImGuiTableDrawChannelIdx)((table->FreezeRowsCount > 0) ? 2 + channels_for_row : TABLE_DRAW_CHANNEL_BG2_FROZEN);

    int draw_channel_current = 2;
    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
    {
        ImGuiTableColumn* column = &table->Columns[column_n];
        if (column->IsVisibleX && column->IsVisibleY)
        {
            column->DrawChannelFrozen = (ImGuiTableDrawChannelIdx)(draw_channel_current);
            column->DrawChannelUnfrozen = (ImGuiTableDrawChannelIdx)(draw_channel_current + (table->FreezeRowsCount > 0 ? channels_for_row + 1 : 0));
            if (!(table->Flags & ImGuiTableFlags_NoClip))
                draw_channel_current++;
        }
        else
        {
            column->DrawChannelFrozen = column->DrawChannelUnfrozen = table->DummyDrawChannel;
        }
        column->DrawChannelCurrent = column->DrawChannelFrozen;
    }

    // Initial draw cmd starts with a BgClipRect that matches the one of its host, to facilitate merge draw commands by default.
    // All our cell highlight are manually clipped with BgClipRect. When unfreezing it will be made smaller to fit scrolling rect.
    // (This technically isn't part of setting up draw channels, but is reasonably related to be done here)
    table->BgClipRect = table->InnerClipRect;
    table->Bg0ClipRectForDrawCmd = table->OuterWindow->ClipRect;
    table->Bg2ClipRectForDrawCmd = table->HostClipRect;
    IM_ASSERT(table->BgClipRect.Min.y <= table->BgClipRect.Max.y);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x241(%rdi), %al
xorl %r14d, %r14d
testb %al, %al
setg %r14b
testb $0x10, 0x6(%rdi)
movsbl 0x231(%rdi), %ecx
movl $0x1, %r12d
movl $0x1, %r15d
cmovel %ecx, %r15d
orl $0x2, %r14d
movb $0x1, %dl
cmpl %ecx, 0x6c(%rdi)
jg 0x8891c
movq 0x48(%rbx), %rcx
cmpq %rcx, 0x50(%rbx)
setne %dl
testb %al, %al
setg %cl
movzbl %dl, %r13d
movl %r15d, %eax
shll %cl, %eax
addl %r13d, %r14d
addl %eax, %r14d
leaq 0x1e8(%rbx), %rdi
movq 0x1d0(%rbx), %rax
movq 0x2b8(%rax), %rsi
movl %r14d, %edx
callq 0x7a356
decb %r14b
movzbl %r14b, %ecx
testb %r13b, %r13b
movl $0xff, %eax
cmovnel %ecx, %eax
movb %al, 0x245(%rbx)
movb $0x1, 0x246(%rbx)
movb 0x241(%rbx), %dil
leal 0x2(%r15), %ecx
testb %dil, %dil
movzbl %cl, %ecx
cmovlel %r12d, %ecx
movb %cl, 0x247(%rbx)
movslq 0x6c(%rbx), %rcx
testq %rcx, %rcx
jle 0x889f1
movq 0x10(%rbx), %rdx
incl %r15d
xorl %esi, %esi
testb %dil, %dil
cmovgl %r15d, %esi
movl $0x2, %edi
cmpq 0x18(%rbx), %rdx
jae 0x88a42
cmpb $0x1, 0x5c(%rdx)
jne 0x889db
cmpb $0x1, 0x5d(%rdx)
jne 0x889db
movb %dil, 0x58(%rdx)
leal (%rdi,%rsi), %r8d
movb %r8b, 0x59(%rdx)
movb 0x6(%rbx), %r8b
andb $0x10, %r8b
cmpb $0x1, %r8b
movl %edi, %r8d
adcl $0x0, %edi
jmp 0x889e4
movb %al, 0x59(%rdx)
movb %al, 0x58(%rdx)
movl %eax, %r8d
movb %r8b, 0x57(%rdx)
addq $0x68, %rdx
decq %rcx
jne 0x889a5
movups 0x11c(%rbx), %xmm0
movups 0x15c(%rbx), %xmm1
movups %xmm0, 0x12c(%rbx)
movq 0x1c8(%rbx), %rax
movups 0x258(%rax), %xmm0
movups %xmm0, 0x13c(%rbx)
movups %xmm1, 0x14c(%rbx)
movss 0x138(%rbx), %xmm0
ucomiss 0x130(%rbx), %xmm0
jb 0x88a61
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31c6f(%rip), %rdi     # 0xba6b8
leaq 0x30bef(%rip), %rsi     # 0xb963f
leaq 0x31c7a(%rip), %rcx     # 0xba6d1
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140
leaq 0x4701d(%rip), %rdi     # 0xcfa85
leaq 0x4641b(%rip), %rsi     # 0xcee8a
leaq 0x47042(%rip), %rcx     # 0xcfab8
movl $0x887, %edx            # imm = 0x887
callq 0xc140