LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pulsemixer.cpp
// Function: version()
void version()
{
    if (strlen(GIT_VERSION) > 0) {
        printf("ncpamixer git v%s\n", GIT_VERSION);
    } else {
        printf("ncpamixer v%s\n", FALLBACK_VERSION);
    }

    printf("Build type: %s\n", BUILD_TYPE);
    printf("Build date: %s\n", BUILD_DATE);
    printf("\n");

}

// Assembly:
pushq %rax
leaq 0xadbc(%rip), %rax      # 0x11b60
cmpb $0x0, (%rax)
je 0x6db9
leaq 0x9280(%rip), %rdi      # 0x10030
leaq 0xada9(%rip), %rsi      # 0x11b60
jmp 0x6dc7
leaq 0x9283(%rip), %rdi      # 0x10043
leaq 0x9265(%rip), %rsi      # 0x1002c
xorl %eax, %eax
callq 0x6070
leaq 0x927d(%rip), %rdi      # 0x10052
leaq 0xad96(%rip), %rsi      # 0x11b72
xorl %eax, %eax
callq 0x6070
leaq 0x9278(%rip), %rdi      # 0x10062
leaq 0xad8f(%rip), %rsi      # 0x11b80
xorl %eax, %eax
callq 0x6070
pushq $0xa
popq %rdi
popq %rax
jmp 0x6810
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pulsemixer.cpp
// Function: help()
void help()
{
    version();

    printf("-c --config=CONFIG_FILE     Set custom location for config\n");
    printf("-t --tab=TAB                Open on given tab. Choices: "
           "(p)layback (default), (r)ecording, (o)utput, (i)nput, (c)onfiguration\n");
    printf("-h --help                   Print this help screen\n");
    printf("-v --version                Print version info\n");
}

