// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TabBarLayout(ImGuiTabBar*)
static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
{
    ImGuiContext& g = *GImGui;
    tab_bar->WantLayout = false;

    // Garbage collect by compacting list
    // Detect if we need to sort out tab list (e.g. in rare case where a tab changed section)
    int tab_dst_n = 0;
    bool need_sort_by_section = false;
    ImGuiTabBarSection sections[3]; // Layout sections: Leading, Central, Trailing
    for (int tab_src_n = 0; tab_src_n < tab_bar->Tabs.Size; tab_src_n++)
    {
        ImGuiTabItem* tab = &tab_bar->Tabs[tab_src_n];
        if (tab->LastFrameVisible < tab_bar->PrevFrameVisible || tab->WantClose)
        {
            // Remove tab
            if (tab_bar->VisibleTabId == tab->ID) { tab_bar->VisibleTabId = 0; }
            if (tab_bar->SelectedTabId == tab->ID) { tab_bar->SelectedTabId = 0; }
            if (tab_bar->NextSelectedTabId == tab->ID) { tab_bar->NextSelectedTabId = 0; }
            continue;
        }
        if (tab_dst_n != tab_src_n)
            tab_bar->Tabs[tab_dst_n] = tab_bar->Tabs[tab_src_n];

        tab = &tab_bar->Tabs[tab_dst_n];
        tab->IndexDuringLayout = (ImS16)tab_dst_n;

        // We will need sorting if tabs have changed section (e.g. moved from one of Leading/Central/Trailing to another)
        int curr_tab_section_n = (tab->Flags & ImGuiTabItemFlags_Leading) ? 0 : (tab->Flags & ImGuiTabItemFlags_Trailing) ? 2 : 1;
        if (tab_dst_n > 0)
        {
            ImGuiTabItem* prev_tab = &tab_bar->Tabs[tab_dst_n - 1];
            int prev_tab_section_n = (prev_tab->Flags & ImGuiTabItemFlags_Leading) ? 0 : (prev_tab->Flags & ImGuiTabItemFlags_Trailing) ? 2 : 1;
            if (curr_tab_section_n == 0 && prev_tab_section_n != 0)
                need_sort_by_section = true;
            if (prev_tab_section_n == 2 && curr_tab_section_n != 2)
                need_sort_by_section = true;
        }

        sections[curr_tab_section_n].TabCount++;
        tab_dst_n++;
    }
    if (tab_bar->Tabs.Size != tab_dst_n)
        tab_bar->Tabs.resize(tab_dst_n);

    if (need_sort_by_section)
        ImQsort(tab_bar->Tabs.Data, tab_bar->Tabs.Size, sizeof(ImGuiTabItem), TabItemComparerBySection);

    // Calculate spacing between sections
    sections[0].Spacing = sections[0].TabCount > 0 && (sections[1].TabCount + sections[2].TabCount) > 0 ? g.Style.ItemInnerSpacing.x : 0.0f;
    sections[1].Spacing = sections[1].TabCount > 0 && sections[2].TabCount > 0 ? g.Style.ItemInnerSpacing.x : 0.0f;

    // Setup next selected tab
    ImGuiID scroll_track_selected_tab_id = 0;
    if (tab_bar->NextSelectedTabId)
    {
        tab_bar->SelectedTabId = tab_bar->NextSelectedTabId;
        tab_bar->NextSelectedTabId = 0;
        scroll_track_selected_tab_id = tab_bar->SelectedTabId;
    }

    // Process order change request (we could probably process it when requested but it's just saner to do it in a single spot).
    if (tab_bar->ReorderRequestTabId != 0)
    {
        if (TabBarProcessReorder(tab_bar))
            if (tab_bar->ReorderRequestTabId == tab_bar->SelectedTabId)
                scroll_track_selected_tab_id = tab_bar->ReorderRequestTabId;
        tab_bar->ReorderRequestTabId = 0;
    }

    // Tab List Popup (will alter tab_bar->BarRect and therefore the available width!)
    const bool tab_list_popup_button = (tab_bar->Flags & ImGuiTabBarFlags_TabListPopupButton) != 0;
    if (tab_list_popup_button)
        if (ImGuiTabItem* tab_to_select = TabBarTabListPopupButton(tab_bar)) // NB: Will alter BarRect.Min.x!
            scroll_track_selected_tab_id = tab_bar->SelectedTabId = tab_to_select->ID;

    // Leading/Trailing tabs will be shrink only if central one aren't visible anymore, so layout the shrink data as: leading, trailing, central
    // (whereas our tabs are stored as: leading, central, trailing)
    int shrink_buffer_indexes[3] = { 0, sections[0].TabCount + sections[2].TabCount, sections[0].TabCount };
    g.ShrinkWidthBuffer.resize(tab_bar->Tabs.Size);

    // Compute ideal tabs widths + store them into shrink buffer
    ImGuiTabItem* most_recently_selected_tab = NULL;
    int curr_section_n = -1;
    bool found_selected_tab_id = false;
    for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)
    {
        ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
        IM_ASSERT(tab->LastFrameVisible >= tab_bar->PrevFrameVisible);

        if ((most_recently_selected_tab == NULL || most_recently_selected_tab->LastFrameSelected < tab->LastFrameSelected) && !(tab->Flags & ImGuiTabItemFlags_Button))
            most_recently_selected_tab = tab;
        if (tab->ID == tab_bar->SelectedTabId)
            found_selected_tab_id = true;
        if (scroll_track_selected_tab_id == 0 && g.NavJustMovedToId == tab->ID)
            scroll_track_selected_tab_id = tab->ID;

        // Refresh tab width immediately, otherwise changes of style e.g. style.FramePadding.x would noticeably lag in the tab bar.
        // Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet,
        // and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window.
        const char* tab_name = tab_bar->GetTabName(tab);
        const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true;
        tab->ContentWidth = TabItemCalcSize(tab_name, has_close_button).x;

        int section_n = (tab->Flags & ImGuiTabItemFlags_Leading) ? 0 : (tab->Flags & ImGuiTabItemFlags_Trailing) ? 2 : 1;
        ImGuiTabBarSection* section = &sections[section_n];
        section->Width += tab->ContentWidth + (section_n == curr_section_n ? g.Style.ItemInnerSpacing.x : 0.0f);
        curr_section_n = section_n;

        // Store data so we can build an array sorted by width if we need to shrink tabs down
        int shrink_buffer_index = shrink_buffer_indexes[section_n]++;
        g.ShrinkWidthBuffer[shrink_buffer_index].Index = tab_n;
        g.ShrinkWidthBuffer[shrink_buffer_index].Width = tab->ContentWidth;

        IM_ASSERT(tab->ContentWidth > 0.0f);
        tab->Width = tab->ContentWidth;
    }

    // Compute total ideal width (used for e.g. auto-resizing a window)
    tab_bar->WidthAllTabsIdeal = 0.0f;
    for (int section_n = 0; section_n < 3; section_n++)
        tab_bar->WidthAllTabsIdeal += sections[section_n].Width + sections[section_n].Spacing;

    // Horizontal scrolling buttons
    // (note that TabBarScrollButtons() will alter BarRect.Max.x)
    if ((tab_bar->WidthAllTabsIdeal > tab_bar->BarRect.GetWidth() && tab_bar->Tabs.Size > 1) && !(tab_bar->Flags & ImGuiTabBarFlags_NoTabListScrollingButtons) && (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll))
        if (ImGuiTabItem* scroll_track_selected_tab = TabBarScrollingButtons(tab_bar))
        {
            scroll_track_selected_tab_id = scroll_track_selected_tab->ID;
            if (!(scroll_track_selected_tab->Flags & ImGuiTabItemFlags_Button))
                tab_bar->SelectedTabId = scroll_track_selected_tab_id;
        }

    // Shrink widths if full tabs don't fit in their allocated space
    float section_0_w = sections[0].Width + sections[0].Spacing;
    float section_1_w = sections[1].Width + sections[1].Spacing;
    float section_2_w = sections[2].Width + sections[2].Spacing;
    bool central_section_is_visible = (section_0_w + section_2_w) < tab_bar->BarRect.GetWidth();
    float width_excess;
    if (central_section_is_visible)
        width_excess = ImMax(section_1_w - (tab_bar->BarRect.GetWidth() - section_0_w - section_2_w), 0.0f); // Excess used to shrink central section
    else
        width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section

    // With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore
    if (width_excess > 0.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible))
    {
        int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount);
        int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);
        ShrinkWidths(g.ShrinkWidthBuffer.Data + shrink_data_offset, shrink_data_count, width_excess);

        // Apply shrunk values into tabs and sections
        for (int tab_n = shrink_data_offset; tab_n < shrink_data_offset + shrink_data_count; tab_n++)
        {
            ImGuiTabItem* tab = &tab_bar->Tabs[g.ShrinkWidthBuffer[tab_n].Index];
            float shrinked_width = IM_FLOOR(g.ShrinkWidthBuffer[tab_n].Width);
            if (shrinked_width < 0.0f)
                continue;

            int section_n = (tab->Flags & ImGuiTabItemFlags_Leading) ? 0 : (tab->Flags & ImGuiTabItemFlags_Trailing) ? 2 : 1;
            sections[section_n].Width -= (tab->Width - shrinked_width);
            tab->Width = shrinked_width;
        }
    }

    // Layout all active tabs
    int section_tab_index = 0;
    float tab_offset = 0.0f;
    tab_bar->WidthAllTabs = 0.0f;
    for (int section_n = 0; section_n < 3; section_n++)
    {
        ImGuiTabBarSection* section = &sections[section_n];
        if (section_n == 2)
            tab_offset = ImMin(ImMax(0.0f, tab_bar->BarRect.GetWidth() - section->Width), tab_offset);

        for (int tab_n = 0; tab_n < section->TabCount; tab_n++)
        {
            ImGuiTabItem* tab = &tab_bar->Tabs[section_tab_index + tab_n];
            tab->Offset = tab_offset;
            tab_offset += tab->Width + (tab_n < section->TabCount - 1 ? g.Style.ItemInnerSpacing.x : 0.0f);
        }
        tab_bar->WidthAllTabs += ImMax(section->Width + section->Spacing, 0.0f);
        tab_offset += section->Spacing;
        section_tab_index += section->TabCount;
    }

    // If we have lost the selected tab, select the next most recently active one
    if (found_selected_tab_id == false)
        tab_bar->SelectedTabId = 0;
    if (tab_bar->SelectedTabId == 0 && tab_bar->NextSelectedTabId == 0 && most_recently_selected_tab != NULL)
        scroll_track_selected_tab_id = tab_bar->SelectedTabId = most_recently_selected_tab->ID;

    // Lock in visible tab
    tab_bar->VisibleTabId = tab_bar->SelectedTabId;
    tab_bar->VisibleTabWasSubmitted = false;

    // Update scrolling
    if (scroll_track_selected_tab_id)
        if (ImGuiTabItem* scroll_track_selected_tab = TabBarFindTabByID(tab_bar, scroll_track_selected_tab_id))
            TabBarScrollToTab(tab_bar, scroll_track_selected_tab, sections);
    tab_bar->ScrollingAnim = TabBarScrollClamp(tab_bar, tab_bar->ScrollingAnim);
    tab_bar->ScrollingTarget = TabBarScrollClamp(tab_bar, tab_bar->ScrollingTarget);
    if (tab_bar->ScrollingAnim != tab_bar->ScrollingTarget)
    {
        // Scrolling speed adjust itself so we can always reach our target in 1/3 seconds.
        // Teleport if we are aiming far off the visible line
        tab_bar->ScrollingSpeed = ImMax(tab_bar->ScrollingSpeed, 70.0f * g.FontSize);
        tab_bar->ScrollingSpeed = ImMax(tab_bar->ScrollingSpeed, ImFabs(tab_bar->ScrollingTarget - tab_bar->ScrollingAnim) / 0.3f);
        const bool teleport = (tab_bar->PrevFrameVisible + 1 < g.FrameCount) || (tab_bar->ScrollingTargetDistToVisibility > 10.0f * g.FontSize);
        tab_bar->ScrollingAnim = teleport ? tab_bar->ScrollingTarget : ImLinearSweep(tab_bar->ScrollingAnim, tab_bar->ScrollingTarget, g.IO.DeltaTime * tab_bar->ScrollingSpeed);
    }
    else
    {
        tab_bar->ScrollingSpeed = 0.0f;
    }
    tab_bar->ScrollingRectMinX = tab_bar->BarRect.Min.x + sections[0].Width + sections[0].Spacing;
    tab_bar->ScrollingRectMaxX = tab_bar->BarRect.Max.x - sections[2].Width - sections[1].Spacing;

    // Clear name buffers
    if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0)
        tab_bar->TabsNames.Buf.resize(0);

    // Actual layout in host window (we don't do it in BeginTabBar() so as not to waste an extra frame)
    ImGuiWindow* window = g.CurrentWindow;
    window->DC.CursorPos = tab_bar->BarRect.Min;
    ItemSize(ImVec2(tab_bar->WidthAllTabs, tab_bar->BarRect.GetHeight()), tab_bar->FramePadding.y);
    window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, %rbx
