// File: Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: TableSetupColumnFlags(ImGuiTable*, ImGuiTableColumn*, int)
static void TableSetupColumnFlags(ImGuiTable* table, ImGuiTableColumn* column, ImGuiTableColumnFlags flags_in)
{
    ImGuiTableColumnFlags flags = flags_in;

    // Sizing Policy
    if ((flags & ImGuiTableColumnFlags_WidthMask_) == 0)
    {
        const ImGuiTableFlags table_sizing_policy = (table->Flags & ImGuiTableFlags_SizingMask_);
        if (table_sizing_policy == ImGuiTableFlags_SizingFixedFit || table_sizing_policy == ImGuiTableFlags_SizingFixedSame)
            flags |= ImGuiTableColumnFlags_WidthFixed;
        else
            flags |= ImGuiTableColumnFlags_WidthStretch;
    }
    else
    {
        IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiTableColumnFlags_WidthMask_)); // Check that only 1 of each set is used.
    }
    
    // Resize
    if ((table->Flags & ImGuiTableFlags_Resizable) == 0)
        flags |= ImGuiTableColumnFlags_NoResize;

    // Sorting
    if ((flags & ImGuiTableColumnFlags_NoSortAscending) && (flags & ImGuiTableColumnFlags_NoSortDescending))
        flags |= ImGuiTableColumnFlags_NoSort;

    // Indentation
    if ((flags & ImGuiTableColumnFlags_IndentMask_) == 0)
        flags |= (table->Columns.index_from_ptr(column) == 0) ? ImGuiTableColumnFlags_IndentEnable : ImGuiTableColumnFlags_IndentDisable;

    // Alignment
    //if ((flags & ImGuiTableColumnFlags_AlignMask_) == 0)
    //    flags |= ImGuiTableColumnFlags_AlignCenter;
    //IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiTableColumnFlags_AlignMask_)); // Check that only 1 of each set is used.

    // Preserve status flags
    column->Flags = flags | (column->Flags & ImGuiTableColumnFlags_StatusMask_);

    // Build an ordered list of available sort directions
    column->SortDirectionsAvailCount = column->SortDirectionsAvailMask = column->SortDirectionsAvailList = 0;
    if (table->Flags & ImGuiTableFlags_Sortable)
    {
        int count = 0, mask = 0, list = 0;
        if ((flags & ImGuiTableColumnFlags_PreferSortAscending)  != 0 && (flags & ImGuiTableColumnFlags_NoSortAscending)  == 0) { mask |= 1 << ImGuiSortDirection_Ascending;  list |= ImGuiSortDirection_Ascending  << (count << 1); count++; }
        if ((flags & ImGuiTableColumnFlags_PreferSortDescending) != 0 && (flags & ImGuiTableColumnFlags_NoSortDescending) == 0) { mask |= 1 << ImGuiSortDirection_Descending; list |= ImGuiSortDirection_Descending << (count << 1); count++; }
        if ((flags & ImGuiTableColumnFlags_PreferSortAscending)  == 0 && (flags & ImGuiTableColumnFlags_NoSortAscending)  == 0) { mask |= 1 << ImGuiSortDirection_Ascending;  list |= ImGuiSortDirection_Ascending  << (count << 1); count++; }
        if ((flags & ImGuiTableColumnFlags_PreferSortDescending) == 0 && (flags & ImGuiTableColumnFlags_NoSortDescending) == 0) { mask |= 1 << ImGuiSortDirection_Descending; list |= ImGuiSortDirection_Descending << (count << 1); count++; }
        if ((table->Flags & ImGuiTableFlags_SortTristate) || count == 0) { mask |= 1 << ImGuiSortDirection_None; count++; }
        column->SortDirectionsAvailList = (ImU8)list;
        column->SortDirectionsAvailMask = (ImU8)mask;
        column->SortDirectionsAvailCount = (ImU8)count;
        ImGui::TableFixColumnSortDirection(table, column);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
andl $0xc, %eax
cmpl $0x0, %eax
jne 0x12ca4b
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0xe000, %eax           # imm = 0xE000
movl %eax, -0x1c(%rbp)
cmpl $0x2000, -0x1c(%rbp)    # imm = 0x2000
je 0x12ca35
cmpl $0x4000, -0x1c(%rbp)    # imm = 0x4000
jne 0x12ca40
movl -0x18(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x18(%rbp)
jmp 0x12ca49
movl -0x18(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x18(%rbp)
jmp 0x12ca7f
movl -0x18(%rbp), %edi
andl $0xc, %edi
callq 0x136cb0
testb $0x1, %al
jne 0x12ca5c
jmp 0x12ca5e
jmp 0x12ca7d
leaq 0x61026(%rip), %rdi     # 0x18da8b
leaq 0x5f536(%rip), %rsi     # 0x18bfa2
movl $0x27c, %edx            # imm = 0x27C
leaq 0x6104c(%rip), %rcx     # 0x18dac4
callq 0xd180
jmp 0x12ca7f
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x12ca97
movl -0x18(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x12cabc
movl -0x18(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x12cabc
movl -0x18(%rbp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
andl $0xc000, %eax           # imm = 0xC000
cmpl $0x0, %eax
jne 0x12caf2
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
callq 0x137ce0
movl %eax, %edx
movl $0x8000, %eax           # imm = 0x8000
movl $0x4000, %ecx           # imm = 0x4000
cmpl $0x0, %edx
cmovel %ecx, %eax
orl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xf00000, %eax         # imm = 0xF00000
orl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x65(%rax)
movq -0x10(%rbp), %rax
movb 0x64(%rax), %cl
andb $0xf, %cl
orb $0x0, %cl
movb %cl, 0x64(%rax)
movq -0x10(%rbp), %rax
movb 0x64(%rax), %cl
andb $-0xd, %cl
orb $0x0, %cl
movb %cl, 0x64(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x12ccc6
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x18(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x12cb96
movl -0x18(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0x12cb96
movl -0x24(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %ecx
shll %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x12cbd4
movl -0x18(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x12cbd4
movl -0x24(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %ecx
shll %ecx
movl $0x2, %eax
shll %cl, %eax
orl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
jne 0x12cc12
movl -0x18(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0x12cc12
movl -0x24(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %ecx
shll %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x12cc50
movl -0x18(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x12cc50
movl -0x24(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %ecx
shll %ecx
movl $0x2, %eax
shll %cl, %eax
orl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x8000000, %eax        # imm = 0x8000000
cmpl $0x0, %eax
jne 0x12cc67
cmpl $0x0, -0x20(%rbp)
jne 0x12cc79
movl -0x24(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x28(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x65(%rax)
movl -0x24(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movb 0x64(%rax), %cl
andb $0xf, %dl
shlb $0x4, %dl
andb $0xf, %cl
orb %dl, %cl
movb %cl, 0x64(%rax)
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movb 0x64(%rax), %cl
andb $0x3, %dl
shlb $0x2, %dl
andb $-0xd, %cl
orb %dl, %cl
movb %cl, 0x64(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1322a0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)