// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui.cpp
// Function: SaveSettings()
static void SaveSettings()
{
    ImGuiState& g = *GImGui;
    const char* filename = g.IO.IniFilename;
    if (!filename)
        return;

    // Gather data from windows that were active during this session
    for (int i = 0; i != g.Windows.Size; i++)
    {
        ImGuiWindow* window = g.Windows[i];
        if (window->Flags & ImGuiWindowFlags_NoSavedSettings)
            continue;
        ImGuiIniData* settings = FindWindowSettings(window->Name);
        settings->Pos = window->Pos;
        settings->Size = window->SizeFull;
        settings->Collapsed = window->Collapsed;
    }

    // Write .ini file
    // If a window wasn't opened in this session we preserve its settings
    FILE* f = fopen(filename, "wt");
    if (!f)
        return;
    for (int i = 0; i != g.Settings.Size; i++)
    {
        const ImGuiIniData* settings = &g.Settings[i];
        if (settings->Pos.x == FLT_MAX)
            continue;
        const char* name = settings->Name;
        if (const char* p = strstr(name, "###"))  // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
            name = p;
        fprintf(f, "[%s]\n", name);
        fprintf(f, "Pos=%d,%d\n", (int)settings->Pos.x, (int)settings->Pos.y);
        fprintf(f, "Size=%d,%d\n", (int)settings->Size.x, (int)settings->Size.y);
        fprintf(f, "Collapsed=%d\n", settings->Collapsed);
        fprintf(f, "\n");
    }

    fclose(f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x45635(%rip), %rbx     # 0x50480
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0xaf86
leaq 0x1738(%rbx), %r15
xorl %r12d, %r12d
cmpl (%r15), %r12d
je 0xaea1
movq %r15, %rdi
movl %r12d, %esi
callq 0x1e6f4
movq (%rax), %r13
testb $0x1, 0xd(%r13)
jne 0xae9c
movq (%r13), %rdi
callq 0x1d30a
movq 0x18(%r13), %rcx
movq %rcx, 0xc(%rax)
movq 0x28(%r13), %rcx
movq %rcx, 0x14(%rax)
movb 0x73(%r13), %cl
movb %cl, 0x1c(%rax)
incl %r12d
jmp 0xae62
leaq 0x2cc21(%rip), %rsi     # 0x37ac9
movq %r14, %rdi
callq 0x78a0
testq %rax, %rax
je 0xaf86
movq %rax, %r14
addq $0x17b0, %rbx           # imm = 0x17B0
xorl %r15d, %r15d
cmpl (%rbx), %r15d
je 0xaf95
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1e872
movss 0xc(%rax), %xmm0
ucomiss 0x2b4ee(%rip), %xmm0    # 0x363d4
jne 0xaeee
jnp 0xaf7e
movq %rax, %r12
movq (%rax), %r13
movq %r13, %rdi
leaq 0x2cbce(%rip), %rsi     # 0x37acc
callq 0x7380
testq %rax, %rax
cmovneq %rax, %r13
movq %r14, %rdi
leaq 0x2cbbc(%rip), %rsi     # 0x37ad0
movq %r13, %rdx
xorl %eax, %eax
callq 0x7180
cvttss2si 0xc(%r12), %edx
cvttss2si 0x10(%r12), %ecx
movq %r14, %rdi
leaq 0x2cba0(%rip), %rsi     # 0x37ad6
xorl %eax, %eax
callq 0x7180
cvttss2si 0x14(%r12), %edx
cvttss2si 0x18(%r12), %ecx
movq %r14, %rdi
leaq 0x2cb8c(%rip), %rsi     # 0x37ae1
xorl %eax, %eax
callq 0x7180
movzbl 0x1c(%r12), %edx
movq %r14, %rdi
leaq 0x2cb81(%rip), %rsi     # 0x37aed
xorl %eax, %eax
callq 0x7180
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x7620
incl %r15d
jmp 0xaec6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7350