// File: hanhwi[P]SimPoint/analysiscode/CmdLineParser.cpp
// Function: CmdLineParser::parseCmdLine(int, char**)
bool CmdLineParser::parseCmdLine(int argc, char **argv) {
    for (int argNdx = 0; argNdx < argc; argNdx++) {
        const char *arg = argv[argNdx];
        Utilities::check(arg != NULL, 
                "CmdLineParser::parseCmdLine(): found NULL argument");
        if (strlen(arg) == 0) {
            parseError("received a command line option that was empty");
            return false;
        }

        if (arg[0] == '-') {
            string optionName(arg + 1);
            CmdLineOption *option = findOption(optionName);
            if (option == NULL) {
                parseError(string("Unknown option: ") + optionName);
                return false;
            }

            // tell this option that it was specified
            option->setSpecified();

            string argument;
            if (option->requiresArgument()) {
                if (argNdx >= argc - 1) {
                    parseError(string("Argument required for option ") +
                               option->getName());
                    return false;
                }

                // don't check if the next token is actually another option; in
                // this case the user must figure it out...
                argNdx++;
                argument = string(argv[argNdx]);

                if (! option->parseArgument(argument)) {
                    parseError("Parsing argument -" + option->getName() + 
                                " : " + option->getParseError());
                    return false;
                }
            }
        } else {
            extraArguments.push_back(string(arg));
        }
    }

    return true;
}

