// File: millanek[P]evo/evo_permute_codons.cpp
// Function: parsePermuteCodonsOptions(int, char**)
void parsePermuteCodonsOptions(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 'l': arg >> opt::alignmentListFile; break;
            case 'h':
                std::cout << PERMUTE_USAGE_MESSAGE;
                exit(EXIT_SUCCESS);
        }
    }
    
    if (opt::alignmentListFile == "") {
        std::cerr << "The -l option must 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 (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" << PERMUTE_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 0x14cb04(%rip), %rdx    # 0x1996a8
leaq 0x149b65(%rip), %rcx    # 0x196710
xorl %eax, %eax
movl %eax, %r8d
callq 0xaa40
movb %al, -0x12(%rbp)
movsbl %al, %eax
cmpl $-0x1, %eax
je 0x4cd6d
movq 0x14c3c5(%rip), %rax    # 0x198f90
cmpq $0x0, (%rax)
je 0x4cbe4
movq 0x14c3b8(%rip), %rax    # 0x198f90
movq (%rax), %rax
movq %rax, -0x1d8(%rbp)
jmp 0x4cbf4
leaq 0xe92f4(%rip), %rax     # 0x135edf
movq %rax, -0x1d8(%rbp)
jmp 0x4cbf4
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 0x4cc31
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
movl $0x8, %edx
callq 0xaaa0
jmp 0x4cc4b
leaq -0x1b8(%rbp), %rdi
callq 0xac88
leaq -0x1b9(%rbp), %rdi
callq 0xa640
movsbl -0x12(%rbp), %eax
movl %eax, -0x1ec(%rbp)
subl $0x3f, %eax
je 0x4cce9
jmp 0x4cc74
movl -0x1ec(%rbp), %eax
subl $0x68, %eax
je 0x4cd40
jmp 0x4cc85
movl -0x1ec(%rbp), %eax
subl $0x6c, %eax
je 0x4cd29
jmp 0x4cc96
movl -0x1ec(%rbp), %eax
subl $0x70, %eax
je 0x4ccef
jmp 0x4cd5c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x4ccd8
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 0x4ce6e
movb $0x1, -0x11(%rbp)
jmp 0x4cd5c
leaq 0x14c9ba(%rip), %rsi    # 0x1996b0
leaq -0x198(%rbp), %rdi
callq 0xa7c0
jmp 0x4cd04
jmp 0x4cd5c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x198(%rbp), %rdi
callq 0xa290
jmp 0x4ce6e
leaq 0x14d068(%rip), %rsi    # 0x199d98
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x4cd3e
jmp 0x4cd5c
movq 0x14c971(%rip), %rsi    # 0x1996b8
movq 0x14c26a(%rip), %rdi    # 0x198fb8
callq 0xa5c0
jmp 0x4cd55
xorl %edi, %edi
callq 0xa700
leaq -0x198(%rbp), %rdi
callq 0xa290
jmp 0x4cb96
leaq 0x14d024(%rip), %rdi    # 0x199d98
leaq 0xe9164(%rip), %rsi     # 0x135edf
callq 0x2d770
testb $0x1, %al
jne 0x4cd86
jmp 0x4cd9d
movq 0x14c263(%rip), %rdi    # 0x198ff0
leaq 0xe5a8a(%rip), %rsi     # 0x13281e
callq 0xa5c0
movb $0x1, -0x11(%rbp)
movsbl 0x14c90c(%rip), %eax    # 0x1996b0
cmpl $0x68, %eax
je 0x4cddf
movsbl 0x14c900(%rip), %eax    # 0x1996b0
cmpl $0x64, %eax
je 0x4cddf
movq 0x14c234(%rip), %rdi    # 0x198ff0
leaq 0xe5a7c(%rip), %rsi     # 0x13283f
callq 0xa5c0
movq 0x14c221(%rip), %rdi    # 0x198ff0
leaq 0xe5aa7(%rip), %rsi     # 0x13287d
callq 0xa5c0
movb $0x1, -0x11(%rbp)
movl -0x4(%rbp), %eax
movq 0x14c1d7(%rip), %rcx    # 0x198fc0
subl (%rcx), %eax
cmpl $0x0, %eax
jge 0x4ce09
movq 0x14c1f9(%rip), %rdi    # 0x198ff0
leaq 0xe562c(%rip), %rsi     # 0x13242a
callq 0xa5c0
movb $0x1, -0x11(%rbp)
jmp 0x4ce33
movl -0x4(%rbp), %eax
movq 0x14c1ad(%rip), %rcx    # 0x198fc0
subl (%rcx), %eax
cmpl $0x0, %eax
jle 0x4ce31
movq 0x14c1cf(%rip), %rdi    # 0x198ff0
leaq 0xe5615(%rip), %rsi     # 0x13243d
callq 0xa5c0
movb $0x1, -0x11(%rbp)
jmp 0x4ce33
testb $0x1, -0x11(%rbp)
je 0x4ce65
movq 0x14c178(%rip), %rdi    # 0x198fb8
leaq 0xe2a46(%rip), %rsi     # 0x12f88d
callq 0xa5c0
movq %rax, %rdi
movq 0x14c862(%rip), %rsi    # 0x1996b8
callq 0xa5c0
movl $0x1, %edi
callq 0xa700
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq -0x1c8(%rbp), %rdi
callq 0xab50
nopw (%rax,%rax)