// File: Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGui::UpdateWindowManualResize(ImGuiWindow*, ImVec2 const&, int*, int, unsigned int*, ImRect const&)
static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindowFlags flags = window->Flags;

    if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
        return false;
    if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window.
        return false;

    bool ret_auto_fit = false;
    const int resize_border_count = g.IO.ConfigWindowsResizeFromEdges ? 4 : 0;
    const float grip_draw_size = IM_FLOOR(ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));
    const float grip_hover_inner_size = IM_FLOOR(grip_draw_size * 0.75f);
    const float grip_hover_outer_size = g.IO.ConfigWindowsResizeFromEdges ? WINDOWS_RESIZE_FROM_EDGES_HALF_THICKNESS : 0.0f;

    ImVec2 pos_target(FLT_MAX, FLT_MAX);
    ImVec2 size_target(FLT_MAX, FLT_MAX);

    // Resize grips and borders are on layer 1
    window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;

    // Manual resize grips
    PushID("#RESIZE");
    for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
    {
        const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n];
        const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPosN);

        // Using the FlattenChilds button flag we make the resize button accessible even if we are hovering over a child window
        ImRect resize_rect(corner - grip.InnerDir * grip_hover_outer_size, corner + grip.InnerDir * grip_hover_inner_size);
        if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x);
        if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y);
        bool hovered, held;
        ButtonBehavior(resize_rect, window->GetID(resize_grip_n), &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus);
        //GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));
        if (hovered || held)
            g.MouseCursor = (resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE;

        if (held && g.IO.MouseDoubleClicked[0] && resize_grip_n == 0)
        {
            // Manual auto-fit when double-clicking
            size_target = CalcWindowSizeAfterConstraint(window, size_auto_fit);
            ret_auto_fit = true;
            ClearActiveID();
        }
        else if (held)
        {
            // Resize from any of the four corners
            // We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position
            ImVec2 corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(grip.InnerDir * grip_hover_outer_size, grip.InnerDir * -grip_hover_inner_size, grip.CornerPosN); // Corner of the window corresponding to our corner grip
            ImVec2 clamp_min = ImVec2(grip.CornerPosN.x == 1.0f ? visibility_rect.Min.x : -FLT_MAX, grip.CornerPosN.y == 1.0f ? visibility_rect.Min.y : -FLT_MAX);
            ImVec2 clamp_max = ImVec2(grip.CornerPosN.x == 0.0f ? visibility_rect.Max.x : +FLT_MAX, grip.CornerPosN.y == 0.0f ? visibility_rect.Max.y : +FLT_MAX);
            corner_target = ImClamp(corner_target, clamp_min, clamp_max);
            CalcResizePosSizeFromAnyCorner(window, corner_target, grip.CornerPosN, &pos_target, &size_target);
        }
        if (resize_grip_n == 0 || held || hovered)
            resize_grip_col[resize_grip_n] = GetColorU32(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip);
    }
    for (int border_n = 0; border_n < resize_border_count; border_n++)
    {
        bool hovered, held;
        ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, WINDOWS_RESIZE_FROM_EDGES_HALF_THICKNESS);
        ButtonBehavior(border_rect, window->GetID(border_n + 4), &hovered, &held, ImGuiButtonFlags_FlattenChildren);
        //GetForegroundDrawLists(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255));
        if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held)
        {
            g.MouseCursor = (border_n & 1) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS;
            if (held)
                *border_held = border_n;
        }
        if (held)
        {
            ImVec2 border_target = window->Pos;
            ImVec2 border_posn;
            if (border_n == 0) { border_posn = ImVec2(0, 0); border_target.y = (g.IO.MousePos.y - g.ActiveIdClickOffset.y + WINDOWS_RESIZE_FROM_EDGES_HALF_THICKNESS); } // Top
            if (border_n == 1) { border_posn = ImVec2(1, 0); border_target.x = (g.IO.MousePos.x - g.ActiveIdClickOffset.x + WINDOWS_RESIZE_FROM_EDGES_HALF_THICKNESS); } // Right
            if (border_n == 2) { border_posn = ImVec2(0, 1); border_target.y = (g.IO.MousePos.y - g.ActiveIdClickOffset.y + WINDOWS_RESIZE_FROM_EDGES_HALF_THICKNESS); } // Bottom
            if (border_n == 3) { border_posn = ImVec2(0, 0); border_target.x = (g.IO.MousePos.x - g.ActiveIdClickOffset.x + WINDOWS_RESIZE_FROM_EDGES_HALF_THICKNESS); } // Left
            ImVec2 clamp_min = ImVec2(border_n == 1 ? visibility_rect.Min.x : -FLT_MAX, border_n == 2 ? visibility_rect.Min.y : -FLT_MAX);
            ImVec2 clamp_max = ImVec2(border_n == 3 ? visibility_rect.Max.x : +FLT_MAX, border_n == 0 ? visibility_rect.Max.y : +FLT_MAX);
            border_target = ImClamp(border_target, clamp_min, clamp_max);
            CalcResizePosSizeFromAnyCorner(window, border_target, border_posn, &pos_target, &size_target);
        }
    }
    PopID();

    // Restore nav layer
    window->DC.NavLayerCurrent = ImGuiNavLayer_Main;

    // Navigation resize (keyboard/gamepad)
    if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window)
    {
        ImVec2 nav_resize_delta;
        if (g.NavInputSource == ImGuiInputSource_NavKeyboard && g.IO.KeyShift)
            nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard, ImGuiInputReadMode_Down);
        if (g.NavInputSource == ImGuiInputSource_NavGamepad)
            nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_Down);
        if (nav_resize_delta.x != 0.0f || nav_resize_delta.y != 0.0f)
        {
            const float NAV_RESIZE_SPEED = 600.0f;
            nav_resize_delta *= ImFloor(NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y));
            nav_resize_delta = ImMax(nav_resize_delta, visibility_rect.Min - window->Pos - window->Size);
            g.NavWindowingToggleLayer = false;
            g.NavDisableMouseHover = true;
            resize_grip_col[0] = GetColorU32(ImGuiCol_ResizeGripActive);
            // FIXME-NAV: Should store and accumulate into a separate size buffer to handle sizing constraints properly, right now a constraint will make us stuck.
            size_target = CalcWindowSizeAfterConstraint(window, window->SizeFull + nav_resize_delta);
        }
    }

    // Apply back modified position/size to window
    if (size_target.x != FLT_MAX)
    {
        window->SizeFull = size_target;
        MarkIniSettingsDirty(window);
    }
    if (pos_target.x != FLT_MAX)
    {
        window->Pos = ImFloor(pos_target);
        MarkIniSettingsDirty(window);
    }

    window->Size = window->SizeFull;
    return ret_auto_fit;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq 0x13b467(%rip), %rax    # 0x212f40
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0xd7b1d
movl -0x44(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0xd7b1d
movq -0x10(%rbp), %rax
movsbl 0xa4(%rax), %eax
cmpl $0x0, %eax
jg 0xd7b1d
movq -0x10(%rbp), %rax
movsbl 0xa5(%rax), %eax
cmpl $0x0, %eax
jle 0xd7b26
movb $0x0, -0x1(%rbp)
jmp 0xd87ac
movq -0x10(%rbp), %rax
movb 0x8f(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xd7b43
movb $0x0, -0x1(%rbp)
jmp 0xd87ac
movb $0x0, -0x45(%rbp)
movq -0x40(%rbp), %rax
movb 0xcc(%rax), %dl
xorl %eax, %eax
movl $0x4, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4c(%rbp)
movq -0x40(%rbp), %rax
movss 0x9ac43(%rip), %xmm0    # 0x1727b0
mulss 0x1980(%rax), %xmm0
movq -0x10(%rbp), %rax
movss 0x990bb(%rip), %xmm2    # 0x170c3c
addss 0x48(%rax), %xmm2
movq -0x40(%rbp), %rax
movss 0x1980(%rax), %xmm1
movss 0x9a436(%rip), %xmm3    # 0x171fd0
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
callq 0xc88c0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x50(%rbp)
movss 0x9abf0(%rip), %xmm0    # 0x1727ac
mulss -0x50(%rbp), %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x54(%rbp)
movq -0x40(%rbp), %rax
movb 0xcc(%rax), %al
movss 0x9ab54(%rip), %xmm0    # 0x172734
xorps %xmm1, %xmm1
movss %xmm1, -0x1d4(%rbp)
testb $0x1, %al
movss %xmm0, -0x1d0(%rbp)
jne 0xd7c07
movss -0x1d4(%rbp), %xmm0
movss %xmm0, -0x1d0(%rbp)
movss -0x1d0(%rbp), %xmm0
movss %xmm0, -0x58(%rbp)
leaq -0x60(%rbp), %rdi
movss 0x9a394(%rip), %xmm1    # 0x171fb4
movaps %xmm1, %xmm0
callq 0xbf4c0
leaq -0x68(%rbp), %rdi
movss 0x9a380(%rip), %xmm1    # 0x171fb4
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x10(%rbp), %rax
movl $0x1, 0x14c(%rax)
leaq 0x9c2c0(%rip), %rdi     # 0x173f11
callq 0xdb440
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xd8119
movslq -0x6c(%rbp), %rax
leaq (%rax,%rax,2), %rcx
leaq 0x13b2e8(%rip), %rax    # 0x212f60
leaq (%rax,%rcx,8), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
movq %rdi, -0x1e8(%rbp)
addq $0x18, %rsi
callq 0xc41b0
movq -0x1e8(%rbp), %rdi
movlpd %xmm0, -0x88(%rbp)
movq -0x78(%rbp), %rdx
leaq -0x88(%rbp), %rsi
callq 0xe5680
movlpd %xmm0, -0x80(%rbp)
movq -0x78(%rbp), %rdi
addq $0x8, %rdi
movss -0x58(%rbp), %xmm0
callq 0xc2f50
movlpd %xmm0, -0xa8(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
leaq -0xa8(%rbp), %rsi
callq 0xc3c00
movlpd %xmm0, -0xa0(%rbp)
movq -0x78(%rbp), %rdi
addq $0x8, %rdi
movss -0x54(%rbp), %xmm0
callq 0xc2f50
movq -0x1e0(%rbp), %rdi
movlpd %xmm0, -0xb8(%rbp)
leaq -0xb8(%rbp), %rsi
callq 0xc41b0
movlpd %xmm0, -0xb0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0xe8660
movss -0x98(%rbp), %xmm0
ucomiss -0x90(%rbp), %xmm0
jbe 0xd7d6f
leaq -0x98(%rbp), %rdi
leaq -0x98(%rbp), %rsi
addq $0x8, %rsi
callq 0xc5c40
movss -0x94(%rbp), %xmm0
ucomiss -0x8c(%rbp), %xmm0
jbe 0xd7d9f
leaq -0x98(%rbp), %rdi
addq $0x4, %rdi
leaq -0x98(%rbp), %rsi
addq $0x8, %rsi
addq $0x4, %rsi
callq 0xc5c40
movq -0x10(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0xc9b30
movl %eax, %esi
leaq -0x98(%rbp), %rdi
leaq -0xb9(%rbp), %rdx
leaq -0xba(%rbp), %rcx
movl $0x40800, %r8d          # imm = 0x40800
callq 0x139df0
testb $0x1, -0xb9(%rbp)
jne 0xd7ddf
testb $0x1, -0xba(%rbp)
je 0xd7dff
movl -0x6c(%rbp), %edx
andl $0x1, %edx
movl $0x6, %ecx
movl $0x5, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x2000(%rax)
testb $0x1, -0xba(%rbp)
je 0xd7e5b
movq -0x40(%rbp), %rax
testb $0x1, 0x425(%rax)
je 0xd7e5b
cmpl $0x0, -0x6c(%rbp)
jne 0xd7e5b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movsd -0xd0(%rbp), %xmm0
callq 0xd6ac0
movlpd %xmm0, -0xc4(%rbp)
movq -0xc4(%rbp), %rax
movq %rax, -0x68(%rbp)
movb $0x1, -0x45(%rbp)
callq 0xca040
jmp 0xd809f
testb $0x1, -0xba(%rbp)
je 0xd809d
movq -0x40(%rbp), %rsi
movq %rsi, %rdi
addq $0x128, %rdi            # imm = 0x128
addq $0x1b58, %rsi           # imm = 0x1B58
callq 0xc3c00
movlpd %xmm0, -0xe0(%rbp)
movq -0x78(%rbp), %rdi
addq $0x8, %rdi
movss -0x58(%rbp), %xmm0
callq 0xc2f50
movlpd %xmm0, -0xf0(%rbp)
movq -0x78(%rbp), %rdi
addq $0x8, %rdi
movaps 0x9a13d(%rip), %xmm1    # 0x171ff0
movss -0x54(%rbp), %xmm0
pxor %xmm1, %xmm0
callq 0xc2f50
movlpd %xmm0, -0xf8(%rbp)
movq -0x78(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0xe5680
movlpd %xmm0, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xc41b0
movlpd %xmm0, -0xd8(%rbp)
movq -0x78(%rbp), %rax
movss (%rax), %xmm0
movss 0x98d29(%rip), %xmm1    # 0x170c3c
ucomiss %xmm1, %xmm0
jne 0xd7f2c
jp 0xd7f2c
movq -0x38(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x1ec(%rbp)
jmp 0xd7f3e
movss 0x9a824(%rip), %xmm0    # 0x172758
movss %xmm0, -0x1ec(%rbp)
jmp 0xd7f3e
movss -0x1ec(%rbp), %xmm0
movss %xmm0, -0x1f0(%rbp)
movq -0x78(%rbp), %rax
movss 0x4(%rax), %xmm0
movss 0x98cdd(%rip), %xmm1    # 0x170c3c
ucomiss %xmm1, %xmm0
jne 0xd7f79
jp 0xd7f79
movq -0x38(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x1f4(%rbp)
jmp 0xd7f8b
movss 0x9a7d7(%rip), %xmm0    # 0x172758
movss %xmm0, -0x1f4(%rbp)
jmp 0xd7f8b
movss -0x1f0(%rbp), %xmm0
movss -0x1f4(%rbp), %xmm1
leaq -0x100(%rbp), %rdi
callq 0xbf4c0
movq -0x78(%rbp), %rax
movss (%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xd7fcc
jp 0xd7fcc
movq -0x38(%rbp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x1f8(%rbp)
jmp 0xd7fde
movss 0x99fe0(%rip), %xmm0    # 0x171fb4
movss %xmm0, -0x1f8(%rbp)
jmp 0xd7fde
movss -0x1f8(%rbp), %xmm0
movss %xmm0, -0x1fc(%rbp)
movq -0x78(%rbp), %rax
movss 0x4(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xd8014
jp 0xd8014
movq -0x38(%rbp), %rax
movss 0xc(%rax), %xmm0
movss %xmm0, -0x200(%rbp)
jmp 0xd8026
movss 0x99f98(%rip), %xmm0    # 0x171fb4
movss %xmm0, -0x200(%rbp)
jmp 0xd8026
movss -0x1fc(%rbp), %xmm0
movss -0x200(%rbp), %xmm1
leaq -0x108(%rbp), %rdi
callq 0xbf4c0
movq -0x108(%rbp), %rax
movq %rax, -0x118(%rbp)
movsd -0x118(%rbp), %xmm0
leaq -0xd8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xdf120
movlpd %xmm0, -0x110(%rbp)
movq -0x110(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rdi
movq -0x78(%rbp), %rdx
leaq -0xd8(%rbp), %rsi
leaq -0x60(%rbp), %rcx
leaq -0x68(%rbp), %r8
callq 0xe56f0
jmp 0xd809f
cmpl $0x0, -0x6c(%rbp)
je 0xd80b7
testb $0x1, -0xba(%rbp)
jne 0xd80b7
testb $0x1, -0xb9(%rbp)
je 0xd8109
testb $0x1, -0xba(%rbp)
je 0xd80cd
movl $0x20, %eax
movl %eax, -0x204(%rbp)
jmp 0xd80e9
movb -0xb9(%rbp), %dl
movl $0x1e, %eax
movl $0x1f, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x204(%rbp)
movl -0x204(%rbp), %edi
movss 0x98b45(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, %edx
movq -0x30(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xd810b
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0xd7c5d
movl $0x0, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0xd8500
movq -0x10(%rbp), %rdi
movl -0x11c(%rbp), %esi
movss -0x54(%rbp), %xmm0
movss 0x9a5eb(%rip), %xmm1    # 0x172734
callq 0xe5800
movlpd %xmm0, -0x130(%rbp)
movlpd %xmm1, -0x128(%rbp)
movq -0x10(%rbp), %rdi
movl -0x11c(%rbp), %esi
addl $0x4, %esi
callq 0xc9b30
movl %eax, %esi
leaq -0x130(%rbp), %rdi
leaq -0x11d(%rbp), %rdx
leaq -0x11e(%rbp), %rcx
movl $0x800, %r8d            # imm = 0x800
callq 0x139df0
testb $0x1, -0x11d(%rbp)
je 0xd81b4
movq -0x40(%rbp), %rax
movss 0x1b28(%rax), %xmm0
movss 0x9a609(%rip), %xmm1    # 0x1727b8
ucomiss %xmm1, %xmm0
ja 0xd81bd
testb $0x1, -0x11e(%rbp)
je 0xd81f7
movl -0x11c(%rbp), %edx
andl $0x1, %edx
movl $0x3, %ecx
movl $0x4, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x2000(%rax)
testb $0x1, -0x11e(%rbp)
je 0xd81f5
movl -0x11c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0xd81f7
testb $0x1, -0x11e(%rbp)
je 0xd84ea
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x138(%rbp)
leaq -0x140(%rbp), %rdi
callq 0xe7de0
cmpl $0x0, -0x11c(%rbp)
jne 0xd8274
leaq -0x148(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x148(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x40(%rbp), %rax
movss 0x12c(%rax), %xmm0
movq -0x40(%rbp), %rax
subss 0x1b5c(%rax), %xmm0
movss 0x9a4cc(%rip), %xmm1    # 0x172734
addss %xmm1, %xmm0
movss %xmm0, -0x134(%rbp)
cmpl $0x1, -0x11c(%rbp)
jne 0xd82ce
leaq -0x150(%rbp), %rdi
movss 0x989b0(%rip), %xmm0    # 0x170c3c
xorps %xmm1, %xmm1
callq 0xbf4c0
movq -0x150(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x40(%rbp), %rax
movss 0x128(%rax), %xmm0
movq -0x40(%rbp), %rax
subss 0x1b58(%rax), %xmm0
movss 0x9a472(%rip), %xmm1    # 0x172734
addss %xmm1, %xmm0
movss %xmm0, -0x138(%rbp)
cmpl $0x2, -0x11c(%rbp)
jne 0xd8328
leaq -0x158(%rbp), %rdi
xorps %xmm0, %xmm0
movss 0x98953(%rip), %xmm1    # 0x170c3c
callq 0xbf4c0
movq -0x158(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x40(%rbp), %rax
movss 0x12c(%rax), %xmm0
movq -0x40(%rbp), %rax
subss 0x1b5c(%rax), %xmm0
movss 0x9a418(%rip), %xmm1    # 0x172734
addss %xmm1, %xmm0
movss %xmm0, -0x134(%rbp)
cmpl $0x3, -0x11c(%rbp)
jne 0xd837d
leaq -0x160(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x160(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x40(%rbp), %rax
movss 0x128(%rax), %xmm0
movq -0x40(%rbp), %rax
subss 0x1b58(%rax), %xmm0
movss 0x9a3c3(%rip), %xmm1    # 0x172734
addss %xmm1, %xmm0
movss %xmm0, -0x138(%rbp)
cmpl $0x1, -0x11c(%rbp)
jne 0xd8398
movq -0x38(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x208(%rbp)
jmp 0xd83aa
movss 0x9a3b8(%rip), %xmm0    # 0x172758
movss %xmm0, -0x208(%rbp)
jmp 0xd83aa
movss -0x208(%rbp), %xmm0
movss %xmm0, -0x20c(%rbp)
cmpl $0x2, -0x11c(%rbp)
jne 0xd83d6
movq -0x38(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x210(%rbp)
jmp 0xd83e8
movss 0x9a37a(%rip), %xmm0    # 0x172758
movss %xmm0, -0x210(%rbp)
jmp 0xd83e8
movss -0x20c(%rbp), %xmm0
movss -0x210(%rbp), %xmm1
leaq -0x168(%rbp), %rdi
callq 0xbf4c0
cmpl $0x3, -0x11c(%rbp)
jne 0xd8420
movq -0x38(%rbp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x214(%rbp)
jmp 0xd8432
movss 0x99b8c(%rip), %xmm0    # 0x171fb4
movss %xmm0, -0x214(%rbp)
jmp 0xd8432
movss -0x214(%rbp), %xmm0
movss %xmm0, -0x218(%rbp)
cmpl $0x0, -0x11c(%rbp)
jne 0xd845e
movq -0x38(%rbp), %rax
movss 0xc(%rax), %xmm0
movss %xmm0, -0x21c(%rbp)
jmp 0xd8470
movss 0x99b4e(%rip), %xmm0    # 0x171fb4
movss %xmm0, -0x21c(%rbp)
jmp 0xd8470
movss -0x218(%rbp), %xmm0
movss -0x21c(%rbp), %xmm1
leaq -0x170(%rbp), %rdi
callq 0xbf4c0
movq -0x170(%rbp), %rax
movq %rax, -0x180(%rbp)
movsd -0x180(%rbp), %xmm0
leaq -0x138(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xdf120
movlpd %xmm0, -0x178(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x140(%rbp), %rdx
leaq -0x60(%rbp), %rcx
leaq -0x68(%rbp), %r8
callq 0xe56f0
jmp 0xd84ec
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0xd8123
callq 0xdb640
movq -0x10(%rbp), %rax
movl $0x0, 0x14c(%rax)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x1dc0(%rax)
je 0xd872a
movq -0x40(%rbp), %rax
movq 0x1dc0(%rax), %rax
movq 0x390(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0xd872a
leaq -0x188(%rbp), %rdi
callq 0xe7de0
movq -0x40(%rbp), %rax
cmpl $0x3, 0x1cc4(%rax)
jne 0xd858f
movq -0x40(%rbp), %rax
testb $0x1, 0x141(%rax)
je 0xd858f
movl $0x1, %edi
xorl %esi, %esi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xdf970
movlpd %xmm0, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x4, 0x1cc4(%rax)
jne 0xd85c4
movl $0x2, %edi
xorl %esi, %esi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xdf970
movlpd %xmm0, -0x198(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x188(%rbp)
movss -0x188(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xd85ed
jp 0xd85ed
movss -0x184(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0xd85ed
jp 0xd85ed
jmp 0xd8728
movl $0x44160000, -0x19c(%rbp) # imm = 0x44160000
movq -0x40(%rbp), %rax
movss 0x18(%rax), %xmm1
movss 0xc0(%rax), %xmm0
movss 0x9a1a4(%rip), %xmm2    # 0x1727b4
mulss %xmm2, %xmm1
movss %xmm1, -0x234(%rbp)
movss 0xc4(%rax), %xmm1
callq 0xc4620
movaps %xmm0, %xmm1
movss -0x234(%rbp), %xmm0
mulss %xmm1, %xmm0
callq 0xc2f90
leaq -0x188(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0xdfb90
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x10, %rsi
callq 0xc3c00
movlpd %xmm0, -0x1b4(%rbp)
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
leaq -0x1b4(%rbp), %rdi
callq 0xc3c00
movq -0x230(%rbp), %rdi
movlpd %xmm0, -0x1ac(%rbp)
leaq -0x1ac(%rbp), %rsi
callq 0xd7960
movlpd %xmm0, -0x1a4(%rbp)
movq -0x1a4(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x40(%rbp), %rax
movb $0x0, 0x1de0(%rax)
movq -0x40(%rbp), %rax
movb $0x1, 0x1ce7(%rax)
movl $0x20, %edi
movss 0x9856b(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movq -0x230(%rbp), %rsi
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq %rdi, -0x228(%rbp)
addq $0x20, %rdi
callq 0xc41b0
movq -0x228(%rbp), %rdi
movlpd %xmm0, -0x1c4(%rbp)
movsd -0x1c4(%rbp), %xmm0
callq 0xd6ac0
movlpd %xmm0, -0x1bc(%rbp)
movq -0x1bc(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0xd872a
movss -0x68(%rbp), %xmm0
movss 0x9987d(%rip), %xmm1    # 0x171fb4
ucomiss %xmm1, %xmm0
jne 0xd8740
jp 0xd8740
jmp 0xd8755
movq -0x10(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rdi
callq 0xcb7c0
movss -0x60(%rbp), %xmm0
movss 0x99852(%rip), %xmm1    # 0x171fb4
ucomiss %xmm1, %xmm0
jne 0xd876b
jp 0xd876b
jmp 0xd8794
leaq -0x60(%rbp), %rdi
callq 0xc2f10
movlpd %xmm0, -0x1cc(%rbp)
movq -0x10(%rbp), %rax
movq -0x1cc(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0xcb7c0
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x20(%rcx), %rcx
movq %rcx, 0x18(%rax)
movb -0x45(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
nopw (%rax,%rax)