// Assembly:
subq $0x2e8, %rsp            # imm = 0x2E8
movq %rdi, 0x2d8(%rsp)
movl %esi, 0x2d4(%rsp)
movq %rdx, 0x2c8(%rsp)
movq 0x2d8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl $0x0, 0x2c4(%rsp)
movl 0x2c4(%rsp), %eax
cmpl 0x2d4(%rsp), %eax
jge 0x64d5
movq 0x2c8(%rsp), %rax
movslq 0x2c4(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x2b8(%rsp)
movq 0x2b8(%rsp), %rax
testq %rax, %rax
setne %al
movb %al, 0x97(%rsp)
leaq 0x297(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x56a0
movq 0x98(%rsp), %rdx
leaq 0x2d382(%rip), %rsi     # 0x33004
leaq 0x298(%rsp), %rdi
callq 0x74e0
jmp 0x5c91
movb 0x97(%rsp), %al
movzbl %al, %edi
andl $0x1, %edi
leaq 0x298(%rsp), %rsi
callq 0x7480
jmp 0x5cad
leaq 0x298(%rsp), %rdi
callq 0x5788
leaq 0x297(%rsp), %rdi
callq 0x53e0
movq 0x2b8(%rsp), %rdi
callq 0x51b0
cmpq $0x0, %rax
jne 0x5de1
leaq 0x25f(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x56a0
movq 0x88(%rsp), %rdx
leaq 0x2d335(%rip), %rsi     # 0x33037
leaq 0x260(%rsp), %rdi
callq 0x74e0
jmp 0x5d11
movq 0xa0(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x75a0
jmp 0x5d28
leaq 0x260(%rsp), %rdi
callq 0x5788
leaq 0x25f(%rsp), %rdi
callq 0x53e0
movb $0x0, 0x2e7(%rsp)
jmp 0x64dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x5d86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x298(%rsp), %rdi
callq 0x5788
leaq 0x297(%rsp), %rdi
callq 0x53e0
jmp 0x64ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x5dcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x260(%rsp), %rdi
callq 0x5788
leaq 0x25f(%rsp), %rdi
callq 0x53e0
jmp 0x64ee
movq 0x2b8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x63fe
movq 0x2b8(%rsp), %rax
incq %rax
movq %rax, 0x78(%rsp)
leaq 0x237(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x56a0
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
leaq 0x238(%rsp), %rdi
callq 0x74e0
jmp 0x5e36
leaq 0x237(%rsp), %rdi
callq 0x53e0
movq 0xa0(%rsp), %rdi
leaq 0x238(%rsp), %rsi
callq 0x75d0
movq %rax, 0x70(%rsp)
jmp 0x5e5f
movq 0x70(%rsp), %rax
movq %rax, 0x228(%rsp)
cmpq $0x0, 0x228(%rsp)
jne 0x5fc8
leaq 0x1e7(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x56a0
movq 0x68(%rsp), %rdx
leaq 0x2d1cc(%rip), %rsi     # 0x33065
leaq 0x1e8(%rsp), %rdi
callq 0x74e0
jmp 0x5ea8
leaq 0x208(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
leaq 0x238(%rsp), %rdx
callq 0x7670
jmp 0x5ec7
movq 0xa0(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x75a0
jmp 0x5ede
leaq 0x208(%rsp), %rdi
callq 0x5788
leaq 0x1e8(%rsp), %rdi
callq 0x5788
leaq 0x1e7(%rsp), %rdi
callq 0x53e0
movb $0x0, 0x2e7(%rsp)
movl $0x1, 0x1e0(%rsp)
jmp 0x63bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x237(%rsp), %rdi
callq 0x53e0
jmp 0x64ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x63ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x5fb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x5fa9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x208(%rsp), %rdi
callq 0x5788
leaq 0x1e8(%rsp), %rdi
callq 0x5788
leaq 0x1e7(%rsp), %rdi
callq 0x53e0
jmp 0x63ec
movq 0x228(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0x5fdb
leaq 0x1c0(%rsp), %rdi
callq 0x5540
movq 0x228(%rsp), %rdi
callq 0x76c0
movb %al, 0x67(%rsp)
jmp 0x5ffb
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0x6008
jmp 0x63a3
movl 0x2c4(%rsp), %eax
movl 0x2d4(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x6159
leaq 0x17f(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x56a0
movq 0x58(%rsp), %rdx
leaq 0x2d037(%rip), %rsi     # 0x33076
leaq 0x180(%rsp), %rdi
callq 0x74e0
jmp 0x604e
movq 0x228(%rsp), %rdi
callq 0x76e0
movq %rax, 0x50(%rsp)
jmp 0x6062
movq 0x50(%rsp), %rdx
leaq 0x1a0(%rsp), %rdi
leaq 0x180(%rsp), %rsi
callq 0x7670
jmp 0x607e
movq 0xa0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x75a0
jmp 0x6095
leaq 0x1a0(%rsp), %rdi
callq 0x5788
leaq 0x180(%rsp), %rdi
callq 0x5788
leaq 0x17f(%rsp), %rdi
callq 0x53e0
movb $0x0, 0x2e7(%rsp)
movl $0x1, 0x1e0(%rsp)
jmp 0x63ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x63df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x6147
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x613a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x1a0(%rsp), %rdi
callq 0x5788
leaq 0x180(%rsp), %rdi
callq 0x5788
leaq 0x17f(%rsp), %rdi
callq 0x53e0
jmp 0x63df
movl 0x2c4(%rsp), %eax
incl %eax
movl %eax, 0x2c4(%rsp)
movq 0x2c8(%rsp), %rax
movslq 0x2c4(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x40(%rsp)
leaq 0x157(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x56a0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq 0x158(%rsp), %rdi
callq 0x74e0
jmp 0x61ad
leaq 0x1c0(%rsp), %rdi
movq %rdi, 0x30(%rsp)
leaq 0x158(%rsp), %rsi
movq %rsi, 0x28(%rsp)
callq 0x5470
movq 0x28(%rsp), %rdi
callq 0x5788
leaq 0x157(%rsp), %rdi
callq 0x53e0
movq 0x30(%rsp), %rsi
movq 0x228(%rsp), %rdi
callq 0x76f0
movb %al, 0x3f(%rsp)
jmp 0x61fb
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x63a1
jmp 0x6209
movq 0x228(%rsp), %rdi
callq 0x76e0
movq %rax, 0x20(%rsp)
jmp 0x621d
movq 0x20(%rsp), %rdx
leaq 0x2ce6b(%rip), %rsi     # 0x33094
leaq 0xf0(%rsp), %rdi
callq 0x7880
jmp 0x6238
leaq 0x2ce68(%rip), %rdx     # 0x330a7
leaq 0x110(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x7830
jmp 0x6256
movq 0x228(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x79b0
jmp 0x626d
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x7740
jmp 0x628c
movq 0xa0(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x75a0
jmp 0x62a3
leaq 0x130(%rsp), %rdi
callq 0x5788
leaq 0xd0(%rsp), %rdi
callq 0x5788
leaq 0x110(%rsp), %rdi
callq 0x5788
leaq 0xf0(%rsp), %rdi
callq 0x5788
movb $0x0, 0x2e7(%rsp)
movl $0x1, 0x1e0(%rsp)
jmp 0x63ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x157(%rsp), %rdi
callq 0x53e0
jmp 0x63df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x6392
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x6385
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x6378
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x5788
leaq 0xd0(%rsp), %rdi
callq 0x5788
leaq 0x110(%rsp), %rdi
callq 0x5788
leaq 0xf0(%rsp), %rdi
callq 0x5788
jmp 0x63df
jmp 0x63a3
movl $0x0, 0x1e0(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x5788
leaq 0x238(%rsp), %rdi
callq 0x5788
movl 0x1e0(%rsp), %eax
testl %eax, %eax
je 0x63da
jmp 0x63d5
jmp 0x64dd
jmp 0x64bd
leaq 0x1c0(%rsp), %rdi
callq 0x5788
leaq 0x238(%rsp), %rdi
callq 0x5788
jmp 0x64ee
movq 0xa0(%rsp), %rax
addq $0x50, %rax
movq %rax, 0x8(%rsp)
movq 0x2b8(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0xaf(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x56a0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0xb0(%rsp), %rdi
callq 0x74e0
jmp 0x6447
movq 0x8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x79e0
jmp 0x645b
leaq 0xb0(%rsp), %rdi
callq 0x5788
leaq 0xaf(%rsp), %rdi
callq 0x53e0
jmp 0x64bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
jmp 0x64ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x288(%rsp)
movl %eax, 0x284(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x5788
leaq 0xaf(%rsp), %rdi
callq 0x53e0
jmp 0x64ee
jmp 0x64bf
movl 0x2c4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c4(%rsp)
jmp 0x5c19
movb $0x1, 0x2e7(%rsp)
movb 0x2e7(%rsp), %al
andb $0x1, %al
addq $0x2e8, %rsp            # imm = 0x2E8
retq
movq 0x288(%rsp), %rdi
callq 0x5690
nopl (%rax,%rax)