leaq 0x57fa3(%rip), %rax     # 0xe3ce0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movb $0x0, 0x6a(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
andl $0x0, -0x70(%rbp)
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %rdi, -0xa8(%rbp)
movl (%rbx), %eax
cmpl %eax, %r15d
jge 0x8be7c
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4bc4e
movl 0x8(%rax), %ecx
cmpl 0x28(%rbx), %ecx
jl 0x8bd8e
cmpb $0x1, 0x22(%rax)
jne 0x8bdb4
movl (%rax), %eax
cmpl %eax, 0x20(%rbx)
jne 0x8bd99
andl $0x0, 0x20(%rbx)
cmpl %eax, 0x18(%rbx)
jne 0x8bda2
andl $0x0, 0x18(%rbx)
cmpl %eax, 0x1c(%rbx)
jne 0x8be74
andl $0x0, 0x1c(%rbx)
jmp 0x8be74
cmpl %r14d, %r15d
je 0x8bdec
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4bc4e
movq %rax, %r12
movq %rbx, %rdi
movl %r14d, %esi
callq 0x4bc4e
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm0, (%rax)
movups %xmm1, 0x10(%rax)
movl 0x1f(%r12), %ecx
movl %ecx, 0x1f(%rax)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x4bc4e
movw %r14w, 0x20(%rax)
movq %rbx, %rdi
movl 0x4(%rax), %ebx
xorl %eax, %eax
testb %bl, %bl
sets %al
incq %rax
testb $0x40, %bl
movl $0x0, %r12d
cmoveq %rax, %r12
testl %r14d, %r14d
jle 0x8be5f
movq %r13, -0x50(%rbp)
movl %ebx, %r13d
shrb $0x6, %r13b
leal -0x1(%r14), %esi
callq 0x4bc4e
movl 0x4(%rax), %eax
testb $0x40, %al
sete %cl
andb %r13b, %cl
movl $0xc0, %edx
andl %edx, %eax
movl $0x80, %esi
cmpl %esi, %eax
sete %al
andl %edx, %ebx
cmpl %esi, %ebx
setne %dl
andb %al, %dl
orb -0x50(%rbp), %cl
orb %dl, %cl
movl %ecx, %r13d
imulq $0xc, %r12, %rax
incl -0x90(%rbp,%rax)
incl %r14d
movq -0xa8(%rbp), %rbx
incl %r15d
jmp 0x8bd6a
cmpl %r14d, %eax
je 0x8be8c
movq %rbx, %rdi
movl %r14d, %esi
callq 0x93436
testb $0x1, %r13b
je 0x8bea8
movq 0x8(%rbx), %rdi
movslq (%rbx), %rsi
leaq 0x2889(%rip), %rcx      # 0x8e729
pushq $0x24
popq %rdx
callq 0xc650
movl -0x90(%rbp), %eax
movl -0x84(%rbp), %edx
movl %eax, -0x5c(%rbp)
testl %eax, %eax
setg %al
movl -0x78(%rbp), %r15d
leal (%r15,%rdx), %ecx
testl %ecx, %ecx
setg %cl
andb %al, %cl
xorps %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
xorps %xmm1, %xmm1
cmpb $0x1, %cl
jne 0x8bee7
movq -0x40(%rbp), %rax
movss 0x15b0(%rax), %xmm1
movss %xmm1, -0x88(%rbp)
movq %rdx, -0xb0(%rbp)
testl %edx, %edx
setg %al
testl %r15d, %r15d
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8bf19
movq -0x40(%rbp), %rax
movss 0x15b0(%rax), %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x34(%rbp), %xmm0
movss %xmm0, -0x7c(%rbp)
movl 0x1c(%rbx), %r14d
testl %r14d, %r14d
je 0x8bf34
movl %r14d, 0x18(%rbx)
andl $0x0, 0x1c(%rbx)
cmpl $0x0, 0x64(%rbx)
movss %xmm1, -0x30(%rbp)
je 0x8bf5f
movq %rbx, %rdi
callq 0x8cc21
testb %al, %al
je 0x8bf55
movl 0x64(%rbx), %eax
cmpl 0x18(%rbx), %eax
cmovel %eax, %r14d
movl %r14d, -0x2c(%rbp)
andl $0x0, 0x64(%rbx)
jmp 0x8bf63
movl %r14d, -0x2c(%rbp)
testb $0x4, 0x10(%rbx)
je 0x8c0c1
movq %r15, -0x50(%rbp)
leaq 0x57d68(%rip), %rax     # 0xe3ce0
movq (%rax), %rax
movq 0x1ae0(%rax), %r12
movss 0x159c(%rax), %xmm0
movss 0x1980(%rax), %xmm1
addss %xmm0, %xmm1
movq 0xd8(%r12), %r13
movss 0x2c(%rbx), %xmm2
subss %xmm0, %xmm2
movl 0x30(%rbx), %ecx
movss %xmm2, 0xd8(%r12)
movl %ecx, 0xdc(%r12)
addss 0x2c(%rbx), %xmm1
movss %xmm1, 0x2c(%rbx)
movups 0x1624(%rax), %xmm0
leaq -0x110(%rbp), %rsi
movaps %xmm0, (%rsi)
movss 0xc(%rsi), %xmm0
mulss 0x10034(%rip), %xmm0    # 0x9c018
movss %xmm0, 0xc(%rsi)
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x35e60
xorps %xmm0, %xmm0
leaq -0xf0(%rbp), %rsi
movaps %xmm0, (%rsi)
pushq $0x15
popq %rdi
callq 0x35e60
leaq 0x1ae00(%rip), %rdi     # 0xa6e0f
pushq $0x50
popq %rdx
xorl %esi, %esi
callq 0x7cfa7
movl %eax, %r15d
pushq $0x2
popq %rdi
callq 0x35eb4
testb %r15b, %r15b
je 0x8c08c
movq %r13, -0x68(%rbp)
movq %r12, -0x58(%rbp)
leaq -0xf0(%rbp), %r15
xorl %r13d, %r13d
cmpl (%rbx), %r14d
jge 0x8c09a
movq %rbx, %rdi
movl %r14d, %esi
callq 0x4bc4e
testb $0x20, 0x6(%rax)
jne 0x8c087
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4bc84
movl 0x18(%rbx), %ecx
xorl %esi, %esi
cmpl (%r12), %ecx
sete %sil
andq $0x0, -0xf0(%rbp)
movq %rax, %rdi
xorl %edx, %edx
movq %r15, %rcx
callq 0x7d81c
testb %al, %al
cmovneq %r12, %r13
incl %r14d
jmp 0x8c03b
movq %r13, 0xd8(%r12)
movq -0x50(%rbp), %r15
jmp 0x8c0c1
callq 0x44bbe
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, 0xd8(%rax)
testq %r13, %r13
movq -0x50(%rbp), %r15
je 0x8c0c1
movl (%r13), %eax
movl %eax, -0x2c(%rbp)
movl %eax, 0x18(%rbx)
andl $0x0, -0xcc(%rbp)
movl -0x5c(%rbp), %eax
addl %eax, %r15d
movl %r15d, -0xc8(%rbp)
movl %eax, -0xc4(%rbp)
movq -0x40(%rbp), %rax
leaq 0x2148(%rax), %rdi
movl (%rbx), %esi
movq %rdi, -0xa0(%rbp)
callq 0x93474
pushq $-0x1
popq %r13
xorl %r15d, %r15d
movl $0x0, -0x68(%rbp)
movq $0x0, -0x58(%rbp)
movl (%rbx), %eax
cmpl %eax, %r15d
jge 0x8c26b
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4bc4e
movq %rax, %r14
movl 0x8(%rax), %eax
cmpl 0x28(%rbx), %eax
jl 0x8ca9f
movq -0x58(%rbp), %rax
testq %rax, %rax
movl -0x2c(%rbp), %ecx
je 0x8c14c
movq -0x58(%rbp), %rax
movl 0xc(%rax), %eax
cmpl 0xc(%r14), %eax
movq -0x58(%rbp), %rax
jge 0x8c159
testb $0x20, 0x6(%r14)
cmoveq %r14, %rax
movq %rax, -0x58(%rbp)
movl (%r14), %eax
cmpl 0x18(%rbx), %eax
movl -0x68(%rbp), %edx
movzbl %dl, %edx
pushq $0x1
popq %rsi
cmovel %esi, %edx
movl %edx, -0x68(%rbp)
testl %ecx, %ecx
jne 0x8c186
movq -0x40(%rbp), %rcx
cmpl %eax, 0x1cb4(%rcx)
movl $0x0, %ecx
cmovnel %ecx, %eax
movl %eax, %ecx
movl %ecx, -0x2c(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4bc84
xorl %esi, %esi
btl $0x14, 0x4(%r14)
setae %sil
movq %rax, %rdi
callq 0x8d692
movss %xmm0, 0x18(%r14)
movl 0x4(%r14), %eax
xorl %r12d, %r12d
testb %al, %al
sets %r12b
incl %r12d
testb $0x40, %al
movl $0x0, %eax
cmovnel %eax, %r12d
xorps %xmm1, %xmm1
cmpl %r13d, %r12d
jne 0x8c1dd
movq -0x40(%rbp), %rax
movss 0x15b0(%rax), %xmm1
addss %xmm1, %xmm0
imulq $0xc, %r12, %rax
addss -0x8c(%rbp,%rax), %xmm0
movss %xmm0, -0x8c(%rbp,%rax)
movl -0xcc(%rbp,%r12,4), %r13d
leal 0x1(%r13), %eax
movl %eax, -0xcc(%rbp,%r12,4)
movq -0xa0(%rbp), %rbx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x934b2
movl %r15d, (%rax)
movss 0x18(%r14), %xmm0
movss %xmm0, -0x50(%rbp)
movq %rbx, %rdi
movl %r13d, %esi
callq 0x934b2
movss -0x50(%rbp), %xmm0
movss %xmm0, 0x4(%rax)
movss 0x18(%r14), %xmm0
ucomiss 0x10677(%rip), %xmm0    # 0x9c8c4
jbe 0x8cabe
movss %xmm0, 0x14(%r14)
incl %r15d
movl %r12d, %r13d
movq -0xa8(%rbp), %rbx
jmp 0x8c10a
xorps %xmm0, %xmm0
pushq $0x8
popq %rcx
movl -0x2c(%rbp), %edx
cmpq $0x2c, %rcx
je 0x8c296
movss -0x94(%rbp,%rcx), %xmm1
addss -0x90(%rbp,%rcx), %xmm1
addss %xmm1, %xmm0
addq $0xc, %rcx
jmp 0x8c274
movss %xmm0, 0x48(%rbx)
movss 0x34(%rbx), %xmm1
cmpl $0x2, %eax
jl 0x8c539
movaps %xmm1, %xmm2
subss 0x2c(%rbx), %xmm2
ucomiss %xmm2, %xmm0
jbe 0x8c539
movl $0x90, %eax
andl 0x10(%rbx), %eax
cmpl $0x80, %eax
jne 0x8c539
leaq 0x57a0c(%rip), %rax     # 0xe3ce0
movq (%rax), %r12
movq 0x1ae0(%r12), %r13
movss 0x1980(%r12), %xmm0
movss 0x105c7(%rip), %xmm1    # 0x9c8b8
addss %xmm0, %xmm1
movaps %xmm1, -0xc0(%rbp)
movss 0x159c(%r12), %xmm2
addss %xmm2, %xmm2
addss %xmm0, %xmm2
movaps %xmm2, -0xe0(%rbp)
addss %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq 0xd8(%r13), %rax
movq %rax, -0xf8(%rbp)
movups 0x1624(%r12), %xmm0
leaq -0x110(%rbp), %rsi
movaps %xmm0, (%rsi)
movss 0xc(%rsi), %xmm0
mulss 0xfccd(%rip), %xmm0     # 0x9c018
movss %xmm0, 0xc(%rsi)
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x35e60
xorps %xmm0, %xmm0
leaq -0xf0(%rbp), %rsi
movaps %xmm0, (%rsi)
pushq $0x15
popq %rdi
callq 0x35e60
movq 0x94(%r12), %rax
movq %rax, -0x98(%rbp)
movabsq $0x3e4ccccd3e800000, %rax # imm = 0x3E4CCCCD3E800000
movq %rax, 0x94(%r12)
movss 0x2c(%rbx), %xmm0
movss 0x34(%rbx), %xmm1
subss -0x50(%rbp), %xmm1
movaps %xmm1, %xmm3
cmpless %xmm0, %xmm3
movaps %xmm3, %xmm2
andnps %xmm1, %xmm2
andps %xmm0, %xmm3
orps %xmm2, %xmm3
movaps %xmm3, -0x120(%rbp)
movl 0x30(%rbx), %eax
movss %xmm3, 0xd8(%r13)
movl %eax, 0xdc(%r13)
movaps -0xc0(%rbp), %xmm0
unpcklps -0xe0(%rbp), %xmm0      # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movaps %xmm0, -0xe0(%rbp)
leaq 0x2e1e2(%rip), %rdi     # 0xba5cb
xorl %esi, %esi
movl $0x410, %edx            # imm = 0x410
callq 0x7a7d3
movzbl %al, %r14d
negl %r14d
movaps -0x120(%rbp), %xmm0
addss -0xc0(%rbp), %xmm0
movl 0x30(%rbx), %eax
movss %xmm0, 0xd8(%r13)
movq %r13, -0xc0(%rbp)
movl %eax, 0xdc(%r13)
leaq 0x2e1a3(%rip), %rdi     # 0xba5cf
pushq $0x1
popq %r13
movl %r13d, %esi
movaps -0xe0(%rbp), %xmm0
movl $0x410, %edx            # imm = 0x410
callq 0x7a7d3
testb %al, %al
cmovnel %r13d, %r14d
pushq $0x2
popq %rdi
callq 0x35eb4
movq -0x98(%rbp), %rax
movq %rax, 0x94(%r12)
movl %r14d, -0x98(%rbp)
testl %r14d, %r14d
je 0x8c4f4
movl 0x18(%rbx), %esi
movq %rbx, %rdi
callq 0x8cadd
testq %rax, %rax
je 0x8c4f1
movq %rbx, %rdi
movq %rax, %rsi
callq 0x932f2
movl %eax, %r13d
movl %eax, %r14d
addl -0x98(%rbp), %r14d
xorl %eax, %eax
movl -0x2c(%rbp), %edx
movq -0xc0(%rbp), %r12
movq %rax, %r15
testq %r15, %r15
jne 0x8c4fe
testl %r14d, %r14d
js 0x8c4ba
movl %r14d, %esi
cmpl (%rbx), %r14d
jl 0x8c4bd
movl %r13d, %esi
movq %rbx, %rdi
callq 0x4bc4e
movq %rax, %r15
testb $0x20, 0x6(%rax)
movl -0x2c(%rbp), %edx
je 0x8c4a8
movl -0x98(%rbp), %eax
addl %eax, %r13d
addl %eax, %r14d
movq %r15, %rax
js 0x8c4a5
movl $0x0, %eax
cmpl (%rbx), %r14d
jl 0x8c4a5
movq %r15, %rax
jmp 0x8c4a5
xorl %r15d, %r15d
movl -0x2c(%rbp), %edx
movq -0xc0(%rbp), %r12
movq -0xf8(%rbp), %rax
movq %rax, 0xd8(%r12)
movaps -0x50(%rbp), %xmm0
addss 0xfadf(%rip), %xmm0     # 0x9bff8
movss 0x34(%rbx), %xmm1
subss %xmm0, %xmm1
movss %xmm1, 0x34(%rbx)
testq %r15, %r15
je 0x8c539
movl (%r15), %edx
testb $0x20, 0x6(%r15)
jne 0x8c539
movl %edx, 0x18(%rbx)
movl %edx, -0x2c(%rbp)
movss -0x8c(%rbp), %xmm4
addss -0x30(%rbp), %xmm4
xorps %xmm3, %xmm3
movss -0x74(%rbp), %xmm5
addss %xmm3, %xmm5
movaps %xmm4, %xmm2
addss %xmm5, %xmm2
movq %rbx, %r12
subss 0x2c(%rbx), %xmm1
ucomiss %xmm2, %xmm1
ja 0x8c572
movaps %xmm2, %xmm0
subss %xmm1, %xmm0
jmp 0x8c590
movss -0x80(%rbp), %xmm0
addss -0x34(%rbp), %xmm0
movaps %xmm1, %xmm6
subss %xmm4, %xmm6
subss %xmm5, %xmm6
subss %xmm6, %xmm0
ucomiss %xmm3, %xmm0
jb 0x8c5ac
ucomiss %xmm3, %xmm0
jbe 0x8c5ac
ucomiss %xmm2, %xmm1
jbe 0x8c76e
movl 0x10(%r12), %eax
andl $0x40, %eax
jne 0x8c76e
movq %r12, %rbx
andl $0x0, 0x44(%r12)
xorl %ecx, %ecx
xorl %r15d, %r15d
xorps %xmm2, %xmm2
cmpq $0x3, %rcx
je 0x8c6bf
imulq $0xc, %rcx, %rax
addq %rbp, %rax
addq $-0x90, %rax
cmpq $0x2, %rcx
movq %rcx, -0xa0(%rbp)
jne 0x8c606
movss 0x34(%rbx), %xmm0
subss 0x2c(%rbx), %xmm0
subss 0x4(%rax), %xmm0
movaps %xmm0, %xmm1
cmpless 0x102c8(%rip), %xmm1    # 0x9c8c4
andnps %xmm0, %xmm1
minss %xmm2, %xmm1
movaps %xmm1, %xmm2
movss %xmm2, -0x50(%rbp)
movq %rax, -0xb0(%rbp)
movl (%rax), %r12d
leal -0x1(%r12), %ebx
xorl %r14d, %r14d
testl %r12d, %r12d
movl $0x0, %r13d
cmovgl %r12d, %r13d
cmpl %r14d, %r13d
je 0x8c670
leal (%r15,%r14), %esi
movq -0xa8(%rbp), %rdi
callq 0x4bc4e
movss -0x50(%rbp), %xmm1
movss %xmm1, 0x10(%rax)
xorps %xmm0, %xmm0
cmpl %ebx, %r14d
jge 0x8c65d
movq -0x40(%rbp), %rcx
movss 0x15b0(%rcx), %xmm0
addss 0x14(%rax), %xmm0
addss %xmm0, %xmm1
movss %xmm1, -0x50(%rbp)
incl %r14d
jmp 0x8c62a
movq -0xb0(%rbp), %rax
movss 0x8(%rax), %xmm0
movss 0x4(%rax), %xmm1
addss %xmm0, %xmm1
xorps %xmm2, %xmm2
cmpless %xmm1, %xmm2
andps %xmm1, %xmm2
movq -0xa8(%rbp), %rbx
addss 0x44(%rbx), %xmm2
movss %xmm2, 0x44(%rbx)
movss -0x50(%rbp), %xmm2
addss %xmm0, %xmm2
addl %r15d, %r12d
movq -0xa0(%rbp), %rcx
incq %rcx
movl %r12d, %r15d
jmp 0x8c5bd
testb $0x1, -0x68(%rbp)
movl -0x2c(%rbp), %esi
jne 0x8c6ce
andl $0x0, 0x18(%rbx)
jmp 0x8c6d5
movl 0x18(%rbx), %eax
testl %eax, %eax
jne 0x8c6ed
xorl %eax, %eax
cmpl $0x0, 0x1c(%rbx)
jne 0x8c6ed
movq -0x58(%rbp), %rcx
testq %rcx, %rcx
je 0x8c6ed
movl (%rcx), %eax
movl %eax, 0x18(%rbx)
movl %eax, %esi
movl %eax, 0x20(%rbx)
movb $0x0, 0x6b(%rbx)
testl %esi, %esi
je 0x8c8c7
movq %rbx, %rdi
callq 0x8cadd
testq %rax, %rax
je 0x8c8c7
movq %rax, %r14
testb $-0x40, 0x4(%rax)
jne 0x8c8c7
leaq 0x575bf(%rip), %rax     # 0xe3ce0
movq (%rax), %rax
movss 0x1980(%rax), %xmm0
movss %xmm0, -0x50(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x932f2
movss 0x34(%rbx), %xmm2
subss 0x2c(%rbx), %xmm2
movss -0x8c(%rbp), %xmm1
movss 0x10(%r14), %xmm0
subss %xmm1, %xmm0
cmpl -0x5c(%rbp), %eax
jl 0x8c836
movss -0x50(%rbp), %xmm4
movaps %xmm4, %xmm3
jmp 0x8c843
movl -0x78(%rbp), %r14d
addl -0x5c(%rbp), %r14d
xorl %eax, %eax
ucomiss %xmm2, %xmm1
movq -0xb0(%rbp), %r15
cmovbel %r14d, %r15d
cmovbel %eax, %r14d
movslq %r14d, %r13
leaq (,%r13,8), %rdi
movq -0x40(%rbp), %rax
addq 0x2150(%rax), %rdi
movl %r15d, %esi
callq 0x7ce26
addl %r15d, %r13d
movq -0xa0(%rbp), %rbx
cmpl %r13d, %r14d
jge 0x8c5ac
movq %rbx, %rdi
movl %r14d, %esi
callq 0x934b2
movl (%rax), %esi
movq %r12, %rdi
callq 0x4bc4e
movq %rax, %r15
movq %rbx, %rdi
movl %r14d, %esi
callq 0x934b2
cvttss2si 0x4(%rax), %eax
testl %eax, %eax
js 0x8c82e
cvtsi2ss %eax, %xmm0
movl 0x4(%r15), %eax
xorl %ecx, %ecx
testb %al, %al
sets %cl
incq %rcx
testb $0x40, %al
movl $0x0, %eax
cmovneq %rax, %rcx
movss 0x14(%r15), %xmm1
subss %xmm0, %xmm1
imulq $0xc, %rcx, %rax
movss -0x8c(%rbp,%rax), %xmm2
subss %xmm1, %xmm2
movss %xmm2, -0x8c(%rbp,%rax)
movss %xmm0, 0x14(%r15)
incl %r14d
jmp 0x8c7b2
movss 0x2b8ae(%rip), %xmm3    # 0xb80ec
movss -0x50(%rbp), %xmm4
subss %xmm1, %xmm2
movaps %xmm0, %xmm1
subss %xmm3, %xmm1
addss 0x14(%r14), %xmm0
incl %eax
movl (%rbx), %ecx
subl -0x78(%rbp), %ecx
cmpl %ecx, %eax
jl 0x8c867
movss 0xf791(%rip), %xmm4     # 0x9bff8
subss -0x74(%rbp), %xmm2
andl $0x0, 0x54(%rbx)
addss %xmm4, %xmm0
movss 0x50(%rbx), %xmm3
ucomiss %xmm1, %xmm3
ja 0x8c8a9
subss -0x34(%rbp), %xmm2
movaps %xmm0, %xmm4
subss %xmm1, %xmm4
ucomiss %xmm2, %xmm4
jae 0x8c8a9
subss %xmm2, %xmm0
ucomiss %xmm3, %xmm0
jbe 0x8c8c7
subss %xmm2, %xmm1
subss 0x4c(%rbx), %xmm1
movaps %xmm1, %xmm2
movaps %xmm0, %xmm1
jmp 0x8c8b2
movss 0x4c(%rbx), %xmm2
subss %xmm0, %xmm2
xorps %xmm0, %xmm0
cmpless %xmm2, %xmm0
andps %xmm2, %xmm0
movss %xmm0, 0x54(%rbx)
movss %xmm1, 0x50(%rbx)
movss 0x4c(%rbx), %xmm0
movq %rbx, %rdi
callq 0x8e768
movaps %xmm0, -0x50(%rbp)
movss %xmm0, 0x4c(%rbx)
movss 0x50(%rbx), %xmm0
movq %rbx, %rdi
callq 0x8e768
movaps -0x50(%rbp), %xmm6
movss %xmm0, 0x50(%rbx)
ucomiss %xmm0, %xmm6
jne 0x8c8fe
jnp 0x8c98d
movss 0x58(%rbx), %xmm2
movq -0x40(%rbp), %rcx
movss 0x1980(%rcx), %xmm1
movss 0x15915(%rip), %xmm3    # 0xa222c
mulss %xmm1, %xmm3
movaps %xmm3, %xmm4
cmpless %xmm2, %xmm4
andps %xmm4, %xmm2
andnps %xmm3, %xmm4
movaps %xmm0, %xmm3
subss %xmm6, %xmm3
andps 0xfeb9(%rip), %xmm3     # 0x9c7f0
divss 0xffe1(%rip), %xmm3     # 0x9c920
orps %xmm2, %xmm4
movaps %xmm3, %xmm2
cmpless %xmm4, %xmm2
movaps %xmm2, %xmm5
andps %xmm4, %xmm5
andnps %xmm3, %xmm2
orps %xmm5, %xmm2
movss %xmm2, 0x58(%rbx)
movl 0x28(%rbx), %eax
incl %eax
cmpl 0x1a68(%rcx), %eax
jl 0x8c97e
movss 0x54(%rbx), %xmm3
mulss 0xf6a7(%rip), %xmm1     # 0x9c01c
ucomiss %xmm1, %xmm3
jbe 0x8ca5c
movaps %xmm0, %xmm6
movss -0x30(%rbp), %xmm3
movss %xmm6, 0x4c(%rbx)
jmp 0x8c996
andl $0x0, 0x58(%rbx)
movss -0x30(%rbp), %xmm3
movss 0x2c(%rbx), %xmm0
movss 0x34(%rbx), %xmm1
addss -0x8c(%rbp), %xmm0
addss %xmm0, %xmm3
movss %xmm3, 0x5c(%rbx)
subss -0x74(%rbp), %xmm1
subss -0x34(%rbp), %xmm1
movss %xmm1, 0x60(%rbx)
testb $0x10, 0x12(%rbx)
jne 0x8c9d4
leaq 0x88(%rbx), %rdi
xorl %esi, %esi
callq 0x49cb6
movq %rbx, %r14
movq -0x40(%rbp), %rax
movq 0x1ae0(%rax), %rbx
movq 0x2c(%r14), %rax
movq %rax, 0xd8(%rbx)
movss 0x38(%r14), %xmm0
movss 0x44(%r14), %xmm1
subss 0x30(%r14), %xmm0
leaq -0x110(%rbp), %rdi
movss %xmm1, (%rdi)
movss %xmm0, 0x4(%rdi)
movss 0x7c(%r14), %xmm0
callq 0x40d3b
movss 0x2c(%r14), %xmm0
addss 0x48(%r14), %xmm0
movss 0xf8(%rbx), %xmm1
movaps %xmm0, %xmm2
cmpless %xmm1, %xmm2
movaps %xmm2, %xmm3
andnps %xmm0, %xmm3
andps %xmm1, %xmm2
orps %xmm3, %xmm2
movss %xmm2, 0xf8(%rbx)
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x40(%rbp), %rax
mulss 0x18(%rax), %xmm2
ucomiss %xmm6, %xmm0
movss -0x30(%rbp), %xmm3
jbe 0x8ca7c
addss %xmm2, %xmm6
minss %xmm0, %xmm6
jmp 0x8c986
ucomiss %xmm0, %xmm6
jbe 0x8c986
subss %xmm2, %xmm6
movaps %xmm0, %xmm1
cmpless %xmm6, %xmm1
andps %xmm1, %xmm6
andnps %xmm0, %xmm1
orps %xmm1, %xmm6
jmp 0x8c986
leaq 0x2da63(%rip), %rdi     # 0xba509
leaq 0x2b8db(%rip), %rsi     # 0xb8388
leaq 0x2da88(%rip), %rcx     # 0xba53c
movl $0x1bcf, %edx           # imm = 0x1BCF
callq 0xc140
leaq 0x2da9f(%rip), %rdi     # 0xba564
leaq 0x2b8bc(%rip), %rsi     # 0xb8388
leaq 0x2da69(%rip), %rcx     # 0xba53c
movl $0x1be9, %edx           # imm = 0x1BE9
callq 0xc140