// File: /workspace/github_cpp_makefile_star2_O3/fulhax[P]ncpamixer/src/ui/tab.cpp
// Function: Tab::volumeBar(int, int, int, int, float, float)
void Tab::volumeBar(int w, int h, int px, int py, float vol, float peak)
{
    auto dw = static_cast<float>(w);

    int pw = static_cast<int>(dw * peak);
    int vw = static_cast<int>(dw * vol);
    int fw = w - pw;

    unsigned int color;

    if (!ui.hide_top) {
        fillW(w, h, 0, py - 1, ui.bar[BAR_TOP].c_str());
    } else {
        py -= 1;
    }

    for (int i = 0; i < pw; i++) {
        if (i >= vw) {
            color = COLOR_VOLUME_PEAK;
        } else {
            color = getVolumeColor(static_cast<int>(
                static_cast<float>(i) / w * 100.0f
            ));
        }

        wattron(ui.window, COLOR_PAIR(color));
        mvwaddstr(ui.window, py, i, ui.bar[BAR_FG].c_str());
        wattroff(ui.window, COLOR_PAIR(color));
    }

    for (int i = 0; i < fw; i++) {
        color = getBarColor(static_cast<int>(
            static_cast<float>(pw + i) / w * 100.0f
        ));

        wattron(ui.window, COLOR_PAIR(color));
        mvwaddstr(ui.window, py, pw + i, ui.bar[BAR_BG].c_str());
        wattroff(ui.window, COLOR_PAIR(color));
    }

    if (!ui.hide_bottom) {
        fillW(w, h, 0, py + 1, ui.bar[BAR_BOTTOM].c_str());
    }

    if (!ui.hide_indicator) {
        wattron(ui.window, COLOR_PAIR(COLOR_VOLUME_INDICATOR));

        mvwaddstr(
            ui.window,
            py,
            vw - 1,
            ui.bar[BAR_INDICATOR].c_str()
        ); // Mark volume

        wattroff(ui.window, COLOR_PAIR(COLOR_VOLUME_INDICATOR));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movl %edi, %ebp
cvtsi2ss %edi, %xmm2
mulss %xmm2, %xmm1
cvttss2si %xmm1, %r15d
movss %xmm2, 0x10(%rsp)
mulss %xmm2, %xmm0
leaq 0xaa7c(%rip), %r14      # 0x187f8
leal -0x1(%rbx), %ecx
cmpb $0x0, 0x101(%r14)
je 0xdd8d
movl %ecx, %ebx
jmp 0xdda9
movq 0x80(%r14), %r8
movl %ebp, %edi
xorl %edx, %edx
movss %xmm0, 0xc(%rsp)
callq 0xf7e6
movss 0xc(%rsp), %xmm0
cvttss2si %xmm0, %eax
movl %eax, 0xc(%rsp)
movl %ebp, %eax
subl %r15d, %eax
movl %eax, 0x14(%rsp)
testl %r15d, %r15d
jle 0xde5a
xorl %r12d, %r12d
movl $0x700, %r13d           # imm = 0x700
cmpl 0xc(%rsp), %r12d
jge 0xde0d
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
divss 0x10(%rsp), %xmm0
mulss 0x4b1b(%rip), %xmm0     # 0x12904
cvttss2si %xmm0, %edx
xorl %eax, %eax
cmpl $0x42, %edx
setae %cl
movl $0x400, %r13d           # imm = 0x400
cmpl $0x21, %edx
jl 0xde0d
movb %cl, %al
shll $0x8, %eax
addl $0x500, %eax            # imm = 0x500
movl %eax, %r13d
movq 0x10(%r14), %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x62e0
movq 0x10(%r14), %rdi
movl %ebx, %esi
movl %r12d, %edx
callq 0x65f0
cmpl $-0x1, %eax
je 0xde40
movq 0x10(%r14), %rdi
movq 0x40(%r14), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6200
movq 0x10(%r14), %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x6750
incl %r12d
cmpl %r12d, %r15d
jne 0xddc6
cmpl $0x0, 0x14(%rsp)
jle 0xdeea
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
divss 0x10(%rsp), %xmm0
mulss 0x4a89(%rip), %xmm0     # 0x12904
cvttss2si %xmm0, %edx
xorl %eax, %eax
cmpl $0x42, %edx
setae %cl
movl $0x100, %r12d           # imm = 0x100
cmpl $0x21, %edx
jl 0xde9d
movb %cl, %al
orl $0x2, %eax
shll $0x8, %eax
movl %eax, %r12d
movq 0x10(%r14), %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x62e0
movq 0x10(%r14), %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x65f0
cmpl $-0x1, %eax
je 0xded0
movq 0x10(%r14), %rdi
movq 0x20(%r14), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6200
movq 0x10(%r14), %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0x6750
incl %r15d
cmpl %r15d, %ebp
jne 0xde65
cmpb $0x0, 0x102(%r14)
jne 0xdf07
leal 0x1(%rbx), %ecx
movq 0xa0(%r14), %r8
movl %ebp, %edi
xorl %edx, %edx
callq 0xf7e6
cmpb $0x0, 0x100(%r14)
je 0xdf20
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r14), %rdi
movl $0x800, %esi            # imm = 0x800
xorl %edx, %edx
callq 0x62e0
movq 0x10(%r14), %rdi
movl 0xc(%rsp), %edx
decl %edx
movl %ebx, %esi
callq 0x65f0
cmpl $-0x1, %eax
je 0xdf58
movq 0x10(%r14), %rdi
movq 0x60(%r14), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6200
movq 0x10(%r14), %rdi
movl $0x800, %esi            # imm = 0x800
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6750