// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: WindowSettingsHandler_WriteAll(ImGuiContext*, ImGuiSettingsHandler*, ImGuiTextBuffer*)
static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
{
    // Gather data from windows that were active during this session
    // (if a window wasn't opened in this session we preserve its settings)
    ImGuiContext& g = *ctx;
    for (int i = 0; i != g.Windows.Size; i++)
    {
        ImGuiWindow* window = g.Windows[i];
        if (window->Flags & ImGuiWindowFlags_NoSavedSettings)
            continue;

        ImGuiWindowSettings* settings = (window->SettingsOffset != -1) ? g.SettingsWindows.ptr_from_offset(window->SettingsOffset) : ImGui::FindWindowSettings(window->ID);
        if (!settings)
        {
            settings = ImGui::CreateNewWindowSettings(window->Name);
            window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings);
        }
        IM_ASSERT(settings->ID == window->ID);
        settings->Pos = ImVec2ih((short)window->Pos.x, (short)window->Pos.y);
        settings->Size = ImVec2ih((short)window->SizeFull.x, (short)window->SizeFull.y);
        settings->Collapsed = window->Collapsed;
    }

    // Write to text buffer
    buf->reserve(buf->size() + g.SettingsWindows.size() * 6); // ballpark reserve
    for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
    {
        const char* settings_name = settings->GetName();
        buf->appendf("[%s][%s]\n", handler->TypeName, settings_name);
        buf->appendf("Pos=%d,%d\n", settings->Pos.x, settings->Pos.y);
        buf->appendf("Size=%d,%d\n", settings->Size.x, settings->Size.y);
        buf->appendf("Collapsed=%d\n", settings->Collapsed);
        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 %rdi, %r15
movl 0x1a88(%rdi), %eax
testl %eax, %eax
je 0x50b34
leaq 0x3108(%r15), %rcx
movq %rcx, -0x38(%rbp)
xorl %r13d, %r13d
movq %rsi, -0x30(%rbp)
cltq
cmpq %rax, %r13
jge 0x50c15
movq 0x1a90(%r15), %rax
movq (%rax,%r13,8), %r12
testb $0x1, 0xd(%r12)
jne 0x50b21
movl 0x2b4(%r12), %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r14
je 0x50a96
cmpl $0x4, %r14d
jl 0x50c53
cmpl %r14d, 0x3108(%r15)
jle 0x50c53
addq 0x3110(%r15), %r14
jmp 0x50aa7
movl 0x8(%r12), %edi
callq 0x5a4fb
movq -0x30(%rbp), %rsi
movq %rax, %r14
testq %r14, %r14
jne 0x50ad0
movq (%r12), %rdi
callq 0x5a47e
movq %rax, %r14
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x5fcf0
movq -0x30(%rbp), %rsi
movl %eax, 0x2b4(%r12)
movl (%r14), %eax
cmpl 0x8(%r12), %eax
jne 0x50c34
cvttss2si 0x10(%r12), %eax
cvttss2si 0x14(%r12), %ecx
shll $0x10, %ecx
movl $0xffff, %edx           # imm = 0xFFFF
andl %edx, %eax
orl %ecx, %eax
movl %eax, 0x4(%r14)
cvttss2si 0x20(%r12), %eax
cvttss2si 0x24(%r12), %ecx
shll $0x10, %ecx
andl %edx, %eax
orl %ecx, %eax
movl %eax, 0x8(%r14)
movb 0x91(%r12), %al
movb %al, 0xc(%r14)
incq %r13
movl 0x1a88(%r15), %eax
cmpq %rax, %r13
jne 0x50a42
movl (%rbx), %eax
xorl %ecx, %ecx
subl $0x1, %eax
cmovbl %ecx, %eax
movl 0x3108(%r15), %ecx
leal (%rcx,%rcx,2), %ecx
movq %rsi, %r14
leal (%rax,%rcx,2), %esi
movq %rbx, %rdi
callq 0x5ff18
movq 0x3110(%r15), %r12
testq %r12, %r12
je 0x50c06
addq $0x3108, %r15           # imm = 0x3108
addq $0x4, %r12
leaq 0x72d4f(%rip), %r13     # 0xc38c7
leaq 0x10(%r12), %rcx
movq (%r14), %rdx
movq %rbx, %rdi
leaq 0x6b9d5(%rip), %rsi     # 0xbc55f
xorl %eax, %eax
callq 0x43d94
movswl 0x4(%r12), %edx
movswl 0x6(%r12), %ecx
movq %rbx, %rdi
leaq 0x6b9c2(%rip), %rsi     # 0xbc569
xorl %eax, %eax
callq 0x43d94
movswl 0x8(%r12), %edx
movswl 0xa(%r12), %ecx
movq %rbx, %rdi
leaq 0x6b9b0(%rip), %rsi     # 0xbc574
xorl %eax, %eax
callq 0x43d94
movzbl 0xc(%r12), %edx
movq %rbx, %rdi
leaq 0x6b9a5(%rip), %rsi     # 0xbc580
xorl %eax, %eax
callq 0x43d94
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x43bae
movq %r15, %rdi
movq %r12, %rsi
callq 0x5f656
movq %rax, %r12
testq %rax, %rax
jne 0x50b78
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6aa5c(%rip), %rdi     # 0xbb678
leaq 0x6aa68(%rip), %rsi     # 0xbb68b
leaq 0x6be3d(%rip), %rcx     # 0xbca67
movl $0x65c, %edx            # imm = 0x65C
callq 0xc140
leaq 0x6b8aa(%rip), %rdi     # 0xbc4e5
leaq 0x67523(%rip), %rsi     # 0xb8165
leaq 0x6b8b7(%rip), %rcx     # 0xbc500
movl $0x2843, %edx           # imm = 0x2843
callq 0xc140
leaq 0x6b934(%rip), %rdi     # 0xbc58e
leaq 0x6a9de(%rip), %rsi     # 0xbb63f
leaq 0x6b941(%rip), %rcx     # 0xbc5a9
movl $0x25b, %edx            # imm = 0x25B
callq 0xc140