// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
leaq 0x5834c(%rip), %r12     # 0xe3ce0
movq (%r12), %r13
movq 0x1ae0(%r13), %r15
movb 0x93(%r15), %bl
testb %bl, %bl
jne 0x8bbb7
movq %rdi, %r14
movq %rsi, -0x38(%rbp)
movl %edx, -0x2c(%rbp)
btl $0x14, %edx
movq %r13, %rdi
jb 0x8b9ce
movl 0x14(%r14), %edi
callq 0x42f94
movq (%r12), %rdi
leaq 0x2138(%r13), %r12
movq 0x2118(%rdi), %rdx
pushq $-0x1
popq %rax
cmpq %r14, %rdx
ja 0x8ba10
movslq 0x2110(%rdi), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rdx
movq %r14, %rcx
cmpq %r14, %rdx
jbe 0x8ba13
addq $0x2110, %rdi           # imm = 0x2110
movq %r14, %rsi
callq 0x933e6
xorl %ecx, %ecx
jmp 0x8ba13
movq %r14, %rcx
leaq -0x48(%rbp), %rsi
movq %rcx, (%rsi)
movl %eax, 0x8(%rsi)
movq %r12, %rdi
callq 0x7876a
movq %r14, 0x2108(%r13)
movq 0xd8(%r15), %rax
movq %rax, 0x80(%r14)
movl 0x24(%r14), %eax
cmpl 0x1a68(%r13), %eax
jne 0x8ba70
movl 0x2c(%r14), %eax
movss 0x38(%r14), %xmm0
addss 0x74(%r14), %xmm0
movl %eax, 0xd8(%r15)
movss %xmm0, 0xdc(%r15)
incb 0x69(%r14)
jmp 0x8bbb7
movl -0x2c(%rbp), %ecx
andl $0x1, %ecx
movl 0x10(%r14), %edx
andl $0x1, %edx
cmpl %edx, %ecx
jne 0x8ba8c
testl %ecx, %ecx
jne 0x8baac
cmpb $0x0, 0x6c(%r14)
je 0x8baac
movslq (%r14), %rsi
cmpq $0x2, %rsi
jl 0x8baac
movq 0x8(%r14), %rdi
leaq 0x12b(%rip), %rcx       # 0x8bbcb
pushq $0x24
popq %rdx
callq 0xc650
movl 0x24(%r14), %eax
movb $0x0, 0x6c(%r14)
movl -0x2c(%rbp), %edx
movl %edx, %ecx
orl $0x40, %ecx
testb $-0x40, %dl
cmovnel %edx, %ecx
movl %ecx, 0x10(%r14)
movq -0x38(%rbp), %rdx
movups (%rdx), %xmm0
movups %xmm0, 0x2c(%r14)
movb $0x1, %dl
movb %dl, 0x6a(%r14)
movl %eax, 0x28(%r14)
movl 0x1a68(%r13), %eax
movl %eax, 0x24(%r14)
movss 0x3c(%r14), %xmm0
movss %xmm0, 0x40(%r14)
andl $0x0, 0x3c(%r14)
movss 0x15ac(%r13), %xmm0
movss %xmm0, 0x74(%r14)
movq 0x1598(%r13), %rax
movq %rax, 0x78(%r14)
andw $0x0, 0x6e(%r14)
movb %dl, 0x69(%r14)
movl 0x2c(%r14), %eax
addss 0x38(%r14), %xmm0
movl %eax, 0xd8(%r15)
movss %xmm0, 0xdc(%r15)
xorl %eax, %eax
btl $0x15, %ecx
setae %al
leal 0x23(,%rax,2), %edi
movss 0x104ad(%rip), %xmm0    # 0x9bff8
callq 0x35d33
movss 0x38(%r14), %xmm0
addss 0x10492(%rip), %xmm0    # 0x9bff0
movss 0x2c(%r14), %xmm1
movss 0x40(%r15), %xmm2
mulss 0x104a6(%rip), %xmm2    # 0x9c018
cvttps2dq %xmm2, %xmm2
cvtdq2ps %xmm2, %xmm2
subss %xmm2, %xmm1
movss 0x34(%r14), %xmm3
addss %xmm2, %xmm3
movq 0x2b8(%r15), %rdi
leaq -0x48(%rbp), %rsi
movss %xmm1, (%rsi)
movss %xmm0, 0x4(%rsi)
leaq -0x50(%rbp), %rdx
movss %xmm3, (%rdx)
movss %xmm0, 0x4(%rdx)
movl %eax, %ecx
movss 0x10446(%rip), %xmm0    # 0x9bff8
callq 0x63ec2
xorb $0x1, %bl
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq