// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TreeNodeBehavior(unsigned int, int, char const*, char const*)
bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return false;

    ImGuiContext& g = *GImGui;
    const ImGuiStyle& style = g.Style;
    const bool display_frame = (flags & ImGuiTreeNodeFlags_Framed) != 0;
    const ImVec2 padding = (display_frame || (flags & ImGuiTreeNodeFlags_FramePadding)) ? style.FramePadding : ImVec2(style.FramePadding.x, ImMin(window->DC.CurrLineTextBaseOffset, style.FramePadding.y));

    if (!label_end)
        label_end = FindRenderedTextEnd(label);
    const ImVec2 label_size = CalcTextSize(label, label_end, false);

    // We vertically grow up to current line height up the typical widget height.
    const float frame_height = ImMax(ImMin(window->DC.CurrLineSize.y, g.FontSize + style.FramePadding.y * 2), label_size.y + padding.y * 2);
    ImRect frame_bb;
    frame_bb.Min.x = (flags & ImGuiTreeNodeFlags_SpanFullWidth) ? window->WorkRect.Min.x : window->DC.CursorPos.x;
    frame_bb.Min.y = window->DC.CursorPos.y;
    frame_bb.Max.x = window->WorkRect.Max.x;
    frame_bb.Max.y = window->DC.CursorPos.y + frame_height;
    if (display_frame)
    {
        // Framed header expand a little outside the default padding, to the edge of InnerClipRect
        // (FIXME: May remove this at some point and make InnerClipRect align with WindowPadding.x instead of WindowPadding.x*0.5f)
        frame_bb.Min.x -= IM_FLOOR(window->WindowPadding.x * 0.5f - 1.0f);
        frame_bb.Max.x += IM_FLOOR(window->WindowPadding.x * 0.5f);
    }

    const float text_offset_x = g.FontSize + (display_frame ? padding.x * 3 : padding.x * 2);           // Collapser arrow width + Spacing
    const float text_offset_y = ImMax(padding.y, window->DC.CurrLineTextBaseOffset);                    // Latch before ItemSize changes it
    const float text_width = g.FontSize + (label_size.x > 0.0f ? label_size.x + padding.x * 2 : 0.0f);  // Include collapser
    ImVec2 text_pos(window->DC.CursorPos.x + text_offset_x, window->DC.CursorPos.y + text_offset_y);
    ItemSize(ImVec2(text_width, frame_height), padding.y);

    // For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing
    ImRect interact_bb = frame_bb;
    if (!display_frame && (flags & (ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth)) == 0)
        interact_bb.Max.x = frame_bb.Min.x + text_width + style.ItemSpacing.x * 2.0f;

    // Store a flag for the current depth to tell if we will allow closing this node when navigating one of its child.
    // For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop().
    // This is currently only support 32 level deep and we are fine with (1 << Depth) overflowing into a zero.
    const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0;
    bool is_open = TreeNodeBehaviorIsOpen(id, flags);
    if (is_open && !g.NavIdIsAlive && (flags & ImGuiTreeNodeFlags_NavLeftJumpsBackHere) && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
        window->DC.TreeJumpToParentOnPopMask |= (1 << window->DC.TreeDepth);

    bool item_add = ItemAdd(interact_bb, id);
    window->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_HasDisplayRect;
    window->DC.LastItemDisplayRect = frame_bb;

    if (!item_add)
    {
        if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
            TreePushOverrideID(id);
        IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.ItemFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));
        return is_open;
    }

    ImGuiButtonFlags button_flags = ImGuiTreeNodeFlags_None;
    if (flags & ImGuiTreeNodeFlags_AllowItemOverlap)
        button_flags |= ImGuiButtonFlags_AllowItemOverlap;
    if (!is_leaf)
        button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;

    // We allow clicking on the arrow section with keyboard modifiers held, in order to easily
    // allow browsing a tree while preserving selection with code implementing multi-selection patterns.
    // When clicking on the rest of the tree node we always disallow keyboard modifiers.
    const float arrow_hit_x1 = (text_pos.x - text_offset_x) - style.TouchExtraPadding.x;
    const float arrow_hit_x2 = (text_pos.x - text_offset_x) + (g.FontSize + padding.x * 2.0f) + style.TouchExtraPadding.x;
    const bool is_mouse_x_over_arrow = (g.IO.MousePos.x >= arrow_hit_x1 && g.IO.MousePos.x < arrow_hit_x2);
    if (window != g.HoveredWindow || !is_mouse_x_over_arrow)
        button_flags |= ImGuiButtonFlags_NoKeyModifiers;

    // Open behaviors can be altered with the _OpenOnArrow and _OnOnDoubleClick flags.
    // Some alteration have subtle effects (e.g. toggle on MouseUp vs MouseDown events) due to requirements for multi-selection and drag and drop support.
    // - Single-click on label = Toggle on MouseUp (default, when _OpenOnArrow=0)
    // - Single-click on arrow = Toggle on MouseDown (when _OpenOnArrow=0)
    // - Single-click on arrow = Toggle on MouseDown (when _OpenOnArrow=1)
    // - Double-click on label = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1)
    // - Double-click on arrow = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1 and _OpenOnArrow=0)
    // It is rather standard that arrow click react on Down rather than Up.
    // We set ImGuiButtonFlags_PressedOnClickRelease on OpenOnDoubleClick because we want the item to be active on the initial MouseDown in order for drag and drop to work.
    if (is_mouse_x_over_arrow)
        button_flags |= ImGuiButtonFlags_PressedOnClick;
    else if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
        button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick;
    else
        button_flags |= ImGuiButtonFlags_PressedOnClickRelease;

    bool selected = (flags & ImGuiTreeNodeFlags_Selected) != 0;
    const bool was_selected = selected;

    bool hovered, held;
    bool pressed = ButtonBehavior(interact_bb, id, &hovered, &held, button_flags);
    bool toggled = false;
    if (!is_leaf)
    {
        if (pressed && g.DragDropHoldJustPressedId != id)
        {
            if ((flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick)) == 0 || (g.NavActivateId == id))
                toggled = true;
            if (flags & ImGuiTreeNodeFlags_OpenOnArrow)
                toggled |= is_mouse_x_over_arrow && !g.NavDisableMouseHover; // Lightweight equivalent of IsMouseHoveringRect() since ButtonBehavior() already did the job
            if ((flags & ImGuiTreeNodeFlags_OpenOnDoubleClick) && g.IO.MouseDoubleClicked[0])
                toggled = true;
        }
        else if (pressed && g.DragDropHoldJustPressedId == id)
        {
            IM_ASSERT(button_flags & ImGuiButtonFlags_PressedOnDragDropHold);
            if (!is_open) // When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again.
                toggled = true;
        }

        if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Left && is_open)
        {
            toggled = true;
            NavMoveRequestCancel();
        }
        if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right && !is_open) // If there's something upcoming on the line we may want to give it the priority?
        {
            toggled = true;
            NavMoveRequestCancel();
        }

        if (toggled)
        {
            is_open = !is_open;
            window->DC.StateStorage->SetInt(id, is_open);
            window->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_ToggledOpen;
        }
    }
    if (flags & ImGuiTreeNodeFlags_AllowItemOverlap)
        SetItemAllowOverlap();

    // In this branch, TreeNodeBehavior() cannot toggle the selection so this will never trigger.
    if (selected != was_selected) //-V547
        window->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_ToggledSelection;

    // Render
    const ImU32 text_col = GetColorU32(ImGuiCol_Text);
    ImGuiNavHighlightFlags nav_highlight_flags = ImGuiNavHighlightFlags_TypeThin;
    if (display_frame)
    {
        // Framed type
        const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
        RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, true, style.FrameRounding);
        RenderNavHighlight(frame_bb, id, nav_highlight_flags);
        if (flags & ImGuiTreeNodeFlags_Bullet)
            RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.60f, text_pos.y + g.FontSize * 0.5f), text_col);
        else if (!is_leaf)
            RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y), text_col, is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f);
        else // Leaf without bullet, left-adjusted text
            text_pos.x -= text_offset_x;
        if (flags & ImGuiTreeNodeFlags_ClipLabelForTrailingButton)
            frame_bb.Max.x -= g.FontSize + style.FramePadding.x;
        if (g.LogEnabled)
        {
            // NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.
            const char log_prefix[] = "\n##";
            const char log_suffix[] = "##";
            LogRenderedText(&text_pos, log_prefix, log_prefix + 3);
            RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size);
            LogRenderedText(&text_pos, log_suffix, log_suffix + 2);
        }
        else
        {
            RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size);
        }
    }
    else
    {
        // Unframed typed for tree nodes
        if (hovered || selected)
        {
            const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
            RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, false);
            RenderNavHighlight(frame_bb, id, nav_highlight_flags);
        }
        if (flags & ImGuiTreeNodeFlags_Bullet)
            RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.5f, text_pos.y + g.FontSize * 0.5f), text_col);
        else if (!is_leaf)
            RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ImGuiDir_Down : ImGuiDir_Right, 0.70f);
        if (g.LogEnabled)
            LogRenderedText(&text_pos, ">");
        RenderText(text_pos, label, label_end, false);
    }

    if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
        TreePushOverrideID(id);
    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));
    return is_open;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
