// File: /workspace/github_cpp_makefile_star2_O2/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, %eax
movl %edi, %r14d
cvtsi2ss %edi, %xmm2
mulss %xmm2, %xmm1
cvttss2si %xmm1, %r15d
movss %xmm2, 0x4(%rsp)
mulss %xmm2, %xmm0
leaq 0xbba5(%rip), %r13      # 0x18828
leal -0x1(%rax), %ecx
cmpb $0x0, 0x101(%r13)
je 0xcc99
movl %ecx, %eax
movq %rax, 0x8(%rsp)
jmp 0xccb9
movq %rax, 0x8(%rsp)
movq 0x80(%r13), %r8
movl %r14d, %edi
xorl %edx, %edx
movss %xmm0, (%rsp)
callq 0xe3a4
movss (%rsp), %xmm0
cvttss2si %xmm0, %eax
movl %eax, (%rsp)
movl %r14d, 0x14(%rsp)
subl %r15d, %r14d
xorl %r12d, %r12d
testl %r15d, %r15d
movl $0x0, %ebx
cmovgl %r15d, %ebx
cmpl %r12d, %ebx
je 0xcd68
movl $0x700, %ebp            # imm = 0x700
cmpl (%rsp), %r12d
jge 0xcd20
cvtsi2ss %r12d, %xmm0
divss 0x4(%rsp), %xmm0
mulss 0x4c46(%rip), %xmm0     # 0x11944
cvttss2si %xmm0, %edx
xorl %eax, %eax
cmpl $0x42, %edx
setae %cl
movl $0x400, %ebp            # imm = 0x400
cmpl $0x21, %edx
jl 0xcd20
movb %cl, %al
shll $0x8, %eax
addl $0x500, %eax            # imm = 0x500
movl %eax, %ebp
movq 0x10(%r13), %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x62e0
movq 0x10(%r13), %rdi
movq 0x8(%rsp), %rsi
movl %r12d, %edx
callq 0x6610
cmpl $-0x1, %eax
je 0xcd53
movq 0x10(%r13), %rdi
movq 0x40(%r13), %rsi
pushq $-0x1
popq %rdx
callq 0x61f0
movq 0x10(%r13), %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x6760
incl %r12d
jmp 0xccd7
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
pushq $-0x1
popq %r12
movq 0x8(%rsp), %rbx
subl $0x1, %r14d
jb 0xcdf5
cvtsi2ss %r15d, %xmm0
divss 0x4(%rsp), %xmm0
mulss 0x4bb1(%rip), %xmm0     # 0x11944
cvttss2si %xmm0, %edx
xorl %eax, %eax
cmpl $0x42, %edx
setae %cl
movl $0x100, %ebp            # imm = 0x100
cmpl $0x21, %edx
jl 0xcdb3
movb %cl, %al
orl $0x2, %eax
shll $0x8, %eax
movl %eax, %ebp
movq 0x10(%r13), %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x62e0
movq 0x10(%r13), %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x6610
cmpl $-0x1, %eax
je 0xcde3
movq 0x10(%r13), %rdi
movq 0x20(%r13), %rsi
movl %r12d, %edx
callq 0x61f0
movq 0x10(%r13), %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x6760
incl %r15d
jmp 0xcd7a
cmpb $0x0, 0x102(%r13)
jne 0xce14
leal 0x1(%rbx), %ecx
movq 0xa0(%r13), %r8
movl 0x14(%rsp), %edi
xorl %edx, %edx
callq 0xe3a4
cmpb $0x0, 0x100(%r13)
je 0xce2d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r13), %rdi
movl $0x800, %esi            # imm = 0x800
xorl %edx, %edx
callq 0x62e0
movq 0x10(%r13), %rdi
movl (%rsp), %edx
decl %edx
movl %ebx, %esi
callq 0x6610
cmpl $-0x1, %eax
je 0xce62
movq 0x10(%r13), %rdi
movq 0x60(%r13), %rsi
pushq $-0x1
popq %rdx
callq 0x61f0
movq 0x10(%r13), %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 0x6760