// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::BeginTooltipEx(int, int)
void ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags)
{
    ImGuiContext& g = *GImGui;

    if (g.DragDropWithinSource || g.DragDropWithinTarget)
    {
        // The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor)
        // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor.
        // Whatever we do we want to call SetNextWindowPos() to enforce a tooltip position and disable clipping the tooltip without our display area, like regular tooltip do.
        //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding;
        ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale);
        SetNextWindowPos(tooltip_pos);
        SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f);
        //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :(
        tooltip_flags |= ImGuiTooltipFlags_OverridePreviousTooltip;
    }

    char window_name[16];
    ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount);
    if (tooltip_flags & ImGuiTooltipFlags_OverridePreviousTooltip)
        if (ImGuiWindow* window = FindWindowByName(window_name))
            if (window->Active)
            {
                // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one.
                window->Hidden = true;
                window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary?
                ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount);
            }
    ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;
    Begin(window_name, NULL, flags | extra_flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq 0x1353cb(%rip), %rax    # 0x212f40
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x2005(%rax)
jne 0xddb97
movq -0x10(%rbp), %rax
testb $0x1, 0x2006(%rax)
je 0xddc2b
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x128, %rcx            # imm = 0x128
movq %rcx, -0x60(%rbp)
movss 0x1614(%rax), %xmm1
movss 0x94bd7(%rip), %xmm2    # 0x172790
movaps %xmm1, %xmm0
mulss %xmm2, %xmm0
movss 0x94b7c(%rip), %xmm2    # 0x172744
mulss %xmm2, %xmm1
leaq -0x20(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0xbf4c0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0xc41b0
movlpd %xmm0, -0x18(%rbp)
leaq -0x28(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0x18(%rbp), %rdi
xorl %esi, %esi
leaq -0x28(%rbp), %rdx
callq 0xdab40
movq -0x10(%rbp), %rax
movss 0x94393(%rip), %xmm0    # 0x171fa8
mulss 0x1670(%rax), %xmm0
callq 0xdae00
movl -0x8(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x30a8(%rax), %ecx
movl $0x10, %esi
leaq 0x9736d(%rip), %rdx     # 0x174fb2
movb $0x0, %al
callq 0xc4d30
movl -0x8(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xddcbc
leaq -0x40(%rbp), %rdi
callq 0xd6500
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0xddcba
movq -0x48(%rbp), %rax
testb $0x1, 0x8e(%rax)
je 0xddcb8
movq -0x48(%rbp), %rax
movb $0x1, 0x95(%rax)
movq -0x48(%rbp), %rax
movb $0x1, 0xac(%rax)
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x30a8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x30a8(%rax)
movl $0x10, %esi
leaq 0x97301(%rip), %rdx     # 0x174fb2
movb $0x0, %al
callq 0xc4d30
jmp 0xddcba
jmp 0xddcbc
movl $0x20c0347, -0x4c(%rbp) # imm = 0x20C0347
leaq -0x40(%rbp), %rdi
movl -0x4c(%rbp), %edx
orl -0x4(%rbp), %edx
xorl %eax, %eax
movl %eax, %esi
callq 0xd0170
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)