// File: millanek[P]evo/process_vcf_cbs.cpp
// Function: parseCbsOptions(int, char**)
void parseCbsOptions(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 's': arg >> opt::sampleNameFile; break;
            case 'm': arg >> opt::minScLength; break;
            case OPT_CBS: arg >> opt::undeterminedLociFile; break;
            case OPT_FEATURES: arg >> opt::featuresFile; break;
            case OPT_CHR_SIZES: arg >> opt::sizesFile; break;
            case OPT_GROUPS: arg >> opt::groupsFile; break;
            case OPT_PREPARE_GENOME: opt::bPrepareGenome = true; break;
            case 'h':
                std::cout << CBS_USAGE_MESSAGE;
                exit(EXIT_SUCCESS);
        }
    }
    if (argc - optind < 1) {
        std::cerr << "missing arguments\n";
        die = true;
    }
    else if (argc - optind > 1)
    {
        std::cerr << "too many arguments\n";
        die = true;
    }
    
    if (die) {
        std::cout << "\n" << CBS_USAGE_MESSAGE;
        exit(EXIT_FAILURE);
    }
    
    // Parse the input filenames
    if (opt::bPrepareGenome)
        opt::genomeFile = argv[optind++];
    else if (!opt::undeterminedLociFile.empty()) {
        opt::vcfFile = argv[optind++];
    } else {
        std::cerr << "either the --cbs or the --prepare-genome option has to be selected" << std::endl;
        std::cout << CBS_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 0x12f35c(%rip), %rdx    # 0x199750
leaq 0x12c8f5(%rip), %rcx    # 0x196cf0
xorl %eax, %eax
movl %eax, %r8d
callq 0xaa40
movb %al, -0x12(%rbp)
movsbl %al, %eax
cmpl $-0x1, %eax
je 0x6a67f
movq 0x12eb75(%rip), %rax    # 0x198f90
cmpq $0x0, (%rax)
je 0x6a434
movq 0x12eb68(%rip), %rax    # 0x198f90
movq (%rax), %rax
movq %rax, -0x1d8(%rbp)
jmp 0x6a444
leaq 0xcbaa4(%rip), %rax     # 0x135edf
movq %rax, -0x1d8(%rbp)
jmp 0x6a444
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 0x6a481
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
movl $0x8, %edx
callq 0xaaa0
jmp 0x6a49b
leaq -0x1b8(%rbp), %rdi
callq 0xac88
leaq -0x1b9(%rbp), %rdi
callq 0xa640
movsbl -0x12(%rbp), %eax
movl %eax, -0x1ec(%rbp)
testl %eax, %eax
je 0x6a5ed
jmp 0x6a4c7
movl -0x1ec(%rbp), %eax
subl $0x1, %eax
je 0x6a649
jmp 0x6a4d8
movl -0x1ec(%rbp), %eax
subl $0x2, %eax
je 0x6a604
jmp 0x6a4e9
movl -0x1ec(%rbp), %eax
subl $0x3, %eax
je 0x6a61b
jmp 0x6a4fa
movl -0x1ec(%rbp), %eax
subl $0x4, %eax
je 0x6a632
jmp 0x6a50b
movl -0x1ec(%rbp), %eax
subl $0x3f, %eax
je 0x6a58d
jmp 0x6a518
movl -0x1ec(%rbp), %eax
subl $0x68, %eax
je 0x6a652
jmp 0x6a529
movl -0x1ec(%rbp), %eax
subl $0x6d, %eax
je 0x6a5d3
jmp 0x6a53a
movl -0x1ec(%rbp), %eax
subl $0x73, %eax
je 0x6a596
jmp 0x6a66e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
jmp 0x6a57c
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 0x6a7cb
movb $0x1, -0x11(%rbp)
jmp 0x6a66e
leaq 0x130043(%rip), %rsi    # 0x19a5e0
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x6a5ab
jmp 0x6a66e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c8(%rbp)
movl %eax, -0x1cc(%rbp)
leaq -0x198(%rbp), %rdi
callq 0xa290
jmp 0x6a7cb
leaq 0x130026(%rip), %rsi    # 0x19a600
leaq -0x198(%rbp), %rdi
callq 0xa370
jmp 0x6a5e8
jmp 0x6a66e
leaq 0x12ffcc(%rip), %rsi    # 0x19a5c0
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x6a602
jmp 0x6a66e
leaq 0x12ff75(%rip), %rsi    # 0x19a580
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x6a619
jmp 0x6a66e
leaq 0x12ff3e(%rip), %rsi    # 0x19a560
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x6a630
jmp 0x6a66e
leaq 0x12ff67(%rip), %rsi    # 0x19a5a0
leaq -0x198(%rbp), %rdi
callq 0xa750
jmp 0x6a647
jmp 0x6a66e
movb $0x1, 0x12ffb4(%rip)    # 0x19a604
jmp 0x6a66e
movq 0x12f0ff(%rip), %rsi    # 0x199758
movq 0x12e958(%rip), %rdi    # 0x198fb8
callq 0xa5c0
jmp 0x6a667
xorl %edi, %edi
callq 0xa700
leaq -0x198(%rbp), %rdi
callq 0xa290
jmp 0x6a3e6
movl -0x4(%rbp), %eax
movq 0x12e937(%rip), %rcx    # 0x198fc0
subl (%rcx), %eax
cmpl $0x1, %eax
jge 0x6a6a9
movq 0x12e959(%rip), %rdi    # 0x198ff0
leaq 0xc7d8c(%rip), %rsi     # 0x13242a
callq 0xa5c0
movb $0x1, -0x11(%rbp)
jmp 0x6a6d3
movl -0x4(%rbp), %eax
movq 0x12e90d(%rip), %rcx    # 0x198fc0
subl (%rcx), %eax
cmpl $0x1, %eax
jle 0x6a6d1
movq 0x12e92f(%rip), %rdi    # 0x198ff0
leaq 0xc7d75(%rip), %rsi     # 0x13243d
callq 0xa5c0
movb $0x1, -0x11(%rbp)
jmp 0x6a6d3
testb $0x1, -0x11(%rbp)
je 0x6a705
movq 0x12e8d8(%rip), %rdi    # 0x198fb8
leaq 0xc51a6(%rip), %rsi     # 0x12f88d
callq 0xa5c0
movq %rax, %rdi
movq 0x12f062(%rip), %rsi    # 0x199758
callq 0xa5c0
movl $0x1, %edi
callq 0xa700
testb $0x1, 0x12fef8(%rip)    # 0x19a604
je 0x6a741
movq -0x10(%rbp), %rax
movq 0x12e8a7(%rip), %rcx    # 0x198fc0
movl (%rcx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movq 0x12e899(%rip), %rdx    # 0x198fc0
movl %esi, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x12fe09(%rip), %rdi    # 0x19a540
callq 0xa810
jmp 0x6a7c2
leaq 0x12fe78(%rip), %rdi    # 0x19a5c0
callq 0xaa70
testb $0x1, %al
jne 0x6a781
movq -0x10(%rbp), %rax
movq 0x12e864(%rip), %rcx    # 0x198fc0
movl (%rcx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movq 0x12e856(%rip), %rdx    # 0x198fc0
movl %esi, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x12fda6(%rip), %rdi    # 0x19a520
callq 0xa810
jmp 0x6a7c0
movq 0x12e868(%rip), %rdi    # 0x198ff0
leaq 0xcef4e(%rip), %rsi     # 0x1396dd
callq 0xa5c0
movq %rax, %rdi
movq 0x12e7ea(%rip), %rsi    # 0x198f88
callq 0xa610
movq 0x12efae(%rip), %rsi    # 0x199758
movq 0x12e807(%rip), %rdi    # 0x198fb8
callq 0xa5c0
movl $0x1, %edi
callq 0xa700
jmp 0x6a7c2
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq -0x1c8(%rbp), %rdi
callq 0xab50
nopw (%rax,%rax)