// File: /workspace/github_cpp_makefile_star2_O2/jovermann[P]streplace/src/CommandLineParser.cpp
// Function: ut1::CommandLineParser::parseLongOption(int, char const**, int&)
void CommandLineParser::parseLongOption(int argc, const char* argv[], int& i)
{
    std::vector<std::string> fields     = ut1::splitString(argv[i] + 2, '=', 1);
    std::string              longOption = fields[0];

    // First try exact match.
    Option* option = getOption(longOption);
    if (option == nullptr)
    {
        // Then try prefix and take it when it is unique.
        std::vector<std::string> matchingOptions;
        for (const auto& optName: optionList)
        {
            if (ut1::hasPrefix(optName, longOption) && (!ut1::hasPrefix(optName, HEADER_PREFIX)))
            {
                matchingOptions.push_back(optName);
            }
        }
        if (matchingOptions.size() == 0)
        {
            error("Unknown option --" + longOption + ".");
        }
        else if (matchingOptions.size() == 1)
        {
            longOption = matchingOptions[0];
            option     = getOption(longOption);
        }
        else
        {
            error("Ambiguous option --" + longOption + " (matches --" + ut1::joinStrings(matchingOptions, ", --") + ").");
        }
    }

    // We only get here when we had an exact match or a unique prefix.
    assert(option != nullptr);

    if (option->hasArg())
    {
        if (fields.size() == 2)
        {
            // --foo=bar
            option->setValue(fields[1], listSepChar);
        }
        else if (++i < argc)
        {
            // --foo bar
            option->setValue(argv[i], listSepChar);
        }
        else
        {
            error("Option --" + longOption + " requires an argument.");
        }
    }
    else
    {
        if (fields.size() == 1)
        {
            // --foo
            option->setValue("", 0);
        }
        else
        {
            error("Option --" + longOption + " does not accept arguments.");
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rcx, %r15
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movslq (%rcx), %rax
movq (%rdx,%rax,8), %rsi
addq $0x2, %rsi
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x760a
leaq 0xb0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
pushq $0x3d
popq %rdx
pushq $0x1
popq %rcx
callq 0x914a
leaq 0x60(%rsp), %rdi
callq 0x51f0
movq 0xb0(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x55d0
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x7520
movq %rax, %r12
testq %rax, %rax
jne 0x63ef
movl %ebp, 0x3c(%rsp)
movq %r15, 0xa0(%rsp)
movq %r14, 0xa8(%rsp)
leaq 0x80(%rsp), %rax
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movq 0x30(%rbx), %r13
movq %rbx, 0x30(%rsp)
movq 0x38(%rbx), %rbx
leaq 0x60(%rsp), %rbp
leaq 0x10(%rsp), %r14
leaq 0x40(%rsp), %r15
cmpq %rbx, %r13
je 0x6385
movq %r13, %rdi
movq %rbp, %rsi
callq 0x8c40
testb %al, %al
je 0x637f
movq %r14, %rdi
leaq 0x14d13(%rip), %rsi     # 0x1b05f
movq %r15, %rdx
callq 0x760a
movq %r13, %rdi
movq %r14, %rsi
callq 0x8c40
movl %eax, %r12d
movq %r14, %rdi
callq 0x51f0
testb %r12b, %r12b
jne 0x637f
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x7a7a
addq $0x20, %r13
jmp 0x632e
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq $0x1, %rax
jne 0x64c2
leaq 0x60(%rsp), %rdi
callq 0x5240
movq 0x30(%rsp), %rbx
movq 0xa8(%rsp), %r14
movq 0xa0(%rsp), %r15
movl 0x3c(%rsp), %ebp
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x7520
movq %rax, %r12
leaq 0x80(%rsp), %rdi
callq 0x7646
testq %r12, %r12
je 0x65ee
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rax
subq %rsi, %rax
cmpq $0x0, 0x50(%r12)
je 0x6425
cmpq $0x40, %rax
jne 0x6456
addq $0x20, %rsi
movsbl 0x90(%rbx), %edx
movq %r12, %rdi
callq 0x59cc
jmp 0x6499
cmpq $0x20, %rax
jne 0x6505
leaq 0x14c74(%rip), %rsi     # 0x1b0aa
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x760a
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x59cc
jmp 0x648f
movslq (%r15), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%r15)
cmpl %ebp, %ecx
jge 0x660d
movq 0x8(%r14,%rax,8), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x760a
movsbl 0x90(%rbx), %edx
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x59cc
leaq 0x10(%rsp), %rdi
callq 0x51f0
leaq 0x60(%rsp), %rdi
callq 0x51f0
leaq 0xb0(%rsp), %rdi
callq 0x7646
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rax, %rax
jne 0x6541
leaq 0x14cf0(%rip), %rsi     # 0x1b1be
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x7667
leaq 0x156ef(%rip), %rdx     # 0x1bbd3
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x76f8
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq 0x30(%rsp), %rdi
callq 0x7540
leaq 0x14d5e(%rip), %rsi     # 0x1b26a
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x7667
leaq 0x14d69(%rip), %rdx     # 0x1b28b
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x76f8
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x7540
leaq 0x14c88(%rip), %rsi     # 0x1b1d0
leaq 0x108(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x7667
leaq 0x14c83(%rip), %rdx     # 0x1b1e4
leaq 0x128(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x76f8
leaq 0x14c74(%rip), %rsi     # 0x1b1f1
leaq 0xc8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x760a
leaq 0xe8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0x95ae
leaq 0x40(%rsp), %rdi
leaq 0x128(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x7aa6
leaq 0x15a38(%rip), %rdx     # 0x1c005
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x76f8
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq 0x30(%rsp), %rdi
callq 0x7540
leaq 0x14c01(%rip), %rdi     # 0x1b1f6
leaq 0x14c0c(%rip), %rsi     # 0x1b208
leaq 0x14c1f(%rip), %rcx     # 0x1b222
movl $0x1c3, %edx            # imm = 0x1C3
callq 0x52d0
leaq 0x14c56(%rip), %rsi     # 0x1b26a
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x7667
leaq 0x14c4a(%rip), %rdx     # 0x1b274
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x76f8
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x7540
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x51f0
jmp 0x665b
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x51f0
jmp 0x666a
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x51f0
jmp 0x667c
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x51f0
jmp 0x668e
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x51f0
jmp 0x66b3
jmp 0x66cc
jmp 0x66db
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x51f0
jmp 0x66c0
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0x66c5
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x51f0
jmp 0x6727
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x51f0
jmp 0x66de
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x66f9
jmp 0x671d
jmp 0x6724
jmp 0x6724
jmp 0x671d
jmp 0x66f1
jmp 0x671d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x51f0
jmp 0x6734
jmp 0x671d
jmp 0x6724
movq %rax, %rbx
jmp 0x673e
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x51f0
jmp 0x674b
movq %rax, %rbx
jmp 0x674b
movq %rax, %rbx
jmp 0x6734
jmp 0x6724
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x7646
leaq 0x60(%rsp), %rdi
callq 0x51f0
leaq 0xb0(%rsp), %rdi
callq 0x7646
movq %rbx, %rdi
callq 0x5730
nop