// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x1
popq %r15
movl %r15d, %r12d
cmovel %ecx, %r12d
orl $0x2, %r14d
movb $0x1, %dl
cmpl %ecx, 0x6c(%rdi)
jg 0x7245d
movq 0x48(%rbx), %rcx
cmpq %rcx, 0x50(%rbx)
setne %dl
testb %al, %al
setg %cl
movzbl %dl, %r13d
movl %r12d, %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 0x6533a
decb %r14b
movzbl %r14b, %eax
testb %r13b, %r13b
movl $0xff, %ecx
cmovnel %eax, %ecx
movb %cl, 0x245(%rbx)
movb $0x1, 0x246(%rbx)
leal 0x2(%r12), %eax
cmpb $0x0, 0x241(%rbx)
movzbl %al, %eax
cmovlel %r15d, %eax
movb %al, 0x247(%rbx)
leaq 0x10(%rbx), %r14
incl %r12d
pushq $0x2
popq %r13
xorl %r15d, %r15d
cmpl 0x6c(%rbx), %r15d
jge 0x72531
movq %r14, %rdi
movl %r15d, %esi
callq 0x4c4c6
cmpb $0x1, 0x5c(%rax)
jne 0x7251d
cmpb $0x1, 0x5d(%rax)
jne 0x7251d
movb %r13b, 0x58(%rax)
cmpb $0x0, 0x241(%rbx)
movl $0x0, %ecx
cmovgl %r12d, %ecx
addl %r13d, %ecx
movb %cl, 0x59(%rax)
movb 0x6(%rbx), %cl
andb $0x10, %cl
cmpb $0x1, %cl
movl %r13d, %ecx
adcl $0x0, %r13d
jmp 0x72529
movb 0x245(%rbx), %cl
movb %cl, 0x59(%rax)
movb %cl, 0x58(%rax)
movb %cl, 0x57(%rax)
incl %r15d
jmp 0x724d4
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 0x72582
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x44778(%rip), %rdi     # 0xb6d01
leaq 0x43b76(%rip), %rsi     # 0xb6106
leaq 0x4479d(%rip), %rcx     # 0xb6d34
movl $0x887, %edx            # imm = 0x887
callq 0xc140