// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: ImGui::TableSaveSettings(ImGuiTable*)
void ImGui::TableSaveSettings(ImGuiTable* table)
{
    table->IsSettingsDirty = false;
    if (table->Flags & ImGuiTableFlags_NoSavedSettings)
        return;

    // Bind or create settings data
    ImGuiContext& g = *GImGui;
    ImGuiTableSettings* settings = TableGetBoundSettings(table);
    if (settings == NULL)
    {
        settings = TableSettingsCreate(table->ID, table->ColumnsCount);
        table->SettingsOffset = g.SettingsTables.offset_from_ptr(settings);
    }
    settings->ColumnsCount = (ImGuiTableColumnIdx)table->ColumnsCount;

    // Serialize ImGuiTable/ImGuiTableColumn into ImGuiTableSettings/ImGuiTableColumnSettings
    IM_ASSERT(settings->ID == table->ID);
    IM_ASSERT(settings->ColumnsCount == table->ColumnsCount && settings->ColumnsCountMax >= settings->ColumnsCount);
    ImGuiTableColumn* column = table->Columns.Data;
    ImGuiTableColumnSettings* column_settings = settings->GetColumnSettings();

    bool save_ref_scale = false;
    settings->SaveFlags = ImGuiTableFlags_None;
    for (int n = 0; n < table->ColumnsCount; n++, column++, column_settings++)
    {
        const float width_or_weight = (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? column->StretchWeight : column->WidthRequest;
        column_settings->WidthOrWeight = width_or_weight;
        column_settings->Index = (ImGuiTableColumnIdx)n;
        column_settings->DisplayOrder = column->DisplayOrder;
        column_settings->SortOrder = column->SortOrder;
        column_settings->SortDirection = column->SortDirection;
        column_settings->IsEnabled = column->IsEnabled;
        column_settings->IsStretch = (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? 1 : 0;
        if ((column->Flags & ImGuiTableColumnFlags_WidthStretch) == 0)
            save_ref_scale = true;

        // We skip saving some data in the .ini file when they are unnecessary to restore our state.
        // Note that fixed width where initial width was derived from auto-fit will always be saved as InitStretchWeightOrWidth will be 0.0f.
        // FIXME-TABLE: We don't have logic to easily compare SortOrder to DefaultSortOrder yet so it's always saved when present.
        if (width_or_weight != column->InitStretchWeightOrWidth)
            settings->SaveFlags |= ImGuiTableFlags_Resizable;
        if (column->DisplayOrder != n)
            settings->SaveFlags |= ImGuiTableFlags_Reorderable;
        if (column->SortOrder != -1)
            settings->SaveFlags |= ImGuiTableFlags_Sortable;
        if (column->IsEnabled != ((column->Flags & ImGuiTableColumnFlags_DefaultHide) == 0))
            settings->SaveFlags |= ImGuiTableFlags_Hideable;
    }
    settings->SaveFlags &= table->Flags;
    settings->RefScale = save_ref_scale ? table->RefScale : 0.0f;

    MarkIniSettingsDirty();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movb $0x0, 0x24f(%rdi)
testb $0x10, 0x4(%rdi)
jne 0x8b0eb
movq %rdi, %rbx
leaq 0x70d46(%rip), %rax     # 0xfbcd0
movq (%rax), %r15
callq 0x8d14d
movq %rax, %r14
testq %rax, %rax
jne 0x8afbc
movl (%rbx), %edi
movl 0x6c(%rbx), %esi
callq 0x8d07e
movq %rax, %r14
addq $0x3118, %r15           # imm = 0x3118
movq %r15, %rdi
movq %rax, %rsi
callq 0x8fc3a
movl %eax, 0x64(%rbx)
movl 0x6c(%rbx), %ecx
movb %cl, 0xc(%r14)
movl (%r14), %eax
cmpl (%rbx), %eax
jne 0x8b115
movsbl %cl, %eax
cmpl %ecx, %eax
jne 0x8b0f6
movsbl 0xd(%r14), %eax
cmpl %eax, %ecx
jg 0x8b0f6
movq 0x10(%rbx), %rax
movl $0x0, 0x4(%r14)
xorps %xmm0, %xmm0
testl %ecx, %ecx
jle 0x8b0d6
leaq 0x10(%r14), %rcx
xorl %esi, %esi
xorl %edx, %edx
movl (%rax), %edi
andl $0x4, %edi
movss 0x10(%rax,%rdi,2), %xmm1
movss %xmm1, (%rcx)
movb %sil, 0x8(%rcx)
movb 0x52(%rax), %dil
movb %dil, 0x9(%rcx)
movb 0x56(%rax), %dil
movb %dil, 0xa(%rcx)
movb 0x64(%rax), %dil
andb $0x3, %dil
movb 0xb(%rcx), %r8b
andb $-0x4, %r8b
orb %dil, %r8b
movb %r8b, 0xb(%rcx)
movb 0x5a(%rax), %dil
shlb $0x2, %dil
andb $-0x5, %r8b
orb %dil, %r8b
movb %r8b, 0xb(%rcx)
movb (%rax), %dil
addb %dil, %dil
andb $0x8, %dil
andb $-0x9, %r8b
orb %dil, %r8b
movb %r8b, 0xb(%rcx)
movl (%rax), %r8d
testb $0x4, %r8b
sete %dil
ucomiss 0x1c(%rax), %xmm1
jne 0x8b07a
jnp 0x8b07f
orb $0x1, 0x4(%r14)
movsbl 0x52(%rax), %r9d
cmpl %r9d, %esi
je 0x8b08e
orb $0x2, 0x4(%r14)
cmpb $-0x1, 0x56(%rax)
je 0x8b099
orb $0x8, 0x4(%r14)
movzbl 0x5a(%rax), %r9d
andl $0x1, %r8d
cmpl %r9d, %r8d
jne 0x8b0ac
orb $0x4, 0x4(%r14)
orb %dil, %dl
incl %esi
addq $0x68, %rax
addq $0xc, %rcx
cmpl 0x6c(%rbx), %esi
jl 0x8b005
movl 0x4(%rbx), %eax
andl %eax, 0x4(%r14)
testb $0x1, %dl
je 0x8b0d6
movss 0xe8(%rbx), %xmm0
movss %xmm0, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x592b5
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x44fe6(%rip), %rdi     # 0xd00e3
leaq 0x43d86(%rip), %rsi     # 0xcee8a
leaq 0x44fac(%rip), %rcx     # 0xd00b7
movl $0xc1b, %edx            # imm = 0xC1B
callq 0xc140
leaq 0x44f42(%rip), %rdi     # 0xd005e
leaq 0x43d67(%rip), %rsi     # 0xcee8a
leaq 0x44f8d(%rip), %rcx     # 0xd00b7
movl $0xc1a, %edx            # imm = 0xC1A
callq 0xc140