// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::ProgressBar(float, ImVec2 const&, char const*)
void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* overlay)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return;

    ImGuiContext& g = *GImGui;
    const ImGuiStyle& style = g.Style;

    ImVec2 pos = window->DC.CursorPos;
    ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y * 2.0f);
    ImRect bb(pos, pos + size);
    ItemSize(size, style.FramePadding.y);
    if (!ItemAdd(bb, 0))
        return;

    // Render
    fraction = ImSaturate(fraction);
    RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
    bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize));
    const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
    RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding);

    // Default displaying the fraction as percentage string, but user can override it
    char overlay_buf[32];
    if (!overlay)
    {
        ImFormatString(overlay_buf, IM_ARRAYSIZE(overlay_buf), "%.0f%%", fraction * 100 + 0.01f);
        overlay = overlay_buf;
    }

    ImVec2 overlay_size = CalcTextSize(overlay, NULL);
    if (overlay_size.x > 0.0f)
        RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImVec2(0.0f, 0.5f), &bb);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movss %xmm0, -0x4(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
callq 0xeb270
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x13d3e3
jmp 0x13d6b7
leaq 0xd5b56(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x1560, %rax           # imm = 0x1560
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0xdcdc0
movaps %xmm0, %xmm1
movq -0x28(%rbp), %rax
movss 0x1980(%rax), %xmm0
movq -0x30(%rbp), %rax
movss 0x3c(%rax), %xmm2
addss %xmm2, %xmm2
addss %xmm0, %xmm2
movsd -0x48(%rbp), %xmm0
callq 0xdcef0
movlpd %xmm0, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x139090
movlpd %xmm0, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0xe8660
movq -0x30(%rbp), %rax
movss 0x3c(%rax), %xmm0
leaq -0x40(%rbp), %rdi
callq 0xd6030
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
testb $0x1, %al
jne 0x13d49a
jmp 0x13d6b7
movss -0x4(%rbp), %xmm0
callq 0x13bfc0
movss %xmm0, -0x4(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x70(%rbp)
movl $0x7, %edi
movss 0x33776(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, %edi
movq -0x30(%rbp), %rax
movss 0x40(%rax), %xmm2
movsd -0x68(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
movl $0x1, %esi
callq 0xc8f20
movq -0x30(%rbp), %rax
movss 0x44(%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x30(%rbp), %rax
movss 0x44(%rax), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
leaq -0x78(%rbp), %rdi
callq 0xbf4c0
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xe89d0
movss -0x58(%rbp), %xmm0
movss -0x50(%rbp), %xmm1
movss -0x4(%rbp), %xmm2
callq 0x13c080
movss -0x4c(%rbp), %xmm1
leaq -0x80(%rbp), %rdi
callq 0xbf4c0
movq -0x20(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0xc0(%rbp)
movl $0x28, %edi
movss 0x336cf(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movq -0xc0(%rbp), %rdi
movl %eax, %edx
movss -0x4(%rbp), %xmm1
movq -0x30(%rbp), %rax
movss 0x40(%rax), %xmm2
leaq -0x58(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x11d690
cmpq $0x0, -0x18(%rbp)
jne 0x13d5e2
leaq -0xa0(%rbp), %rdi
movss -0x4(%rbp), %xmm0
movss 0x351c8(%rip), %xmm1    # 0x172778
mulss %xmm1, %xmm0
movss 0x3b004(%rip), %xmm1    # 0x1785c0
addss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movl $0x20, %esi
leaq 0x51089(%rip), %rdx     # 0x18e659
movb $0x1, %al
callq 0xc4d30
leaq -0xa0(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
movss 0x3498e(%rip), %xmm0    # 0x171f80
callq 0xc87e0
movlpd %xmm0, -0xa8(%rbp)
movss -0xa8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x13d6b7
movss -0x80(%rbp), %xmm0
movq -0x30(%rbp), %rax
addss 0x48(%rax), %xmm0
movss -0x58(%rbp), %xmm1
movss -0x50(%rbp), %xmm2
subss -0xa8(%rbp), %xmm2
movq -0x30(%rbp), %rax
subss 0x50(%rax), %xmm2
callq 0x13c020
movss -0x54(%rbp), %xmm1
leaq -0xb0(%rbp), %rdi
callq 0xbf4c0
leaq -0x58(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xd0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq -0xb8(%rbp), %rdi
xorps %xmm0, %xmm0
movss 0x3495a(%rip), %xmm1    # 0x171fd8
callq 0xbf4c0
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq -0xa8(%rbp), %r8
leaq -0xb8(%rbp), %r9
leaq -0x58(%rbp), %rax
movq %rax, (%rsp)
callq 0xc8900
addq $0xe0, %rsp
popq %rbp
retq