// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableLoadSettings(ImGuiTable*)
void ImGui::TableLoadSettings(ImGuiTable* table)
{
    ImGuiContext& g = *GImGui;
    table->IsSettingsRequestLoad = false;
    if (table->Flags & ImGuiTableFlags_NoSavedSettings)
        return;

    // Bind settings
    ImGuiTableSettings* settings;
    if (table->SettingsOffset == -1)
    {
        settings = TableSettingsFindByID(table->ID);
        if (settings == NULL)
            return;
        if (settings->ColumnsCount != table->ColumnsCount) // Allow settings if columns count changed. We could otherwise decide to return...
            table->IsSettingsDirty = true;
        table->SettingsOffset = g.SettingsTables.offset_from_ptr(settings);
    }
    else
    {
        settings = TableGetBoundSettings(table);
    }

    table->SettingsLoadedFlags = settings->SaveFlags;
    table->RefScale = settings->RefScale;

    // Serialize ImGuiTableSettings/ImGuiTableColumnSettings into ImGuiTable/ImGuiTableColumn
    ImGuiTableColumnSettings* column_settings = settings->GetColumnSettings();
    ImU64 display_order_mask = 0;
    for (int data_n = 0; data_n < settings->ColumnsCount; data_n++, column_settings++)
    {
        int column_n = column_settings->Index;
        if (column_n < 0 || column_n >= table->ColumnsCount)
            continue;

        ImGuiTableColumn* column = &table->Columns[column_n];
        if (settings->SaveFlags & ImGuiTableFlags_Resizable)
        {
            if (column_settings->IsStretch)
                column->StretchWeight = column_settings->WidthOrWeight;
            else
                column->WidthRequest = column_settings->WidthOrWeight;
            column->AutoFitQueue = 0x00;
        }
        if (settings->SaveFlags & ImGuiTableFlags_Reorderable)
            column->DisplayOrder = column_settings->DisplayOrder;
        else
            column->DisplayOrder = (ImGuiTableColumnIdx)column_n;
        display_order_mask |= (ImU64)1 << column->DisplayOrder;
        column->IsEnabled = column->IsEnabledNextFrame = column_settings->IsEnabled;
        column->SortOrder = column_settings->SortOrder;
        column->SortDirection = column_settings->SortDirection;
    }

    // Validate and fix invalid display order data
    const ImU64 expected_display_order_mask = (settings->ColumnsCount == 64) ? ~0 : ((ImU64)1 << settings->ColumnsCount) - 1;
    if (display_order_mask != expected_display_order_mask)
        for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
            table->Columns[column_n].DisplayOrder = (ImGuiTableColumnIdx)column_n;

    // Rebuild index
    for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
        table->DisplayOrderToIndex[table->Columns[column_n].DisplayOrder] = (ImGuiTableColumnIdx)column_n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x750e3(%rip), %rax     # 0xfdcd0
movq (%rax), %r15
movb $0x0, 0x24e(%rdi)
testb $0x10, 0x4(%rdi)
jne 0x88d9f
movq %rdi, %rbx
cmpl $-0x1, 0x64(%rdi)
je 0x88c17
movq %rbx, %rdi
callq 0x8ee91
movq %rax, %r14
jmp 0x88c4f
movl (%rbx), %edi
callq 0x8ee4a
testq %rax, %rax
je 0x88d9f
movq %rax, %r14
movsbl 0xc(%rax), %eax
cmpl %eax, 0x6c(%rbx)
je 0x88c3a
movb $0x1, 0x24f(%rbx)
addq $0x3118, %r15           # imm = 0x3118
movq %r15, %rdi
movq %r14, %rsi
callq 0x91952
movl %eax, 0x64(%rbx)
movl 0x4(%r14), %eax
movl %eax, 0x60(%rbx)
movss 0x8(%r14), %xmm0
movss %xmm0, 0xe8(%rbx)
movsbl 0xc(%r14), %ecx
xorl %eax, %eax
testl %ecx, %ecx
jle 0x88d1b
leaq 0x1b(%r14), %rsi
xorl %edx, %edx
movsbl -0x3(%rsi), %edi
testl %edi, %edi
js 0x88d00
cmpl %edi, 0x6c(%rbx)
jle 0x88d00
movslq %edi, %rcx
imulq $0x68, %rcx, %rcx
addq 0x10(%rbx), %rcx
cmpq 0x18(%rbx), %rcx
jae 0x88daa
movl 0x4(%r14), %r8d
testb $0x1, %r8b
je 0x88cbd
movzbl (%rsi), %r9d
movss -0xb(%rsi), %xmm0
andl $0x8, %r9d
movss %xmm0, 0x10(%rcx,%r9)
movb $0x0, 0x62(%rcx)
testb $0x2, %r8b
je 0x88cc7
movb -0x2(%rsi), %dil
movb %dil, 0x52(%rcx)
btsq %rdi, %rdx
movb (%rsi), %dil
shrb $0x2, %dil
andb $0x1, %dil
movb %dil, 0x5b(%rcx)
movb %dil, 0x5a(%rcx)
movb -0x1(%rsi), %dil
movb %dil, 0x56(%rcx)
movb (%rsi), %dil
andb $0x3, %dil
movb 0x64(%rcx), %r8b
andb $-0x4, %r8b
orb %dil, %r8b
movb %r8b, 0x64(%rcx)
incl %eax
movsbl 0xc(%r14), %ecx
addq $0xc, %rsi
cmpl %ecx, %eax
jl 0x88c79
cmpb $0x40, %cl
sete %al
jmp 0x88d1d
xorl %edx, %edx
movq $-0x1, %rsi
movq $-0x1, %rdi
shlq %cl, %rdi
notq %rdi
testb %al, %al
cmovneq %rsi, %rdi
cmpq %rdi, %rdx
je 0x88d60
movslq 0x6c(%rbx), %rax
testq %rax, %rax
jle 0x88d60
movq 0x10(%rbx), %rcx
xorl %edx, %edx
cmpq 0x18(%rbx), %rcx
jae 0x88daa
movb %dl, 0x52(%rcx)
incq %rdx
addq $0x68, %rcx
cmpq %rdx, %rax
jne 0x88d4b
cmpl $0x0, 0x6c(%rbx)
jle 0x88d9f
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x10(%rbx), %rdx
leaq (%rdx,%rax), %rsi
cmpq 0x18(%rbx), %rsi
jae 0x88daa
movsbq 0x52(%rdx,%rax), %rdx
testq %rdx, %rdx
js 0x88dc1
addq 0x20(%rbx), %rdx
cmpq 0x28(%rbx), %rdx
jae 0x88dc1
movb %cl, (%rdx)
incq %rcx
movslq 0x6c(%rbx), %rdx
addq $0x68, %rax
cmpq %rdx, %rcx
jl 0x88d6a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x33907(%rip), %rdi     # 0xbc6b8
leaq 0x32887(%rip), %rsi     # 0xbb63f
leaq 0x33912(%rip), %rcx     # 0xbc6d1
jmp 0x88dd6
leaq 0x338f0(%rip), %rdi     # 0xbc6b8
leaq 0x32870(%rip), %rsi     # 0xbb63f
leaq 0x49c93(%rip), %rcx     # 0xd2a69
movl $0x20e, %edx            # imm = 0x20E
callq 0xc140