// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/utils/bamtools_options.cpp
// Function: BamTools::Options::Parse(int, char**, int)
void Options::Parse(int argc, char* argv[], int offset) {

    // initialize
    map<string, OptionValue>::const_iterator ovMapIter;
    map<string, OptionValue>::const_iterator checkMapIter;
    const int LAST_INDEX = argc - 1;
    ostringstream errorBuilder;
    bool foundError = false;
    char* end_ptr = NULL;
    const string ERROR_SPACER(7, ' ');

    // check if we should show the help menu
    bool showHelpMenu = false;
    if (argc > 1) {
        for (int i = 1; i < argc; i++) {
            const std::string argument = argv[i];
            if ( (argument == "-h") || (argument == "--help") || (argument == "help") ) 
                showHelpMenu = true;
        }
    } else showHelpMenu = true;

    if (showHelpMenu) 
        DisplayHelp();

    // check each argument
    for (int i = offset+1; i < argc; i++) {
      
        const string argument = argv[i];
        ovMapIter = m_optionsMap.find(argument);

        if (ovMapIter == m_optionsMap.end()) {
            errorBuilder << ERROR_SPACER << "An unrecognized argument was found: " << argument << std::endl;
            foundError = true;
        } else {

            *ovMapIter->second.pFoundArgument = true;

            // grab the value
            if (ovMapIter->second.StoreValue) {

                if (i < LAST_INDEX) {

                    // check if the next argument is really a command line option
                    const string val = argv[i + 1]; 
                    checkMapIter = m_optionsMap.find(val);

                    if (checkMapIter == m_optionsMap.end()) {
                        
                        ++i;
                        
                        if (ovMapIter->second.VariantValue.is_type<unsigned int>()) {
                            const unsigned int uint32 = (unsigned int)strtoul(val.c_str(), &end_ptr, 10);
                            unsigned int* varValue = (unsigned int*)ovMapIter->second.pValue;
                            *varValue = uint32;
                        } else if (ovMapIter->second.VariantValue.is_type<unsigned char>()) {
                            const unsigned char uint8 = (unsigned char)strtoul(val.c_str(), &end_ptr, 10);
                            unsigned char* varValue = (unsigned char*)ovMapIter->second.pValue;
                            *varValue = uint8;
                        } else if (ovMapIter->second.VariantValue.is_type<uint64_t>()) {
                            const uint64_t uint64 = strtoui64(val.c_str(), &end_ptr, 10);
                            uint64_t* varValue = (uint64_t*)ovMapIter->second.pValue;
                            *varValue = uint64;
                        } else if (ovMapIter->second.VariantValue.is_type<double>()) {
                            const double d = strtod(val.c_str(), &end_ptr);
                            double* varValue = (double*)ovMapIter->second.pValue;
                            *varValue = d;
                        } else if (ovMapIter->second.VariantValue.is_type<float>()) {
                            const float f = (float)strtod(val.c_str(), &end_ptr);
                            float* varValue = (float*)ovMapIter->second.pValue;
                            *varValue = f;
                        } else if (ovMapIter->second.VariantValue.is_type<string>()) {
                            string* pStringValue = (string*)ovMapIter->second.pValue;
                            *pStringValue = val;
                        } else if (ovMapIter->second.VariantValue.is_type<vector<string> >()) {
                            vector<string>* pVectorValue = (vector<string>*)ovMapIter->second.pValue;
                            pVectorValue->push_back(val);
                        } else {
                            printf("ERROR: Found an unsupported data type for argument %s when parsing the arguments.\n",
                                   argument.c_str());
                            exit(1);
                        }
                    } else {
                        errorBuilder << ERROR_SPACER << "The argument (" << argument
                                     << ") expects a value, but none was found." << endl;
                        foundError = true;
                    }
                } else {
                    errorBuilder << ERROR_SPACER << "The argument (" << argument
                                 << ") expects a value, but none was found." << endl;
                    foundError = true;
                }
            }
        }
    }

    // check if we missed any required parameters
    for (ovMapIter = m_optionsMap.begin(); ovMapIter != m_optionsMap.end(); ++ovMapIter) {
        if (ovMapIter->second.IsRequired && !*ovMapIter->second.pFoundArgument) {
            errorBuilder << ERROR_SPACER << ovMapIter->second.ValueTypeDescription
                         << " was not specified. Please use the " << ovMapIter->first << " parameter." << endl;
            foundError = true;
        }
    }

    // print the errors if any were found
    if (foundError) {
        printf("ERROR: Some problems were encountered when parsing the command line options:\n");
        printf("%s\n", errorBuilder.str().c_str());
        printf("For a complete list of command line options, type \"%s help %s\"\n", argv[0], argv[1]);
        exit(1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movl %edx, %r14d
movq %rsi, 0x20(%rsp)
movl %edi, %ebx
leaq 0xa0(%rsp), %rdi
callq 0x277e0
movq $0x0, 0x18(%rsp)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x48(%rsp), %rdi
movl $0x7, %esi
movl $0x20, %edx
callq 0x276e0
movq %r14, 0x8(%rsp)
cmpl $0x2, %ebx
jl 0x645b1
leal -0x1(%rbx), %eax
movl %eax, 0x6c(%rsp)
movq %rbx, 0x98(%rsp)
movl %ebx, %ebx
movl $0x1, %r14d
xorl %ebp, %ebp
leaq 0x28(%rsp), %r15
leaq 0x70(%rsp), %r12
leaq 0x12eb1(%rip), %r13     # 0x76f39
movq 0x20(%rsp), %rax
movq (%rax,%r14,8), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x272a0
movq %r15, %rdi
movq %r13, %rsi
callq 0x271c0
testl %eax, %eax
je 0x640d1
movq %r15, %rdi
leaq 0x12602(%rip), %rsi     # 0x766b7
callq 0x271c0
testl %eax, %eax
je 0x640d1
movq %r15, %rdi
leaq 0x125f1(%rip), %rsi     # 0x766b9
callq 0x271c0
testl %eax, %eax
jne 0x640d4
movb $0x1, %bpl
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x640e8
callq 0x27560
incq %r14
cmpq %r14, %rbx
jne 0x64088
testb $0x1, %bpl
movq 0x98(%rsp), %r14
jne 0x645b1
movq 0x8(%rsp), %rax
leal 0x1(%rax), %r12d
xorl %ebx, %ebx
cmpl %r14d, %r12d
jge 0x6449e
leaq 0x28(%rsp), %r15
leaq 0x2d53e(%rip), %rax     # 0x91660
addq $0x8, %rax
movq %rax, 0x90(%rsp)
movslq %r12d, %rax
movq 0x20(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r15, %rdi
leaq 0x70(%rsp), %rdx
callq 0x272a0
leaq 0x2d512(%rip), %rdi     # 0x91660
movq %r15, %rbp
movq %r15, %rsi
callq 0x650ec
movq %rax, %r13
cmpq 0x90(%rsp), %rax
je 0x64252
movq 0x40(%r13), %rax
movb $0x1, (%rax)
cmpb $0x1, 0x71(%r13)
jne 0x642ab
cmpl 0x6c(%rsp), %r12d
jge 0x642b3
movslq 0x8(%rsp), %rax
movq 0x20(%rsp), %rcx
movq 0x10(%rcx,%rax,8), %rsi
leaq 0x70(%rsp), %r15
movq %r15, %rdi
leaq 0x17(%rsp), %rdx
callq 0x272a0
leaq 0x2d4b1(%rip), %rdi     # 0x91660
movq %r15, %rsi
callq 0x650ec
cmpq 0x90(%rsp), %rax
je 0x6433b
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x276c0
movq %rax, %rbx
movl $0xe, %edx
movq %rax, %rdi
leaq 0x12dc6(%rip), %rsi     # 0x76fb4
callq 0x276c0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x276c0
movq %rax, %rbx
movl $0x26, %edx
movq %rax, %rdi
leaq 0x12dac(%rip), %rsi     # 0x76fc3
callq 0x276c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbx, %rdi
callq 0x27040
movb $0x1, %bl
movq %rax, %rdi
callq 0x27410
movl %r12d, %eax
movq %rax, 0x8(%rsp)
jmp 0x64459
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x276c0
movq %rax, %rbx
movl $0x24, %edx
movq %rax, %rdi
leaq 0x12cc1(%rip), %rsi     # 0x76f3c
callq 0x276c0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x276c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
jmp 0x6431e
movl %r12d, %r15d
jmp 0x64475
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x276c0
movq %rax, %rbx
movl $0xe, %edx
movq %rax, %rdi
leaq 0x12cd8(%rip), %rsi     # 0x76fb4
callq 0x276c0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x276c0
movq %rax, %rbx
movl $0x26, %edx
movq %rax, %rdi
leaq 0x12cbe(%rip), %rsi     # 0x76fc3
callq 0x276c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbx, %rdi
callq 0x27040
movb $0x1, %bl
movq %rax, %rdi
callq 0x27410
movl %r12d, %r15d
jmp 0x64475
movq %r13, %r12
addq $0x78, %r12
movq %r12, %rdi
callq 0x40ac8
movq 0x8(%rsp), %rcx
addl $0x2, %ecx
movq %rcx, 0x8(%rsp)
testb %al, %al
je 0x6437a
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x27230
movq 0x48(%r13), %rcx
movl %eax, (%rcx)
jmp 0x64459
movq %r12, %rdi
callq 0x647b2
testb %al, %al
je 0x643a5
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x27230
movq 0x48(%r13), %rcx
movb %al, (%rcx)
jmp 0x64459
movq %r12, %rdi
callq 0x64836
testb %al, %al
je 0x643d1
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x277c0
movq 0x48(%r13), %rcx
movq %rax, (%rcx)
jmp 0x64459
movq %r12, %rdi
callq 0x647f4
testb %al, %al
je 0x643f6
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x274a0
movq 0x48(%r13), %rax
movsd %xmm0, (%rax)
jmp 0x64459
movq %r12, %rdi
callq 0x421f4
testb %al, %al
je 0x6441f
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x274a0
cvtsd2ss %xmm0, %xmm0
movq 0x48(%r13), %rax
movss %xmm0, (%rax)
jmp 0x64459
movq %r12, %rdi
callq 0x3a81a
testb %al, %al
je 0x6443b
movq 0x48(%r13), %rdi
leaq 0x70(%rsp), %rsi
callq 0x27350
jmp 0x64459
movq %r12, %rdi
callq 0x64878
testb %al, %al
je 0x6460d
movq 0x48(%r13), %rdi
leaq 0x70(%rsp), %rsi
callq 0x2e1b0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x64470
callq 0x27560
movq 0x8(%rsp), %r15
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x64489
callq 0x27560
movq %r15, 0x8(%rsp)
leal 0x1(%r15), %r12d
cmpl %r14d, %r12d
movq %rbp, %r15
jl 0x6412e
leaq 0x2d1bb(%rip), %rbp     # 0x91660
movq 0x18(%rbp), %r14
addq $0x8, %rbp
cmpq %rbp, %r14
je 0x64579
leaq 0xa0(%rsp), %r15
leaq 0x12b25(%rip), %r12     # 0x76fea
leaq 0x12b42(%rip), %r13     # 0x7700e
cmpb $0x1, 0x72(%r14)
jne 0x64565
movq 0x40(%r14), %rax
cmpb $0x0, (%rax)
jne 0x64565
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %r15, %rdi
callq 0x276c0
movq 0x50(%r14), %rsi
movq 0x58(%r14), %rdx
movq %rax, %rdi
callq 0x276c0
movq %rax, %rbx
movl $0x23, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x276c0
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %rbx, %rdi
callq 0x276c0
movq %rax, %rbx
movl $0xb, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x276c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbx, %rdi
callq 0x27040
movb $0x1, %bl
movq %rax, %rdi
callq 0x27410
movq %r14, %rdi
callq 0x276d0
movq %rax, %r14
cmpq %rbp, %rax
jne 0x644cc
testb $0x1, %bl
jne 0x645b6
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x64592
callq 0x27560
leaq 0xa0(%rsp), %rdi
callq 0x27160
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x63aa8
leaq 0x12adc(%rip), %rdi     # 0x77099
callq 0x278f0
leaq 0xa8(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x279a0
leaq 0x28(%rsp), %rbx
movq (%rbx), %rdi
callq 0x278f0
movq %rbx, %rdi
callq 0x27c58
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0x12a1e(%rip), %rdi     # 0x7701a
xorl %eax, %eax
callq 0x27070
movl $0x1, %edi
callq 0x27720
movq 0x28(%rsp), %rsi
leaq 0x12948(%rip), %rdi     # 0x76f61
xorl %eax, %eax
callq 0x27070
jmp 0x64603
jmp 0x64633
jmp 0x64633
jmp 0x64655
movq %rax, %rbx
jmp 0x64687
jmp 0x64655
jmp 0x64633
jmp 0x6465c
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x6465f
callq 0x27560
jmp 0x6465f
jmp 0x64655
jmp 0x6465c
jmp 0x64655
movq %rax, %rbx
jmp 0x64673
jmp 0x6465c
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x64673
callq 0x27560
leaq 0x58(%rsp), %rax
movq 0x48(%rsp), %rdi
cmpq %rax, %rdi
je 0x64687
callq 0x27560
leaq 0xa0(%rsp), %rdi
callq 0x27160
movq %rbx, %rdi
callq 0x27b20
movq %rax, %rdi
callq 0x2e1ed