// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/process_vcf_stats.cpp
// Function: parseStatsOptions(int, char**)
void parseStatsOptions(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 OPT_POP: arg >> opt::populationsFile; break;
            case OPT_INDIV: arg >> opt::sampleNameFile; break;
            case OPT_DIFF_MATRIX: opt::bDiffs = true; break;    
            case OPT_DOUBLETON: opt::bDoubleton = true; break;
            case OPT_HETS: opt::countHets = true; break;
            case OPT_DIFF_MATRIX_H1: opt::bDiffH1 = true; break;
            case OPT_DIFF_MATRIX_ALLH: opt::bDiffAllH = true; break;
            case OPT_BLOCK_BOOTSTRAP: arg >> opt::bootstrapBlockSize; opt::bDoBootstrap = true; break;
            case OPT_PRIVATE_VARS: opt::countPrivateVars = true; break;
            case OPT_ACC_GEN_BED: arg >> opt::accesibleGenBedFile; break;
            case OPT_NUM_ACCESSIBLE: arg >> opt::numAccessibleBP; break;
            case OPT_ACC_GEN_BED_WINDOW: arg >> opt::accessibleGenBedWindow; break;
            case 'h':
                std::cout << STATS_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 (opt::countPrivateVars && opt::populationsFile == "") {
        std::cerr << "You need to supply a file defining populations to count private fixed variants\n";
        die = true;
    }
    
    if (!opt::bDiffs && !opt::bDoubleton && !opt::countHets && !opt::countPrivateVars && opt::accesibleGenBedFile.empty()) {
        std::cerr << "Which statistics should the program calculate?\n";
        die = true;
    }
    
    if (die) {
        std::cout << "\n" << STATS_USAGE_MESSAGE;
        exit(EXIT_FAILURE);
    }
    
    // Parse the input filenames
    opt::vcfFile = argv[optind++];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %rbx
movl %edi, %ebp
movq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %r12
leaq 0x38(%rsp), %r13
leaq 0x561d3(%rip), %r14     # 0xa04a0
movl %ebp, %edi
movq %rbx, %rsi
leaq 0x483ad(%rip), %rdx     # 0x92686
leaq 0x90f20(%rip), %rcx     # 0xdb200
xorl %r8d, %r8d
callq 0x8790
movl %eax, %r15d
shll $0x18, %eax
cmpl $0xff000000, %eax       # imm = 0xFF000000
je 0x4a3f9
movq 0x92c90(%rip), %rax     # 0xdcf90
movq (%rax), %rsi
testq %rsi, %rsi
leaq 0x4fb12(%rip), %rax     # 0x99e1f
cmoveq %rax, %rsi
movq %r12, %rdi
leaq 0xf(%rsp), %rdx
callq 0x21904
movq %r13, %rdi
movq %r12, %rsi
pushq $0x8
popq %rdx
callq 0x87e0
movsbl %r15b, %r15d
movq %r12, %rdi
callq 0x8978
cmpl $0xb, %r15d
ja 0x4a361
movl %r15d, %eax
movslq (%r14,%rax,4), %rcx
addq %r14, %rcx
leaq 0x93f09(%rip), %rsi     # 0xde258
leaq 0x931ea(%rip), %rax     # 0xdd540
jmpq *%rcx
leaq 0x93f19(%rip), %rsi     # 0xde278
jmp 0x4a396
cmpl $0x3f, %r15d
je 0x4a3b2
cmpl $0x68, %r15d
jne 0x4a3ec
jmp 0x4a4c3
leaq 0x931bf(%rip), %rax     # 0xdd538
movq %r13, %rdi
movq %rax, %rsi
callq 0x82e0
jmp 0x4a3ec
movb $0x1, 0x93f30(%rip)     # 0xde2bd
jmp 0x4a3ec
leaq 0x93f02(%rip), %rsi     # 0xde298
movq %r13, %rdi
callq 0x8570
jmp 0x4a3ec
movb $0x1, 0x93f12(%rip)     # 0xde2b9
jmp 0x4a3ec
movb $0x1, 0x93f08(%rip)     # 0xde2b8
jmp 0x4a3ec
movb $0x1, %al
movq %rax, 0x10(%rsp)
jmp 0x4a3ec
movq %r13, %rdi
leaq 0x93177(%rip), %rsi     # 0xdd53c
callq 0x82e0
movb $0x1, 0x93eed(%rip)     # 0xde2be
jmp 0x4a3ec
movb $0x1, 0x93ee1(%rip)     # 0xde2bb
jmp 0x4a3ec
movb $0x1, 0x93ed9(%rip)     # 0xde2bc
jmp 0x4a3ec
movb $0x1, 0x93ece(%rip)     # 0xde2ba
movq %r13, %rdi
callq 0x8220
jmp 0x4a2cd
movq 0x92bc0(%rip), %r14     # 0xdcfc0
subl (%r14), %ebp
jle 0x4a418
cmpl $0x1, %ebp
movq 0x10(%rsp), %r15
je 0x4a42e
leaq 0x4bf1f(%rip), %rsi     # 0x96335
jmp 0x4a41f
leaq 0x4bf03(%rip), %rsi     # 0x96322
movq 0x92bc2(%rip), %rdi     # 0xdcfe8
callq 0x8480
movb $0x1, %r15b
cmpb $0x1, 0x93e85(%rip)     # 0xde2ba
jne 0x4a464
leaq 0x93e3a(%rip), %rdi     # 0xde278
leaq 0x4f9da(%rip), %rsi     # 0x99e1f
callq 0x2193f
testb %al, %al
je 0x4a464
movq 0x92b93(%rip), %rdi     # 0xdcfe8
leaq 0x56271(%rip), %rsi     # 0xa06cd
callq 0x8480
movb $0x1, %r15b
cmpb $0x0, 0x93e52(%rip)     # 0xde2bd
jne 0x4a492
cmpb $0x0, 0x93e45(%rip)     # 0xde2b9
jne 0x4a492
cmpb $0x0, 0x93e3b(%rip)     # 0xde2b8
jne 0x4a492
cmpb $0x0, 0x93e34(%rip)     # 0xde2ba
jne 0x4a492
cmpq $0x0, 0x93e10(%rip)     # 0xde2a0
je 0x4a4dd
testb $0x1, %r15b
jne 0x4a4f0
movslq (%r14), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%r14)
movq (%rbx,%rax,8), %rsi
leaq 0x93d8c(%rip), %rdi     # 0xde238
callq 0x88f0
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x92aee(%rip), %rdi     # 0xdcfb8
leaq 0x56341(%rip), %rsi     # 0xa0812
callq 0x8480
xorl %edi, %edi
callq 0x8540
movq 0x92b04(%rip), %rdi     # 0xdcfe8
leaq 0x56232(%rip), %rsi     # 0xa071d
callq 0x8480
movq 0x92ac1(%rip), %rdi     # 0xdcfb8
leaq 0x4944f(%rip), %rsi     # 0x9394d
callq 0x8480
leaq 0x56308(%rip), %rsi     # 0xa0812
movq %rax, %rdi
callq 0x8480
pushq $0x1
popq %rdi
callq 0x8540
jmp 0x4a51c
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x8220
jmp 0x4a53d
movq %rax, %rbx
jmp 0x4a53d
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x8978
movq %rbx, %rdi
callq 0x8870
nop