// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui_tables.cpp
// Function: TableSettingsHandler_WriteAll(ImGuiContext*, ImGuiSettingsHandler*, ImGuiTextBuffer*)
static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
{
    ImGuiContext& g = *ctx;
    for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
    {
        if (settings->ID == 0) // Skip ditched settings
            continue;

        // TableSaveSettings() may clear some of those flags when we establish that the data can be stripped
        // (e.g. Order was unchanged)
        const bool save_size    = (settings->SaveFlags & ImGuiTableFlags_Resizable) != 0;
        const bool save_visible = (settings->SaveFlags & ImGuiTableFlags_Hideable) != 0;
        const bool save_order   = (settings->SaveFlags & ImGuiTableFlags_Reorderable) != 0;
        const bool save_sort    = (settings->SaveFlags & ImGuiTableFlags_Sortable) != 0;
        if (!save_size && !save_visible && !save_order && !save_sort)
            continue;

        buf->reserve(buf->size() + 30 + settings->ColumnsCount * 50); // ballpark reserve
        buf->appendf("[%s][0x%08X,%d]\n", handler->TypeName, settings->ID, settings->ColumnsCount);
        if (settings->RefScale != 0.0f)
            buf->appendf("RefScale=%g\n", settings->RefScale);
        ImGuiTableColumnSettings* column = settings->GetColumnSettings();
        for (int column_n = 0; column_n < settings->ColumnsCount; column_n++, column++)
        {
            // "Column 0  UserID=0x42AD2D21 Width=100 Visible=1 Order=0 Sort=0v"
            buf->appendf("Column %-2d", column_n);
            if (column->UserID != 0)                    buf->appendf(" UserID=%08X", column->UserID);
            if (save_size && column->IsStretch)         buf->appendf(" Weight=%.4f", column->WidthOrWeight);
            if (save_size && !column->IsStretch)        buf->appendf(" Width=%d", (int)column->WidthOrWeight);
            if (save_visible)                           buf->appendf(" Visible=%d", column->IsEnabled);
            if (save_order)                             buf->appendf(" Order=%d", column->DisplayOrder);
            if (save_sort && column->SortOrder != -1)   buf->appendf(" Sort=%d%c", column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? 'v' : '^');
            buf->append("\n");
        }
        buf->append("\n");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, -0x38(%rbp)
movq 0x3120(%rdi), %r12
testq %r12, %r12
je 0x8d91b
movq %rdx, %rbx
movq %rdi, %r14
addq $0x3118, %r14           # imm = 0x3118
addq $0x4, %r12
movq %r14, -0x30(%rbp)
cmpl $0x0, (%r12)
je 0x8d904
movl 0x4(%r12), %r13d
testb $0xf, %r13b
je 0x8d904
movl (%rbx), %eax
subl $0x1, %eax
movl $0x0, %ecx
cmovbl %ecx, %eax
movsbl 0xc(%r12), %ecx
imull $0x32, %ecx, %ecx
leal (%rax,%rcx), %esi
addl $0x1e, %esi
movq %rbx, %rdi
callq 0x5ed34
movq -0x38(%rbp), %rax
movq (%rax), %rdx
movl (%r12), %ecx
movsbl 0xc(%r12), %r8d
movq %rbx, %rdi
leaq 0x4313e(%rip), %rsi     # 0xd08e0
xorl %eax, %eax
callq 0x43426
movss 0x8(%r12), %xmm0
ucomiss 0x2808d(%rip), %xmm0    # 0xb5844
jne 0x8d7bb
jnp 0x8d7d0
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
leaq 0x43128(%rip), %rsi     # 0xd08f1
movb $0x1, %al
callq 0x43426
cmpb $0x0, 0xc(%r12)
jle 0x8d8ef
leaq 0x1b(%r12), %r14
xorl %r15d, %r15d
movq %rbx, %rdi
leaq 0x43110(%rip), %rsi     # 0xd08fe
movl %r15d, %edx
xorl %eax, %eax
callq 0x43426
movl -0x7(%r14), %edx
testl %edx, %edx
je 0x8d811
movq %rbx, %rdi
leaq 0x43100(%rip), %rsi     # 0xd090a
xorl %eax, %eax
callq 0x43426
testb $0x1, %r13b
je 0x8d856
movb (%r14), %al
testb $0x8, %al
je 0x8d83b
xorps %xmm0, %xmm0
cvtss2sd -0xb(%r14), %xmm0
movq %rbx, %rdi
leaq 0x430e6(%rip), %rsi     # 0xd0917
movb $0x1, %al
callq 0x43426
movb (%r14), %al
testb $0x8, %al
jne 0x8d856
cvttss2si -0xb(%r14), %edx
movq %rbx, %rdi
leaq 0x430d5(%rip), %rsi     # 0xd0924
xorl %eax, %eax
callq 0x43426
testb $0x4, %r13b
je 0x8d877
movzbl (%r14), %edx
shrl $0x2, %edx
andl $0x1, %edx
movq %rbx, %rdi
leaq 0x430be(%rip), %rsi     # 0xd092e
xorl %eax, %eax
callq 0x43426
testb $0x2, %r13b
je 0x8d893
movsbl -0x2(%r14), %edx
movq %rbx, %rdi
leaq 0x430ae(%rip), %rsi     # 0xd093a
xorl %eax, %eax
callq 0x43426
testb $0x8, %r13b
je 0x8d8c8
movsbl -0x1(%r14), %edx
cmpl $-0x1, %edx
je 0x8d8c8
movb (%r14), %al
andb $0x3, %al
cmpb $0x1, %al
movl $0x5e, %ecx
movl $0x76, %eax
cmovel %eax, %ecx
movq %rbx, %rdi
leaq 0x43083(%rip), %rsi     # 0xd0944
xorl %eax, %eax
callq 0x43426
movq %rbx, %rdi
leaq 0x33fc5(%rip), %rsi     # 0xc1897
xorl %edx, %edx
callq 0x432cc
incl %r15d
movsbl 0xc(%r12), %eax
addq $0xc, %r14
cmpl %eax, %r15d
jl 0x8d7e4
movq %rbx, %rdi
leaq 0x33f9e(%rip), %rsi     # 0xc1897
xorl %edx, %edx
callq 0x432cc
movq -0x30(%rbp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x5e4e0
movq %rax, %r12
testq %rax, %rax
jne 0x8d749
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq