// File: /workspace/github_cpp_makefile_star2_O2/ridiculousfish[P]docopt_fish/docopt_fish.cpp
// Function: docopt_fish::argv_classifier_t::parse_separated_option(docopt_fish::option_t::name_type_t, std::vector<docopt_fish::error_t, std::allocator<docopt_fish::error_t>>*)
bool argv_classifier_t::parse_separated_option(option_t::name_type_t type, error_list_t *out_errors) {
    const string_t &arg = this->arg();
    assert(this->arg_has_prefix(type == option_t::double_long ? "--" : "-"));

    // Parse the argument into an 'option'. Note that this option does not appear
    // in the options list because its range reflects the string in the argument.
    // TODO: Need to distinguish between equivalent ways of specifying parameters
    // (--foo=bar and --foo bar)
    option_t arg_as_option = option_t::parse_from_argument(arg, type);
    const rstring_t arg_name = arg_as_option.names[type];
    assert(!arg_name.empty());

    // Get list of matching options.
    // Short options must have a value to match, else we handle them in parse_unseparated_short_options
    auto match_iter = std::find_if(this->options.cbegin(), this->options.cend(), [&](const option_t &opt) {
        bool does_match = opt.names[type] == arg_name &&
            (type != option_t::single_short || opt.has_value());
        return does_match;
    });
    
    bool errored = false;
    // Our option de-duplication ensures we should never have more than one match
    if (match_iter == this->options.cend()) {
        this->error(out_errors, error_unknown_option, "Unknown option");
        errored = true;
    } else {
        const option_t &match = *match_iter;
        // Ensure the option and argument agree on having a value
        rstring_t value;
        const size_t name_idx = this->idx;
        size_t arg_index = npos;
        if (match.has_value()) {
            if (arg_as_option.has_value()) {
                // The arg was specified as --foo=bar (long) or -DNDEBUG (short)
                // The range is the value portion; the index is the same as our
                // argument.
                value = arg_as_option.value;
                arg_index = this->idx;
            } else if (! (match.flags & value_is_optional)) {
                if (this->idx + 1 < this->argv.size()) {
                    this->idx += 1;
                    arg_index = this->idx;
                    value = rstring_t(this->argv.at(arg_index));
                } else {
                    // We are at the last argument, and we expect a value. Return the
                    // value as a suggestion.
                    this->suggest(match.value);
                    this->error(out_errors, error_option_has_missing_argument,
                                      "Option expects an argument");
                    errored = true;
                }
            } else {
                // There was no value match, but it was optional
                assert(match.flags & value_is_optional);
            }
        } else if (arg_as_option.has_value()) {
            // A value was specified as --foo=bar, but none was expected
            this->error(out_errors, error_option_unexpected_argument,
                              "Option does not expect an argument");
            errored = true;
        }
        
        // Apply our SEPARATOR-NOTE
        // Be strict about = separators
        // Note that we use the single_long_strict_eqsep flag in arg_as_option
        // to indicate that we got an = separator
        if (! errored && type == option_t::single_long) {
            bool requires_eq = match.flags & single_long_strict_eqsep;
            bool has_eq = arg_as_option.flags & single_long_strict_eqsep;
            if (requires_eq != has_eq) {
                const char *msg = has_eq ?
                                   "Option requires a space to separate its argument" :
                                   "Option requires '=' to separate its argument";
                this->error(out_errors, error_wrong_separator, msg);
                errored = true;
            }
        }

        if (!errored) {
            this->classification.resolved_options.emplace_back(match, name_idx, arg_index, value);
            this->idx += 1;
        }
    }
    return ! errored;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, 0x8(%rsp)
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, 0x4(%rsp)
callq 0x922e
movq %rax, %r15
cmpl $0x2, %ebp
leaq 0x17844(%rip), %rax     # 0x1f62b
leaq 0x1783e(%rip), %rsi     # 0x1f62c
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0x923e
testb %al, %al
je 0x80af
leaq 0x58(%rsp), %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x7bec
movl %ebp, %eax
imulq $0x18, %rax, %rax
movups 0x58(%rsp,%rax), %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0x68(%rsp,%rax), %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x80ce
movq 0x8(%rbx), %rax
movq (%rax), %r12
movq 0x8(%rax), %r14
leaq 0x4(%rsp), %rax
leaq 0x10(%rsp), %r13
movq %rax, (%r13)
leaq 0x40(%rsp), %rax
movq %rax, 0x8(%r13)
movq %r14, 0x30(%rsp)
subq %r12, %r14
movq %r14, %rbp
sarq $0x9, %rbp
testq %rbp, %rbp
jle 0x7ee0
movq %r13, %rdi
movq %r12, %rsi
callq 0x8ed8
testb %al, %al
jne 0x7f1c
leaq 0x80(%r12), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x8ed8
testb %al, %al
jne 0x7f44
leaq 0x100(%r12), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x8ed8
testb %al, %al
jne 0x7f44
leaq 0x180(%r12), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x8ed8
testb %al, %al
jne 0x7f44
addq $0x200, %r12            # imm = 0x200
decq %rbp
addq $-0x200, %r14           # imm = 0xFE00
jmp 0x7e68
sarq $0x7, %r14
cmpq $0x1, %r14
je 0x7f2c
cmpq $0x2, %r14
je 0x7f0b
cmpq $0x3, %r14
jne 0x7f21
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x8ed8
testb %al, %al
jne 0x7f1c
subq $-0x80, %r12
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x8ed8
testb %al, %al
je 0x7f28
movq %r12, %r15
jmp 0x7f44
movq 0x30(%rsp), %r15
jmp 0x7f44
subq $-0x80, %r12
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x8ed8
testb %al, %al
movq 0x30(%rsp), %r15
cmovneq %r12, %r15
movq 0x8(%rbx), %rax
cmpq 0x8(%rax), %r15
je 0x7fa0
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq 0x20(%rbx), %rsi
orq $-0x1, 0x28(%rsp)
movq %rsi, 0x38(%rsp)
cmpq $0x0, 0x50(%r15)
movq 0xa8(%rsp), %rax
je 0x7fb1
testq %rax, %rax
je 0x7fc7
movq 0xb0(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0xa0(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq %rsi, 0x28(%rsp)
jmp 0x800d
leaq 0x142d2(%rip), %rcx     # 0x1c279
xorl %r15d, %r15d
pushq $0x67
jmp 0x8089
testq %rax, %rax
je 0x800d
leaq 0x142e6(%rip), %rcx     # 0x1c2a3
xorl %r15d, %r15d
pushq $0x65
jmp 0x8089
testb $0x1, 0x78(%r15)
jne 0x800d
incq %rsi
movq (%rbx), %rdi
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x5, %rax
cmpq %rax, %rsi
jae 0x806e
movq %rsi, 0x20(%rbx)
movq %rsi, 0x28(%rsp)
callq 0x9290
movq (%rax), %rcx
movq 0x8(%rax), %rax
andq $0x0, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
cmpl $0x1, 0x4(%rsp)
jne 0x802f
movl 0x78(%r15), %ecx
movl 0xd0(%rsp), %eax
andl $0x2, %eax
shrl %ecx
andl $0x1, %ecx
movl %eax, %edx
shrl %edx
cmpl %edx, %ecx
jne 0x8053
leaq 0x40(%rbx), %rdi
leaq 0x38(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %r15, %rsi
callq 0x92fa
incq 0x20(%rbx)
movb $0x1, %r15b
jmp 0x809a
testl %eax, %eax
leaq 0x1429b(%rip), %rax     # 0x1c2f7
leaq 0x14263(%rip), %rcx     # 0x1c2c6
cmoveq %rax, %rcx
xorl %r15d, %r15d
pushq $0x68
jmp 0x8089
addq $0x48, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x92b2
leaq 0x14204(%rip), %rcx     # 0x1c288
xorl %r15d, %r15d
pushq $0x64
popq %rdx
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
xorl %r8d, %r8d
callq 0x927e
movl %r15d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1410d(%rip), %rdi     # 0x1c1c3
leaq 0x13f77(%rip), %rsi     # 0x1c034
leaq 0x14140(%rip), %rcx     # 0x1c204
movl $0x1fd, %edx            # imm = 0x1FD
callq 0x7150
leaq 0x14192(%rip), %rdi     # 0x1c267
leaq 0x13f58(%rip), %rsi     # 0x1c034
leaq 0x14121(%rip), %rcx     # 0x1c204
movl $0x205, %edx            # imm = 0x205
callq 0x7150
nop