// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movl %edi, %ebp
leaq 0xa380(%rip), %rsi      # 0x114e4
movl $0x6, %edi
callq 0x6570
leaq 0x4(%rsp), %r14
movl $0x0, (%r14)
leaq 0x8(%rsp), %rax
movb $0x0, 0x28(%rax)
movl $0x0, (%rsp)
leaq 0x9ec6(%rip), %r13      # 0x11057
leaq 0x10628(%rip), %r12     # 0x177c0
movq 0x10dd1(%rip), %r15     # 0x17f70
movl %ebp, %edi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r14, %r8
callq 0x69d0
cmpl $0x67, %eax
jg 0x71cb
cmpl $0x63, %eax
jne 0x71f7
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x72fa
jmp 0x719f
cmpl $0x74, %eax
jne 0x7206
movq (%r15), %rdx
movzbl (%rdx), %eax
cmpl $0x70, %eax
je 0x719f
cmpl $0x6e, %eax
jg 0x7212
cmpl $0x63, %eax
je 0x722c
cmpl $0x69, %eax
jne 0x72b8
movl $0x3, (%rsp)
jmp 0x719f
cmpl $-0x1, %eax
je 0x724b
cmpl $0x3f, %eax
jne 0x719f
jmp 0x7290
cmpl $0x68, %eax
je 0x7244
cmpl $0x76, %eax
jne 0x719f
jmp 0x728b
cmpl $0x72, %eax
je 0x7238
cmpl $0x6f, %eax
jne 0x72b8
movl $0x2, (%rsp)
jmp 0x719f
movl $0x4, (%rsp)
jmp 0x719f
movl $0x1, (%rsp)
jmp 0x719f
callq 0x7113
jmp 0x7290
leaq 0x1154e(%rip), %rdi     # 0x187a0
leaq 0x8(%rsp), %rsi
callq 0xa276
leaq 0x113a5(%rip), %rdi     # 0x18608
callq 0x85e8
leaq 0x11589(%rip), %rdi     # 0x187f8
movl (%rsp), %esi
callq 0xb688
xorl %ebx, %ebx
testl %eax, %eax
jle 0x7292
leaq 0x11574(%rip), %rdi     # 0x187f8
callq 0xd3e0
jmp 0x7292
callq 0x70ac
xorl %ebx, %ebx
cmpb $0x1, 0x30(%rsp)
jne 0x72a7
leaq 0x8(%rsp), %rdi
movb $0x0, 0x28(%rdi)
callq 0x7324
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10cf1(%rip), %rax     # 0x17fb0
movq (%rax), %rdi
leaq 0x9d95(%rip), %rsi      # 0x1105e
xorl %eax, %eax
callq 0x6830
movl $0x1, %ebx
jmp 0x7292
jmp 0x72d9
movq %rax, %rbx
cmpb $0x1, 0x30(%rsp)
jne 0x72f1
leaq 0x8(%rsp), %rdi
movb $0x0, 0x28(%rdi)
callq 0x7324
movq %rbx, %rdi
callq 0x6a80
nop