// File: jovermann[P]streplace/src/CommandLineParser.cpp
// Function: ut1::CommandLineParser::parse(int, char const**)
void CommandLineParser::parse(int argc, const char* argv[])
{
    // Parse arguments.
    for (int i = 1; i < argc; i++)
    {
        if (argv[i][0] == '-')
        {
            if (argv[i][1] == '-')
            {
                if (argv[i][2] == 0)
                {
                    // "--": End of options.
                    // Keep the "--" as an argument so the application can add further semantics to it.
                    for (; i < argc; i++)
                    {
                        args.emplace_back(argv[i]);
                    }
                }
                else
                {
                    // Long option.
                    parseLongOption(argc, argv, i);
                }
            }
            else if (argv[i][1] == 0)
            {
                // Positional arg '-'.
                args.emplace_back(argv[i]);
            }
            else
            {
                // Short option(s).
                parseShortOptions(argc, argv, i);
            }
        }
        else
        {
            // Positional arg.
            args.emplace_back(argv[i]);
        }
    }

    if (isSet("help"))
    {
        printMessage(getUsageStr());
        std::exit(0);
    }

    if (isSet("version"))
    {
        printMessage("version " + version);
        std::exit(0);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x8a45
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x8a16
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2d, %eax
jne 0x89c5
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x89ac
jmp 0x8978
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x89aa
movq -0xc8(%rbp), %rdi
addq $0x78, %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0xbdc0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8978
jmp 0x89c3
movq -0xc8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
callq 0x8c50
jmp 0x8a14
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x89fb
movq -0xc8(%rbp), %rdi
addq $0x78, %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0xbdc0
jmp 0x8a12
movq -0xc8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
callq 0x9570
jmp 0x8a14
jmp 0x8a35
movq -0xc8(%rbp), %rdi
addq $0x78, %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0xbdc0
jmp 0x8a37
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8928
leaq -0x41(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x7a50
movq -0xd0(%rbp), %rdx
leaq 0x415b9(%rip), %rsi     # 0x4a01c
leaq -0x40(%rbp), %rdi
callq 0xb310
jmp 0x8a6e
movq -0xc8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xbe40
movb %al, -0xd1(%rbp)
jmp 0x8a86
leaq -0x40(%rbp), %rdi
callq 0x73c0
leaq -0x41(%rbp), %rdi
callq 0x7670
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x8aa7
jmp 0x8b2e
movq -0xc8(%rbp), %rsi
leaq -0x78(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x9a80
movq -0xc8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
callq 0x9a20
jmp 0x8ad3
leaq -0x78(%rbp), %rdi
callq 0x73c0
xorl %edi, %edi
callq 0x7740
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x8b06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x73c0
leaq -0x41(%rbp), %rdi
callq 0x7670
jmp 0x8c46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x73c0
jmp 0x8c46
leaq -0x99(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x7a50
movq -0xe8(%rbp), %rdx
leaq 0x4164b(%rip), %rsi     # 0x4a19a
leaq -0x98(%rbp), %rdi
callq 0xb310
jmp 0x8b5d
movq -0xc8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xbe40
movb %al, -0xe9(%rbp)
jmp 0x8b78
leaq -0x98(%rbp), %rdi
callq 0x73c0
leaq -0x99(%rbp), %rdi
callq 0x7670
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x8b9f
jmp 0x8c3d
movq -0xc8(%rbp), %rdx
addq $0xf8, %rdx
leaq 0x41505(%rip), %rsi     # 0x4a0b9
leaq -0xc0(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0xb5b0
movq -0xc8(%rbp), %rdi
movq -0xf8(%rbp), %rsi
callq 0x9a20
jmp 0x8bdc
leaq -0xc0(%rbp), %rdi
callq 0x73c0
xorl %edi, %edi
callq 0x7740
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x8c15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x73c0
leaq -0x99(%rbp), %rdi
callq 0x7670
jmp 0x8c46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x73c0
jmp 0x8c46
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x7a30
nop