// File: /workspace/github_cpp_makefile_star2_O3/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::update_source(pa_source_info const*)
void Pa::update_source(const pa_source_info *info)
{
    std::lock_guard<std::mutex> lk(inputMtx);

    PaSource *p;

    bool newObj = false;

    if (PA_SOURCES.count(info->index) == 0) {
        p = new PaSource;
        PA_SOURCES[info->index] = p;
        p->monitor_index = info->index;
        p->monitor_stream = nullptr;
        newObj = true;
    } else {
        p = reinterpret_cast<PaSource *>(PA_SOURCES[info->index]);
    }

    p->index = info->index;
    p->channels = info->channel_map.channels;
    p->volume = (const pa_volume_t) pa_cvolume_avg(&info->volume);
    p->mute = info->mute;

    strncpy(p->name, info->description, sizeof(p->name) - 1);
    strncpy(p->pa_name, info->name, sizeof(p->pa_name) - 1);

    if (newObj) {
        create_monitor_stream_for_paobject(p);
    }

    p->updatePorts(info->ports, info->n_ports);

    if (info->active_port != nullptr) {
        for (uint32_t i = 0; i < p->attributes.size(); i++) {
            if (strcmp(p->attributes[i]->name, info->active_port->name) == 0) {
                p->active_attribute = p->attributes[i];
                break;
            }
        }
    }

    notify_update();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r12
movq %rdi, %r14
addq $0x100, %rdi            # imm = 0x100
movq %rdi, 0x8(%rsp)
callq 0x6870
testl %eax, %eax
jne 0x8cfc
leaq 0x68(%r14), %rbx
leaq 0x8(%r12), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x9630
movq %rax, %r13
testq %rax, %rax
je 0x8bba
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x9678
movq (%rax), %r15
movl (%rbp), %eax
jmp 0x8bf2
movl $0x278, %edi            # imm = 0x278
callq 0x65b0
movq %rax, %r15
movq %rax, %rdi
callq 0x7da4
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x9678
movq %r15, (%rax)
movl (%rbp), %eax
movl %eax, 0x21c(%r15)
movq $0x0, 0x220(%r15)
movl %eax, 0xc(%r15)
movzbl 0x24(%r12), %eax
movl %eax, 0x210(%r15)
leaq 0xac(%r12), %rdi
callq 0x6a00
movl %eax, 0x214(%r15)
cmpl $0x0, 0x130(%r12)
setne 0x218(%r15)
leaq 0x10(%r15), %rdi
movq 0x10(%r12), %rsi
movl $0xfe, %edx
callq 0x6320
leaq 0x10f(%r15), %rdi
movq (%r12), %rsi
movl $0xfe, %edx
callq 0x6320
testq %r13, %r13
jne 0x8c60
movq %r14, %rdi
movq %r15, %rsi
callq 0x8d2a
movq 0x180(%r12), %rsi
movl 0x178(%r12), %edx
movq %r15, %rdi
callq 0x7e08
movq %r14, 0x10(%rsp)
movq 0x188(%r12), %rax
testq %rax, %rax
je 0x8cd1
movq 0x238(%r15), %r12
movq 0x240(%r15), %r13
subq %r12, %r13
je 0x8cd1
sarq $0x3, %r13
movq (%rax), %rbx
movl $0x1, %ebp
xorl %eax, %eax
movq (%r12,%rax,8), %r14
leaq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x67f0
testl %eax, %eax
je 0x8cca
movl %ebp, %eax
incl %ebp
cmpq %rax, %r13
ja 0x8cab
jmp 0x8cd1
movq %r14, 0x230(%r15)
movq 0x10(%rsp), %rax
movq 0xf8(%rax), %rax
testq %rax, %rax
je 0x8ce4
callq *%rax
movq 0x8(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x64b0
movl %eax, %edi
callq 0x6430
movq %rax, %rbx
movl $0x278, %esi            # imm = 0x278
movq %r15, %rdi
callq 0x65c0
jmp 0x8d18
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x64b0
movq %rbx, %rdi
callq 0x6a80