// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
movq %rdi, %rbx
movb 0x241(%rdi), %al
movl $0x1, %r15d
testb $0x10, 0x6(%rdi)
jne 0x8a53e
movsbl 0x231(%rbx), %r15d
xorl %r14d, %r14d
testb %al, %al
setg %r14b
orl $0x2, %r14d
movsbl 0x231(%rbx), %ecx
movb $0x1, %dl
cmpl %ecx, 0x6c(%rbx)
jg 0x8a564
movq 0x50(%rbx), %rcx
cmpq 0x48(%rbx), %rcx
setne %dl
testb %al, %al
setg %cl
movzbl %dl, %r12d
movl %r15d, %eax
shll %cl, %eax
addl %r12d, %r14d
addl %eax, %r14d
leaq 0x1e8(%rbx), %rdi
movq 0x1d0(%rbx), %rax
movq 0x2b8(%rax), %rsi
movl %r14d, %edx
callq 0x7bbb6
decb %r14b
movzbl %r14b, %ecx
testb %r12b, %r12b
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
movl $0x1, %edx
cmovgl %ecx, %edx
movb %dl, 0x247(%rbx)
movslq 0x6c(%rbx), %rcx
testq %rcx, %rcx
jle 0x8a63b
movq 0x10(%rbx), %rdx
incl %r15d
xorl %esi, %esi
testb %dil, %dil
cmovgl %r15d, %esi
movl $0x2, %edi
cmpq 0x18(%rbx), %rdx
jae 0x8a686
cmpb $0x1, 0x5c(%rdx)
jne 0x8a624
cmpb $0x1, 0x5d(%rdx)
jne 0x8a624
movb %dil, 0x58(%rdx)
leal (%rdi,%rsi), %r8d
movb %r8b, 0x59(%rdx)
movb 0x6(%rbx), %r8b
andb $0x10, %r8b
cmpb $0x1, %r8b
adcl $0x0, %edi
jmp 0x8a62a
movb %al, 0x59(%rdx)
movb %al, 0x58(%rdx)
movb 0x58(%rdx), %r8b
movb %r8b, 0x57(%rdx)
addq $0x68, %rdx
decq %rcx
jne 0x8a5f1
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 0x8a6a5
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3202b(%rip), %rdi     # 0xbc6b8
leaq 0x30fab(%rip), %rsi     # 0xbb63f
leaq 0x32036(%rip), %rcx     # 0xbc6d1
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140
leaq 0x47409(%rip), %rdi     # 0xd1ab5
leaq 0x46807(%rip), %rsi     # 0xd0eba
leaq 0x4742e(%rip), %rcx     # 0xd1ae8
movl $0x887, %edx            # imm = 0x887
callq 0xc140