// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/ui/tab.cpp
// Function: Tab::handleEvents(char const* const&)
void Tab::handleEvents(const char* const &event)
{
    if (object == nullptr) {
        return;
    }

    selected_index = pulse.exists(*object, selected_index);

    if (selected_index == static_cast<uint32_t>(-1)) {
        return;
    }

    auto pai = object->find(selected_index);

    PaObject *selected_pobj = nullptr;

    if (pai != object->end()) {
        selected_pobj = pai->second;
    }

    if (!strcmp("mute", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->toggle_mute();
        }
    } else if (!strcmp("move_first", event)) {
        auto i = object->begin();

        if (i != object->end()) {
            selected_index = i->first;
            selected_block = 0;
        }

    } else if (!strcmp("move_last", event)) {
        auto i = object->rbegin();

        if (i != object->rend()) {
            selected_index = i->first;
            selected_block = object->size() - 1;
        }
    } else if (!strcmp("move_up", event)) {
        auto i = std::prev(object->find(selected_index), 1);

        if (i != object->end()) {
            selected_index = i->first;
            selected_block = (selected_block > 0) ? selected_block - 1 : 0;
        }
    } else if (!strcmp("move_down", event)) {
        auto i = std::next(object->find(selected_index), 1);

        if (i != object->end()) {
            selected_index = i->first;
            selected_block++;
        }
    } else if (!strcmp("toggle_static", event)) {
        ui.static_bar = !ui.static_bar;
    } else if (!strcmp("volume_up", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->step_volume(1);
        }
    } else if (!strcmp("volume_down", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->step_volume(-1);
        }
    } else if (!strcmp("set_volume_0", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(0);
        }
    } else if (!strcmp("set_volume_10", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.1f);
        }
    } else if (!strcmp("set_volume_20", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.2f);
        }
    } else if (!strcmp("set_volume_30", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.3f);
        }
    } else if (!strcmp("set_volume_40", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.4f);
        }
    } else if (!strcmp("set_volume_50", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.5f);
        }
    } else if (!strcmp("set_volume_60", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.6f);
        }
    } else if (!strcmp("set_volume_70", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.7f);
        }
    } else if (!strcmp("set_volume_80", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.8f);
        }
    } else if (!strcmp("set_volume_90", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(.9f);
        }
    } else if (!strcmp("set_volume_100", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_volume(1.0f);
        }
    } else if (!strcmp("set_default", event)) {
        if (selected_pobj != nullptr) {
            selected_pobj->set_default(selected_pobj->pa_name);
        }
    } else if (!strcmp("switch", event)) {
        if (selected_pobj != nullptr && toggle != nullptr) {
            auto current_toggle = toggle->find(selected_pobj->getRelation());
            current_toggle = std::next(current_toggle, 1);

            if (current_toggle == toggle->end()) {
                current_toggle = toggle->begin();
            }

            selected_pobj->move(current_toggle->first);
        } else if (selected_pobj != nullptr) {
            uint32_t current_attribute = selected_pobj->getRelation();

            if (current_attribute + 1 < selected_pobj->attributes.size()) {
                current_attribute++;
            } else {
                current_attribute = 0;
            }

            if (selected_pobj->attributes.size() > 0) {
                selected_pobj->set_active_attribute(
                    selected_pobj->attributes[current_attribute]->name
                );
            }
        }
    } else if (!strcmp("dropdown", event) || !strcmp("select", event)) {
        handleDropDown(selected_pobj);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movq 0x10(%rdi), %rsi
testq %rsi, %rsi
je 0xd493
movq %rdi, %r14
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xe628
movl 0xc(%r14), %esi
movq %rbx, %rdi
callq 0x858e
leaq 0xc(%r14), %r12
movl %eax, (%r12)
leaq 0x8(%rsp), %rdi
callq 0x92e2
cmpl $-0x1, (%r12)
je 0xd493
movq 0x10(%r14), %rdi
movq %r12, %rsi
callq 0x93a8
movq 0x10(%r14), %r13
leaq 0x8(%r13), %rbp
cmpq %rbp, %rax
je 0xd0a8
movq 0x28(%rax), %rbx
jmp 0xd0aa
xorl %ebx, %ebx
movq (%r15), %r15
leaq 0x48f7(%rip), %rdi      # 0x119ab
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd2ca
leaq 0x48e5(%rip), %rdi      # 0x119b0
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd2e0
leaq 0x48d9(%rip), %rdi      # 0x119bb
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd2fe
leaq 0x48cc(%rip), %rdi      # 0x119c5
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd326
leaq 0x48bd(%rip), %rdi      # 0x119cd
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd36b
leaq 0x48b0(%rip), %rdi      # 0x119d7
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd3a2
leaq 0x48a7(%rip), %rdi      # 0x119e5
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd3b5
leaq 0x489a(%rip), %rdi      # 0x119ef
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd3c2
leaq 0x488f(%rip), %rdi      # 0x119fb
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd3db
leaq 0x4885(%rip), %rdi      # 0x11a08
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd3ec
leaq 0x487c(%rip), %rdi      # 0x11a16
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd402
leaq 0x4873(%rip), %rdi      # 0x11a24
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd415
leaq 0x486a(%rip), %rdi      # 0x11a32
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd424
leaq 0x4861(%rip), %rdi      # 0x11a40
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd433
leaq 0x4858(%rip), %rdi      # 0x11a4e
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd442
leaq 0x484f(%rip), %rdi      # 0x11a5c
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd451
leaq 0x4846(%rip), %rdi      # 0x11a6a
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd460
leaq 0x483d(%rip), %rdi      # 0x11a78
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd46f
leaq 0x4834(%rip), %rdi      # 0x11a86
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd47e
leaq 0x482c(%rip), %rdi      # 0x11a95
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd4a2
leaq 0x4821(%rip), %rdi      # 0x11aa1
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd4b8
leaq 0x4811(%rip), %rdi      # 0x11aa8
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
je 0xd2ba
leaq 0x4807(%rip), %rdi      # 0x11ab1
movq %r15, %rsi
callq 0x6830
testl %eax, %eax
jne 0xd493
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd560
jmp 0xd493
testq %rbx, %rbx
je 0xd493
movq %rbx, %rdi
callq 0x73f8
jmp 0xd493
movq 0x18(%r13), %rax
cmpq %rbp, %rax
je 0xd493
movl 0x20(%rax), %eax
movl %eax, 0xc(%r14)
andl $0x0, 0x20(%r14)
jmp 0xd493
cmpq 0x18(%r13), %rbp
je 0xd493
movq %rbp, %rdi
callq 0x6620
movl 0x20(%rax), %eax
movl %eax, 0xc(%r14)
movl 0x28(%r13), %eax
decl %eax
movl %eax, 0x20(%r14)
jmp 0xd493
movq %r13, %rdi
movq %r12, %rsi
callq 0x93a8
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0xe524
movq 0x10(%r14), %rcx
addq $0x8, %rcx
cmpq %rcx, %rax
je 0xd493
movl 0x20(%rax), %eax
movl %eax, 0xc(%r14)
movl 0x20(%r14), %eax
leal -0x1(%rax), %ecx
xorl %edx, %edx
testl %eax, %eax
cmovgl %ecx, %edx
movl %edx, 0x20(%r14)
jmp 0xd493
movq %r13, %rdi
movq %r12, %rsi
callq 0x93a8
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0xe545
movq 0x10(%r14), %rcx
addq $0x8, %rcx
cmpq %rcx, %rax
je 0xd493
movl 0x20(%rax), %eax
movl %eax, 0xc(%r14)
incl 0x20(%r14)
jmp 0xd493
leaq 0xb47f(%rip), %rax      # 0x18828
xorb $0x1, 0x103(%rax)
jmp 0xd493
testq %rbx, %rbx
je 0xd493
pushq $0x1
jmp 0xd3cd
testq %rbx, %rbx
je 0xd493
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x73c0
jmp 0xd493
testq %rbx, %rbx
je 0xd493
xorps %xmm0, %xmm0
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x4543(%rip), %xmm0     # 0x11940
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x4551(%rip), %xmm0     # 0x11964
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x453e(%rip), %xmm0     # 0x11960
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x452b(%rip), %xmm0     # 0x1195c
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x4518(%rip), %xmm0     # 0x11958
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x4505(%rip), %xmm0     # 0x11954
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x44f2(%rip), %xmm0     # 0x11950
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x44df(%rip), %xmm0     # 0x1194c
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x44cc(%rip), %xmm0     # 0x11948
jmp 0xd48b
testq %rbx, %rbx
je 0xd493
movss 0x2df9(%rip), %xmm0     # 0x10284
movq %rbx, %rdi
callq 0x7322
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rbx, %rbx
je 0xd493
leaq 0x10f(%rbx), %rsi
movq %rbx, %rdi
callq 0x74a2
jmp 0xd493
testq %rbx, %rbx
je 0xd493
movq 0x18(%r14), %r15
testq %r15, %r15
je 0xd507
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r15, %rdi
callq 0x93a8
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0xe545
movq 0x18(%r14), %rcx
leaq 0x8(%rcx), %rdx
cmpq %rdx, %rax
jne 0xd4fa
movq 0x18(%rcx), %rax
movl 0x20(%rax), %esi
movq %rbx, %rdi
callq 0x7436
jmp 0xd493
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movq 0x238(%rbx), %rcx
movq 0x240(%rbx), %rdx
subq %rcx, %rdx
je 0xd493
sarq $0x3, %rdx
incl %eax
xorl %esi, %esi
cmpq %rax, %rdx
cmovaq %rax, %rsi
movq (%rcx,%rsi,8), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x746c
jmp 0xd493
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x92e2
movq %rbx, %rdi
callq 0x6ac0