// File: 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
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
addq $0x3118, %rdi           # imm = 0x3118
callq 0xec710
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1341ad
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x133ee9
jmp 0x134190
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x29(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x2a(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x2b(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x2c(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x133f5a
testb $0x1, -0x2a(%rbp)
jne 0x133f5a
testb $0x1, -0x2b(%rbp)
jne 0x133f5a
testb $0x1, -0x2c(%rbp)
jne 0x133f5a
jmp 0x134190
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0xec2b0
movq -0x48(%rbp), %rdi
movl %eax, %esi
addl $0x1e, %esi
movq -0x28(%rbp), %rax
movsbl 0xc(%rax), %eax
imull $0x32, %eax, %eax
addl %eax, %esi
callq 0xee9b0
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x28(%rbp), %rax
movsbl 0xc(%rax), %r8d
leaq 0x59cc0(%rip), %rsi     # 0x18dc67
movb $0x0, %al
callq 0xc6bd0
movq -0x28(%rbp), %rax
movss 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x133fc3
jp 0x133fc3
jmp 0x133fe2
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movss 0x8(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x59c9d(%rip), %rsi     # 0x18dc78
movb $0x1, %al
callq 0xc6bd0
movq -0x28(%rbp), %rdi
callq 0x137910
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x28(%rbp), %rcx
movsbl 0xc(%rcx), %ecx
cmpl %ecx, %eax
jge 0x13417c
movq -0x18(%rbp), %rdi
movl -0x3c(%rbp), %edx
leaq 0x59c6e(%rip), %rsi     # 0x18dc85
movb $0x0, %al
callq 0xc6bd0
movq -0x38(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x134041
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x4(%rax), %edx
leaq 0x59c57(%rip), %rsi     # 0x18dc91
movb $0x0, %al
callq 0xc6bd0
testb $0x1, -0x29(%rbp)
je 0x134075
movq -0x38(%rbp), %rax
movb 0xb(%rax), %al
shrb $0x3, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x134075
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x59c30(%rip), %rsi     # 0x18dc9e
movb $0x1, %al
callq 0xc6bd0
testb $0x1, -0x29(%rbp)
je 0x1340a5
movq -0x38(%rbp), %rax
movb 0xb(%rax), %al
shrb $0x3, %al
andb $0x1, %al
cmpb $0x0, %al
jne 0x1340a5
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
cvttss2si (%rax), %edx
leaq 0x59c0d(%rip), %rsi     # 0x18dcab
movb $0x0, %al
callq 0xc6bd0
testb $0x1, -0x2a(%rbp)
je 0x1340cc
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movb 0xb(%rax), %al
shrb $0x2, %al
andb $0x1, %al
movzbl %al, %edx
leaq 0x59bf0(%rip), %rsi     # 0x18dcb5
movb $0x0, %al
callq 0xc6bd0
testb $0x1, -0x2b(%rbp)
je 0x1340ec
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movsbl 0x9(%rax), %edx
leaq 0x59bdc(%rip), %rsi     # 0x18dcc1
movb $0x0, %al
callq 0xc6bd0
testb $0x1, -0x2c(%rbp)
je 0x13414e
movq -0x38(%rbp), %rax
movsbl 0xa(%rax), %eax
cmpl $-0x1, %eax
je 0x13414e
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movsbl 0xa(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movb 0xb(%rax), %al
andb $0x3, %al
movzbl %al, %ecx
movb $0x76, %al
movb $0x5e, %dl
movb %dl, -0x4a(%rbp)
cmpl $0x1, %ecx
movb %al, -0x49(%rbp)
je 0x134133
movb -0x4a(%rbp), %al
movb %al, -0x49(%rbp)
movl -0x50(%rbp), %edx
movq -0x58(%rbp), %rdi
movb -0x49(%rbp), %al
movsbl %al, %ecx
leaq 0x59b84(%rip), %rsi     # 0x18dccb
movb $0x0, %al
callq 0xc6bd0
movq -0x18(%rbp), %rdi
leaq 0x4ad6b(%rip), %rsi     # 0x17eec4
xorl %eax, %eax
movl %eax, %edx
callq 0xc6ad0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x38(%rbp)
jmp 0x133ff6
movq -0x18(%rbp), %rdi
leaq 0x4ad3d(%rip), %rsi     # 0x17eec4
xorl %eax, %eax
movl %eax, %edx
callq 0xc6ad0
movq -0x20(%rbp), %rdi
addq $0x3118, %rdi           # imm = 0x3118
movq -0x28(%rbp), %rsi
callq 0xec750
movq %rax, -0x28(%rbp)
jmp 0x133ed0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)