// File: /workspace/github_cpp_makefile_star2_O3/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::ShrinkWidths(ImGuiShrinkWidthItem*, int, float)
void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess)
{
    if (count == 1)
    {
        if (items[0].Width >= 0.0f)
            items[0].Width = ImMax(items[0].Width - width_excess, 1.0f);
        return;
    }
    ImQsort(items, (size_t)count, sizeof(ImGuiShrinkWidthItem), ShrinkWidthItemComparer);
    int count_same_width = 1;
    while (width_excess > 0.0f && count_same_width < count)
    {
        while (count_same_width < count && items[0].Width <= items[count_same_width].Width)
            count_same_width++;
        float max_width_to_remove_per_item = (count_same_width < count && items[count_same_width].Width >= 0.0f) ? (items[0].Width - items[count_same_width].Width) : (items[0].Width - 1.0f);
        if (max_width_to_remove_per_item <= 0.0f)
            break;
        float width_to_remove_per_item = ImMin(width_excess / count_same_width, max_width_to_remove_per_item);
        for (int item_n = 0; item_n < count_same_width; item_n++)
            items[item_n].Width -= width_to_remove_per_item;
        width_excess -= width_to_remove_per_item * count_same_width;
    }

    // Round width and redistribute remainder left-to-right (could make it an option of the function?)
    // Ensure that e.g. the right-most tab of a shrunk tab-bar always reaches exactly at the same distance from the right-most edge of the tab bar separator.
    width_excess = 0.0f;
    for (int n = 0; n < count; n++)
    {
        float width_rounded = ImFloor(items[n].Width);
        width_excess += items[n].Width - width_rounded;
        items[n].Width = width_rounded;
    }
    if (width_excess > 0.0f)
        for (int n = 0; n < count; n++)
            if (items[n].Index < (int)(width_excess + 0.01f))
                items[n].Width += 1.0f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x1, %esi
jne 0x93c18
movss 0x4(%rbx), %xmm2
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm2
jb 0x93d4c
subss %xmm0, %xmm2
maxss 0x213d6(%rip), %xmm2    # 0xb4fe4
movss %xmm2, 0x4(%rbx)
jmp 0x93d4c
movl %esi, %r14d
movslq %esi, %r15
leaq 0x132(%rip), %rcx       # 0x93d57
movl $0x8, %edx
movq %rbx, %rdi
movq %r15, %rsi
movss %xmm0, -0x1c(%rbp)
callq 0xc620
movss -0x1c(%rbp), %xmm5
cmpl $0x2, %r14d
jl 0x93cd6
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm5
jbe 0x93cd6
movl $0x1, %eax
movss 0x2136e(%rip), %xmm1    # 0xb4fd0
movss 0x4(%rbx), %xmm2
cltq
movss 0x4(%rbx,%rax,8), %xmm3
ucomiss %xmm2, %xmm3
jb 0x93c7e
incq %rax
cmpq %r15, %rax
jl 0x93c69
jmp 0x93c83
ucomiss %xmm0, %xmm3
jae 0x93c89
addss %xmm1, %xmm2
jmp 0x93c8d
subss %xmm3, %xmm2
ucomiss %xmm2, %xmm0
jae 0x93cd6
xorps %xmm4, %xmm4
cvtsi2ss %eax, %xmm4
movaps %xmm5, %xmm3
divss %xmm4, %xmm3
minss %xmm2, %xmm3
testl %eax, %eax
jle 0x93cc4
movl %eax, %ecx
xorl %edx, %edx
movss 0x4(%rbx,%rdx,8), %xmm2
subss %xmm3, %xmm2
movss %xmm2, 0x4(%rbx,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x93cac
cmpl %r14d, %eax
jge 0x93cd6
mulss %xmm4, %xmm3
subss %xmm3, %xmm5
ucomiss %xmm0, %xmm5
ja 0x93c62
testl %r14d, %r14d
jle 0x93d4c
movl %r14d, %eax
xorps %xmm0, %xmm0
xorl %ecx, %ecx
movss 0x4(%rbx,%rcx,8), %xmm1
cvttps2dq %xmm1, %xmm2
cvtdq2ps %xmm2, %xmm2
subss %xmm2, %xmm1
addss %xmm1, %xmm0
movss %xmm2, 0x4(%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x93ce3
testl %r14d, %r14d
setle %cl
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
setbe %dl
orb %cl, %dl
jne 0x93d4c
addss 0x271c3(%rip), %xmm0    # 0xbaee4
cvttss2si %xmm0, %ecx
xorl %edx, %edx
movss 0x212b5(%rip), %xmm0    # 0xb4fe4
cmpl %ecx, (%rbx,%rdx,8)
jge 0x93d44
movss 0x4(%rbx,%rdx,8), %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0x4(%rbx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x93d2f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq