// File: /workspace/github_cpp_makefile_star2_O1/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 0x8cd97
movq %rdi, %rbx
leaq 0x71090(%rip), %rax     # 0xfdcd0
movq (%rax), %r15
callq 0x8ee91
movq %rax, %r14
testq %rax, %rax
jne 0x8cc72
movl (%rbx), %edi
movl 0x6c(%rbx), %esi
callq 0x8edc0
movq %rax, %r14
addq $0x3118, %r15           # imm = 0x3118
movq %r15, %rdi
movq %rax, %rsi
callq 0x91952
movl %eax, 0x64(%rbx)
movl 0x6c(%rbx), %eax
movb %al, 0xc(%r14)
movl (%r14), %ecx
cmpl (%rbx), %ecx
jne 0x8cde0
movsbl %al, %ecx
cmpl %eax, %ecx
jne 0x8cdc1
movsbl 0xd(%r14), %eax
cmpl %eax, %ecx
jg 0x8cdc1
movq 0x10(%rbx), %rax
movl $0x0, 0x4(%r14)
cmpl $0x0, 0x6c(%rbx)
jle 0x8cda2
leaq 0x10(%r14), %rcx
xorl %esi, %esi
movl $0x1, %edi
xorl %edx, %edx
movl (%rax), %r8d
andl $0x4, %r8d
movss 0x10(%rax,%r8,2), %xmm0
movss %xmm0, (%rcx)
movb %sil, 0x8(%rcx)
movb 0x52(%rax), %r8b
movb %r8b, 0x9(%rcx)
movb 0x56(%rax), %r8b
movb %r8b, 0xa(%rcx)
movb 0x64(%rax), %r8b
andb $0x3, %r8b
movb 0xb(%rcx), %r9b
andb $-0x4, %r9b
orb %r8b, %r9b
movb %r9b, 0xb(%rcx)
movb 0x5a(%rax), %r8b
shlb $0x2, %r8b
andb $-0x5, %r9b
orb %r8b, %r9b
movb %r9b, 0xb(%rcx)
movb (%rax), %r8b
addb %r8b, %r8b
andb $0x8, %r8b
andb $-0x9, %r9b
orb %r8b, %r9b
movb %r9b, 0xb(%rcx)
movl (%rax), %r8d
testb $0x4, %r8b
movzbl %dl, %edx
cmovel %edi, %edx
ucomiss 0x1c(%rax), %xmm0
jne 0x8cd39
jnp 0x8cd3e
orb $0x1, 0x4(%r14)
movsbl 0x52(%rax), %r9d
cmpl %r9d, %esi
je 0x8cd4d
orb $0x2, 0x4(%r14)
cmpb $-0x1, 0x56(%rax)
je 0x8cd58
orb $0x8, 0x4(%r14)
movzbl 0x5a(%rax), %r9d
andl $0x1, %r8d
cmpl %r9d, %r8d
jne 0x8cd6b
orb $0x4, 0x4(%r14)
incl %esi
addq $0x68, %rax
addq $0xc, %rcx
cmpl 0x6c(%rbx), %esi
jl 0x8ccbf
movl 0x4(%rbx), %eax
andl %eax, 0x4(%r14)
xorps %xmm0, %xmm0
testb $0x1, %dl
je 0x8cdac
movss 0xe8(%rbx), %xmm0
jmp 0x8cdac
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%rbx), %eax
andl %eax, 0x4(%r14)
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5a458
leaq 0x4534b(%rip), %rdi     # 0xd2113
leaq 0x440eb(%rip), %rsi     # 0xd0eba
leaq 0x45311(%rip), %rcx     # 0xd20e7
movl $0xc1b, %edx            # imm = 0xC1B
callq 0xc140
leaq 0x452a7(%rip), %rdi     # 0xd208e
leaq 0x440cc(%rip), %rsi     # 0xd0eba
leaq 0x452f2(%rip), %rcx     # 0xd20e7
movl $0xc1a, %edx            # imm = 0xC1A
callq 0xc140