// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabItemEx(ImGuiTabBar*, char const*, bool*, int)
bool    ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags)
{
    // Layout whole tab bar if not already done
    if (tab_bar->WantLayout)
        TabBarLayout(tab_bar);

    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (window->SkipItems)
        return false;

    const ImGuiStyle& style = g.Style;
    const ImGuiID id = TabBarCalcTabID(tab_bar, label);

    // If the user called us with *p_open == false, we early out and don't render.
    // We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID.
    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags);
    if (p_open && !*p_open)
    {
        PushItemFlag(ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus, true);
        ItemAdd(ImRect(), id);
        PopItemFlag();
        return false;
    }

    IM_ASSERT(!p_open || !(flags & ImGuiTabItemFlags_Button));
    IM_ASSERT((flags & (ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing)) != (ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing)); // Can't use both Leading and Trailing

    // Store into ImGuiTabItemFlags_NoCloseButton, also honor ImGuiTabItemFlags_NoCloseButton passed by user (although not documented)
    if (flags & ImGuiTabItemFlags_NoCloseButton)
        p_open = NULL;
    else if (p_open == NULL)
        flags |= ImGuiTabItemFlags_NoCloseButton;

    // Calculate tab contents size
    ImVec2 size = TabItemCalcSize(label, p_open != NULL);

    // Acquire tab data
    ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, id);
    bool tab_is_new = false;
    if (tab == NULL)
    {
        tab_bar->Tabs.push_back(ImGuiTabItem());
        tab = &tab_bar->Tabs.back();
        tab->ID = id;
        tab->Width = size.x;
        tab_bar->TabsAddedNew = true;
        tab_is_new = true;
    }
    tab_bar->LastTabItemIdx = (ImS16)tab_bar->Tabs.index_from_ptr(tab);
    tab->ContentWidth = size.x;
    tab->BeginOrder = tab_bar->TabsActiveCount++;

    const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
    const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0;
    const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount);
    const bool is_tab_button = (flags & ImGuiTabItemFlags_Button) != 0;
    tab->LastFrameVisible = g.FrameCount;
    tab->Flags = flags;

    // Append name with zero-terminator
    tab->NameOffset = (ImS16)tab_bar->TabsNames.size();
    tab_bar->TabsNames.append(label, label + strlen(label) + 1);

    // Update selected tab
    if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0)
        if (!tab_bar_appearing || tab_bar->SelectedTabId == 0)
            if (!is_tab_button)
                tab_bar->NextSelectedTabId = id;  // New tabs gets activated
    if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // SetSelected can only be passed on explicit tab bar
        if (!is_tab_button)
            tab_bar->NextSelectedTabId = id;

    // Lock visibility
    // (Note: tab_contents_visible != tab_selected... because CTRL+TAB operations may preview some tabs without selecting them!)
    bool tab_contents_visible = (tab_bar->VisibleTabId == id);
    if (tab_contents_visible)
        tab_bar->VisibleTabWasSubmitted = true;

    // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches
    if (!tab_contents_visible && tab_bar->SelectedTabId == 0 && tab_bar_appearing)
        if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs))
            tab_contents_visible = true;

    // Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted
    // and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'.
    if (tab_appearing && (!tab_bar_appearing || tab_is_new))
    {
        PushItemFlag(ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus, true);
        ItemAdd(ImRect(), id);
        PopItemFlag();
        if (is_tab_button)
            return false;
        return tab_contents_visible;
    }

    if (tab_bar->SelectedTabId == id)
        tab->LastFrameSelected = g.FrameCount;

    // Backup current layout position
    const ImVec2 backup_main_cursor_pos = window->DC.CursorPos;

    // Layout
    const bool is_central_section = (tab->Flags & (ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing)) == 0;
    size.x = tab->Width;
    if (is_central_section)
        window->DC.CursorPos = tab_bar->BarRect.Min + ImVec2(IM_FLOOR(tab->Offset - tab_bar->ScrollingAnim), 0.0f);
    else
        window->DC.CursorPos = tab_bar->BarRect.Min + ImVec2(tab->Offset, 0.0f);
    ImVec2 pos = window->DC.CursorPos;
    ImRect bb(pos, pos + size);

    // We don't have CPU clipping primitives to clip the CloseButton (until it becomes a texture), so need to add an extra draw call (temporary in the case of vertical animation)
    const bool want_clip_rect = is_central_section && (bb.Min.x < tab_bar->ScrollingRectMinX || bb.Max.x > tab_bar->ScrollingRectMaxX);
    if (want_clip_rect)
        PushClipRect(ImVec2(ImMax(bb.Min.x, tab_bar->ScrollingRectMinX), bb.Min.y - 1), ImVec2(tab_bar->ScrollingRectMaxX, bb.Max.y), true);

    ImVec2 backup_cursor_max_pos = window->DC.CursorMaxPos;
    ItemSize(bb.GetSize(), style.FramePadding.y);
    window->DC.CursorMaxPos = backup_cursor_max_pos;

    if (!ItemAdd(bb, id))
    {
        if (want_clip_rect)
            PopClipRect();
        window->DC.CursorPos = backup_main_cursor_pos;
        return tab_contents_visible;
    }

    // Click to Select a tab
    ImGuiButtonFlags button_flags = ((is_tab_button ? ImGuiButtonFlags_PressedOnClickRelease : ImGuiButtonFlags_PressedOnClick) | ImGuiButtonFlags_AllowItemOverlap);
    if (g.DragDropActive)
        button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;
    bool hovered, held;
    bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);
    if (pressed && !is_tab_button)
        tab_bar->NextSelectedTabId = id;
    hovered |= (g.HoveredId == id);

    // Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered)
    if (g.ActiveId != id)
        SetItemAllowOverlap();

    // Drag and drop: re-order tabs
    if (held && !tab_appearing && IsMouseDragging(0))
    {
        if (!g.DragDropActive && (tab_bar->Flags & ImGuiTabBarFlags_Reorderable))
        {
            // While moving a tab it will jump on the other side of the mouse, so we also test for MouseDelta.x
            if (g.IO.MouseDelta.x < 0.0f && g.IO.MousePos.x < bb.Min.x)
            {
                if (tab_bar->Flags & ImGuiTabBarFlags_Reorderable)
                    TabBarQueueReorder(tab_bar, tab, -1);
            }
            else if (g.IO.MouseDelta.x > 0.0f && g.IO.MousePos.x > bb.Max.x)
            {
                if (tab_bar->Flags & ImGuiTabBarFlags_Reorderable)
                    TabBarQueueReorder(tab_bar, tab, +1);
            }
        }
    }

