// File: Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableBeginApplyRequests(ImGuiTable*)
void ImGui::TableBeginApplyRequests(ImGuiTable* table)
{
    // Handle resizing request
    // (We process this at the first TableBegin of the frame)
    // FIXME-TABLE: Contains columns if our work area doesn't allow for scrolling?
    if (table->InstanceCurrent == 0)
    {
        if (table->ResizedColumn != -1 && table->ResizedColumnNextWidth != FLT_MAX)
            TableSetColumnWidth(table->ResizedColumn, table->ResizedColumnNextWidth);
        table->LastResizedColumn = table->ResizedColumn;
        table->ResizedColumnNextWidth = FLT_MAX;
        table->ResizedColumn = -1;

        // Process auto-fit for single column, which is a special case for stretch columns and fixed columns with FixedSame policy.
        // FIXME-TABLE: Would be nice to redistribute available stretch space accordingly to other weights, instead of giving it all to siblings.
        if (table->AutoFitSingleColumn != -1)
        {
            TableSetColumnWidth(table->AutoFitSingleColumn, table->Columns[table->AutoFitSingleColumn].WidthAuto);
            table->AutoFitSingleColumn = -1;
        }
    }

    // Handle reordering request
    // Note: we don't clear ReorderColumn after handling the request.
    if (table->InstanceCurrent == 0)
    {
        if (table->HeldHeaderColumn == -1 && table->ReorderColumn != -1)
            table->ReorderColumn = -1;
        table->HeldHeaderColumn = -1;
        if (table->ReorderColumn != -1 && table->ReorderColumnDir != 0)
        {
            // We need to handle reordering across hidden columns.
            // In the configuration below, moving C to the right of E will lead to:
            //    ... C [D] E  --->  ... [D] E  C   (Column name/index)
            //    ... 2  3  4        ...  2  3  4   (Display order)
            const int reorder_dir = table->ReorderColumnDir;
            IM_ASSERT(reorder_dir == -1 || reorder_dir == +1);
            IM_ASSERT(table->Flags & ImGuiTableFlags_Reorderable);
            ImGuiTableColumn* src_column = &table->Columns[table->ReorderColumn];
            ImGuiTableColumn* dst_column = &table->Columns[(reorder_dir == -1) ? src_column->PrevEnabledColumn : src_column->NextEnabledColumn];
            IM_UNUSED(dst_column);
            const int src_order = src_column->DisplayOrder;
            const int dst_order = dst_column->DisplayOrder;
            src_column->DisplayOrder = (ImGuiTableColumnIdx)dst_order;
            for (int order_n = src_order + reorder_dir; order_n != dst_order + reorder_dir; order_n += reorder_dir)
                table->Columns[table->DisplayOrderToIndex[order_n]].DisplayOrder -= (ImGuiTableColumnIdx)reorder_dir;
            IM_ASSERT(dst_column->DisplayOrder == dst_order - reorder_dir);

            // Display order is stored in both columns->IndexDisplayOrder and table->DisplayOrder[],
            // rebuild the later from the former.
            for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
                table->DisplayOrderToIndex[table->Columns[column_n].DisplayOrder] = (ImGuiTableColumnIdx)column_n;
            table->ReorderColumnDir = 0;
            table->IsSettingsDirty = true;
        }
    }

    // Handle display order reset request
    if (table->IsResetDisplayOrderRequest)
    {
        for (int n = 0; n < table->ColumnsCount; n++)
            table->DisplayOrderToIndex[n] = table->Columns[n].DisplayOrder = (ImGuiTableColumnIdx)n;
        table->IsResetDisplayOrderRequest = false;
        table->IsSettingsDirty = true;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movswl 0x78(%rax), %eax
cmpl $0x0, %eax
jne 0x12ac29
movq -0x8(%rbp), %rax
movsbl 0x237(%rax), %eax
cmpl $-0x1, %eax
je 0x12aba6
movq -0x8(%rbp), %rax
movss 0xe0(%rax), %xmm0
movss 0x47433(%rip), %xmm1    # 0x171fb4
ucomiss %xmm1, %xmm0
jne 0x12ab8a
jp 0x12ab8a
jmp 0x12aba6
movq -0x8(%rbp), %rax
movsbl 0x237(%rax), %edi
movq -0x8(%rbp), %rax
movss 0xe0(%rax), %xmm0
callq 0x12af10
movq -0x8(%rbp), %rax
movb 0x237(%rax), %cl
movq -0x8(%rbp), %rax
movb %cl, 0x238(%rax)
movq -0x8(%rbp), %rax
movss 0x473ee(%rip), %xmm0    # 0x171fb4
movss %xmm0, 0xe0(%rax)
movq -0x8(%rbp), %rax
movb $-0x1, 0x237(%rax)
movq -0x8(%rbp), %rax
movsbl 0x236(%rax), %eax
cmpl $-0x1, %eax
je 0x12ac27
movq -0x8(%rbp), %rax
movsbl 0x236(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rax
movsbl 0x236(%rax), %esi
callq 0xeea20
movl -0x38(%rbp), %edi
movss 0x14(%rax), %xmm0
callq 0x12af10
movq -0x8(%rbp), %rax
movb $-0x1, 0x236(%rax)
jmp 0x12ac29
movq -0x8(%rbp), %rax
movswl 0x78(%rax), %eax
cmpl $0x0, %eax
jne 0x12ae89
movq -0x8(%rbp), %rax
movsbl 0x239(%rax), %eax
cmpl $-0x1, %eax
jne 0x12ac65
movq -0x8(%rbp), %rax
movsbl 0x23a(%rax), %eax
cmpl $-0x1, %eax
je 0x12ac65
movq -0x8(%rbp), %rax
movb $-0x1, 0x23a(%rax)
movq -0x8(%rbp), %rax
movb $-0x1, 0x239(%rax)
movq -0x8(%rbp), %rax
movsbl 0x23a(%rax), %eax
cmpl $-0x1, %eax
je 0x12ae87
movq -0x8(%rbp), %rax
movsbl 0x23b(%rax), %eax
cmpl $0x0, %eax
je 0x12ae87
movq -0x8(%rbp), %rax
movsbl 0x23b(%rax), %eax
movl %eax, -0xc(%rbp)
movb $0x1, %al
cmpl $-0x1, -0xc(%rbp)
movb %al, -0x39(%rbp)
je 0x12acbb
cmpl $0x1, -0xc(%rbp)
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x12acc4
jmp 0x12acc6
jmp 0x12ace5
leaq 0x614b4(%rip), %rdi     # 0x18c181
leaq 0x612ce(%rip), %rsi     # 0x18bfa2
movl $0x24d, %edx            # imm = 0x24D
leaq 0x614c8(%rip), %rcx     # 0x18c1a8
callq 0xd180
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x12acf6
jmp 0x12ad15
leaq 0x614dd(%rip), %rdi     # 0x18c1da
leaq 0x6129e(%rip), %rsi     # 0x18bfa2
movl $0x24e, %edx            # imm = 0x24E
leaq 0x61498(%rip), %rcx     # 0x18c1a8
callq 0xd180
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rax
movsbl 0x23a(%rax), %esi
callq 0xeea20
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x48(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x12ad4f
movq -0x18(%rbp), %rax
movb 0x54(%rax), %al
movb %al, -0x49(%rbp)
jmp 0x12ad59
movq -0x18(%rbp), %rax
movb 0x55(%rax), %al
movb %al, -0x49(%rbp)
movq -0x48(%rbp), %rdi
movb -0x49(%rbp), %al
movsbl %al, %esi
callq 0xeea20
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movsbl 0x52(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movsbl 0x52(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x52(%rax)
movl -0x24(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x28(%rbp), %ecx
addl -0xc(%rbp), %ecx
cmpl %ecx, %eax
je 0x12adec
movl -0xc(%rbp), %eax
movsbl %al, %eax
movl %eax, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movl -0x2c(%rbp), %esi
callq 0x1370a0
movq -0x58(%rbp), %rdi
movsbl (%rax), %esi
callq 0xeea20
movl -0x50(%rbp), %edx
movsbl 0x52(%rax), %ecx
subl %edx, %ecx
movb %cl, 0x52(%rax)
movl -0xc(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x12ad97
movq -0x20(%rbp), %rax
movsbl 0x52(%rax), %eax
movl -0x28(%rbp), %ecx
subl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jne 0x12ae00
jmp 0x12ae1f
leaq 0x613fe(%rip), %rdi     # 0x18c205
leaq 0x61194(%rip), %rsi     # 0x18bfa2
movl $0x257, %edx            # imm = 0x257
leaq 0x6138e(%rip), %rcx     # 0x18c1a8
callq 0xd180
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x12ae71
movl -0x30(%rbp), %eax
movb %al, -0x59(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
movl -0x30(%rbp), %esi
callq 0xeea20
movq -0x68(%rbp), %rdi
movsbl 0x52(%rax), %esi
callq 0x1370a0
movb -0x59(%rbp), %cl
movb %cl, (%rax)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x12ae26
movq -0x8(%rbp), %rax
movb $0x0, 0x23b(%rax)
movq -0x8(%rbp), %rax
movb $0x1, 0x24f(%rax)
jmp 0x12ae89
movq -0x8(%rbp), %rax
testb $0x1, 0x252(%rax)
je 0x12aefb
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x12aee5
movl -0x34(%rbp), %eax
movb %al, -0x69(%rbp)
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
movl -0x34(%rbp), %esi
callq 0xeea20
movb -0x69(%rbp), %cl
movb %cl, 0x52(%rax)
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movl -0x34(%rbp), %esi
callq 0x1370a0
movb -0x69(%rbp), %cl
movb %cl, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x12ae9d
movq -0x8(%rbp), %rax
movb $0x0, 0x252(%rax)
movq -0x8(%rbp), %rax
movb $0x1, 0x24f(%rax)
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)