// File: /workspace/github_cpp_makefile_star2_O3/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 0x277d0
movq $0x0, 0x18(%rsp)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x48(%rsp), %rdi
movl $0x7, %esi
movl $0x20, %edx
callq 0x276d0
movq %r14, 0x8(%rsp)
cmpl $0x2, %ebx
jl 0x64071
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 0x123f1(%rip), %r13     # 0x75f39
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 0x63b91
movq %r15, %rdi
leaq 0x11b42(%rip), %rsi     # 0x756b7
callq 0x271c0
testl %eax, %eax
je 0x63b91
movq %r15, %rdi
leaq 0x11b31(%rip), %rsi     # 0x756b9
callq 0x271c0
testl %eax, %eax
jne 0x63b94
movb $0x1, %bpl
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x63ba8
callq 0x27560
incq %r14
cmpq %r14, %rbx
jne 0x63b48
testb $0x1, %bpl
movq 0x98(%rsp), %r14
jne 0x64071
movq 0x8(%rsp), %rax
leal 0x1(%rax), %r12d
xorl %ebx, %ebx
cmpl %r14d, %r12d
jge 0x63f5e
leaq 0x28(%rsp), %r15
leaq 0x2ca76(%rip), %rax     # 0x90658
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 0x2ca4a(%rip), %rdi     # 0x90658
movq %r15, %rbp
movq %r15, %rsi
callq 0x64bd0
movq %rax, %r13
cmpq 0x90(%rsp), %rax
je 0x63d12
movq 0x40(%r13), %rax
movb $0x1, (%rax)
cmpb $0x1, 0x71(%r13)
jne 0x63d6b
cmpl 0x6c(%rsp), %r12d
jge 0x63d73
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 0x2c9e9(%rip), %rdi     # 0x90658
movq %r15, %rsi
callq 0x64bd0
cmpq 0x90(%rsp), %rax
je 0x63dfb
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x276b0
movq %rax, %rbx
movl $0xe, %edx
movq %rax, %rdi
leaq 0x12306(%rip), %rsi     # 0x75fb4
callq 0x276b0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x276b0
movq %rax, %rbx
movl $0x26, %edx
movq %rax, %rdi
leaq 0x122ec(%rip), %rsi     # 0x75fc3
callq 0x276b0
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 0x63f19
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x276b0
movq %rax, %rbx
movl $0x24, %edx
movq %rax, %rdi
leaq 0x12201(%rip), %rsi     # 0x75f3c
callq 0x276b0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x276b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
jmp 0x63dde
movl %r12d, %r15d
jmp 0x63f35
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x276b0
movq %rax, %rbx
movl $0xe, %edx
movq %rax, %rdi
leaq 0x12218(%rip), %rsi     # 0x75fb4
callq 0x276b0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x276b0
movq %rax, %rbx
movl $0x26, %edx
movq %rax, %rdi
leaq 0x121fe(%rip), %rsi     # 0x75fc3
callq 0x276b0
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 0x63f35
movq %r13, %r12
addq $0x78, %r12
movq %r12, %rdi
callq 0x409ee
movq 0x8(%rsp), %rcx
addl $0x2, %ecx
movq %rcx, 0x8(%rsp)
testb %al, %al
je 0x63e3a
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x27230
movq 0x48(%r13), %rcx
movl %eax, (%rcx)
jmp 0x63f19
movq %r12, %rdi
callq 0x64272
testb %al, %al
je 0x63e65
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x27230
movq 0x48(%r13), %rcx
movb %al, (%rcx)
jmp 0x63f19
movq %r12, %rdi
callq 0x642f6
testb %al, %al
je 0x63e91
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x277b0
movq 0x48(%r13), %rcx
movq %rax, (%rcx)
jmp 0x63f19
movq %r12, %rdi
callq 0x642b4
testb %al, %al
je 0x63eb6
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x274a0
movq 0x48(%r13), %rax
movsd %xmm0, (%rax)
jmp 0x63f19
movq %r12, %rdi
callq 0x4212e
testb %al, %al
je 0x63edf
movq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x274a0
cvtsd2ss %xmm0, %xmm0
movq 0x48(%r13), %rax
movss %xmm0, (%rax)
jmp 0x63f19
movq %r12, %rdi
callq 0x3a7b4
testb %al, %al
je 0x63efb
movq 0x48(%r13), %rdi
leaq 0x70(%rsp), %rsi
callq 0x27350
jmp 0x63f19
movq %r12, %rdi
callq 0x64338
testb %al, %al
je 0x640cd
movq 0x48(%r13), %rdi
leaq 0x70(%rsp), %rsi
callq 0x2e190
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x63f30
callq 0x27560
movq 0x8(%rsp), %r15
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x63f49
callq 0x27560
movq %r15, 0x8(%rsp)
leal 0x1(%r15), %r12d
cmpl %r14d, %r12d
movq %rbp, %r15
jl 0x63bee
leaq 0x2c6f3(%rip), %rbp     # 0x90658
movq 0x18(%rbp), %r14
addq $0x8, %rbp
cmpq %rbp, %r14
je 0x64039
leaq 0xa0(%rsp), %r15
leaq 0x12065(%rip), %r12     # 0x75fea
leaq 0x12082(%rip), %r13     # 0x7600e
cmpb $0x1, 0x72(%r14)
jne 0x64025
movq 0x40(%r14), %rax
cmpb $0x0, (%rax)
jne 0x64025
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %r15, %rdi
callq 0x276b0
movq 0x50(%r14), %rsi
movq 0x58(%r14), %rdx
movq %rax, %rdi
callq 0x276b0
movq %rax, %rbx
movl $0x23, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x276b0
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %rbx, %rdi
callq 0x276b0
movq %rax, %rbx
movl $0xb, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x276b0
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 0x276c0
movq %rax, %r14
cmpq %rbp, %rax
jne 0x63f8c
testb $0x1, %bl
jne 0x64076
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x64052
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 0x63568
leaq 0x1201c(%rip), %rdi     # 0x76099
callq 0x278e0
leaq 0xa8(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x27990
leaq 0x28(%rsp), %rbx
movq (%rbx), %rdi
callq 0x278e0
movq %rbx, %rdi
callq 0x27c48
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0x11f5e(%rip), %rdi     # 0x7601a
xorl %eax, %eax
callq 0x27070
movl $0x1, %edi
callq 0x27710
movq 0x28(%rsp), %rsi
leaq 0x11e88(%rip), %rdi     # 0x75f61
xorl %eax, %eax
callq 0x27070
jmp 0x640c3
jmp 0x640f3
jmp 0x640f3
jmp 0x64115
movq %rax, %rbx
jmp 0x64147
jmp 0x64115
jmp 0x640f3
jmp 0x6411c
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x6411f
callq 0x27560
jmp 0x6411f
jmp 0x64115
jmp 0x6411c
jmp 0x64115
movq %rax, %rbx
jmp 0x64133
jmp 0x6411c
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x64133
callq 0x27560
leaq 0x58(%rsp), %rax
movq 0x48(%rsp), %rdi
cmpq %rax, %rdi
je 0x64147
callq 0x27560
leaq 0xa0(%rsp), %rdi
callq 0x27160
movq %rbx, %rdi
callq 0x27b10
movq %rax, %rdi
callq 0x2e1cd