// File: millanek[P]evo/evo_codingStats_from_alignment.cpp
// Function: parseCodingStatsOptions(int, char**)
void parseCodingStatsOptions(int argc, char** argv) {
    bool die = false;
    for (char c; (c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1;)
    {
        std::istringstream arg(optarg != NULL ? optarg : "");
        switch (c)
        {
            case '?': die = true; break;
            case 'p': arg >> opt::ploidy; break;
            case 'a': arg >> opt::alignmentFile; break;
            case 'l': arg >> opt::alignmentListFile; break;
            case 't': arg >> opt::tStVratio; break;
            case 'n': opt::nonCodingNull = true; break;
            case OPT_DXY_MATRIX: arg >> opt::genomeWide_DxyMatrixFile; break;
            case OPT_PN_GROUPS: arg >> opt::pNgroupsFile; break;
            case 'h':
                std::cout << CODINGSTATS_USAGE_MESSAGE;
                exit(EXIT_SUCCESS);
        }
    }
    
    if (opt::alignmentFile == "" && opt::alignmentListFile == "") {
        std::cerr << "Either -a or -l options must be specified\n";
        die = true;
    }
    
    if (opt::alignmentFile != "" && opt::alignmentListFile != "") {
        std::cerr << "The -a and -l options can't both be specified\n";
        die = true;
    }
    
    if (opt::ploidy != 'h' && opt::ploidy != 'd') {
        std::cerr << "The -p (--ploidy) option can only have the values 'h' or 'd'\n";
        std::cerr << "At the moment I don't support other than haploid and diploid species\n";
        die = true;
    }
    
    if (opt::tStVratio <= 0) {
        std::cerr << "The tS/tV ratio must be positive\n";
        die = true;
    }
    
    
    if (argc - optind < 0) {
        std::cerr << "missing arguments\n";
        die = true;
    }
    else if (argc - optind > 0)
    {
        std::cerr << "too many arguments\n";
        die = true;
    }
    
    if (die) {
        std::cout << "\n" << CODINGSTATS_USAGE_MESSAGE;
        exit(EXIT_FAILURE);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movq 0x13516c(%rip), %rdx    # 0x199730
leaq 0x132585(%rip), %rcx    # 0x196b50
xorl %eax, %eax
movl %eax, %r8d
callq 0xaa40
movb %al, -0x12(%rbp)
movsbl %al, %eax
cmpl $-0x1, %eax
je 0x64853
movq 0x1349a5(%rip), %rax    # 0x198f90
cmpq $0x0, (%rax)
je 0x64604
movq 0x134998(%rip), %rax    # 0x198f90
movq (%rax), %rax
movq %rax, -0x1d8(%rbp)
jmp 0x64614
leaq 0xd18d4(%rip), %rax     # 0x135edf
movq %rax, -0x1d8(%rbp)
jmp 0x64614
movq -0x1d8(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x1b9(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0xab60
movq -0x1e8(%rbp), %rsi
movq -0x1e0(%rbp), %rdx
leaq -0x1b8(%rbp), %rdi
callq 0x2d6c0
jmp 0x64651
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
movl $0x8, %edx
callq 0xaaa0
jmp 0x6466b
leaq -0x1b8(%rbp), %rdi
callq 0xac88
leaq -0x1b9(%rbp), %rdi
callq 0xa640
movsbl -0x12(%rbp), %eax
movl %eax, -0x1ec(%rbp)
testl %eax, %eax
je 0x647f8
jmp 0x64697
movl -0x1ec(%rbp), %eax
subl $0x1, %eax
je 0x6480f
jmp 0x646a8
movl -0x1ec(%rbp), %eax
subl $0x3f, %eax
je 0x64761
jmp 0x646b9
movl -0x1ec(%rbp), %eax
subl $0x61, %eax
je 0x647a7
jmp 0x646ca
movl -0x1ec(%rbp), %eax
subl $0x68, %eax
je 0x64826
jmp 0x646db
movl -0x1ec(%rbp), %eax
subl $0x6c, %eax
je 0x647c1
jmp 0x646ec
movl -0x1ec(%rbp), %eax
subl $0x6e, %eax
je 0x647ef
jmp 0x646fd
movl -0x1ec(%rbp), %eax
subl $0x70, %eax
je 0x6476a
jmp 0x6470a
movl -0x1ec(%rbp), %eax
subl $0x74, %eax
je 0x647d8
jmp 0x64842
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x64750
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0xac88
leaq -0x1b9(%rbp), %rdi
callq 0xa640
jmp 0x649da
movb $0x1, -0x11(%rbp)
jmp 0x64842
leaq 0x134faf(%rip), %rsi    # 0x199720
leaq -0x198(%rbp), %rdi
callq 0xa7c0
jmp 0x6477f
jmp 0x64842
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x198(%rbp), %rdi
callq 0xa290
jmp 0x649da
leaq 0x135c72(%rip), %rsi    # 0x19a420
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x647bc
jmp 0x64842
leaq 0x135c78(%rip), %rsi    # 0x19a440
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x647d6
jmp 0x64842
leaq 0x134f49(%rip), %rsi    # 0x199728
leaq -0x198(%rbp), %rdi
callq 0xa4b0
jmp 0x647ed
jmp 0x64842
movb $0x1, 0x135caa(%rip)    # 0x19a4a0
jmp 0x64842
leaq 0x135c81(%rip), %rsi    # 0x19a480
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x6480d
jmp 0x64842
leaq 0x135c4a(%rip), %rsi    # 0x19a460
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x64824
jmp 0x64842
movq 0x134f0b(%rip), %rsi    # 0x199738
movq 0x134784(%rip), %rdi    # 0x198fb8
callq 0xa5c0
jmp 0x6483b
xorl %edi, %edi
callq 0xa700
leaq -0x198(%rbp), %rdi
callq 0xa290
jmp 0x645b6
leaq 0x135bc6(%rip), %rdi    # 0x19a420
leaq 0xd167e(%rip), %rsi     # 0x135edf
callq 0x2d770
testb $0x1, %al
jne 0x6486c
jmp 0x6489c
leaq 0x135bcd(%rip), %rdi    # 0x19a440
leaq 0xd1665(%rip), %rsi     # 0x135edf
callq 0x2d770
testb $0x1, %al
jne 0x64885
jmp 0x6489c
movq 0x134764(%rip), %rdi    # 0x198ff0
leaq 0xd164d(%rip), %rsi     # 0x135ee0
callq 0xa5c0
movb $0x1, -0x11(%rbp)
leaq 0x135b7d(%rip), %rdi    # 0x19a420
leaq 0xd1635(%rip), %rsi     # 0x135edf
callq 0x50eb0
testb $0x1, %al
jne 0x648b5
jmp 0x648e5
leaq 0x135b84(%rip), %rdi    # 0x19a440
leaq 0xd161c(%rip), %rsi     # 0x135edf
callq 0x50eb0
testb $0x1, %al
jne 0x648ce
jmp 0x648e5
movq 0x13471b(%rip), %rdi    # 0x198ff0
leaq 0xd162f(%rip), %rsi     # 0x135f0b
callq 0xa5c0
movb $0x1, -0x11(%rbp)
movsbl 0x134e34(%rip), %eax    # 0x199720
cmpl $0x68, %eax
je 0x64927
movsbl 0x134e28(%rip), %eax    # 0x199720
cmpl $0x64, %eax
je 0x64927
movq 0x1346ec(%rip), %rdi    # 0x198ff0
leaq 0xcdf34(%rip), %rsi     # 0x13283f
callq 0xa5c0
movq 0x1346d9(%rip), %rdi    # 0x198ff0
leaq 0xcdf5f(%rip), %rsi     # 0x13287d
callq 0xa5c0
movb $0x1, -0x11(%rbp)
xorps %xmm0, %xmm0
ucomisd 0x134df6(%rip), %xmm0   # 0x199728
jb 0x6494b
movq 0x1346b5(%rip), %rdi    # 0x198ff0
leaq 0xd3408(%rip), %rsi     # 0x137d4a
callq 0xa5c0
movb $0x1, -0x11(%rbp)
movl -0x4(%rbp), %eax
movq 0x13466b(%rip), %rcx    # 0x198fc0
subl (%rcx), %eax
cmpl $0x0, %eax
jge 0x64975
movq 0x13468d(%rip), %rdi    # 0x198ff0
leaq 0xcdac0(%rip), %rsi     # 0x13242a
callq 0xa5c0
movb $0x1, -0x11(%rbp)
jmp 0x6499f
movl -0x4(%rbp), %eax
movq 0x134641(%rip), %rcx    # 0x198fc0
subl (%rcx), %eax
cmpl $0x0, %eax
jle 0x6499d
movq 0x134663(%rip), %rdi    # 0x198ff0
leaq 0xcdaa9(%rip), %rsi     # 0x13243d
callq 0xa5c0
movb $0x1, -0x11(%rbp)
jmp 0x6499f
testb $0x1, -0x11(%rbp)
je 0x649d1
movq 0x13460c(%rip), %rdi    # 0x198fb8
leaq 0xcaeda(%rip), %rsi     # 0x12f88d
callq 0xa5c0
movq %rax, %rdi
movq 0x134d76(%rip), %rsi    # 0x199738
callq 0xa5c0
movl $0x1, %edi
callq 0xa700
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq -0x1c8(%rbp), %rdi
callq 0xab50
nopw %cs:(%rax,%rax)