// File: /workspace/github_cpp_makefile_star2_O2/fulhax[P]ncpamixer/src/pulsemixer.cpp
// Function: main
int main(int argc, char *argv[])
{
    setlocale(LC_ALL, "");

    static const struct option longOpts[] = {
        { "version", no_argument, 0, 'v' },
        { "help", no_argument, 0, 'h' },
        { "config", required_argument, 0, 'c' },
        { "tab", required_argument, 0, 't' },
        { 0, 0, 0, 0 }
    };

    int c;
    int longIndex = 0;
    int startingTab = TAB_PLAYBACK;

    std::optional<fs::path> config_path{std::nullopt};

    while ((c = getopt_long(argc, argv, "vhc:t:", longOpts, &longIndex)) != -1) {

        switch (c) {
            case 'v':
                version();
                return 0;

            case 'h':
                help();
                return 0;

            case 'c':
                config_path = optarg;
                break;

            case 't':
                switch (optarg[0]) {
                    case 'p':
                        break;
                    case 'r':
                        startingTab = TAB_RECORDING;
                        break;
                    case 'o':
                        startingTab = TAB_OUTPUT;
                        break;
                    case 'i':
                        startingTab = TAB_INPUT;
                        break;
                    case 'c':
                        startingTab = TAB_CONFIGURATION;
                        break;
                    default:
                        fprintf(stderr, "invalid tab: %s\n", optarg);
                        return 1;

                }
                break;
            case '?':
                return 0;

            default:
                break;
        }
    }

    config.init(config_path);

    pulse.init();

    if (ui.init(startingTab) > 0) {
        ui.run();
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movl %edi, %ebp
leaq 0x969d(%rip), %rsi      # 0x104ef
pushq $0x6
popq %rdi
callq 0x6580
leaq 0x4(%rsp), %r15
andl $0x0, (%r15)
leaq 0x8(%rsp), %rax
movb $0x0, 0x28(%rax)
movl $0x0, (%rsp)
leaq 0x9209(%rip), %r13      # 0x10083
leaq 0x108ef(%rip), %rbx     # 0x17770
movq 0x110d8(%rip), %r12     # 0x17f60
movl %ebp, %edi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
movq %r15, %r8
callq 0x6a00
cmpl $0x63, %eax
je 0x6eed
cmpl $0x74, %eax
je 0x6ec6
cmpl $-0x1, %eax
je 0x6f26
cmpl $0x3f, %eax
je 0x6f72
cmpl $0x68, %eax
je 0x6f6d
cmpl $0x76, %eax
jne 0x6e88
jmp 0x6f66
movq (%r12), %rdx
movzbl (%rdx), %eax
leal -0x69(%rax), %ecx
cmpl $0x9, %ecx
ja 0x6efc
leaq 0x9128(%rip), %rsi      # 0x10004
movslq (%rsi,%rcx,4), %rax
addq %rsi, %rax
jmpq *%rax
pushq $0x3
popq %rax
movl %eax, (%rsp)
jmp 0x6e88
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x6fc4
jmp 0x6e88
cmpl $0x63, %eax
jne 0x6f8f
pushq $0x4
popq %rax
movl %eax, (%rsp)
jmp 0x6e88
pushq $0x2
popq %rax
movl %eax, (%rsp)
jmp 0x6e88
pushq $0x1
popq %rax
movl %eax, (%rsp)
jmp 0x6e88
leaq 0x118a3(%rip), %rdi     # 0x187d0
leaq 0x8(%rsp), %rsi
callq 0x9ce6
leaq 0x116fa(%rip), %rdi     # 0x18638
callq 0x82c0
leaq 0x118de(%rip), %rdi     # 0x18828
movl (%rsp), %esi
callq 0xb0ba
xorl %ebx, %ebx
testl %eax, %eax
jle 0x6f74
leaq 0x118c9(%rip), %rdi     # 0x18828
callq 0xc4c8
jmp 0x6f74
callq 0x6d9c
jmp 0x6f72
callq 0x6e01
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x6fe6
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1100a(%rip), %rax     # 0x17fa0
movq (%rax), %rdi
leaq 0x90ea(%rip), %rsi      # 0x1008a
xorl %eax, %eax
callq 0x6860
pushq $0x1
popq %rbx
jmp 0x6f74
jmp 0x6fae
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6fe6
movq %rbx, %rdi
callq 0x6ac0
nop