// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::NavEndFrame()
static void ImGui::NavEndFrame()
{
    ImGuiContext& g = *GImGui;

    // Show CTRL+TAB list window
    if (g.NavWindowingTarget != NULL)
        NavUpdateWindowingOverlay();

    // Perform wrap-around in menus
    ImGuiWindow* window = g.NavWrapRequestWindow;
    ImGuiNavMoveFlags move_flags = g.NavWrapRequestFlags;
    if (window != NULL && g.NavWindow == window && NavMoveRequestButNoResultYet() && g.NavMoveRequestForward == ImGuiNavForward_None && g.NavLayer == ImGuiNavLayer_Main)
    {
        IM_ASSERT(move_flags != 0); // No points calling this with no wrapping
        ImRect bb_rel = window->NavRectRel[0];

        ImGuiDir clip_dir = g.NavMoveDir;
        if (g.NavMoveDir == ImGuiDir_Left && (move_flags & (ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_LoopX)))
        {
            bb_rel.Min.x = bb_rel.Max.x =
                ImMax(window->SizeFull.x, window->ContentSize.x + window->WindowPadding.x * 2.0f) - window->Scroll.x;
            if (move_flags & ImGuiNavMoveFlags_WrapX)
            {
                bb_rel.TranslateY(-bb_rel.GetHeight());
                clip_dir = ImGuiDir_Up;
            }
            NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);
        }
        if (g.NavMoveDir == ImGuiDir_Right && (move_flags & (ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_LoopX)))
        {
            bb_rel.Min.x = bb_rel.Max.x = -window->Scroll.x;
            if (move_flags & ImGuiNavMoveFlags_WrapX)
            {
                bb_rel.TranslateY(+bb_rel.GetHeight());
                clip_dir = ImGuiDir_Down;
            }
            NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);
        }
        if (g.NavMoveDir == ImGuiDir_Up && (move_flags & (ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY)))
        {
            bb_rel.Min.y = bb_rel.Max.y =
                ImMax(window->SizeFull.y, window->ContentSize.y + window->WindowPadding.y * 2.0f) - window->Scroll.y;
            if (move_flags & ImGuiNavMoveFlags_WrapY)
            {
                bb_rel.TranslateX(-bb_rel.GetWidth());
                clip_dir = ImGuiDir_Left;
            }
            NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);
        }
        if (g.NavMoveDir == ImGuiDir_Down && (move_flags & (ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY)))
        {
            bb_rel.Min.y = bb_rel.Max.y = -window->Scroll.y;
            if (move_flags & ImGuiNavMoveFlags_WrapY)
            {
                bb_rel.TranslateX(+bb_rel.GetWidth());
                clip_dir = ImGuiDir_Right;
            }
            NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq 0x13f201(%rip), %rax    # 0x212f40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x1dc0(%rax)
je 0xd3d56
callq 0xe7b00
movq -0x8(%rbp), %rax
movq 0x1db0(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x1db8(%rax), %eax
movl %eax, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xd4046
movq -0x8(%rbp), %rax
movq 0x1c90(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0xd4046
callq 0xdf630
testb $0x1, %al
jne 0xd3da0
jmp 0xd4046
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1d08(%rax)
jne 0xd4046
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1cdc(%rax)
jne 0xd4046
cmpl $0x0, -0x14(%rbp)
je 0xd3dca
jmp 0xd3de9
leaq 0xa39d8(%rip), %rdi     # 0x1777a9
leaq 0x9f131(%rip), %rsi     # 0x172f09
movl $0x2413, %edx           # imm = 0x2413
leaq 0xa39d5(%rip), %rcx     # 0x1777b9
callq 0xd180
movq -0x10(%rbp), %rax
movq 0x3b8(%rax), %rcx
movq %rcx, -0x24(%rbp)
movq 0x3c0(%rax), %rax
movq %rax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0x1d10(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1d10(%rax)
jne 0xd3eb5
movl -0x14(%rbp), %eax
andl $0x5, %eax
cmpl $0x0, %eax
je 0xd3eb5
movq -0x10(%rbp), %rax
movss 0x20(%rax), %xmm0
movq -0x10(%rbp), %rax
movss 0x28(%rax), %xmm2
movq -0x10(%rbp), %rax
movss 0x40(%rax), %xmm1
addss %xmm1, %xmm1
addss %xmm2, %xmm1
callq 0xc88c0
movq -0x10(%rbp), %rax
subss 0x5c(%rax), %xmm0
movss %xmm0, -0x1c(%rbp)
movss %xmm0, -0x24(%rbp)
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xd3e9c
leaq -0x24(%rbp), %rdi
callq 0xeb860
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
leaq -0x24(%rbp), %rdi
callq 0xee830
movl $0x2, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x1d10(%rax), %edi
movl -0x28(%rbp), %esi
movl -0x14(%rbp), %ecx
leaq -0x24(%rbp), %rdx
callq 0xdf6b0
movq -0x8(%rbp), %rax
cmpl $0x1, 0x1d10(%rax)
jne 0xd3f2a
movl -0x14(%rbp), %eax
andl $0x5, %eax
cmpl $0x0, %eax
je 0xd3f2a
movq -0x10(%rbp), %rax
movss 0x5c(%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x1c(%rbp)
movss %xmm0, -0x24(%rbp)
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xd3f11
leaq -0x24(%rbp), %rdi
callq 0xeb860
leaq -0x24(%rbp), %rdi
callq 0xee830
movl $0x3, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x1d10(%rax), %edi
movl -0x28(%rbp), %esi
movl -0x14(%rbp), %ecx
leaq -0x24(%rbp), %rdx
callq 0xdf6b0
movq -0x8(%rbp), %rax
cmpl $0x2, 0x1d10(%rax)
jne 0xd3fcf
movl -0x14(%rbp), %eax
andl $0xa, %eax
cmpl $0x0, %eax
je 0xd3fcf
movq -0x10(%rbp), %rax
movss 0x24(%rax), %xmm0
movq -0x10(%rbp), %rax
movss 0x2c(%rax), %xmm2
movq -0x10(%rbp), %rax
movss 0x44(%rax), %xmm1
addss %xmm1, %xmm1
addss %xmm2, %xmm1
callq 0xc88c0
movq -0x10(%rbp), %rax
subss 0x60(%rax), %xmm0
movss %xmm0, -0x18(%rbp)
movss %xmm0, -0x20(%rbp)
movl -0x14(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xd3fb6
leaq -0x24(%rbp), %rdi
callq 0xeb840
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
leaq -0x24(%rbp), %rdi
callq 0xee870
movl $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x1d10(%rax), %edi
movl -0x28(%rbp), %esi
movl -0x14(%rbp), %ecx
leaq -0x24(%rbp), %rdx
callq 0xdf6b0
movq -0x8(%rbp), %rax
cmpl $0x3, 0x1d10(%rax)
jne 0xd4044
movl -0x14(%rbp), %eax
andl $0xa, %eax
cmpl $0x0, %eax
je 0xd4044
movq -0x10(%rbp), %rax
movss 0x60(%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x18(%rbp)
movss %xmm0, -0x20(%rbp)
movl -0x14(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xd402b
leaq -0x24(%rbp), %rdi
callq 0xeb840
leaq -0x24(%rbp), %rdi
callq 0xee870
movl $0x1, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x1d10(%rax), %edi
movl -0x28(%rbp), %esi
movl -0x14(%rbp), %ecx
leaq -0x24(%rbp), %rdx
callq 0xdf6b0
jmp 0xd4046
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)