callq 0xeb270
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x151148
movb $0x0, -0x1(%rbp)
jmp 0x151f04
leaq 0xc1df1(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x1560, %rax           # imm = 0x1560
movq %rax, -0x38(%rbp)
movl -0xc(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x39(%rbp)
testb $0x1, -0x39(%rbp)
jne 0x151188
movl -0xc(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x151196
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x44(%rbp)
jmp 0x1511d5
movq -0x38(%rbp), %rax
movss 0x38(%rax), %xmm0
movss %xmm0, -0x11c(%rbp)
movq -0x28(%rbp), %rax
movss 0x110(%rax), %xmm0
movq -0x38(%rbp), %rax
movss 0x3c(%rax), %xmm1
callq 0x13c690
movaps %xmm0, %xmm1
movss -0x11c(%rbp), %xmm0
leaq -0x44(%rbp), %rdi
callq 0xbf4c0
cmpq $0x0, -0x20(%rbp)
jne 0x1511ed
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc8090
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
movss 0x20d81(%rip), %xmm0    # 0x171f80
callq 0xc87e0
movlpd %xmm0, -0x4c(%rbp)
movq -0x28(%rbp), %rax
movss 0x104(%rax), %xmm0
movq -0x30(%rbp), %rax
movss 0x1980(%rax), %xmm2
movq -0x38(%rbp), %rax
movss 0x3c(%rax), %xmm1
addss %xmm1, %xmm1
addss %xmm2, %xmm1
callq 0x13c690
movss -0x48(%rbp), %xmm2
movss -0x40(%rbp), %xmm1
addss %xmm1, %xmm1
addss %xmm2, %xmm1
callq 0x139050
movss %xmm0, -0x50(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xe8c60
movl -0xc(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x15127f
movq -0x28(%rbp), %rax
movss 0x238(%rax), %xmm0
movss %xmm0, -0x120(%rbp)
jmp 0x151293
movq -0x28(%rbp), %rax
movss 0xd8(%rax), %xmm0
movss %xmm0, -0x120(%rbp)
movss -0x120(%rbp), %xmm0
movss %xmm0, -0x60(%rbp)
movq -0x28(%rbp), %rax
movss 0xdc(%rax), %xmm0
movss %xmm0, -0x5c(%rbp)
movq -0x28(%rbp), %rax
movss 0x240(%rax), %xmm0
movss %xmm0, -0x58(%rbp)
movq -0x28(%rbp), %rax
movss 0xdc(%rax), %xmm0
addss -0x50(%rbp), %xmm0
movss %xmm0, -0x54(%rbp)
testb $0x1, -0x39(%rbp)
je 0x151338
movq -0x28(%rbp), %rax
movss 0x40(%rax), %xmm0
movss 0x20ce9(%rip), %xmm1    # 0x171fd8
mulss %xmm1, %xmm0
movss 0x20c85(%rip), %xmm1    # 0x171f80
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm1
movss -0x60(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0x60(%rbp)
movq -0x28(%rbp), %rax
movss 0x20cb7(%rip), %xmm0    # 0x171fd8
mulss 0x40(%rax), %xmm0
cvttss2si %xmm0, %eax
cvtsi2ss %eax, %xmm0
addss -0x58(%rbp), %xmm0
movss %xmm0, -0x58(%rbp)
movq -0x30(%rbp), %rax
movss 0x1980(%rax), %xmm0
movss %xmm0, -0x124(%rbp)
testb $0x1, -0x39(%rbp)
je 0x151369
movss 0x20c66(%rip), %xmm0    # 0x171fc0
mulss -0x44(%rbp), %xmm0
movss %xmm0, -0x128(%rbp)
jmp 0x15137e
movss 0x20c5b(%rip), %xmm0    # 0x171fcc
mulss -0x44(%rbp), %xmm0
movss %xmm0, -0x128(%rbp)
movss -0x124(%rbp), %xmm0
movss -0x128(%rbp), %xmm1
addss %xmm1, %xmm0
movss %xmm0, -0x64(%rbp)
movss -0x40(%rbp), %xmm0
movq -0x28(%rbp), %rax
movss 0x110(%rax), %xmm1
callq 0x139050
movss %xmm0, -0x68(%rbp)
movq -0x30(%rbp), %rax
movss 0x1980(%rax), %xmm0
movss %xmm0, -0x12c(%rbp)
movss -0x4c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x1513ef
movss -0x4c(%rbp), %xmm1
movss -0x44(%rbp), %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x130(%rbp)
jmp 0x1513fc
xorps %xmm0, %xmm0
movss %xmm0, -0x130(%rbp)
jmp 0x1513fc
movss -0x12c(%rbp), %xmm0
movss -0x130(%rbp), %xmm1
addss %xmm1, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x28(%rbp), %rax
movss 0xd8(%rax), %xmm0
addss -0x64(%rbp), %xmm0
movq -0x28(%rbp), %rax
movss 0xdc(%rax), %xmm1
addss -0x68(%rbp), %xmm1
leaq -0x74(%rbp), %rdi
callq 0xbf4c0
movss -0x6c(%rbp), %xmm0
movss -0x50(%rbp), %xmm1
leaq -0x7c(%rbp), %rdi
callq 0xbf4c0
movss -0x40(%rbp), %xmm0
leaq -0x7c(%rbp), %rdi
callq 0xd6030
movq -0x60(%rbp), %rax
movq %rax, -0x8c(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x84(%rbp)
testb $0x1, -0x39(%rbp)
jne 0x1514ad
movl -0xc(%rbp), %eax
andl $0x1800, %eax           # imm = 0x1800
cmpl $0x0, %eax
jne 0x1514ad
movss -0x60(%rbp), %xmm1
addss -0x6c(%rbp), %xmm1
movq -0x38(%rbp), %rax
movss 0x48(%rax), %xmm0
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x84(%rbp)
movl -0xc(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x8d(%rbp)
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0x152140
andb $0x1, %al
movb %al, -0x8e(%rbp)
testb $0x1, -0x8e(%rbp)
je 0x151527
movq -0x30(%rbp), %rax
testb $0x1, 0x1ce4(%rax)
jne 0x151527
movl -0xc(%rbp), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x151527
movl -0xc(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x151527
movq -0x28(%rbp), %rax
movl 0x18c(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
orl 0x190(%rax), %ecx
movl %ecx, 0x190(%rax)
movl -0x8(%rbp), %esi
leaq -0x8c(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
andb $0x1, %al
movb %al, -0x8f(%rbp)
movq -0x28(%rbp), %rax
movl 0x128(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x128(%rax)
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0x13c(%rax)
movq -0x58(%rbp), %rcx
movq %rcx, 0x144(%rax)
testb $0x1, -0x8f(%rbp)
jne 0x1515a8
testb $0x1, -0x8e(%rbp)
je 0x151594
movl -0xc(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x151594
movl -0x8(%rbp), %edi
callq 0x1522b0
jmp 0x151596
jmp 0x151598
movb -0x8e(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x151f04
movl $0x0, -0x94(%rbp)
movl -0xc(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1515ce
movl -0x94(%rbp), %eax
orl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x94(%rbp)
testb $0x1, -0x8d(%rbp)
jne 0x1515e8
movl -0x94(%rbp), %eax
orl $0x200, %eax            # imm = 0x200
movl %eax, -0x94(%rbp)
movss -0x74(%rbp), %xmm0
subss -0x64(%rbp), %xmm0
movq -0x38(%rbp), %rax
subss 0x60(%rax), %xmm0
movss %xmm0, -0x98(%rbp)
movss -0x74(%rbp), %xmm0
subss -0x64(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss 0x1980(%rax), %xmm2
movss -0x44(%rbp), %xmm1
addss %xmm1, %xmm1
addss %xmm2, %xmm1
addss %xmm1, %xmm0
movq -0x38(%rbp), %rax
addss 0x60(%rax), %xmm0
movss %xmm0, -0x9c(%rbp)
movq -0x30(%rbp), %rax
movss 0x128(%rax), %xmm0
xorl %eax, %eax
ucomiss -0x98(%rbp), %xmm0
movb %al, -0x131(%rbp)
jb 0x151678
movq -0x30(%rbp), %rax
movss 0x128(%rax), %xmm1
movss -0x9c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
seta %al
movb %al, -0x131(%rbp)
movb -0x131(%rbp), %al
andb $0x1, %al
movb %al, -0x9d(%rbp)
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x1ae8(%rcx), %rax
jne 0x1516a0
testb $0x1, -0x9d(%rbp)
jne 0x1516b1
movl -0x94(%rbp), %eax
orl $0x10000, %eax          # imm = 0x10000
movl %eax, -0x94(%rbp)
testb $0x1, -0x9d(%rbp)
je 0x1516cb
movl -0x94(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x94(%rbp)
jmp 0x1516fa
movl -0xc(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x1516e9
movl -0x94(%rbp), %eax
orl $0x120, %eax            # imm = 0x120
movl %eax, -0x94(%rbp)
jmp 0x1516f8
movl -0x94(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x94(%rbp)
jmp 0x1516fa
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x9e(%rbp)
movb -0x9e(%rbp), %al
andb $0x1, %al
movb %al, -0x9f(%rbp)
movl -0x8(%rbp), %esi
movl -0x94(%rbp), %r8d
leaq -0x8c(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq -0xa1(%rbp), %rcx
callq 0x139df0
andb $0x1, %al
movb %al, -0xa2(%rbp)
movb $0x0, -0xa3(%rbp)
testb $0x1, -0x8d(%rbp)
jne 0x15193b
testb $0x1, -0xa2(%rbp)
je 0x151816
movq -0x30(%rbp), %rax
movl 0x2080(%rax), %eax
cmpl -0x8(%rbp), %eax
je 0x151816
movl -0xc(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0x151798
movq -0x30(%rbp), %rax
movl 0x1ca0(%rax), %eax
cmpl -0x8(%rbp), %eax
jne 0x15179f
movb $0x1, -0xa3(%rbp)
movl -0xc(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1517f5
xorl %eax, %eax
testb $0x1, -0x9d(%rbp)
movb %al, -0x132(%rbp)
je 0x1517cf
movq -0x30(%rbp), %rax
movb 0x1ce7(%rax), %al
xorb $-0x1, %al
movb %al, -0x132(%rbp)
movb -0x132(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movb -0xa3(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
orl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0xa3(%rbp)
movl -0xc(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x151814
movq -0x30(%rbp), %rax
testb $0x1, 0x425(%rax)
je 0x151814
movb $0x1, -0xa3(%rbp)
jmp 0x151873
testb $0x1, -0xa2(%rbp)
je 0x151871
movq -0x30(%rbp), %rax
movl 0x2080(%rax), %eax
cmpl -0x8(%rbp), %eax
jne 0x151871
movl -0x94(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x151840
jmp 0x15185f
leaq 0x3e4dc(%rip), %rdi     # 0x18fd23
leaq 0x3cb92(%rip), %rsi     # 0x18e3e0
movl $0x1678, %edx           # imm = 0x1678
leaq 0x3e4ff(%rip), %rcx     # 0x18fd59
callq 0xd180
testb $0x1, -0x8e(%rbp)
jne 0x15186f
movb $0x1, -0xa3(%rbp)
jmp 0x151871
jmp 0x151873
movq -0x30(%rbp), %rax
movl 0x1c98(%rax), %eax
cmpl -0x8(%rbp), %eax
jne 0x1518b1
movq -0x30(%rbp), %rax
testb $0x1, 0x1d00(%rax)
je 0x1518b1
movq -0x30(%rbp), %rax
cmpl $0x0, 0x1d10(%rax)
jne 0x1518b1
testb $0x1, -0x8e(%rbp)
je 0x1518b1
movb $0x1, -0xa3(%rbp)
callq 0xdf680
movq -0x30(%rbp), %rax
movl 0x1c98(%rax), %eax
cmpl -0x8(%rbp), %eax
jne 0x1518ef
movq -0x30(%rbp), %rax
testb $0x1, 0x1d00(%rax)
je 0x1518ef
movq -0x30(%rbp), %rax
cmpl $0x1, 0x1d10(%rax)
jne 0x1518ef
testb $0x1, -0x8e(%rbp)
jne 0x1518ef
movb $0x1, -0xa3(%rbp)
callq 0xdf680
testb $0x1, -0xa3(%rbp)
je 0x151939
movb -0x8e(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x8e(%rbp)
movq -0x28(%rbp), %rax
movq 0x1a8(%rax), %rdi
movl -0x8(%rbp), %esi
movb -0x8e(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0xc6380
movq -0x28(%rbp), %rax
movl 0x128(%rax), %ecx
orl $0x10, %ecx
movl %ecx, 0x128(%rax)
jmp 0x15193b
movl -0xc(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x15194b
callq 0xd5760
movb -0x9e(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movb -0x9f(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x151979
movq -0x28(%rbp), %rax
movl 0x128(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0x128(%rax)
xorl %edi, %edi
movss 0x1f2b9(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0xa8(%rbp)
movl $0x2, -0xac(%rbp)
testb $0x1, -0x39(%rbp)
je 0x151cd0
testb $0x1, -0xa1(%rbp)
je 0x1519c1
testb $0x1, -0xa0(%rbp)
je 0x1519c1
movl $0x1a, %eax
movl %eax, -0x138(%rbp)
jmp 0x1519dd
movb -0xa0(%rbp), %dl
movl $0x18, %eax
movl $0x19, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x138(%rbp)
movl -0x138(%rbp), %edi
movss 0x1f251(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0xb0(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl -0xb0(%rbp), %edi
movq -0x38(%rbp), %rax
movss 0x40(%rax), %xmm2
movsd -0xb8(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm1
movl $0x1, %esi
callq 0xc8f20
movl -0x8(%rbp), %esi
movl -0xac(%rbp), %edx
leaq -0x60(%rbp), %rdi
callq 0xc91e0
movl -0xc(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x151acc
movq -0x28(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x140(%rbp)
movss -0x64(%rbp), %xmm1
movss 0x3c7a5(%rip), %xmm0    # 0x18e218
mulss %xmm0, %xmm1
movss -0x74(%rbp), %xmm0
movss -0x70(%rbp), %xmm2
addss %xmm1, %xmm0
movq -0x30(%rbp), %rax
movss 0x1980(%rax), %xmm1
movss 0x2053f(%rip), %xmm3    # 0x171fd8
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
leaq -0xc8(%rbp), %rdi
callq 0xbf4c0
movq -0x140(%rbp), %rdi
movl -0xa8(%rbp), %esi
movsd -0xc8(%rbp), %xmm0
callq 0x11cd90
jmp 0x151b58
testb $0x1, -0x8d(%rbp)
jne 0x151b43
movq -0x28(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x148(%rbp)
movss -0x64(%rbp), %xmm2
movss -0x74(%rbp), %xmm0
movss -0x70(%rbp), %xmm1
subss %xmm2, %xmm0
movss -0x44(%rbp), %xmm2
addss %xmm2, %xmm0
leaq -0xd0(%rbp), %rdi
callq 0xbf4c0
movq -0x148(%rbp), %rdi
movl -0xa8(%rbp), %esi
movzbl -0x8e(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %eax
leal 0x1(%rax,%rax), %edx
movsd -0xd0(%rbp), %xmm0
movss 0x1f100(%rip), %xmm1    # 0x170c3c
callq 0x11ca10
jmp 0x151b56
movss -0x64(%rbp), %xmm1
movss -0x74(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0x74(%rbp)
jmp 0x151b58
movl -0xc(%rbp), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
je 0x151b88
movq -0x30(%rbp), %rax
movss 0x1980(%rax), %xmm1
movq -0x38(%rbp), %rax
addss 0x38(%rax), %xmm1
movss -0x58(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0x58(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x3138(%rax)
je 0x151c61
movl 0x3e210(%rip), %eax     # 0x18fdaf
movl %eax, -0xd4(%rbp)
movw 0x3e204(%rip), %ax      # 0x18fdb0
movw %ax, -0xd7(%rbp)
movb 0x3e1f9(%rip), %al      # 0x18fdb2
movb %al, -0xd5(%rbp)
leaq -0xd4(%rbp), %rsi
leaq -0xd4(%rbp), %rdx
addq $0x3, %rdx
leaq -0x74(%rbp), %rdi
callq 0xc8240
leaq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x160(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x150(%rbp)
leaq -0xe0(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
movq -0x150(%rbp), %rcx
leaq -0x74(%rbp), %rdi
leaq -0x4c(%rbp), %r8
leaq -0xe0(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0xc8900
leaq -0xd7(%rbp), %rsi
leaq -0xd7(%rbp), %rdx
addq $0x2, %rdx
leaq -0x74(%rbp), %rdi
callq 0xc8240
jmp 0x151ccb
leaq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x178(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0xe8(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
movq -0x168(%rbp), %rcx
leaq -0x74(%rbp), %rdi
leaq -0x4c(%rbp), %r8
leaq -0xe8(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0xc8900
jmp 0x151ed9
testb $0x1, -0xa0(%rbp)
jne 0x151ce6
testb $0x1, -0x9e(%rbp)
je 0x151d82
testb $0x1, -0xa1(%rbp)
je 0x151d05
testb $0x1, -0xa0(%rbp)
je 0x151d05
movl $0x1a, %eax
movl %eax, -0x17c(%rbp)
jmp 0x151d21
movb -0xa0(%rbp), %dl
movl $0x18, %eax
movl $0x19, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x17c(%rbp)
movl -0x17c(%rbp), %edi
movss 0x1ef0d(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0xec(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x100(%rbp)
movl -0xec(%rbp), %edi
movsd -0xf8(%rbp), %xmm0
movsd -0x100(%rbp), %xmm1
xorl %esi, %esi
xorps %xmm2, %xmm2
callq 0xc8f20
movl -0x8(%rbp), %esi
movl -0xac(%rbp), %edx
leaq -0x60(%rbp), %rdi
callq 0xc91e0
movl -0xc(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x151dff
movq -0x28(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x188(%rbp)
movss -0x64(%rbp), %xmm1
movss 0x2022a(%rip), %xmm3    # 0x171fd8
mulss %xmm3, %xmm1
movss -0x74(%rbp), %xmm0
movss -0x70(%rbp), %xmm2
subss %xmm1, %xmm0
movq -0x30(%rbp), %rax
movss 0x1980(%rax), %xmm1
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
leaq -0x108(%rbp), %rdi
callq 0xbf4c0
movq -0x188(%rbp), %rdi
movl -0xa8(%rbp), %esi
movsd -0x108(%rbp), %xmm0
callq 0x11cd90
jmp 0x151e96
testb $0x1, -0x8d(%rbp)
jne 0x151e94
movq -0x28(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x190(%rbp)
movss -0x64(%rbp), %xmm1
movss -0x74(%rbp), %xmm0
movss -0x70(%rbp), %xmm2
subss %xmm1, %xmm0
movss -0x44(%rbp), %xmm1
addss %xmm1, %xmm0
movq -0x30(%rbp), %rax
movss 0x1980(%rax), %xmm1
movss 0x209aa(%rip), %xmm3    # 0x1727f8
mulss %xmm3, %xmm1
addss %xmm2, %xmm1
leaq -0x110(%rbp), %rdi
callq 0xbf4c0
movq -0x190(%rbp), %rdi
movl -0xa8(%rbp), %esi
movzbl -0x8e(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %eax
leal 0x1(%rax,%rax), %edx
movsd -0x110(%rbp), %xmm0
movss 0x20931(%rip), %xmm1    # 0x1727c0
callq 0x11ca10
jmp 0x151e96
movq -0x30(%rbp), %rax
testb $0x1, 0x3138(%rax)
je 0x151eb7
leaq -0x74(%rbp), %rdi
leaq 0x3ea6f(%rip), %rsi     # 0x19091d
xorl %eax, %eax
movl %eax, %edx
callq 0xc8240
movq -0x74(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movsd -0x118(%rbp), %xmm0
xorl %edx, %edx
callq 0xc8120
testb $0x1, -0x8e(%rbp)
je 0x151ef5
movl -0xc(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x151ef5
movl -0x8(%rbp), %edi
callq 0x1522b0
jmp 0x151ef7
jmp 0x151ef9
movb -0x8e(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nopw %cs:(%rax,%rax)