// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::BeginTabBarEx(ImGuiTabBar*, ImRect const&, int)
bool    ImGui::BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& tab_bar_bb, ImGuiTabBarFlags flags)
{
    ImGuiContext& g = *GImGui;
    ImGuiWindow* window = g.CurrentWindow;
    if (window->SkipItems)
        return false;

    if ((flags & ImGuiTabBarFlags_DockNode) == 0)
        PushOverrideID(tab_bar->ID);

    // Add to stack
    g.CurrentTabBarStack.push_back(GetTabBarRefFromTabBar(tab_bar));
    g.CurrentTabBar = tab_bar;

    // Append with multiple BeginTabBar()/EndTabBar() pairs.
    tab_bar->BackupCursorPos = window->DC.CursorPos;
    if (tab_bar->CurrFrameVisible == g.FrameCount)
    {
        window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.y + tab_bar->ItemSpacingY);
        tab_bar->BeginCount++;
        return true;
    }

    // Ensure correct ordering when toggling ImGuiTabBarFlags_Reorderable flag, or when a new tab was added while being not reorderable
    if ((flags & ImGuiTabBarFlags_Reorderable) != (tab_bar->Flags & ImGuiTabBarFlags_Reorderable) || (tab_bar->TabsAddedNew && !(flags & ImGuiTabBarFlags_Reorderable)))
        if (tab_bar->Tabs.Size > 1)
            ImQsort(tab_bar->Tabs.Data, tab_bar->Tabs.Size, sizeof(ImGuiTabItem), TabItemComparerByBeginOrder);
    tab_bar->TabsAddedNew = false;

    // Flags
    if ((flags & ImGuiTabBarFlags_FittingPolicyMask_) == 0)
        flags |= ImGuiTabBarFlags_FittingPolicyDefault_;

    tab_bar->Flags = flags;
    tab_bar->BarRect = tab_bar_bb;
    tab_bar->WantLayout = true; // Layout will be done on the first call to ItemTab()
    tab_bar->PrevFrameVisible = tab_bar->CurrFrameVisible;
    tab_bar->CurrFrameVisible = g.FrameCount;
    tab_bar->PrevTabsContentsHeight = tab_bar->CurrTabsContentsHeight;
    tab_bar->CurrTabsContentsHeight = 0.0f;
    tab_bar->ItemSpacingY = g.Style.ItemSpacing.y;
    tab_bar->FramePadding = g.Style.FramePadding;
    tab_bar->TabsActiveCount = 0;
    tab_bar->BeginCount = 1;

    // Set cursor pos in a way which only be used in the off-chance the user erroneously submits item before BeginTabItem(): items will overlap
    window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.y + tab_bar->ItemSpacingY);

    // Draw separator
    const ImU32 col = GetColorU32((flags & ImGuiTabBarFlags_IsFocused) ? ImGuiCol_TabActive : ImGuiCol_TabUnfocusedActive);
    const float y = tab_bar->BarRect.Max.y - 1.0f;
    {
        const float separator_min_x = tab_bar->BarRect.Min.x - IM_FLOOR(window->WindowPadding.x * 0.5f);
        const float separator_max_x = tab_bar->BarRect.Max.x + IM_FLOOR(window->WindowPadding.x * 0.5f);
        window->DrawList->AddLine(ImVec2(separator_min_x, y), ImVec2(separator_max_x, y), col, 1.0f);
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x58748(%rip), %r12     # 0xfdcd0
movq (%r12), %r13
movq 0x1ae0(%r13), %r15
movb 0x93(%r15), %bl
testb %bl, %bl
jne 0xa584f
movq %rdi, %r14
movq %rsi, -0x48(%rbp)
movl %edx, -0x2c(%rbp)
btl $0x14, %edx
jb 0xa55bb
movl 0x14(%r14), %edi
callq 0x5605a
movq (%r12), %rdi
movq 0x2118(%rdi), %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %r14, %rdx
ja 0xa55fc
movslq 0x2110(%rdi), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rdx
movq %r14, %rsi
cmpq %r14, %rdx
jbe 0xa55ff
addq $0x2110, %rdi           # imm = 0x2110
movq %r14, %rsi
callq 0xad6da
xorl %esi, %esi
jmp 0xa55ff
movq %r14, %rsi
movl 0x2138(%r13), %r12d
movl 0x213c(%r13), %edx
cmpl %edx, %r12d
jne 0xa5696
incl %r12d
testl %edx, %edx
je 0xa562a
movl %edx, %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
sarl %ecx
addl %edx, %ecx
jmp 0xa562f
movl $0x8, %ecx
cmpl %r12d, %ecx
cmovgl %ecx, %r12d
cmpl %r12d, %edx
jge 0xa5696
movq %rsi, -0x40(%rbp)
movl %eax, -0x30(%rbp)
movslq %r12d, %rdi
shlq $0x4, %rdi
callq 0x424fb
movq 0x2140(%r13), %rsi
testq %rsi, %rsi
je 0xa5681
movslq 0x2138(%r13), %rdx
shlq $0x4, %rdx
movq %rax, %rdi
movq %rax, -0x38(%rbp)
callq 0xc080
movq 0x2140(%r13), %rdi
callq 0x425d4
movq -0x38(%rbp), %rax
movq %rax, 0x2140(%r13)
movl %r12d, 0x213c(%r13)
movl -0x30(%rbp), %eax
movq -0x40(%rbp), %rsi
movq 0x2140(%r13), %rdx
movslq 0x2138(%r13), %rcx
shlq $0x4, %rcx
movq %rsi, (%rdx,%rcx)
movl %eax, 0x8(%rdx,%rcx)
incl 0x2138(%r13)
movq %r14, 0x2108(%r13)
movq 0xd8(%r15), %rax
movq %rax, 0x80(%r14)
movl 0x24(%r14), %eax
cmpl 0x1a68(%r13), %eax
jne 0xa5702
movl 0x2c(%r14), %eax
movss 0x38(%r14), %xmm0
addss 0x74(%r14), %xmm0
movl %eax, 0xd8(%r15)
movss %xmm0, 0xdc(%r15)
incb 0x69(%r14)
jmp 0xa584f
movl -0x2c(%rbp), %eax
andl $0x1, %eax
movl 0x10(%r14), %ecx
andl $0x1, %ecx
cmpl %ecx, %eax
jne 0xa571e
testl %eax, %eax
jne 0xa573c
cmpb $0x0, 0x6c(%r14)
je 0xa573c
movslq (%r14), %rsi
cmpq $0x2, %rsi
jl 0xa573c
movq 0x8(%r14), %rdi
leaq 0x131(%rip), %rcx       # 0xa5863
movl $0x24, %edx
callq 0xc620
movl -0x2c(%rbp), %ecx
movl %ecx, %eax
orl $0x40, %eax
testb $-0x40, %cl
cmovnel %ecx, %eax
movb $0x0, 0x6c(%r14)
movl %eax, 0x10(%r14)
movq -0x48(%rbp), %rcx
movups (%rcx), %xmm0
movups %xmm0, 0x2c(%r14)
movb $0x1, %cl
movb %cl, 0x6a(%r14)
movl 0x24(%r14), %edx
movl %edx, 0x28(%r14)
movl 0x1a68(%r13), %edx
movl %edx, 0x24(%r14)
movss 0x3c(%r14), %xmm0
movss %xmm0, 0x40(%r14)
movl $0x0, 0x3c(%r14)
movss 0x15ac(%r13), %xmm0
movss %xmm0, 0x74(%r14)
movq 0x1598(%r13), %rdx
movq %rdx, 0x78(%r14)
movw $0x0, 0x6e(%r14)
movb %cl, 0x69(%r14)
movl 0x2c(%r14), %ecx
addss 0x38(%r14), %xmm0
movl %ecx, 0xd8(%r15)
movss %xmm0, 0xdc(%r15)
xorl %ecx, %ecx
btl $0x15, %eax
setae %cl
leal 0x23(,%rcx,2), %edi
movss 0x11801(%rip), %xmm0    # 0xb6fe4
callq 0x445bd
movss 0x38(%r14), %xmm0
addss 0x117da(%rip), %xmm0    # 0xb6fd0
movss 0x2c(%r14), %xmm1
movss 0x40(%r15), %xmm2
mulss 0x117fa(%rip), %xmm2    # 0xb7004
cvttps2dq %xmm2, %xmm2
cvtdq2ps %xmm2, %xmm2
subss %xmm2, %xmm1
movss 0x34(%r14), %xmm3
addss %xmm2, %xmm3
movq 0x2b8(%r15), %rdi
leaq -0x58(%rbp), %rsi
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
leaq -0x50(%rbp), %rdx
movss %xmm3, (%rdx)
movss %xmm0, 0x4(%rdx)
movl %eax, %ecx
movss 0x1179a(%rip), %xmm0    # 0xb6fe4
callq 0x79abc
xorb $0x1, %bl
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq