// File: /workspace/github_cpp_makefile_star2_O3/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 0x4fb57
leaq 0x3108(%r15), %rcx
movq %rcx, -0x38(%rbp)
xorl %r13d, %r13d
movq %rsi, -0x30(%rbp)
movslq %eax, %rcx
cmpq %rcx, %r13
jge 0x4fc38
movq 0x1a90(%r15), %rcx
movq (%rcx,%r13,8), %r12
testb $0x1, 0xd(%r12)
jne 0x4fb49
movl 0x2b4(%r12), %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r14
je 0x4fab7
cmpl $0x4, %r14d
jl 0x4fc76
movq -0x38(%rbp), %rax
cmpl %r14d, (%rax)
jle 0x4fc76
addq 0x3110(%r15), %r14
jmp 0x4fac8
movl 0x8(%r12), %edi
callq 0x59358
movq -0x30(%rbp), %rsi
movq %rax, %r14
testq %r14, %r14
jne 0x4faf1
movq (%r12), %rdi
callq 0x592db
movq %rax, %r14
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x5eb12
movq -0x30(%rbp), %rsi
movl %eax, 0x2b4(%r12)
movl (%r14), %eax
cmpl 0x8(%r12), %eax
jne 0x4fc57
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)
movl 0x1a88(%r15), %eax
incq %r13
movl %eax, %ecx
cmpq %rcx, %r13
jne 0x4fa62
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 0x5ed34
movq 0x3110(%r15), %r12
testq %r12, %r12
je 0x4fc29
addq $0x3108, %r15           # imm = 0x3108
addq $0x4, %r12
leaq 0x71cfc(%rip), %r13     # 0xc1897
leaq 0x10(%r12), %rcx
movq (%r14), %rdx
movq %rbx, %rdi
leaq 0x6a9b2(%rip), %rsi     # 0xba55f
xorl %eax, %eax
callq 0x43426
movswl 0x4(%r12), %edx
movswl 0x6(%r12), %ecx
movq %rbx, %rdi
leaq 0x6a99f(%rip), %rsi     # 0xba569
xorl %eax, %eax
callq 0x43426
movswl 0x8(%r12), %edx
movswl 0xa(%r12), %ecx
movq %rbx, %rdi
leaq 0x6a98d(%rip), %rsi     # 0xba574
xorl %eax, %eax
callq 0x43426
movzbl 0xc(%r12), %edx
movq %rbx, %rdi
leaq 0x6a982(%rip), %rsi     # 0xba580
xorl %eax, %eax
callq 0x43426
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x432cc
movq %r15, %rdi
movq %r12, %rsi
callq 0x5e478
movq %rax, %r12
testq %rax, %rax
jne 0x4fb9b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x69a39(%rip), %rdi     # 0xb9678
leaq 0x69a45(%rip), %rsi     # 0xb968b
leaq 0x6ae1a(%rip), %rcx     # 0xbaa67
movl $0x65c, %edx            # imm = 0x65C
callq 0xc140
leaq 0x6a887(%rip), %rdi     # 0xba4e5
leaq 0x66500(%rip), %rsi     # 0xb6165
leaq 0x6a894(%rip), %rcx     # 0xba500
movl $0x2843, %edx           # imm = 0x2843
callq 0xc140
leaq 0x6a911(%rip), %rdi     # 0xba58e
leaq 0x699bb(%rip), %rsi     # 0xb963f
leaq 0x6a91e(%rip), %rcx     # 0xba5a9
movl $0x25b, %edx            # imm = 0x25B
callq 0xc140