#if 0
    if (hovered && g.HoveredIdNotActiveTimer > TOOLTIP_DELAY && bb.GetWidth() < tab->ContentWidth)
    {
        // Enlarge tab display when hovering
        bb.Max.x = bb.Min.x + IM_FLOOR(ImLerp(bb.GetWidth(), tab->ContentWidth, ImSaturate((g.HoveredIdNotActiveTimer - 0.40f) * 6.0f)));
        display_draw_list = GetForegroundDrawList(window);
        TabItemBackground(display_draw_list, bb, flags, GetColorU32(ImGuiCol_TitleBgActive));
    }
#endif

    // Render tab shape
    ImDrawList* display_draw_list = window->DrawList;
    const ImU32 tab_col = GetColorU32((held || hovered) ? ImGuiCol_TabHovered : tab_contents_visible ? (tab_bar_focused ? ImGuiCol_TabActive : ImGuiCol_TabUnfocusedActive) : (tab_bar_focused ? ImGuiCol_Tab : ImGuiCol_TabUnfocused));
    TabItemBackground(display_draw_list, bb, flags, tab_col);
    RenderNavHighlight(bb, id);

    // Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget.
    const bool hovered_unblocked = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);
    if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1)))
        if (!is_tab_button)
            tab_bar->NextSelectedTabId = id;

    if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)
        flags |= ImGuiTabItemFlags_NoCloseWithMiddleMouseButton;

    // Render tab label, process close button
    const ImGuiID close_button_id = p_open ? GetIDWithSeed("#CLOSE", NULL, id) : 0;
    bool just_closed;
    bool text_clipped;
    TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped);
    if (just_closed && p_open != NULL)
    {
        *p_open = false;
        TabBarCloseTab(tab_bar, tab);
    }

    // Restore main window position so user can draw there
    if (want_clip_rect)
        PopClipRect();
    window->DC.CursorPos = backup_main_cursor_pos;

    // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer)
    // We test IsItemHovered() to discard e.g. when another item is active or drag and drop over the tab bar (which g.HoveredId ignores)
    if (text_clipped && g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay && IsItemHovered())
        if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip) && !(tab->Flags & ImGuiTabItemFlags_NoTooltip))
            SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label);

    IM_ASSERT(!is_tab_button || !(tab_bar->SelectedTabId == tab->ID && is_tab_button)); // TabItemButton should not be selected
    if (is_tab_button)
        return pressed;
    return tab_contents_visible;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x6a(%rax)
