// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: CloseWindowButton(bool*)
static bool CloseWindowButton(bool* p_opened)
{
    ImGuiWindow* window = ImGui::GetCurrentWindow();

    const ImGuiID id = window->GetID("#CLOSE");
    const float size = window->TitleBarHeight() - 4.0f;
    const ImRect bb(window->Rect().GetTR() + ImVec2(-2.0f-size,2.0f), window->Rect().GetTR() + ImVec2(-2.0f,2.0f+size));

    bool hovered, held;
    bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held, true);

    // Render
    const ImU32 col = window->Color((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton);
    const ImVec2 center = bb.GetCenter();
    window->DrawList->AddCircleFilled(center, ImMax(2.0f,size*0.5f), col, 16);

    const float cross_extent = (size * 0.5f * 0.7071f) - 1.0f;
    if (hovered)
    {
        window->DrawList->AddLine(center + ImVec2(+cross_extent,+cross_extent), center + ImVec2(-cross_extent,-cross_extent), window->Color(ImGuiCol_Text));
        window->DrawList->AddLine(center + ImVec2(+cross_extent,-cross_extent), center + ImVec2(-cross_extent,+cross_extent), window->Color(ImGuiCol_Text));
    }

    if (p_opened != NULL && pressed)
        *p_opened = !*p_opened;

    return pressed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x8(%rbp)
callq 0x2e220
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x45001(%rip), %rsi     # 0x5ca94
xorl %eax, %eax
movl %eax, %edx
callq 0xbc60
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2f170
movss 0x43644(%rip), %xmm1    # 0x5b0f4
addss %xmm1, %xmm0
movss %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2f2d0
movlpd %xmm0, -0x48(%rbp)
movlpd %xmm1, -0x40(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x301f0
movlpd %xmm0, -0x38(%rbp)
movss -0x18(%rbp), %xmm1
movss 0x43611(%rip), %xmm0    # 0x5b0f8
movss %xmm0, -0xe4(%rbp)
subss %xmm1, %xmm0
leaq -0x50(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
movss 0x435b2(%rip), %xmm1    # 0x5b0b8
movss %xmm1, -0xe8(%rbp)
callq 0x2d280
movq -0xf0(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0xc7e0
movlpd %xmm0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2f2d0
movlpd %xmm0, -0x70(%rbp)
movlpd %xmm1, -0x68(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x301f0
movss -0xe8(%rbp), %xmm2
movaps %xmm0, %xmm1
movss -0xe4(%rbp), %xmm0
movlpd %xmm1, -0x60(%rbp)
movss -0x18(%rbp), %xmm1
addss %xmm2, %xmm1
leaq -0x78(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x2d280
movq -0xe0(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xc7e0
movlpd %xmm0, -0x58(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x2eb40
movl -0x14(%rbp), %esi
leaq -0x28(%rbp), %rdi
leaq -0x79(%rbp), %rdx
leaq -0x7a(%rbp), %rcx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x17010
andb $0x1, %al
movb %al, -0x7b(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
testb $0x1, -0x7a(%rbp)
je 0x17be1
testb $0x1, -0x79(%rbp)
je 0x17be1
movl $0x23, %eax
movl %eax, -0xf4(%rbp)
jmp 0x17bfa
movb -0x79(%rbp), %dl
movl $0x21, %eax
movl $0x22, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0xf4(%rbp)
movq -0xd8(%rbp), %rdi
movl -0xf4(%rbp), %esi
movss 0x43409(%rip), %xmm0    # 0x5b018
callq 0x2ea40
movl %eax, -0x80(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2f120
movlpd %xmm0, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq 0x270(%rax), %rax
movq %rax, -0x100(%rbp)
movss 0x433e2(%rip), %xmm1    # 0x5b024
mulss -0x18(%rbp), %xmm1
movss 0x43469(%rip), %xmm0    # 0x5b0b8
callq 0xb7c0
movq -0x100(%rbp), %rdi
movl -0x80(%rbp), %edx
leaq -0x88(%rbp), %rsi
movl $0x10, %ecx
callq 0x40980
movss 0x433ad(%rip), %xmm0    # 0x5b024
mulss -0x18(%rbp), %xmm0
movss 0x43478(%rip), %xmm1    # 0x5b0fc
mulss %xmm1, %xmm0
movss 0x433ec(%rip), %xmm1    # 0x5b07c
addss %xmm1, %xmm0
movss %xmm0, -0x8c(%rbp)
testb $0x1, -0x79(%rbp)
je 0x17e53
movq -0x10(%rbp), %rax
movq 0x270(%rax), %rax
movq %rax, -0x148(%rbp)
movss -0x8c(%rbp), %xmm1
leaq -0x9c(%rbp), %rdi
movq %rdi, -0x158(%rbp)
movaps %xmm1, %xmm0
callq 0x2d280
movq -0x158(%rbp), %rsi
leaq -0x88(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xc7e0
movlpd %xmm0, -0x94(%rbp)
movss -0x8c(%rbp), %xmm1
movaps 0x43449(%rip), %xmm0    # 0x5b150
movaps %xmm0, -0x130(%rbp)
pxor %xmm0, %xmm1
leaq -0xac(%rbp), %rdi
movq %rdi, -0x150(%rbp)
movaps %xmm1, %xmm0
callq 0x2d280
movq -0x150(%rbp), %rsi
movq -0x118(%rbp), %rdi
callq 0xc7e0
movlpd %xmm0, -0xa4(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movss 0x432c7(%rip), %xmm0    # 0x5b018
movss %xmm0, -0x13c(%rbp)
callq 0x2ea40
movq -0x148(%rbp), %rdi
movss -0x13c(%rbp), %xmm0
movl %eax, %ecx
leaq -0x94(%rbp), %rsi
leaq -0xa4(%rbp), %rdx
callq 0x404c0
movaps -0x130(%rbp), %xmm2
movq -0x10(%rbp), %rax
movq 0x270(%rax), %rax
movq %rax, -0x108(%rbp)
movss -0x8c(%rbp), %xmm0
movaps %xmm0, %xmm1
pxor %xmm2, %xmm1
leaq -0xbc(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x2d280
movq -0x138(%rbp), %rsi
movq -0x118(%rbp), %rdi
callq 0xc7e0
movaps -0x130(%rbp), %xmm2
movlpd %xmm0, -0xb4(%rbp)
movss -0x8c(%rbp), %xmm1
movaps %xmm1, %xmm0
pxor %xmm2, %xmm0
leaq -0xcc(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x2d280
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rsi
callq 0xc7e0
movlpd %xmm0, -0xc4(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movss 0x431ee(%rip), %xmm0    # 0x5b018
callq 0x2ea40
movq -0x108(%rbp), %rdi
movl %eax, %ecx
leaq -0xb4(%rbp), %rsi
leaq -0xc4(%rbp), %rdx
movss 0x431ca(%rip), %xmm0    # 0x5b018
callq 0x404c0
cmpq $0x0, -0x8(%rbp)
je 0x17e72
testb $0x1, -0x7b(%rbp)
je 0x17e72
movq -0x8(%rbp), %rax
movb (%rax), %cl
xorb $-0x1, %cl
movq -0x8(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movb -0x7b(%rbp), %al
andb $0x1, %al
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq