// File: /workspace/github_cpp_makefile_star2_O3/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
movl %edi, %ebp
leaq 0x6cb79(%rip), %rdx     # 0xca176
leaq 0xa2bdc(%rip), %rcx     # 0x1001e0
movq $0x0, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
xorl %r8d, %r8d
callq 0x8770
movl %eax, %r14d
shll $0x18, %r14d
cmpl $0xff000000, %r14d      # imm = 0xFF000000
je 0x5d7ad
leaq 0x28(%rsp), %rbx
movq $0x0, 0x8(%rsp)
leaq 0x18(%rsp), %r15
leaq 0x38(%rsp), %r12
movq 0xa4933(%rip), %rax     # 0x101f80
movq (%rax), %r13
testq %r13, %r13
leaq 0x70371(%rip), %rax     # 0xcd9cb
cmoveq %rax, %r13
movq %rbx, 0x18(%rsp)
movq %r13, %rdi
callq 0x81f0
leaq (%rax,%r13), %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x28a52
movq %r12, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x87b0
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5d6a1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x8480
sarl $0x18, %r14d
cmpl $0xb, %r14d
ja 0x5d6d5
movl %r14d, %eax
leaq 0x746ab(%rip), %rdx     # 0xd1d60
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
leaq 0xa5b65(%rip), %rsi     # 0x103228
leaq 0xa4e46(%rip), %rax     # 0x102510
jmpq *%rcx
leaq 0xa5b75(%rip), %rsi     # 0x103248
jmp 0x5d70a
cmpl $0x3f, %r14d
je 0x5d726
cmpl $0x68, %r14d
jne 0x5d760
jmp 0x5d8ad
leaq 0xa4e1b(%rip), %rax     # 0x102508
movq %r12, %rdi
movq %rax, %rsi
callq 0x82b0
jmp 0x5d760
movb $0x1, 0xa5b8c(%rip)     # 0x10328d
jmp 0x5d760
leaq 0xa5b5e(%rip), %rsi     # 0x103268
movq %r12, %rdi
callq 0x8560
jmp 0x5d760
movb $0x1, 0xa5b6e(%rip)     # 0x103289
jmp 0x5d760
movb $0x1, 0xa5b64(%rip)     # 0x103288
jmp 0x5d760
movb $0x1, %al
movq %rax, 0x8(%rsp)
jmp 0x5d760
movq %r12, %rdi
leaq 0xa4dd3(%rip), %rsi     # 0x10250c
callq 0x82b0
movb $0x1, 0xa5b49(%rip)     # 0x10328e
jmp 0x5d760
movb $0x1, 0xa5b3d(%rip)     # 0x10328b
jmp 0x5d760
movb $0x1, 0xa5b35(%rip)     # 0x10328c
jmp 0x5d760
movb $0x1, 0xa5b2a(%rip)     # 0x10328a
movq %r12, %rdi
movq 0xa482e(%rip), %rsi     # 0x101f98
callq 0x8620
leaq 0xb0(%rsp), %rdi
callq 0x8190
movl %ebp, %edi
movq 0x10(%rsp), %rsi
leaq 0x6c9ec(%rip), %rdx     # 0xca176
leaq 0xa2a4f(%rip), %rcx     # 0x1001e0
xorl %r8d, %r8d
callq 0x8770
movl %eax, %r14d
shll $0x18, %r14d
cmpl $0xff000000, %r14d      # imm = 0xFF000000
jne 0x5d646
movq 0xa480c(%rip), %rbx     # 0x101fc0
subl (%rbx), %ebp
jle 0x5d7d7
cmpl $0x1, %ebp
movq 0x8(%rsp), %r14
je 0x5d7f2
movq 0xa481f(%rip), %rdi     # 0x101fe8
leaq 0x6e725(%rip), %rsi     # 0xcbef5
movl $0x13, %edx
jmp 0x5d7ea
movq 0xa480a(%rip), %rdi     # 0x101fe8
leaq 0x6e6fd(%rip), %rsi     # 0xcbee2
movl $0x12, %edx
callq 0x84e0
movb $0x1, %r14b
cmpb $0x1, 0xa5a91(%rip)     # 0x10328a
jne 0x5d82d
leaq 0xa5a46(%rip), %rdi     # 0x103248
leaq 0x701c2(%rip), %rsi     # 0xcd9cb
callq 0x8160
testl %eax, %eax
jne 0x5d82d
movq 0xa47cf(%rip), %rdi     # 0x101fe8
leaq 0x7476d(%rip), %rsi     # 0xd1f8d
movl $0x4f, %edx
callq 0x84e0
movb $0x1, %r14b
cmpb $0x0, 0xa5a59(%rip)     # 0x10328d
jne 0x5d85b
cmpb $0x0, 0xa5a4c(%rip)     # 0x103289
jne 0x5d85b
cmpb $0x0, 0xa5a42(%rip)     # 0x103288
jne 0x5d85b
cmpb $0x0, 0xa5a3b(%rip)     # 0x10328a
jne 0x5d85b
cmpq $0x0, 0xa5a17(%rip)     # 0x103270
je 0x5d8c7
testb $0x1, %r14b
jne 0x5d8df
movslq (%rbx), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%rbx)
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rbx
movq 0xa5997(%rip), %r14     # 0x103210
leaq 0xa5988(%rip), %r15     # 0x103208
movq %rbx, %rdi
callq 0x81f0
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x86c0
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa4704(%rip), %rdi     # 0x101fb8
leaq 0x74817(%rip), %rsi     # 0xd20d2
callq 0x8460
xorl %edi, %edi
callq 0x8530
movq 0xa471a(%rip), %rdi     # 0x101fe8
leaq 0x74708(%rip), %rsi     # 0xd1fdd
movl $0x2f, %edx
callq 0x84e0
movq 0xa46d2(%rip), %rdi     # 0x101fb8
leaq 0x6db50(%rip), %rsi     # 0xcb43d
callq 0x8460
leaq 0x747d9(%rip), %rsi     # 0xd20d2
movq %rax, %rdi
callq 0x8460
movl $0x1, %edi
callq 0x8530
jmp 0x5d90d
movq %rax, %r14
movq 0xa4681(%rip), %rsi     # 0x101f98
leaq 0x38(%rsp), %rdi
callq 0x8620
leaq 0xb0(%rsp), %rdi
callq 0x8190
jmp 0x5d94f
movq %rax, %r14
jmp 0x5d94f
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5d94f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
callq 0x8840
nop