// Assembly:
pushq %rax
callq 0x6d9c
leaq 0x92b7(%rip), %rdi      # 0x100c5
callq 0x68d0
leaq 0x92e6(%rip), %rdi      # 0x10100
callq 0x68d0
leaq 0x9358(%rip), %rdi      # 0x1017e
callq 0x68d0
leaq 0x937f(%rip), %rdi      # 0x101b1
popq %rax
jmp 0x68d0
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_object.cpp
// Function: PaObject::PaObject()
PaObject::PaObject() : type(pa_object_t::SINK)
{
    index = 0;
    memset(name, 0, sizeof(name));
    memset(pa_name, 0, sizeof(pa_name));
    channels = 0;
    mute = false;
    monitor_index = 0;
    monitor_stream = nullptr;
    peak = 0;
    pa_set_volume = nullptr;
    pa_set_mute = nullptr;
    pa_move = nullptr;
    pa_set_active_attribute = nullptr;
    pa_set_default = nullptr;
    active_attribute = nullptr;
    is_default = false;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x105dd(%rip), %rax     # 0x17820
movq %rax, (%rdi)
addq $0x8, %rdi
andl $0x0, 0x210(%rbx)
movb $0x0, 0x218(%rbx)
movl $0x207, %edx            # imm = 0x207
xorl %esi, %esi
callq 0x6360
xorps %xmm0, %xmm0
movups %xmm0, 0x21c(%rbx)
movups %xmm0, 0x230(%rbx)
movups %xmm0, 0x240(%rbx)
movups %xmm0, 0x250(%rbx)
movups %xmm0, 0x260(%rbx)
andq $0x0, 0x270(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_object.cpp
// Function: PaObject::set_volume(float)
void PaObject::set_volume(float perc)
{

    if (pa_set_volume != nullptr) {
        pa_threaded_mainloop_lock(pulse.pa_ml);

        int vol = (PA_VOLUME_NORM * perc);
        pa_cvolume cvol;

        pa_cvolume_init(&cvol);
        pa_cvolume_set(&cvol, channels, vol);


        pa_operation *o = pa_set_volume(
                              pulse.pa_ctx,
                              index,
                              &cvol,
                              NULL,
                              NULL
                          );
        pa_operation_unref(o);
        pa_threaded_mainloop_unlock(pulse.pa_ml);
    }
}

// Assembly:
cmpq $0x0, 0x250(%rdi)
je 0x73bf
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
leaq 0x112f1(%rip), %r15     # 0x18638
movq 0x158(%r15), %rdi
movss %xmm0, (%rsp)
callq 0x60c0
movss (%rsp), %xmm0
mulss 0x8e7b(%rip), %xmm0     # 0x101e0
cvttss2si %xmm0, %ebp
leaq 0x4(%rsp), %r14
movq %r14, %rdi
callq 0x69a0
movl 0x210(%rbx), %esi
movq %r14, %rdi
movl %ebp, %edx
callq 0x6b30
movq 0x150(%r15), %rdi
movl 0xc(%rbx), %esi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *0x250(%rbx)
movq %rax, %rdi
callq 0x6670
movq 0x158(%r15), %rdi
callq 0x6190
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_object.cpp
// Function: PaObject::toggle_mute()
void PaObject::toggle_mute()
{
    if (pa_set_mute != nullptr) {
        pa_operation *o = pa_set_mute(
                              pulse.pa_ctx,
                              index,
                              !mute,
                              NULL,
                              NULL
                          );
        pa_operation_unref(o);
    }
}

// Assembly:
movq 0x258(%rdi), %r9
testq %r9, %r9
je 0x7434
pushq %rax
leaq 0x1122c(%rip), %rax     # 0x18638
movq 0x150(%rax), %rax
movl 0xc(%rdi), %esi
movzbl 0x218(%rdi), %edx
xorl $0x1, %edx
movq %rax, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%r9
movq %rax, %rdi
popq %rax
jmp 0x6670
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_object.cpp
// Function: PaObject::move(unsigned int)
void PaObject::move(uint32_t dest)
{
    if (pa_move != nullptr) {
        pa_operation *o = pa_move(
                              pulse.pa_ctx,
                              index,
                              dest,
                              NULL,
                              NULL
                          );
        pa_operation_unref(o);
    }
}

// Assembly:
movq 0x260(%rdi), %r9
testq %r9, %r9
je 0x746a
pushq %rax
movl %esi, %edx
leaq 0x111ec(%rip), %rax     # 0x18638
movq 0x150(%rax), %rax
movl 0xc(%rdi), %esi
movq %rax, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%r9
movq %rax, %rdi
popq %rax
jmp 0x6670
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_object.cpp
// Function: PaObject::set_active_attribute(char const*)
void PaObject::set_active_attribute(const char *name)
{
    if (pa_set_active_attribute != nullptr) {
        pa_operation *o = pa_set_active_attribute(
                              pulse.pa_ctx,
                              index,
                              name,
                              NULL,
                              NULL
                          );
        pa_operation_unref(o);
    }
}

// Assembly:
movq 0x268(%rdi), %r9
testq %r9, %r9
je 0x74a1
pushq %rax
movq %rsi, %rdx
leaq 0x111b5(%rip), %rax     # 0x18638
movq 0x150(%rax), %rax
movl 0xc(%rdi), %esi
movq %rax, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq *%r9
movq %rax, %rdi
popq %rax
jmp 0x6670
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_object.cpp
// Function: PaObject::set_default(char const*)
void PaObject::set_default(const char *name)
{
    if (pa_set_default != nullptr) {
        pa_operation *o = pa_set_default(
                              pulse.pa_ctx,
                              name,
                              NULL,
                              NULL
                          );
        pa_operation_unref(o);
    }
}

// Assembly:
movq 0x270(%rdi), %rax
testq %rax, %rax
je 0x74cc
pushq %rax
leaq 0x11182(%rip), %rcx     # 0x18638
movq 0x150(%rcx), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq *%rax
movq %rax, %rdi
popq %rax
jmp 0x6670
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_object.cpp
// Function: PaObject::getRelation()
uint32_t PaObject::getRelation()
{
    if (active_attribute != nullptr) {
        for (uint32_t j = 0; j < attributes.size(); j++) {
            int current = strcmp(attributes[j]->name, active_attribute->name);

            if (current == 0) {
                return j;
            }
        }
    }

    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x230(%rdi), %r14
pushq $-0x1
popq %rbx
testq %r14, %r14
je 0x7521
movq 0x238(%rdi), %r15
movq 0x240(%rdi), %r12
subq %r15, %r12
sarq $0x3, %r12
addq $0x8, %r14
xorl %ebp, %ebp
movl %ebp, %eax
cmpq %rax, %r12
jbe 0x7521
movq (%r15,%rax,8), %rdi
addq $0x8, %rdi
movq %r14, %rsi
callq 0x6830
testl %eax, %eax
je 0x751f
incl %ebp
jmp 0x7500
movl %ebp, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_card.cpp
// Function: PaCard::PaCard()
PaCard::PaCard()
{
    type = pa_object_t::CARD;
    monitor_stream = nullptr;
    pa_set_active_attribute = pa_context_set_card_profile_by_index;
    pa_set_volume = nullptr;
    pa_set_mute = nullptr;
    pa_move = nullptr;
    active_attribute = nullptr;
    pa_set_default = nullptr;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x7238
leaq 0x102ec(%rip), %rax     # 0x17860
movq %rax, (%rbx)
movl $0x4, 0x8(%rbx)
andq $0x0, 0x220(%rbx)
movq 0x109db(%rip), %rax     # 0x17f68
movq %rax, 0x268(%rbx)
andq $0x0, 0x230(%rbx)
andq $0x0, 0x270(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x250(%rbx)
andq $0x0, 0x260(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_card.cpp
// Function: PaCard::updateProfiles(pa_card_profile_info*, unsigned int)
void PaCard::updateProfiles(pa_card_profile_info *pa_profiles, uint32_t n_profile)
{
    clearAttributes();

    for (uint32_t i = 0; i < n_profile; i++) {
        PaObjectAttribute *p = new PaObjectAttribute;
        snprintf(p->name, sizeof(p->name), "%s", pa_profiles[i].name);
        snprintf(
            p->description,
            sizeof(p->description),
            "%s",
            pa_profiles[i].description
        );
        attributes.push_back(p);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x72b8
addq $0x238, %r14            # imm = 0x238
movl %ebp, %r13d
shlq $0x5, %r13
leaq 0xa350(%rip), %r15      # 0x11935
movq %rsp, %r12
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x764f
movl $0x208, %edi            # imm = 0x208
callq 0x65c0
leaq 0x102a8(%rip), %rcx     # 0x178a8
movq %rcx, (%rax)
movq %rax, (%rsp)
leaq 0x8(%rax), %rdi
movq (%rbx,%rbp), %rcx
movl $0xff, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x69c0
movq (%rsp), %rdi
movl $0x107, %eax            # imm = 0x107
addq %rax, %rdi
movq 0x8(%rbx,%rbp), %rcx
movl $0xff, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x69c0
movq %r14, %rdi
movq %r12, %rsi
callq 0x765e
addq $0x20, %rbp
jmp 0x75ea
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_sink.cpp
// Function: PaSink::PaSink()
PaSink::PaSink()
{
    type = pa_object_t::SINK;
    monitor_stream = nullptr;

    pa_set_volume = &pa_context_set_sink_volume_by_index;
    pa_set_mute = &pa_context_set_sink_mute_by_index;
    pa_move = nullptr;
    pa_set_active_attribute = &pa_context_set_sink_port_by_index;
    pa_set_default = &pa_context_set_default_sink;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x7238
leaq 0x100e4(%rip), %rax     # 0x178d8
movq %rax, (%rbx)
andl $0x0, 0x8(%rbx)
andq $0x0, 0x220(%rbx)
movq 0x107de(%rip), %rax     # 0x17fe8
movq %rax, 0x250(%rbx)
movq 0x107a0(%rip), %rax     # 0x17fb8
movq %rax, 0x258(%rbx)
andq $0x0, 0x260(%rbx)
movq 0x107aa(%rip), %rax     # 0x17fd8
movq %rax, 0x268(%rbx)
movq 0x1071c(%rip), %rax     # 0x17f58
movq %rax, 0x270(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_sink.cpp
// Function: PaSink::updatePorts(pa_sink_port_info**, unsigned int)
void PaSink::updatePorts(pa_sink_port_info **info, uint32_t n_ports)
{
    clearAttributes();

    for (uint32_t i = 0; i < n_ports; i++) {
        auto *p = new PaPort;

        snprintf(p->name, sizeof(p->name), "%s", info[i]->name);
        snprintf(
            p->description,
            sizeof(p->description),
            "%s",
            info[i]->description
        );
        attributes.push_back(p);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x72b8
addq $0x238, %r14            # imm = 0x238
movl %ebp, %ebp
leaq 0xa0c7(%rip), %r15      # 0x11935
xorl %r12d, %r12d
cmpq %r12, %rbp
je 0x78da
movl $0x210, %edi            # imm = 0x210
callq 0x65c0
movq %rax, %r13
leaq 0x10096(%rip), %rax     # 0x17920
movq %rax, (%r13)
leaq 0x8(%r13), %rdi
movq (%rbx,%r12,8), %rax
movq (%rax), %rcx
movl $0xff, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x69c0
leaq 0x107(%r13), %rdi
movq (%rbx,%r12,8), %rax
movq 0x8(%rax), %rcx
movl $0xff, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x69c0
movq %r13, (%rsp)
movq %r14, %rdi
movq %rsp, %rsi
callq 0x790c
incq %r12
jmp 0x7871
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_input.cpp
// Function: PaInput::PaInput()
PaInput::PaInput()
{
    type = pa_object_t::INPUT;
    monitor_stream = nullptr;
    pa_set_volume = &pa_context_set_sink_input_volume;
    pa_set_mute = &pa_context_set_sink_input_mute;
    pa_move = &pa_context_move_sink_input_by_index;
    pa_set_active_attribute = nullptr;
    pa_set_default = nullptr;

    sink = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x7238
leaq 0xff40(%rip), %rax      # 0x17958
movq %rax, (%rbx)
leaq 0x290(%rbx), %rax
movq %rax, 0x280(%rbx)
andq $0x0, 0x288(%rbx)
movb $0x0, 0x290(%rbx)
movl $0x1, 0x8(%rbx)
andq $0x0, 0x220(%rbx)
movq 0x1057a(%rip), %rax     # 0x17fc8
movq %rax, 0x250(%rbx)
movq 0x10514(%rip), %rax     # 0x17f70
movq %rax, 0x258(%rbx)
movq 0x104de(%rip), %rax     # 0x17f48
movq %rax, 0x260(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x268(%rbx)
andl $0x0, 0x278(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_source.cpp
// Function: PaSource::PaSource()
PaSource::PaSource()
{
    type = pa_object_t::SOURCE;
    monitor_stream = nullptr;

    pa_set_volume = &pa_context_set_source_volume_by_index;
    pa_set_mute = &pa_context_set_source_mute_by_index ;
    pa_move = nullptr;
    pa_set_active_attribute = &pa_context_set_source_port_by_index;
    pa_set_default = &pa_context_set_default_source;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x7238
leaq 0xfec0(%rip), %rax      # 0x179a0
movq %rax, (%rbx)
movl $0x2, 0x8(%rbx)
andq $0x0, 0x220(%rbx)
movq 0x1048f(%rip), %rax     # 0x17f88
movq %rax, 0x250(%rbx)
movq 0x10411(%rip), %rax     # 0x17f18
movq %rax, 0x258(%rbx)
andq $0x0, 0x260(%rbx)
movq 0x1040b(%rip), %rax     # 0x17f28
movq %rax, 0x268(%rbx)
movq 0x10425(%rip), %rax     # 0x17f50
movq %rax, 0x270(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_source.cpp
// Function: PaSource::updatePorts(pa_source_port_info**, unsigned int)
void PaSource::updatePorts(pa_source_port_info **info, uint32_t n_ports)
{
    clearAttributes();

    for (uint32_t i = 0; i < n_ports; i++) {
        PaPort *p = new PaPort;
        snprintf(p->name, sizeof(p->name), "%s", info[i]->name);
        snprintf(
            p->description,
            sizeof(p->description),
            "%s",
            info[i]->description
        );
        attributes.push_back(p);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x72b8
addq $0x238, %r14            # imm = 0x238
movl %ebp, %ebp
leaq 0x9dd9(%rip), %r15      # 0x11935
xorl %r12d, %r12d
cmpq %r12, %rbp
je 0x7bc8
movl $0x210, %edi            # imm = 0x210
callq 0x65c0
movq %rax, %r13
leaq 0xfda8(%rip), %rax      # 0x17920
movq %rax, (%r13)
leaq 0x8(%r13), %rdi
movq (%rbx,%r12,8), %rax
movq (%rax), %rcx
movl $0xff, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x69c0
leaq 0x107(%r13), %rdi
movq (%rbx,%r12,8), %rax
movq 0x8(%rax), %rcx
movl $0xff, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x69c0
movq %r13, (%rsp)
movq %r14, %rdi
movq %rsp, %rsi
callq 0x790c
incq %r12
jmp 0x7b5f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa_source_output.cpp
// Function: PaSourceOutput::PaSourceOutput()
PaSourceOutput::PaSourceOutput()
{
    type = pa_object_t::SOURCE_OUTPUT;
    monitor_stream = nullptr;

    pa_set_volume = &pa_context_set_source_output_volume;
    pa_set_mute = &pa_context_set_source_output_mute;
    pa_move = &pa_context_move_source_output_by_index;
    pa_set_active_attribute = nullptr;
    pa_set_default = nullptr;

    source = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x7a08
leaq 0xfde8(%rip), %rax      # 0x179e8
movq %rax, (%rbx)
movl $0x3, 0x8(%rbx)
andq $0x0, 0x220(%rbx)
movq 0x10367(%rip), %rax     # 0x17f80
movq %rax, 0x250(%rbx)
movq 0x10381(%rip), %rax     # 0x17fa8
movq %rax, 0x258(%rbx)
movq 0x102db(%rip), %rax     # 0x17f10
movq %rax, 0x260(%rbx)
andl $0x0, 0x2a0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x268(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::clearAllPaObjects()
void Pa::clearAllPaObjects()
{
    deletePaobjects(&PA_SOURCE_OUTPUTS);
    deletePaobjects(&PA_INPUTS);
    deletePaobjects(&PA_SOURCES);
    deletePaobjects(&PA_SINKS);
    deletePaobjects(&PA_CARDS);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x98(%rdi), %rsi
callq 0x7e3c
leaq 0x8(%rbx), %rsi
movq %rbx, %rdi
callq 0x7e3c
leaq 0x68(%rbx), %rsi
movq %rbx, %rdi
callq 0x7e3c
leaq 0x38(%rbx), %rsi
movq %rbx, %rdi
callq 0x7e3c
leaq 0xc8(%rbx), %rsi
movq %rbx, %rdi
popq %rbx
jmp 0x7e3c
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::exitPa()
void Pa::exitPa()
{
    if (pa_ctx) {
        pa_context_disconnect(pa_ctx);
        pa_threaded_mainloop_stop(pa_ml);
        pa_threaded_mainloop_free(pa_ml);
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x150(%rdi), %rdi
testq %rdi, %rdi
je 0x7e3a
callq 0x6ae0
movq 0x158(%rbx), %rdi
callq 0x6b80
movq 0x158(%rbx), %rdi
popq %rbx
jmp 0x6410
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::deletePaobjects(std::map<unsigned int, PaObject*, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, PaObject*>>>*)
void Pa::deletePaobjects(std::map<uint32_t, PaObject *> *objects)
{
    std::lock_guard<std::mutex> lk(inputMtx);

    for (auto i = objects->begin(); i != objects->end(); ) {
        delete i->second;
        i = objects->erase(i);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x100, %rbx            # imm = 0x100
movq %rbx, %rdi
callq 0x92ce
movq 0x18(%r14), %r15
leaq 0x8(%r14), %r12
cmpq %r12, %r15
je 0x7e85
movq 0x28(%r15), %rdi
testq %rdi, %rdi
je 0x7e75
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x935a
movq %rax, %r15
jmp 0x7e61
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x64c0
movq %rax, %r14
movq %rbx, %rdi
callq 0x64c0
movq %r14, %rdi
callq 0x6ac0
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::do_reconnect(Pa*)
void Pa::do_reconnect(Pa *pa)
{
    if (pa->reconnect_running || pa->connected) {
        return;
    }

    pa->reconnect_running = true;
    pa->clearAllPaObjects();

    while (!pa->connected) {
        pa->pa_connect();
        usleep(500000);
    }

    pa->reconnect_running = false;
}

// Assembly:
cmpb $0x0, (%rdi)
jne 0x7ee4
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0x1(%rdi)
jne 0x7ee3
movb $0x1, (%rbx)
movq %rbx, %rdi
callq 0x7dc8
cmpb $0x0, 0x1(%rbx)
jne 0x7ee0
movq %rbx, %rdi
callq 0x7ee6
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x6840
jmp 0x7ec6
movb $0x0, (%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::pa_connect()
bool Pa::pa_connect()
{
    if (pa_ctx) {
        return false;
    }

    pa_threaded_mainloop_lock(pa_ml);

    pa_proplist *proplist = pa_proplist_new();
    pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "ncpamixer");
    pa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "ncpamixer");
    pa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "audio-card");
    pa_ctx = pa_context_new_with_proplist(pa_api, NULL, proplist);
    pa_proplist_free(proplist);

    if (!pa_ctx) {
        fprintf(stderr, "Unable to create PA context.\n");
        pa_threaded_mainloop_unlock(pa_ml);
        pa_ctx = nullptr;
        exit(EXIT_FAILURE);
        return false;
    }

    pa_context_set_state_callback(pa_ctx, &Pa::ctx_state_cb, this);
    pa_context_set_subscribe_callback(pa_ctx, &Pa::subscribe_cb, this);

    if (pa_context_connect(pa_ctx, NULL, PA_CONTEXT_NOFAIL, NULL) < 0) {
        pa_context_disconnect(pa_ctx);
        pa_context_unref(pa_ctx); // Tror ej den behövs?
        pa_threaded_mainloop_unlock(pa_ml);
        pa_ctx = nullptr;

        connectionMtx.unlock();
        reconnect();
        return false;
    }

    pa_threaded_mainloop_unlock(pa_ml);

    connectionMtx.unlock();
    return true;

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpq $0x0, 0x150(%rdi)
je 0x7efc
xorl %eax, %eax
jmp 0x7fdd
movq %rdi, %rbx
movq 0x158(%rdi), %rdi
callq 0x60c0
callq 0x6210
movq %rax, %r14
leaq 0x836e(%rip), %rsi      # 0x10288
leaq 0x8378(%rip), %r15      # 0x10299
movq %rax, %rdi
movq %r15, %rdx
callq 0x6b00
leaq 0x8370(%rip), %rsi      # 0x102a3
movq %r14, %rdi
movq %r15, %rdx
callq 0x6b00
leaq 0x836d(%rip), %rsi      # 0x102b2
leaq 0x837c(%rip), %rdx      # 0x102c8
movq %r14, %rdi
callq 0x6b00
movq 0x160(%rbx), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x67f0
movq %rax, 0x150(%rbx)
movq %r14, %rdi
callq 0x6770
movq 0x150(%rbx), %rdi
testq %rdi, %rdi
je 0x8028
leaq 0x129(%rip), %rsi       # 0x80b4
movq %rbx, %rdx
callq 0x6a80
movq 0x150(%rbx), %rdi
leaq 0x1cf(%rip), %rsi       # 0x8170
movq %rbx, %rdx
callq 0x6030
movq 0x150(%rbx), %rdi
pushq $0x2
popq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x6ba0
testl %eax, %eax
js 0x7fe3
movq 0x158(%rbx), %rdi
callq 0x6190
addq $0x128, %rbx            # imm = 0x128
movq %rbx, %rdi
callq 0x64c0
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
movq 0x150(%rbx), %rdi
callq 0x6ae0
movq 0x150(%rbx), %rdi
callq 0x68e0
movq 0x158(%rbx), %rdi
callq 0x6190
andq $0x0, 0x150(%rbx)
leaq 0x128(%rbx), %rdi
callq 0x64c0
movq %rbx, %rdi
callq 0x8060
jmp 0x7ef5
movq 0xff71(%rip), %rax      # 0x17fa0
movq (%rax), %rcx
leaq 0x829a(%rip), %rdi      # 0x102d3
pushq $0x1d
popq %rsi
pushq $0x1
popq %rdx
callq 0x6bb0
movq 0x158(%rbx), %rdi
callq 0x6190
andq $0x0, 0x150(%rbx)
pushq $0x1
popq %rdi
callq 0x6700
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::ctx_state_cb(pa_context*, void*)
void Pa::ctx_state_cb(pa_context *ctx, void *instance)
{
    int state = pa_context_get_state(ctx);
    Pa *pa = reinterpret_cast<Pa *>(instance);

    switch (state) {
        case PA_CONTEXT_READY: {
            pa_operation *o = pa_context_subscribe(
                                  pa->pa_ctx,
                                  (pa_subscription_mask_t)
                                  (PA_SUBSCRIPTION_MASK_SINK |
                                   PA_SUBSCRIPTION_MASK_SOURCE |
                                   PA_SUBSCRIPTION_MASK_SINK_INPUT |
                                   PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT |
                                   PA_SUBSCRIPTION_MASK_CARD |
                                   PA_SUBSCRIPTION_MASK_SERVER
                                  ), &Pa::ctx_success_cb, instance);
            pa->wait_on_pa_operation(o);
            pa_operation_unref(o);
            pa->fetchPaobjects();

            pa->connectionMtx.lock();
            pa->connected = true;
            pa->connectionMtx.unlock();
            break;
        }

        case PA_CONTEXT_FAILED:
            pa->connectionMtx.lock();
            pa->connected = false;
            pa_context_unref(pa->pa_ctx);
            pa->pa_ctx = nullptr;
            pa->connectionMtx.unlock();
            pa->reconnect();
            break;


        case PA_CONTEXT_UNCONNECTED:
        case PA_CONTEXT_CONNECTING:
        case PA_CONTEXT_AUTHORIZING:
        case PA_CONTEXT_SETTING_NAME:
        case PA_CONTEXT_TERMINATED:
            break;
    }

    return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
callq 0x6990
cmpl $0x5, %eax
je 0x8129
cmpl $0x4, %eax
jne 0x8167
movq 0x150(%rbx), %rdi
leaq 0x296(%rip), %rdx       # 0x8372
movl $0x28f, %esi            # imm = 0x28F
movq %rbx, %rcx
callq 0x68c0
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x84a4
movq %r14, %rdi
callq 0x6670
movq %rbx, %rdi
callq 0x8380
leaq 0x128(%rbx), %r14
movq %r14, %rdi
callq 0x92ce
movb $0x1, 0x1(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x64c0
leaq 0x128(%rbx), %r14
movq %r14, %rdi
callq 0x92ce
movb $0x0, 0x1(%rbx)
movq 0x150(%rbx), %rdi
callq 0x68e0
andq $0x0, 0x150(%rbx)
movq %r14, %rdi
callq 0x64c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8060
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::init()
bool Pa::init()
{
    pa_init = true;

    pa_ml = pa_threaded_mainloop_new();

    if (!pa_ml) {
        fprintf(stderr, "Unable to create PA main loop.\n");
        exit(EXIT_FAILURE);
        return false;
    }

    pa_api  = pa_threaded_mainloop_get_api(pa_ml);

    if (pa_threaded_mainloop_start(pa_ml) < 0) {
        fprintf(stderr, "Unable to start PA mainloop.\n");
        pa_context_disconnect(pa_ctx);
        pa_context_unref(pa_ctx);
        pa_threaded_mainloop_unlock(pa_ml);
        pa_ctx = nullptr;
        exit(EXIT_FAILURE);
        return false;
    }

    return pa_connect();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb $0x1, 0x168(%rdi)
callq 0x6a10
movq %rax, 0x158(%rbx)
testq %rax, %rax
je 0x8304
movq %rax, %rdi
callq 0x6800
movq %rax, 0x160(%rbx)
movq 0x158(%rbx), %rdi
callq 0x64a0
testl %eax, %eax
js 0x8322
movq %rbx, %rdi
popq %rbx
jmp 0x7ee6
movq 0xfc95(%rip), %rax      # 0x17fa0
movq (%rax), %rcx
leaq 0x7fdc(%rip), %rdi      # 0x102f1
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x6bb0
jmp 0x836a
movq 0xfc77(%rip), %rax      # 0x17fa0
movq (%rax), %rcx
leaq 0x7fde(%rip), %rdi      # 0x10311
pushq $0x1d
popq %rsi
pushq $0x1
popq %rdx
callq 0x6bb0
movq 0x150(%rbx), %rdi
callq 0x6ae0
movq 0x150(%rbx), %rdi
callq 0x68e0
movq 0x158(%rbx), %rdi
callq 0x6190
andq $0x0, 0x150(%rbx)
pushq $0x1
popq %rdi
callq 0x6700
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::fetchPaobjects()
void Pa::fetchPaobjects()
{

    //pa_threaded_mainloop_lock(pa_ml);
    pa_operation *o;

    // get cards
    o = pa_context_get_card_info_list(pa_ctx, &Pa::ctx_cardlist_cb, this);
    wait_on_pa_operation(o);
    pa_operation_unref(o);

    // source list cb
    o = pa_context_get_source_info_list(pa_ctx, &Pa::ctx_sourcelist_cb, this);
    wait_on_pa_operation(o);
    pa_operation_unref(o);

    // Sink devices list cb
    o = pa_context_get_sink_info_list(pa_ctx, &Pa::ctx_sinklist_cb, this);
    wait_on_pa_operation(o);
    pa_operation_unref(o);

    // Sink input list (application) cb
    o = pa_context_get_sink_input_info_list(pa_ctx, &Pa::ctx_inputlist_cb, this);
    wait_on_pa_operation(o);
    pa_operation_unref(o);

    // source outputs list cb
    o = pa_context_get_source_output_info_list(
            pa_ctx,
            &Pa::ctx_sourceoutputlist_cb,
            this
        );
    wait_on_pa_operation(o);
    pa_operation_unref(o);

    // Get server info
    o = pa_context_get_server_info(pa_ctx, &Pa::ctx_serverinfo_cb, this);
    wait_on_pa_operation(o);
    pa_operation_unref(o);

    //pa_threaded_mainloop_unlock(pa_ml);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x150(%rdi), %rdi
leaq 0x101(%rip), %rsi       # 0x8496
movq %rbx, %rdx
callq 0x6bf0
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x84a4
movq %r14, %rdi
callq 0x6670
movq 0x150(%rbx), %rdi
leaq 0x111(%rip), %rsi       # 0x84d2
movq %rbx, %rdx
callq 0x6900
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x84a4
movq %r14, %rdi
callq 0x6670
movq 0x150(%rbx), %rdi
leaq 0xf3(%rip), %rsi        # 0x84e0
movq %rbx, %rdx
callq 0x6480
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x84a4
movq %r14, %rdi
callq 0x6670
movq 0x150(%rbx), %rdi
leaq 0xd5(%rip), %rsi        # 0x84ee
movq %rbx, %rdx
callq 0x6b40
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x84a4
movq %r14, %rdi
callq 0x6670
movq 0x150(%rbx), %rdi
leaq 0xb7(%rip), %rsi        # 0x84fc
movq %rbx, %rdx
callq 0x6a50
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x84a4
movq %r14, %rdi
callq 0x6670
movq 0x150(%rbx), %rdi
leaq 0x99(%rip), %rsi        # 0x850a
movq %rbx, %rdx
callq 0x65a0
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x84a4
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6670
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::remove_paobject(std::map<unsigned int, PaObject*, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, PaObject*>>>*, unsigned int)
void Pa::remove_paobject(std::map<uint32_t, PaObject *> *objects,
                         uint32_t index)
{
    std::lock_guard<std::mutex> lk(inputMtx);

    for (auto i = objects->begin(); i != objects->end(); i++) {
        if (i->first == index) {
            delete i->second;
            i = objects->erase(i);
            return;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x100, %rbx            # imm = 0x100
movq %rbx, %rdi
callq 0x92ce
movq 0x18(%r14), %r15
leaq 0x8(%r14), %r12
cmpq %r12, %r15
je 0x856b
cmpl %ebp, 0x20(%r15)
je 0x8551
movq %r15, %rdi
callq 0x6450
movq %rax, %r15
jmp 0x8539
movq 0x28(%r15), %rdi
testq %rdi, %rdi
je 0x8560
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x935a
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x64c0
movq %rax, %r14
movq %rbx, %rdi
callq 0x64c0
movq %r14, %rdi
callq 0x6ac0
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::exists(std::map<unsigned int, PaObject*, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, PaObject*>>>, unsigned int)
uint32_t Pa::exists(std::map<uint32_t, PaObject *> objects, uint32_t index)
{
    if (objects.empty()) {
        return -1;
    }

    if ((objects.find(index) == objects.end())) {
        index = objects.begin()->first;
    }

    return index;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %esi, 0xc(%rsp)
cmpq $0x0, 0x28(%rdi)
je 0x85ba
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
callq 0x93a8
leaq 0x8(%rbx), %rcx
cmpq %rcx, %rax
je 0x85bf
movl 0xc(%rsp), %eax
jmp 0x85c6
pushq $-0x1
popq %rax
jmp 0x85c6
movq 0x18(%rbx), %rax
movl 0x20(%rax), %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::set_defaults(pa_server_info const*)
void Pa::set_defaults(const pa_server_info *info)
{
    std::lock_guard<std::mutex> lk(inputMtx);

    for (auto &s : PA_SINKS) {
        if (!strcmp(s.second->pa_name, info->default_sink_name)) {
            s.second->is_default = true;
        } else {
            s.second->is_default = false;
        }
    }

    for (auto &s : PA_SOURCES) {
        if (!strcmp(s.second->pa_name, info->default_source_name)) {
            s.second->is_default = true;
        } else {
            s.second->is_default = false;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x100(%rdi), %r14
movq %r14, %rdi
callq 0x92ce
movq 0x50(%r15), %r12
leaq 0x40(%r15), %r13
cmpq %r13, %r12
je 0x8624
movq 0x28(%r12), %rbp
leaq 0x10f(%rbp), %rdi
movq 0x30(%rbx), %rsi
callq 0x6830
testl %eax, %eax
sete 0x20e(%rbp)
movq %r12, %rdi
callq 0x6450
movq %rax, %r12
jmp 0x85f4
movq 0x80(%r15), %r12
addq $0x70, %r15
cmpq %r15, %r12
je 0x8660
movq 0x28(%r12), %r13
leaq 0x10f(%r13), %rdi
movq 0x38(%rbx), %rsi
callq 0x6830
testl %eax, %eax
sete 0x20e(%r13)
movq %r12, %rdi
callq 0x6450
movq %rax, %r12
jmp 0x862f
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x64c0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x92ce
leaq 0x68(%r14), %rbx
leaq 0x8(%r12), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x9266
movq %rax, %r13
testq %rax, %rax
je 0x889c
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x9280
movq (%rax), %r15
movl (%rbp), %eax
jmp 0x88d1
movl $0x278, %edi            # imm = 0x278
callq 0x65c0
movq %rax, %r15
movq %rax, %rdi
callq 0x7ad0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x9280
movq %r15, (%rax)
movl (%rbp), %eax
movl %eax, 0x21c(%r15)
andq $0x0, 0x220(%r15)
movl %eax, 0xc(%r15)
movzbl 0x24(%r12), %eax
movl %eax, 0x210(%r15)
leaq 0xac(%r12), %rdi
callq 0x6a30
movl %eax, 0x214(%r15)
cmpl $0x0, 0x130(%r12)
setne 0x218(%r15)
leaq 0x10(%r15), %rdi
movq 0x10(%r12), %rsi
movl $0xfe, %edx
callq 0x6330
leaq 0x10f(%r15), %rdi
movq (%r12), %rsi
movl $0xfe, %edx
callq 0x6330
testq %r13, %r13
jne 0x893f
movq %r14, %rdi
movq %r15, %rsi
callq 0x89f8
movq 0x180(%r12), %rsi
movl 0x178(%r12), %edx
movq %r15, %rdi
callq 0x7b34
movq %r14, 0x10(%rsp)
movq 0x188(%r12), %rbx
testq %rbx, %rbx
je 0x89a5
movq 0x238(%r15), %r12
movq 0x240(%r15), %r13
subq %r12, %r13
sarq $0x3, %r13
xorl %ecx, %ecx
movl %ecx, %ebp
cmpq %rbp, %r13
jbe 0x89a5
movq (%r12,%rbp,8), %r14
leaq 0x8(%r14), %rdi
movq (%rbx), %rsi
callq 0x6830
leal 0x1(%rbp), %ecx
testl %eax, %eax
jne 0x8980
movq %r14, 0x230(%r15)
movq 0x10(%rsp), %rax
movq 0xf8(%rax), %rax
testq %rax, %rax
je 0x89b8
callq *%rax
movq 0x8(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x64c0
movq %rax, %rbx
movl $0x278, %esi            # imm = 0x278
movq %r15, %rdi
callq 0x65d0
jmp 0x89e5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x64c0
movq %rbx, %rdi
callq 0x6ac0
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::create_monitor_stream_for_paobject(PaObject*)
void Pa::create_monitor_stream_for_paobject(PaObject *po)
{
    if (po->monitor_stream != nullptr) {
        pa_stream_disconnect(po->monitor_stream);
        po->monitor_stream = nullptr;
    }

	po->monitor_stream = create_monitor_stream_for_source
		(po->monitor_index, po->type == pa_object_t::INPUT ? po->index : -1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x220(%rsi), %rdi
testq %rdi, %rdi
je 0x8a1b
callq 0x6b20
andq $0x0, 0x220(%rbx)
movl 0x21c(%rbx), %esi
cmpl $0x1, 0x8(%rbx)
jne 0x8a2c
movl 0xc(%rbx), %edx
jmp 0x8a2f
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x90fc
movq %rax, 0x220(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::update_card(pa_card_info const*)
void Pa::update_card(const pa_card_info *info)
{
    std::lock_guard<std::mutex> lk(inputMtx);
    PaCard *p;

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

    p->index = info->index;
    p->channels = 0;
    p->volume = 0;
    p->mute = false;
    p->updateProfiles(info->profiles, info->n_profiles);
    p->active_attribute = nullptr;

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

    const char *description;
    description = pa_proplist_gets(info->proplist, PA_PROP_DEVICE_DESCRIPTION);

    if (description) {
        snprintf(p->name, sizeof(p->name), "%s", description);
    } else {
        snprintf(p->name, sizeof(p->name), "%s", info->name);
    }

    notify_update();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x100, %rdi            # imm = 0x100
movq %rdi, (%rsp)
callq 0x92ce
leaq 0xc8(%rbx), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x9266
testq %rax, %rax
je 0x8a94
movq %r13, %rdi
movq %r14, %rsi
callq 0x9280
movq (%rax), %r12
movl (%r14), %eax
jmp 0x8acb
movl $0x278, %edi            # imm = 0x278
callq 0x65c0
movq %rax, %r12
movq %rax, %rdi
callq 0x7564
movq %r13, %rdi
movq %r14, %rsi
callq 0x9280
movq %r12, (%rax)
movl (%r14), %eax
movl %eax, 0x21c(%r12)
andq $0x0, 0x220(%r12)
movl %eax, 0xc(%r12)
andq $0x0, 0x210(%r12)
movb $0x0, 0x218(%r12)
movq 0x28(%r14), %rsi
movl 0x20(%r14), %edx
movq %r12, %rdi
callq 0x75b8
movq %rbx, 0x8(%rsp)
andq $0x0, 0x230(%r12)
movq %r14, 0x10(%rsp)
movq 0x30(%r14), %r13
testq %r13, %r13
je 0x8b51
movq 0x238(%r12), %rbp
movq 0x240(%r12), %rbx
subq %rbp, %rbx
sarq $0x3, %rbx
xorl %ecx, %ecx
movl %ecx, %r14d
cmpq %r14, %rbx
jbe 0x8b51
movq (%rbp,%r14,8), %r15
leaq 0x8(%r15), %rdi
movq (%r13), %rsi
callq 0x6830
leal 0x1(%r14), %ecx
testl %eax, %eax
jne 0x8b27
movq %r15, 0x230(%r12)
movq 0x10(%rsp), %r14
movq 0x38(%r14), %rdi
leaq 0x7816(%rip), %rsi      # 0x10377
callq 0x6520
addq $0x10, %r12
testq %rax, %rax
movq 0x8(%rsp), %rbx
je 0x8b88
leaq 0x8dba(%rip), %rdx      # 0x11935
movl $0xff, %esi
movq %r12, %rdi
movq %rax, %rcx
jmp 0x8b9b
movq 0x8(%r14), %rcx
leaq 0x8da2(%rip), %rdx      # 0x11935
movl $0xff, %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x69c0
movq 0xf8(%rbx), %rax
testq %rax, %rax
je 0x8bb0
callq *%rax
movq (%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x64c0
movq %rax, %r14
movl $0x278, %esi            # imm = 0x278
movq %r12, %rdi
callq 0x65d0
jmp 0x8bde
jmp 0x8bdb
movq %rax, %r14
movq (%rsp), %rdi
callq 0x64c0
movq %r14, %rdi
callq 0x6ac0
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::update_sink(pa_sink_info const*)
void Pa::update_sink(const pa_sink_info *info)
{
    std::lock_guard<std::mutex> lk(inputMtx);

    PaSink *p;

    if (PA_SINKS.count(info->index) == 0) {
        p = new PaSink;
        PA_SINKS[info->index] = p;
        p->monitor_stream = nullptr;
    } else {
        p = reinterpret_cast<PaSink *>(PA_SINKS[info->index]);
    }

    p->index = info->index;
    p->channels = info->channel_map.channels;
    p->monitor_index = info->monitor_source;
    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);

    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, %rbx
addq $0x100, %rdi            # imm = 0x100
movq %rdi, 0x8(%rsp)
callq 0x92ce
leaq 0x38(%rbx), %rbp
leaq 0x8(%r12), %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x9266
testq %rax, %rax
je 0x8c3e
movq %rbp, %rdi
movq %r13, %rsi
callq 0x9280
movq (%rax), %r15
jmp 0x8c69
movl $0x278, %edi            # imm = 0x278
callq 0x65c0
movq %rax, %r15
movq %rax, %rdi
callq 0x77e4
movq %rbp, %rdi
movq %r13, %rsi
callq 0x9280
movq %r15, (%rax)
andq $0x0, 0x220(%r15)
movl 0x8(%r12), %eax
movl %eax, 0xc(%r15)
movzbl 0x24(%r12), %eax
movl %eax, 0x210(%r15)
movl 0x134(%r12), %eax
movl %eax, 0x21c(%r15)
leaq 0xac(%r12), %rdi
callq 0x6a30
movl %eax, 0x214(%r15)
cmpl $0x0, 0x130(%r12)
setne 0x218(%r15)
leaq 0x10(%r15), %rdi
movq 0x10(%r12), %rsi
movl $0xfe, %edx
callq 0x6330
leaq 0x10f(%r15), %rdi
movq (%r12), %rsi
movl $0xfe, %edx
callq 0x6330
movq 0x180(%r12), %rsi
movl 0x178(%r12), %edx
movq %r15, %rdi
callq 0x7846
movq %rbx, 0x10(%rsp)
movq 0x188(%r12), %r12
testq %r12, %r12
je 0x8d43
movq 0x238(%r15), %r13
movq 0x240(%r15), %rbp
subq %r13, %rbp
sarq $0x3, %rbp
xorl %ecx, %ecx
movl %ecx, %ebx
cmpq %rbx, %rbp
jbe 0x8d43
movq (%r13,%rbx,8), %r14
leaq 0x8(%r14), %rdi
movq (%r12), %rsi
callq 0x6830
leal 0x1(%rbx), %ecx
testl %eax, %eax
jne 0x8d1c
movq %r14, 0x230(%r15)
movq 0x10(%rsp), %rax
movq 0xf8(%rax), %rax
testq %rax, %rax
je 0x8d56
callq *%rax
movq 0x8(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x64c0
movq %rax, %r14
movl $0x278, %esi            # imm = 0x278
movq %r15, %rdi
callq 0x65d0
jmp 0x8d83
movq %rax, %r14
movq 0x8(%rsp), %rdi
callq 0x64c0
movq %r14, %rdi
callq 0x6ac0
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::update_input(pa_sink_input_info const*)
void Pa::update_input(const pa_sink_input_info *info)
{

    std::lock_guard<std::mutex> lk(inputMtx);

    PaInput *p;

    bool sink_changed = true;

    if (PA_INPUTS.count(info->index) == 0) {
        p = new PaInput;
        PA_INPUTS[info->index] = p;
        p->monitor_stream = nullptr;
    } else {
        p = reinterpret_cast<PaInput *>(PA_INPUTS[info->index]);

        if (PA_INPUTS.count(info->index)) {
            sink_changed = info->sink != p->sink;
        }
    }


    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;
    p->sink = info->sink;
    snprintf(p->name, sizeof(p->name), "%s", info->name);

    const auto app_name = pa_proplist_gets(info->proplist, PA_PROP_APPLICATION_NAME);
    p->app_name = (app_name != NULL) ? app_name : "Module";

    if (sink_changed) {
        create_monitor_stream_for_paobject(p);
    }

    notify_update();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %r14
leaq 0x100(%rdi), %rbx
movq %rbx, %rdi
callq 0x92ce
leaq 0x8(%r14), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x9266
testq %rax, %rax
je 0x8dfa
movq %r13, %rdi
movq %r12, %rsi
callq 0x9280
movq (%rax), %r15
movq %r13, %rdi
movq %r12, %rsi
callq 0x9266
testq %rax, %rax
je 0x8e25
movl 0x18(%r12), %eax
cmpl 0x278(%r15), %eax
setne %bpl
jmp 0x8e28
movl $0x2a0, %edi            # imm = 0x2A0
callq 0x65c0
movq %rax, %r15
movq %rax, %rdi
callq 0x7a08
movq %r13, %rdi
movq %r12, %rsi
callq 0x9280
movq %r15, (%rax)
andq $0x0, 0x220(%r15)
movb $0x1, %bpl
movl (%r12), %eax
movl %eax, 0xc(%r15)
movzbl 0x28(%r12), %eax
movl %eax, 0x210(%r15)
leaq 0xac(%r12), %rdi
callq 0x6a30
movl %eax, 0x214(%r15)
cmpl $0x0, 0x150(%r12)
setne 0x218(%r15)
movl 0x18(%r12), %eax
movl %eax, 0x278(%r15)
leaq 0x10(%r15), %rdi
movq 0x8(%r12), %rcx
leaq 0x8ab7(%rip), %rdx      # 0x11935
movl $0xff, %esi
xorl %eax, %eax
callq 0x69c0
movq 0x158(%r12), %rdi
leaq 0x73ef(%rip), %rsi      # 0x10288
callq 0x6520
testq %rax, %rax
leaq 0x74c8(%rip), %rsi      # 0x10370
cmovneq %rax, %rsi
leaq 0x280(%r15), %rdi
callq 0x6b90
testb %bpl, %bpl
je 0x8ec8
movq %r14, %rdi
movq %r15, %rsi
callq 0x89f8
movq 0xf8(%r14), %rax
testq %rax, %rax
je 0x8ed6
callq *%rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x64c0
movq %rax, %r14
movl $0x2a0, %esi            # imm = 0x2A0
movq %r15, %rdi
callq 0x65d0
jmp 0x8f03
jmp 0x8f00
movq %rax, %r14
movq %rbx, %rdi
callq 0x64c0
movq %r14, %rdi
callq 0x6ac0
nop
// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pa.cpp
// Function: Pa::read_callback(pa_stream*, unsigned long, void*)
void Pa::read_callback(pa_stream *s, size_t length, void *instance)
{
    Pa *pa = reinterpret_cast<Pa *>(instance);
    std::lock_guard<std::mutex> lk(pa->inputMtx);
    const void *data;
    float v;

    if (pa_stream_peek(s, &data, &length) < 0) {
        return;
    }

    if (!data) {
        /*  NULL data means either a hole or empty buffer.
            Only drop the stream when there is a hole (length > 0) */
        if (length) {
            pa_stream_drop(s);
        }

        return;
    }

    assert(length > 0);
    assert(length % sizeof(float) == 0);

    v = ((const float *) data)[length / sizeof(float) - 1];

    pa_stream_drop(s);

    if (v < 0) {
        v = 0;
    }

    if (v > 1) {
        v = 1;
    }

    uint32_t input_idx = pa_stream_get_monitor_stream(s);

    if (input_idx != PA_INVALID_INDEX && pa->PA_INPUTS.find(input_idx) != pa->PA_INPUTS.end()) {
        pa->PA_INPUTS[input_idx]->peak = v;
    } else {
        pa->updatePeakByDeviceId(pa_stream_get_device_index(s), v);
    }

    pa->notify_update();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, %r15
leaq 0x10(%rsp), %r12
movq %rsi, (%r12)
leaq 0x100(%rdx), %rbx
movq %rbx, %rdi
callq 0x92ce
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x6380
testl %eax, %eax
js 0x9016
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
testq %rax, %rax
je 0x9009
andq $-0x4, %rcx
movss -0x4(%rax,%rcx), %xmm0
movss %xmm0, (%rsp)
movq %r15, %rdi
callq 0x6950
movq %r15, %rdi
callq 0x6270
xorps %xmm0, %xmm0
maxss (%rsp), %xmm0
movss 0x72ed(%rip), %xmm1     # 0x10284
minss %xmm0, %xmm1
movss %xmm1, (%rsp)
movl %eax, 0x4(%rsp)
cmpl $-0x1, %eax
je 0x8fe2
leaq 0x8(%r14), %r12
leaq 0x4(%rsp), %rsi
movq %r12, %rdi
callq 0x93a8
leaq 0x10(%r14), %rcx
cmpq %rcx, %rax
je 0x8fe2
leaq 0x4(%rsp), %rsi
movq %r12, %rdi
callq 0x9280
movq (%rax), %rax
movss (%rsp), %xmm0
movss %xmm0, 0x228(%rax)
jmp 0x8ff9
movq %r15, %rdi
callq 0x6110
movq %r14, %rdi
movl %eax, %esi
movss (%rsp), %xmm0
callq 0x9042
movq 0xf8(%r14), %rax
testq %rax, %rax
je 0x9016
callq *%rax
jmp 0x9016
testq %rcx, %rcx
je 0x9016
movq %r15, %rdi
callq 0x6950
movq %rbx, %rdi
callq 0x64c0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x902e
jmp 0x902e
movq %rax, %r14
movq %rbx, %rdi
callq 0x64c0
movq %r14, %rdi
callq 0x6ac0
nop