je 0x15750d
movq -0x10(%rbp), %rdi
callq 0x155fb0
leaq 0xbba2c(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x1ae0(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x157540
movb $0x0, -0x1(%rbp)
jmp 0x15812e
movq -0x30(%rbp), %rax
addq $0x1560, %rax           # imm = 0x1560
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x158300
movl %eax, -0x44(%rbp)
jmp 0x157560
cmpq $0x0, -0x20(%rbp)
je 0x1575a6
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
jne 0x1575a6
movl $0x18, %edi
movl $0x1, %esi
callq 0xda0f0
leaq -0x54(%rbp), %rdi
callq 0xe8c60
movl -0x44(%rbp), %esi
leaq -0x54(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
callq 0xda1b0
movb $0x0, -0x1(%rbp)
jmp 0x15812e
movb $0x1, %al
cmpq $0x0, -0x20(%rbp)
movb %al, -0x149(%rbp)
je 0x1575cb
movl -0x24(%rbp), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x149(%rbp)
movb -0x149(%rbp), %al
testb $0x1, %al
jne 0x1575d7
jmp 0x1575d9
jmp 0x1575f8
leaq 0x38df3(%rip), %rdi     # 0x1903d3
leaq 0x36df9(%rip), %rsi     # 0x18e3e0
movl $0x1da8, %edx           # imm = 0x1DA8
leaq 0x38e0f(%rip), %rcx     # 0x190402
callq 0xd180
movl -0x24(%rbp), %eax
andl $0xc0, %eax
cmpl $0xc0, %eax
je 0x157609
jmp 0x157628
leaq 0x38e40(%rip), %rdi     # 0x190450
leaq 0x36dc9(%rip), %rsi     # 0x18e3e0
movl $0x1da9, %edx           # imm = 0x1DA9
leaq 0x38ddf(%rip), %rcx     # 0x190402
callq 0xd180
movl -0x24(%rbp), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
je 0x15763f
movq $0x0, -0x20(%rbp)
jmp 0x157653
cmpq $0x0, -0x20(%rbp)
jne 0x157651
movl -0x24(%rbp), %eax
orl $0x100000, %eax         # imm = 0x100000
movl %eax, -0x24(%rbp)
jmp 0x157653
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
testq %rax, %rax
setne %al
movzbl %al, %esi
callq 0x158380
movlpd %xmm0, -0x5c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x157030
movq %rax, -0x68(%rbp)
movb $0x0, -0x69(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x1576e3
movq -0x10(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x1629b0
movq -0x158(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x162940
movq -0x10(%rbp), %rdi
callq 0x162a00
movq %rax, -0x68(%rbp)
movl -0x44(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, (%rax)
movss -0x5c(%rbp), %xmm0
movq -0x68(%rbp), %rax
movss %xmm0, 0x14(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x6c(%rax)
movb $0x1, -0x69(%rbp)
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x162a60
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x70(%rax)
movss -0x5c(%rbp), %xmm0
movq -0x68(%rbp), %rax
movss %xmm0, 0x18(%rax)
movq -0x10(%rbp), %rax
movw 0x6e(%rax), %cx
movw %cx, %dx
addw $0x1, %dx
movw %dx, 0x6e(%rax)
movq -0x68(%rbp), %rax
movw %cx, 0x1e(%rax)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
addl $0x1, %eax
movq -0x30(%rbp), %rcx
cmpl 0x1a68(%rcx), %eax
setl %al
andb $0x1, %al
movb %al, -0x91(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x92(%rbp)
movq -0x68(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x30(%rbp), %rcx
cmpl 0x1a68(%rcx), %eax
setl %al
andb $0x1, %al
movb %al, -0x93(%rbp)
movl -0x24(%rbp), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x94(%rbp)
movq -0x30(%rbp), %rax
movl 0x1a68(%rax), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x24(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rdi
addq $0x88, %rdi
callq 0xec2b0
movw %ax, %cx
movq -0x68(%rbp), %rax
movw %cx, 0x1c(%rax)
movq -0x10(%rbp), %rax
addq $0x88, %rax
movq %rax, -0x168(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd410
movq -0x170(%rbp), %rdx
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rsi
addq %rax, %rdx
addq $0x1, %rdx
callq 0xc6ad0
testb $0x1, -0x93(%rbp)
je 0x157865
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x157865
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x157865
testb $0x1, -0x91(%rbp)
je 0x15784e
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x157863
testb $0x1, -0x94(%rbp)
jne 0x157861
movl -0x44(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x157863
jmp 0x157865
movl -0x24(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x157891
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x44(%rbp), %eax
je 0x157891
testb $0x1, -0x94(%rbp)
jne 0x15788f
movl -0x44(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x157891
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
cmpl -0x44(%rbp), %eax
sete %al
andb $0x1, %al
movb %al, -0x95(%rbp)
testb $0x1, -0x95(%rbp)
je 0x1578b7
movq -0x10(%rbp), %rax
movb $0x1, 0x6b(%rax)
testb $0x1, -0x95(%rbp)
jne 0x1578f4
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x1578f4
testb $0x1, -0x91(%rbp)
je 0x1578f4
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x1578f2
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x1578f2
movb $0x1, -0x95(%rbp)
jmp 0x1578f4
testb $0x1, -0x93(%rbp)
je 0x157961
testb $0x1, -0x91(%rbp)
je 0x15790c
testb $0x1, -0x69(%rbp)
je 0x157961
movl $0x18, %edi
movl $0x1, %esi
callq 0xda0f0
leaq -0xa8(%rbp), %rdi
callq 0xe8c60
movl -0x44(%rbp), %esi
leaq -0xa8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
callq 0xda1b0
testb $0x1, -0x94(%rbp)
je 0x157951
movb $0x0, -0x1(%rbp)
jmp 0x15812e
movb -0x95(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x15812e
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x44(%rbp), %eax
jne 0x15797e
movq -0x30(%rbp), %rax
movl 0x1a68(%rax), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x38(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, -0xb1(%rbp)
movq -0x68(%rbp), %rax
movss 0x14(%rax), %xmm0
movss %xmm0, -0x5c(%rbp)
testb $0x1, -0xb1(%rbp)
je 0x157a31
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x2c, %rcx
movq %rcx, -0x180(%rbp)
movq -0x68(%rbp), %rcx
movss 0x10(%rcx), %xmm0
movss 0x4c(%rax), %xmm1
subss %xmm1, %xmm0
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm0
leaq -0xc4(%rbp), %rdi
movq %rdi, -0x178(%rbp)
xorps %xmm1, %xmm1
callq 0xbf4c0
movq -0x180(%rbp), %rdi
movq -0x178(%rbp), %rsi
callq 0x139090
movlpd %xmm0, -0xbc(%rbp)
movq -0x38(%rbp), %rax
movq -0xbc(%rbp), %rcx
movq %rcx, 0xd8(%rax)
jmp 0x157a8c
movq -0x10(%rbp), %rax
addq $0x2c, %rax
movq %rax, -0x190(%rbp)
movq -0x68(%rbp), %rax
movss 0x10(%rax), %xmm0
leaq -0xd4(%rbp), %rdi
movq %rdi, -0x188(%rbp)
xorps %xmm1, %xmm1
callq 0xbf4c0
movq -0x190(%rbp), %rdi
movq -0x188(%rbp), %rsi
callq 0x139090
movlpd %xmm0, -0xcc(%rbp)
movq -0x38(%rbp), %rax
movq -0xcc(%rbp), %rcx
movq %rcx, 0xd8(%rax)
movq -0x38(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0xe0(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
callq 0x139090
movlpd %xmm0, -0xf8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
callq 0xe8660
xorl %eax, %eax
testb $0x1, -0xb1(%rbp)
movb %al, -0x191(%rbp)
je 0x157b24
movss -0xf0(%rbp), %xmm1
movq -0x10(%rbp), %rax
movss 0x5c(%rax), %xmm0
movb $0x1, %al
ucomiss %xmm1, %xmm0
movb %al, -0x192(%rbp)
ja 0x157b18
movss -0xe8(%rbp), %xmm0
movq -0x10(%rbp), %rax
ucomiss 0x60(%rax), %xmm0
seta %al
movb %al, -0x192(%rbp)
movb -0x192(%rbp), %al
movb %al, -0x191(%rbp)
movb -0x191(%rbp), %al
andb $0x1, %al
movb %al, -0xf9(%rbp)
testb $0x1, -0xf9(%rbp)
je 0x157ba6
movss -0xf0(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss 0x5c(%rax), %xmm1
callq 0x139050
movss -0xec(%rbp), %xmm1
movss 0x190db(%rip), %xmm2    # 0x170c3c
subss %xmm2, %xmm1
leaq -0x104(%rbp), %rdi
callq 0xbf4c0
movq -0x10(%rbp), %rax
movss 0x60(%rax), %xmm0
movss -0xe4(%rbp), %xmm1
leaq -0x10c(%rbp), %rdi
callq 0xbf4c0
leaq -0x104(%rbp), %rdi
leaq -0x10c(%rbp), %rsi
movl $0x1, %edx
callq 0xd34b0
movq -0x38(%rbp), %rax
movq 0xf0(%rax), %rax
movq %rax, -0x118(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0xeb560
movlpd %xmm0, -0x120(%rbp)
movq -0x40(%rbp), %rax
movss 0x3c(%rax), %xmm0
leaq -0x120(%rbp), %rdi
callq 0xd6030
movq -0x38(%rbp), %rax
movq -0x118(%rbp), %rcx
movq %rcx, 0xf0(%rax)
movl -0x44(%rbp), %esi
leaq -0xf0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
testb $0x1, %al
jne 0x157c3a
testb $0x1, -0xf9(%rbp)
je 0x157c18
callq 0xd3550
movq -0x38(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, 0xd8(%rax)
movb -0x95(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x15812e
movb -0x94(%rbp), %dl
movl $0x10, %eax
movl $0x20, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
orl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x124(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x2004(%rax)
je 0x157c79
movl -0x124(%rbp), %eax
orl $0x200, %eax            # imm = 0x200
movl %eax, -0x124(%rbp)
movl -0x44(%rbp), %esi
movl -0x124(%rbp), %r8d
leaq -0xf0(%rbp), %rdi
leaq -0x125(%rbp), %rdx
leaq -0x126(%rbp), %rcx
callq 0x139df0
andb $0x1, %al
movb %al, -0x127(%rbp)
testb $0x1, -0x127(%rbp)
je 0x157cc1
testb $0x1, -0x94(%rbp)
jne 0x157cc1
movl -0x44(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x30(%rbp), %rax
movl 0x1b1c(%rax), %eax
cmpl -0x44(%rbp), %eax
sete %al
andb $0x1, %al
movzbl %al, %ecx
movb -0x125(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
orl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x125(%rbp)
movq -0x30(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x44(%rbp), %eax
je 0x157d05
callq 0xd5760
testb $0x1, -0x126(%rbp)
je 0x157df9
testb $0x1, -0x93(%rbp)
jne 0x157df9
xorl %edi, %edi
movss 0x1a257(%rip), %xmm0    # 0x171f80
callq 0xd4fe0
testb $0x1, %al
jne 0x157d37
jmp 0x157df9
movq -0x30(%rbp), %rax
testb $0x1, 0x2004(%rax)
jne 0x157df7
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x157df7
movq -0x30(%rbp), %rax
xorps %xmm0, %xmm0
ucomiss 0x3b8(%rax), %xmm0
jbe 0x157da7
movq -0x30(%rbp), %rax
movss 0x128(%rax), %xmm1
movss -0xf0(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x157da7
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x157da5
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1571e0
jmp 0x157df5
movq -0x30(%rbp), %rax
movss 0x3b8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x157df3
movq -0x30(%rbp), %rax
movss 0x128(%rax), %xmm0
ucomiss -0xe8(%rbp), %xmm0
jbe 0x157df3
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x157df1
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl $0x1, %edx
callq 0x1571e0
jmp 0x157df3
jmp 0x157df5
jmp 0x157df7
jmp 0x157df9
movq -0x38(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x130(%rbp)
testb $0x1, -0x126(%rbp)
jne 0x157e1d
testb $0x1, -0x125(%rbp)
je 0x157e2a
movl $0x22, %eax
movl %eax, -0x198(%rbp)
jmp 0x157e79
testb $0x1, -0x95(%rbp)
je 0x157e51
movb -0x92(%rbp), %dl
movl $0x25, %eax
movl $0x23, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x19c(%rbp)
jmp 0x157e6d
movb -0x92(%rbp), %dl
movl $0x24, %eax
movl $0x21, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x19c(%rbp)
movl -0x19c(%rbp), %eax
movl %eax, -0x198(%rbp)
movl -0x198(%rbp), %edi
movss 0x18db5(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0x134(%rbp)
movq -0x130(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x134(%rbp), %ecx
leaq -0xf0(%rbp), %rsi
callq 0x158490
movl -0x44(%rbp), %esi
leaq -0xf0(%rbp), %rdi
movl $0x1, %edx
callq 0xc91e0
movl $0x8, %edi
callq 0xca1c0
andb $0x1, %al
movb %al, -0x135(%rbp)
testb $0x1, -0x135(%rbp)
je 0x157f12
movl $0x1, %edi
xorl %esi, %esi
callq 0xd4d60
testb $0x1, %al
jne 0x157efd
movl $0x1, %edi
callq 0xd4e60
testb $0x1, %al
jne 0x157efd
jmp 0x157f12
testb $0x1, -0x94(%rbp)
jne 0x157f10
movl -0x44(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x157f12
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x157f2a
movl -0x24(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x24(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x157f4c
movl -0x44(%rbp), %edx
leaq 0x1ec3b(%rip), %rdi     # 0x176b76
xorl %eax, %eax
movl %eax, %esi
callq 0xdb5e0
movl %eax, -0x1a0(%rbp)
jmp 0x157f56
xorl %eax, %eax
movl %eax, -0x1a0(%rbp)
jmp 0x157f56
movl -0x1a0(%rbp), %eax
movl %eax, -0x13c(%rbp)
movq -0x130(%rbp), %rdi
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x148(%rbp)
movq -0x18(%rbp), %rcx
movl -0x44(%rbp), %r8d
movl -0x13c(%rbp), %r9d
movb -0x95(%rbp), %sil
movsd -0x148(%rbp), %xmm0
movq %rsp, %rax
leaq -0x13e(%rbp), %r10
movq %r10, 0x10(%rax)
leaq -0x13d(%rbp), %r10
movq %r10, 0x8(%rax)
movzbl %sil, %esi
andl $0x1, %esi
movl %esi, (%rax)
leaq -0xf0(%rbp), %rsi
callq 0x158820
testb $0x1, -0x13d(%rbp)
je 0x157feb
cmpq $0x0, -0x20(%rbp)
je 0x157feb
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x157120
testb $0x1, -0xf9(%rbp)
je 0x157ff9
callq 0xd3550
movq -0x38(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, 0xd8(%rax)
testb $0x1, -0x13e(%rbp)
je 0x15809e
movq -0x30(%rbp), %rax
movl 0x1b1c(%rax), %eax
cmpl -0x44(%rbp), %eax
jne 0x15809e
testb $0x1, -0x126(%rbp)
jne 0x15809e
movq -0x30(%rbp), %rax
movss 0x1b2c(%rax), %xmm0
movq -0x30(%rbp), %rax
ucomiss 0x30ac(%rax), %xmm0
jbe 0x15809e
xorl %edi, %edi
callq 0xca1c0
testb $0x1, %al
jne 0x158056
jmp 0x15809e
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x15809c
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x15809c
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc8090
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
movq -0x18(%rbp), %rdx
leaq 0x1d75a(%rip), %rdi     # 0x1757ef
movb $0x0, %al
callq 0xd4170
jmp 0x15809e
movb $0x1, %al
testb $0x1, -0x94(%rbp)
movb %al, -0x1a1(%rbp)
je 0x1580e0
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x68(%rbp), %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, -0x1a2(%rbp)
jne 0x1580d2
movb -0x94(%rbp), %al
movb %al, -0x1a2(%rbp)
movb -0x1a2(%rbp), %al
xorb $-0x1, %al
movb %al, -0x1a1(%rbp)
movb -0x1a1(%rbp), %al
testb $0x1, %al
jne 0x1580ec
jmp 0x1580ee
jmp 0x15810d
leaq 0x383da(%rip), %rdi     # 0x1904cf
leaq 0x362e4(%rip), %rsi     # 0x18e3e0
movl $0x1e60, %edx           # imm = 0x1E60
leaq 0x382fa(%rip), %rcx     # 0x190402
callq 0xd180
testb $0x1, -0x94(%rbp)
je 0x158123
movb -0x127(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x15812e
movb -0x95(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nopl (%rax)