// File: /workspace/github_cpp_makefile_star2_O1/donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::FocusWindow(ImGuiWindow*)
void ImGui::FocusWindow(ImGuiWindow* window)
{
    ImGuiState& g = *GImGui;

    // Always mark the window we passed as focused. This is used for keyboard interactions such as tabbing.
    g.FocusedWindow = window;

    // Passing NULL allow to disable keyboard focus
    if (!window)
        return;

    // And move its root window to the top of the pile
    if (window->RootWindow)
        window = window->RootWindow;

    // Steal focus on active widgets
    if (window->Flags & ImGuiWindowFlags_Popup) // FIXME: This statement should be unnecessary. Need further testing before removing it..
        if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != window)
            ImGui::SetActiveID(0);

    if (g.Windows.back() == window)
        return;

    for (int i = 0; i < g.Windows.Size; i++)
        if (g.Windows[i] == window)
        {
            g.Windows.erase(g.Windows.begin() + i);
            break;
        }
    g.Windows.push_back(window);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x48472(%rip), %r14     # 0x55490
movq %rdi, 0x1770(%r14)
testq %rdi, %rdi
je 0xd1a8
movq 0x278(%rdi), %r15
testq %r15, %r15
cmoveq %rdi, %r15
testb $0x2, 0xf(%r15)
je 0xd082
cmpl $0x0, 0x1790(%r14)
je 0xd082
movq 0x17a0(%r14), %rax
testq %rax, %rax
je 0xd082
cmpq %r15, 0x278(%rax)
je 0xd082
movl $0x0, 0x1790(%r14)
movw $0x1, 0x1799(%r14)
movq $0x0, 0x17a0(%r14)
movslq 0x1738(%r14), %rax
testq %rax, %rax
jle 0xd1b1
movq 0x1740(%r14), %rcx
cmpq %r15, -0x8(%rcx,%rax,8)
je 0xd1a8
movl %eax, %edx
leaq -0x8(,%rdx,8), %rdx
xorl %esi, %esi
cmpq %r15, (%rcx,%rsi,8)
je 0xd0c5
incq %rsi
addq $-0x8, %rdx
cmpq $-0x8, %rdx
jne 0xd0b0
jmp 0xd0e5
cmpl %esi, %eax
jbe 0xd1d0
leaq (%rcx,%rsi,8), %rdi
leaq (%rcx,%rsi,8), %rsi
addq $0x8, %rsi
callq 0x7130
decl 0x1738(%r14)
movl 0x1738(%r14), %r12d
movl 0x173c(%r14), %eax
cmpl %eax, %r12d
jne 0xd18c
incl %r12d
testl %eax, %eax
je 0xd110
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl %eax, %ecx
jmp 0xd115
movl $0x8, %ecx
cmpl %r12d, %ecx
cmovgl %ecx, %r12d
cmpl %r12d, %eax
jge 0xd18c
movslq %r12d, %rdi
shlq $0x3, %rdi
movq 0x48361(%rip), %rax     # 0x55490
incl 0x334(%rax)
callq *0xd0(%rax)
movq %rax, %rbx
movq 0x1740(%r14), %rsi
movslq 0x1738(%r14), %rdx
shlq $0x3, %rdx
movq %rax, %rdi
callq 0x7080
movq 0x1740(%r14), %rdi
testq %rdi, %rdi
je 0xd171
movq 0x48325(%rip), %rax     # 0x55490
decl 0x334(%rax)
movq 0x48318(%rip), %rax     # 0x55490
callq *0xd8(%rax)
movq %rbx, 0x1740(%r14)
movl %r12d, 0x173c(%r14)
movq 0x1740(%r14), %rax
movslq 0x1738(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x1738(%r14)
movq %r15, (%rax,%rcx,8)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x399fd(%rip), %rdi     # 0x46bb5
leaq 0x318d4(%rip), %rsi     # 0x3ea93
leaq 0x321a9(%rip), %rcx     # 0x3f36f
movl $0x326, %edx            # imm = 0x326
callq 0x7140
leaq 0x32252(%rip), %rdi     # 0x3f429
leaq 0x318b5(%rip), %rsi     # 0x3ea93
leaq 0x32260(%rip), %rcx     # 0x3f445
movl $0x33a, %edx            # imm = 0x33A
callq 0x7140