// File: /workspace/github_cpp_makefile_star2_O2/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 %rdx, %rbx
movq %rsi, -0x38(%rbp)
movq %rdi, %r14
movq 0x3120(%rdi), %rax
addq $0x3118, %r14           # imm = 0x3118
leaq 0x4(%rax), %r12
testq %rax, %rax
cmoveq %rax, %r12
movq %r14, -0x30(%rbp)
testq %r12, %r12
je 0x76b7e
cmpl $0x0, (%r12)
je 0x76b6b
movl 0x4(%r12), %r13d
testb $0xf, %r13b
je 0x76b6b
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 0x49c66
movq -0x38(%rbp), %rax
movq (%rax), %rdx
movl (%r12), %ecx
movsbl 0xc(%r12), %r8d
movq %rbx, %rdi
leaq 0x41142(%rip), %rsi     # 0xb7b5c
xorl %eax, %eax
callq 0x3563c
movss 0x8(%r12), %xmm0
ucomiss 0x25e95(%rip), %xmm0    # 0x9c8c4
jne 0x76a33
jnp 0x76a48
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
leaq 0x4112c(%rip), %rsi     # 0xb7b6d
movb $0x1, %al
callq 0x3563c
leaq 0x1b(%r12), %r14
xorl %r15d, %r15d
movsbl 0xc(%r12), %eax
movq %rbx, %rdi
cmpl %eax, %r15d
jge 0x76b59
leaq 0x41111(%rip), %rsi     # 0xb7b7a
movl %r15d, %edx
xorl %eax, %eax
callq 0x3563c
movl -0x7(%r14), %edx
testl %edx, %edx
je 0x76a8c
movq %rbx, %rdi
leaq 0x41101(%rip), %rsi     # 0xb7b86
xorl %eax, %eax
callq 0x3563c
testb $0x1, %r13b
je 0x76ace
movb (%r14), %al
testb $0x8, %al
je 0x76ab3
cvtss2sd -0xb(%r14), %xmm0
movq %rbx, %rdi
leaq 0x410ea(%rip), %rsi     # 0xb7b93
movb $0x1, %al
callq 0x3563c
movb (%r14), %al
testb $0x8, %al
jne 0x76ace
cvttss2si -0xb(%r14), %edx
movq %rbx, %rdi
leaq 0x410d9(%rip), %rsi     # 0xb7ba0
xorl %eax, %eax
callq 0x3563c
testb $0x4, %r13b
je 0x76aef
movzbl (%r14), %edx
shrl $0x2, %edx
andl $0x1, %edx
movq %rbx, %rdi
leaq 0x410c2(%rip), %rsi     # 0xb7baa
xorl %eax, %eax
callq 0x3563c
testb $0x2, %r13b
je 0x76b0b
movsbl -0x2(%r14), %edx
movq %rbx, %rdi
leaq 0x410b2(%rip), %rsi     # 0xb7bb6
xorl %eax, %eax
callq 0x3563c
testb $0x8, %r13b
je 0x76b3c
movsbl -0x1(%r14), %edx
cmpl $-0x1, %edx
je 0x76b3c
movb (%r14), %al
andb $0x3, %al
cmpb $0x1, %al
pushq $0x5e
popq %rcx
pushq $0x76
popq %rax
cmovel %eax, %ecx
movq %rbx, %rdi
leaq 0x4108b(%rip), %rsi     # 0xb7bc0
xorl %eax, %eax
callq 0x3563c
movq %rbx, %rdi
leaq 0x32081(%rip), %rsi     # 0xa8bc7
xorl %edx, %edx
callq 0x355a2
incl %r15d
addq $0xc, %r14
jmp 0x76a50
leaq 0x32067(%rip), %rsi     # 0xa8bc7
xorl %edx, %edx
callq 0x355a2
movq -0x30(%rbp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x4bb2a
movq %rax, %r12
jmp 0x769b8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq