// File: Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableSetBgColor(int, unsigned int, int)
void ImGui::TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n)
{
    ImGuiContext& g = *GImGui;
    ImGuiTable* table = g.CurrentTable;
    IM_ASSERT(target != ImGuiTableBgTarget_None);

    if (color == IM_COL32_DISABLE)
        color = 0;

    // We cannot draw neither the cell or row background immediately as we don't know the row height at this point in time.
    switch (target)
    {
    case ImGuiTableBgTarget_CellBg:
    {
        if (table->RowPosY1 > table->InnerClipRect.Max.y) // Discard
            return;
        if (column_n == -1)
            column_n = table->CurrentColumn;
        if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0)
            return;
        if (table->RowCellDataCurrent < 0 || table->RowCellData[table->RowCellDataCurrent].Column != column_n)
            table->RowCellDataCurrent++;
        ImGuiTableCellData* cell_data = &table->RowCellData[table->RowCellDataCurrent];
        cell_data->BgColor = color;
        cell_data->Column = (ImGuiTableColumnIdx)column_n;
        break;
    }
    case ImGuiTableBgTarget_RowBg0:
    case ImGuiTableBgTarget_RowBg1:
    {
        if (table->RowPosY1 > table->InnerClipRect.Max.y) // Discard
            return;
        IM_ASSERT(column_n == -1);
        int bg_idx = (target == ImGuiTableBgTarget_RowBg1) ? 1 : 0;
        table->RowBgColor[bg_idx] = color;
        break;
    }
    default:
        IM_ASSERT(0);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
leaq 0xe1c18(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x20a8(%rax), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x131346
jmp 0x131365
leaq 0x5b740(%rip), %rdi     # 0x18ca8d
leaq 0x5ac4e(%rip), %rsi     # 0x18bfa2
movl $0x5ec, %edx            # imm = 0x5EC
leaq 0x5b74f(%rip), %rcx     # 0x18caaf
callq 0xd180
cmpl $0x1000000, -0x8(%rbp)  # imm = 0x1000000
jne 0x131375
movl $0x0, -0x8(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x30(%rbp)
decl %eax
subl $0x2, %eax
jb 0x13145f
jmp 0x131388
movl -0x30(%rbp), %eax
subl $0x3, %eax
jne 0x1314c5
jmp 0x131396
movq -0x20(%rbp), %rax
movss 0x7c(%rax), %xmm0
movq -0x20(%rbp), %rax
ucomiss 0x128(%rax), %xmm0
jbe 0x1313b1
jmp 0x1314e4
cmpl $-0x1, -0xc(%rbp)
jne 0x1313c1
movq -0x20(%rbp), %rax
movl 0x74(%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rax
movl -0xc(%rbp), %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
jne 0x1313e5
jmp 0x1314e4
movq -0x20(%rbp), %rax
movsbl 0x244(%rax), %eax
cmpl $0x0, %eax
jl 0x131416
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movsbl 0x244(%rax), %esi
callq 0x1374e0
movsbl 0x4(%rax), %eax
cmpl -0xc(%rbp), %eax
je 0x131429
movq -0x20(%rbp), %rax
movb 0x244(%rax), %cl
addb $0x1, %cl
movb %cl, 0x244(%rax)
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
movq -0x20(%rbp), %rax
movsbl 0x244(%rax), %esi
callq 0x1374e0
movq %rax, -0x28(%rbp)
movl -0x8(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0xc(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x4(%rax)
jmp 0x1314e4
movq -0x20(%rbp), %rax
movss 0x7c(%rax), %xmm0
movq -0x20(%rbp), %rax
ucomiss 0x128(%rax), %xmm0
jbe 0x131477
jmp 0x1314e4
cmpl $-0x1, -0xc(%rbp)
jne 0x13147f
jmp 0x13149e
leaq 0x5b665(%rip), %rdi     # 0x18caeb
leaq 0x5ab15(%rip), %rsi     # 0x18bfa2
movl $0x608, %edx            # imm = 0x608
leaq 0x5b616(%rip), %rcx     # 0x18caaf
callq 0xd180
movl -0x4(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2, %edx
cmovel %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x8(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, 0x98(%rax,%rcx,4)
jmp 0x1314e4
leaq 0x43c3e(%rip), %rdi     # 0x17510a
leaq 0x5aacf(%rip), %rsi     # 0x18bfa2
movl $0x60e, %edx            # imm = 0x60E
leaq 0x5b5d0(%rip), %rcx     # 0x18caaf
callq 0xd180
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)