// File: /workspace/github_cpp_makefile_star2_O3/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
subq $0x18, %rsp
movq 0x4933b(%rip), %r12     # 0x55480
movq 0x18(%r12), %rbx
testq %rbx, %rbx
je 0xc2ea
movl 0x1738(%r12), %eax
testl %eax, %eax
je 0xc1b2
xorl %r14d, %r14d
movslq %eax, %rcx
cmpq %rcx, %r14
jge 0xc2f9
movq 0x1740(%r12), %rcx
movq (%rcx,%r14,8), %r15
testb $0x1, 0xd(%r15)
jne 0xc1a8
movq (%r15), %rdi
callq 0x23255
movq 0x18(%r15), %rcx
movq %rcx, 0xc(%rax)
movq 0x28(%r15), %rcx
movq %rcx, 0x14(%rax)
movb 0x73(%r15), %cl
movb %cl, 0x1c(%rax)
movl 0x1738(%r12), %eax
incq %r14
movl %eax, %ecx
cmpq %rcx, %r14
jne 0xc162
leaq 0x32958(%rip), %rsi     # 0x3eb11
movq %rbx, %rdi
callq 0x78b0
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xc2ea
movl 0x17b0(%r12), %eax
testl %eax, %eax
je 0xc2d3
movl $0x1c, %r13d
movss 0x311e4(%rip), %xmm1    # 0x3d3d0
xorl %r14d, %r14d
movq %r12, -0x38(%rbp)
movslq %eax, %rcx
cmpq %rcx, %r14
jge 0xc310
movq 0x17b8(%r12), %rbx
movss -0x10(%rbx,%r13), %xmm0
ucomiss %xmm1, %xmm0
jne 0xc219
jnp 0xc2c1
movq -0x1c(%rbx,%r13), %r15
movq %r15, %rdi
leaq 0x328ec(%rip), %rsi     # 0x3eb14
callq 0x7350
testq %rax, %rax
cmovneq %rax, %r15
movq -0x30(%rbp), %r12
movq %r12, %rdi
leaq 0x328d6(%rip), %rsi     # 0x3eb18
movq %r15, %rdx
xorl %eax, %eax
callq 0x7180
cvttss2si -0x10(%rbx,%r13), %edx
cvttss2si -0xc(%rbx,%r13), %ecx
movq %r12, %rdi
leaq 0x328ba(%rip), %rsi     # 0x3eb1e
xorl %eax, %eax
callq 0x7180
cvttss2si -0x8(%rbx,%r13), %edx
cvttss2si -0x4(%rbx,%r13), %ecx
movq %r12, %rdi
leaq 0x328a6(%rip), %rsi     # 0x3eb29
xorl %eax, %eax
callq 0x7180
movzbl (%rbx,%r13), %edx
movq %r12, %rdi
leaq 0x3289c(%rip), %rsi     # 0x3eb35
xorl %eax, %eax
callq 0x7180
movl $0xa, %edi
movq %r12, %rsi
movq -0x38(%rbp), %r12
callq 0x7640
movss 0x31117(%rip), %xmm1    # 0x3d3d0
movl 0x17b0(%r12), %eax
incq %r14
movl %eax, %ecx
addq $0x20, %r13
cmpq %rcx, %r14
jne 0xc1f3
movq -0x30(%rbp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7330
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x32ae0(%rip), %rdi     # 0x3ede0
leaq 0x327bc(%rip), %rsi     # 0x3eac3
leaq 0x32f32(%rip), %rcx     # 0x3f240
jmp 0xc325
leaq 0x32ac9(%rip), %rdi     # 0x3ede0
leaq 0x327a5(%rip), %rsi     # 0x3eac3
leaq 0x32fa3(%rip), %rcx     # 0x3f2c8
movl $0x31c, %edx            # imm = 0x31C
callq 0x7140