// File: millanek[P]Dsuite/Dquartets.cpp
// Function: parseDquartetsOptions(int, char**)
void parseDquartetsOptions(int argc, char** argv) {
    bool die = false; string regionArgString; std::vector<string> regionArgs;
    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 'n': arg >> opt::runName; break;
            case 't': arg >> opt::treeFile; break;
            case 'j': arg >> opt::jkWindowSize; break;
            case 'k': arg >> opt::jkNum; break;
            case 'o': arg >> opt::providedOutPrefix; break;
            case OPT_NO_F4: opt::fStats = false; break;
            case 'l': arg >> opt::providedNumLines; break;
            case 'a': opt::allF4 = true; break;
            case 'r': arg >> regionArgString; regionArgs = split(regionArgString, ',');
                opt::regionStart = (int)stringToDouble(regionArgs[0]); opt::regionLength = (int)stringToDouble(regionArgs[1]);  break;
            case 'h':
                std::cout << DQUARTS_USAGE_MESSAGE;
                exit(EXIT_SUCCESS);
        }
    }
    
    if (argc - optind < 2) {
        std::cerr << "missing arguments\n";
        die = true;
    }
    else if (argc - optind > 2)
    {
        std::cerr << "too many arguments\n";
        die = true;
    }
    
    if (die) {
        std::cout << "\n" << DQUARTS_USAGE_MESSAGE;
        exit(EXIT_FAILURE);
    }
    
    // Parse the input filenames
    opt::vcfFile = argv[optind++];
    opt::setsFile = argv[optind++];
    
    if (opt::vcfFile == "stdin" && opt::providedNumLines <= 0) {
        std::cerr << "If you want to read the VCF via a pipe, you need to specify the number of lines in the input via the -l option\n";
        std::cerr << "See the example above\n";
        die = true;
    }
    
    if (die) {
        std::cout << "\n" << DQUARTS_USAGE_MESSAGE;
        exit(EXIT_FAILURE);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x87d0
leaq -0x50(%rbp), %rdi
callq 0x11d80
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movq 0x43052(%rip), %rdx     # 0xbfae8
leaq 0x42153(%rip), %rcx     # 0xbebf0
xorl %eax, %eax
movl %eax, %r8d
callq 0x8970
movb %al, -0x51(%rbp)
movsbl %al, %eax
cmpl $-0x1, %eax
je 0x7cea8
movq 0x424ab(%rip), %rax     # 0xbef68
cmpq $0x0, (%rax)
je 0x7cad6
movq 0x4249e(%rip), %rax     # 0xbef68
movq (%rax), %rax
movq %rax, -0x270(%rbp)
jmp 0x7cae6
leaq 0xe88c(%rip), %rax      # 0x8b369
movq %rax, -0x270(%rbp)
jmp 0x7cae6
movq -0x270(%rbp), %rax
movq %rax, -0x280(%rbp)
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x8a60
movq -0x280(%rbp), %rsi
movq -0x278(%rbp), %rdx
leaq -0x1f8(%rbp), %rdi
callq 0x9a00
jmp 0x7cb23
leaq -0x1d8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
movl $0x8, %edx
callq 0x89a0
jmp 0x7cb3d
leaq -0x1f8(%rbp), %rdi
callq 0x8c08
leaq -0x1f9(%rbp), %rdi
callq 0x8610
movsbl -0x51(%rbp), %eax
movl %eax, -0x284(%rbp)
testl %eax, %eax
je 0x7ccfb
jmp 0x7cb69
movl -0x284(%rbp), %eax
subl $0x3f, %eax
je 0x7cc59
jmp 0x7cb7a
movl -0x284(%rbp), %eax
subl $0x61, %eax
je 0x7cd21
jmp 0x7cb8b
movl -0x284(%rbp), %eax
subl $0x68, %eax
je 0x7ce6a
jmp 0x7cb9c
movl -0x284(%rbp), %eax
subl $0x6a, %eax
je 0x7ccad
jmp 0x7cbad
movl -0x284(%rbp), %eax
subl $0x6b, %eax
je 0x7ccc7
jmp 0x7cbbe
movl -0x284(%rbp), %eax
subl $0x6c, %eax
je 0x7cd07
jmp 0x7cbcf
movl -0x284(%rbp), %eax
subl $0x6e, %eax
je 0x7cc62
jmp 0x7cbe0
movl -0x284(%rbp), %eax
subl $0x6f, %eax
je 0x7cce1
jmp 0x7cbf1
movl -0x284(%rbp), %eax
subl $0x72, %eax
je 0x7cd2d
jmp 0x7cc02
movl -0x284(%rbp), %eax
subl $0x74, %eax
je 0x7cc93
jmp 0x7ce86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x208(%rbp)
movl %eax, -0x20c(%rbp)
jmp 0x7cc48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x208(%rbp)
movl %eax, -0x20c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x8c08
leaq -0x1f9(%rbp), %rdi
callq 0x8610
jmp 0x7d05e
movb $0x1, -0x11(%rbp)
jmp 0x7ce86
leaq 0x43347(%rip), %rsi     # 0xbffb0
leaq -0x1d8(%rbp), %rdi
callq 0x8730
jmp 0x7cc77
jmp 0x7ce86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x208(%rbp)
movl %eax, -0x20c(%rbp)
jmp 0x7ce97
leaq 0x432f6(%rip), %rsi     # 0xbff90
leaq -0x1d8(%rbp), %rdi
callq 0x8730
jmp 0x7cca8
jmp 0x7ce86
leaq 0x4333c(%rip), %rsi     # 0xbfff0
leaq -0x1d8(%rbp), %rdi
callq 0x8360
jmp 0x7ccc2
jmp 0x7ce86
leaq 0x42e12(%rip), %rsi     # 0xbfae0
leaq -0x1d8(%rbp), %rdi
callq 0x8360
jmp 0x7ccdc
jmp 0x7ce86
leaq 0x432e8(%rip), %rsi     # 0xbffd0
leaq -0x1d8(%rbp), %rdi
callq 0x8730
jmp 0x7ccf6
jmp 0x7ce86
movb $0x0, 0x42dda(%rip)     # 0xbfadc
jmp 0x7ce86
leaq 0x42dca(%rip), %rsi     # 0xbfad8
leaq -0x1d8(%rbp), %rdi
callq 0x8360
jmp 0x7cd1c
jmp 0x7ce86
movb $0x1, 0x432cc(%rip)     # 0xbfff4
jmp 0x7ce86
leaq -0x1d8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x8730
jmp 0x7cd3f
leaq -0x228(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x2c, %edx
callq 0xaef0
jmp 0x7cd56
leaq -0x50(%rbp), %rdi
movq %rdi, -0x290(%rbp)
leaq -0x228(%rbp), %rsi
movq %rsi, -0x298(%rbp)
callq 0x20aa0
movq -0x298(%rbp), %rdi
callq 0x10760
movq -0x290(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x10b10
movq %rax, %rsi
leaq -0x248(%rbp), %rdi
callq 0x8250
jmp 0x7cda1
leaq -0x248(%rbp), %rdi
callq 0xf4f0
movsd %xmm0, -0x2a0(%rbp)
jmp 0x7cdb7
movsd -0x2a0(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x42d07(%rip)     # 0xbfad0
leaq -0x248(%rbp), %rdi
callq 0x8c08
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0x10b10
movq %rax, %rsi
leaq -0x268(%rbp), %rdi
callq 0x8250
jmp 0x7cdf4
leaq -0x268(%rbp), %rdi
callq 0xf4f0
movsd %xmm0, -0x2a8(%rbp)
jmp 0x7ce0a
movsd -0x2a8(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x42cb8(%rip)     # 0xbfad4
leaq -0x268(%rbp), %rdi
callq 0x8c08
jmp 0x7ce86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x208(%rbp)
movl %eax, -0x20c(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x8c08
jmp 0x7ce97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x208(%rbp)
movl %eax, -0x20c(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x8c08
jmp 0x7ce97
movq 0x42c7f(%rip), %rsi     # 0xbfaf0
movq 0x42130(%rip), %rdi     # 0xbefa8
callq 0x8590
jmp 0x7ce7f
xorl %edi, %edi
callq 0x86e0
leaq -0x1d8(%rbp), %rdi
callq 0x8290
jmp 0x7ca88
leaq -0x1d8(%rbp), %rdi
callq 0x8290
jmp 0x7d05e
movl -0x4(%rbp), %eax
movq 0x420fe(%rip), %rcx     # 0xbefb0
subl (%rcx), %eax
cmpl $0x2, %eax
jge 0x7ceeb
movq 0x42130(%rip), %rdi     # 0xbeff0
leaq 0xbb7b(%rip), %rsi      # 0x88a42
callq 0x8590
jmp 0x7cece
movb $0x1, -0x11(%rbp)
jmp 0x7cf17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x208(%rbp)
movl %eax, -0x20c(%rbp)
jmp 0x7d05e
movl -0x4(%rbp), %eax
movq 0x420bb(%rip), %rcx     # 0xbefb0
subl (%rcx), %eax
cmpl $0x2, %eax
jle 0x7cf15
movq 0x420ed(%rip), %rdi     # 0xbeff0
leaq 0xbb4b(%rip), %rsi      # 0x88a55
callq 0x8590
jmp 0x7cf11
movb $0x1, -0x11(%rbp)
jmp 0x7cf17
testb $0x1, -0x11(%rbp)
je 0x7cf58
movq 0x42084(%rip), %rdi     # 0xbefa8
leaq 0xb50f(%rip), %rsi      # 0x8843a
callq 0x8590
movq %rax, -0x2b0(%rbp)
jmp 0x7cf39
movq -0x2b0(%rbp), %rdi
movq 0x42ba9(%rip), %rsi     # 0xbfaf0
callq 0x8590
jmp 0x7cf4e
movl $0x1, %edi
callq 0x86e0
movq -0x10(%rbp), %rax
movq 0x4204d(%rip), %rdx     # 0xbefb0
movslq (%rdx), %rcx
movl %ecx, %esi
incl %esi
movl %esi, (%rdx)
movq (%rax,%rcx,8), %rsi
leaq 0x42fd9(%rip), %rdi     # 0xbff50
callq 0x87c0
jmp 0x7cf7e
movq -0x10(%rbp), %rax
movq 0x42027(%rip), %rdx     # 0xbefb0
movslq (%rdx), %rcx
movl %ecx, %esi
incl %esi
movl %esi, (%rdx)
movq (%rax,%rcx,8), %rsi
leaq 0x42fd3(%rip), %rdi     # 0xbff70
callq 0x87c0
jmp 0x7cfa4
leaq 0x42fa5(%rip), %rdi     # 0xbff50
leaq 0xc45e(%rip), %rsi      # 0x89410
callq 0x9ab0
movb %al, -0x2b1(%rbp)
jmp 0x7cfbf
movb -0x2b1(%rbp), %al
testb $0x1, %al
jne 0x7cfcb
jmp 0x7d002
cmpl $0x0, 0x42b06(%rip)     # 0xbfad8
jg 0x7d002
movq 0x42015(%rip), %rdi     # 0xbeff0
leaq 0xc82e(%rip), %rsi      # 0x89810
callq 0x8590
jmp 0x7cfe9
movq 0x42000(%rip), %rdi     # 0xbeff0
leaq 0xc889(%rip), %rsi      # 0x89880
callq 0x8590
jmp 0x7cffe
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
je 0x7d043
movq 0x41f99(%rip), %rdi     # 0xbefa8
leaq 0xb424(%rip), %rsi      # 0x8843a
callq 0x8590
movq %rax, -0x2c0(%rbp)
jmp 0x7d024
movq -0x2c0(%rbp), %rdi
movq 0x42abe(%rip), %rsi     # 0xbfaf0
callq 0x8590
jmp 0x7d039
movl $0x1, %edi
callq 0x86e0
leaq -0x50(%rbp), %rdi
callq 0x10760
leaq -0x38(%rbp), %rdi
callq 0x8c08
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x10760
leaq -0x38(%rbp), %rdi
callq 0x8c08
movq -0x208(%rbp), %rdi
callq 0x8a50
nopl (%rax)