// File: /workspace/github_cpp_makefile_star2_O1/ridiculousfish[P]docopt_fish/docopt_fish.cpp
// Function: docopt_fish::argv_classifier_t::parse_unseparated_short_options(std::vector<docopt_fish::error_t, std::allocator<docopt_fish::error_t>>*)
bool argv_classifier_t::parse_unseparated_short_options(error_list_t *out_errors) {
    const string_t &arg = this->arg();
    assert(this->arg_has_prefix("-"));
    assert(arg.length() > 1);  // must not be just a single dash
    bool errored = false;
    bool last_option_has_argument = false;

    // Construct the list of options in-order, corresponding to this argument
    std::vector<option_t> options_for_argument;

    // walk over the characters in the argument, skipping the leading dash
    for (size_t idx_in_arg = 1; idx_in_arg < arg.length() && !errored; idx_in_arg++) {
        // Get list of short options matching this resolved option.
        const rstring_t::char_t short_char = arg.at(idx_in_arg);
        const option_list_t matches = this->filter_options([&](const option_t &opt) {
            // This is a short option (-D) so we check the second character (idx 1)
            const rstring_t &name = opt.names[option_t::single_short];
            return name.length() > 1 && name[1] == short_char;
        });
        
        size_t match_count = matches.size();
        // We should catch all duplicates during the preflight phase
        assert(match_count <= 1);
        if (match_count < 1) {
            this->error(out_errors, error_unknown_option, "Unknown short option",
                              idx_in_arg);
            errored = true;
        } else {
            // Just one match, add it to the global array
            options_for_argument.push_back(matches.at(0));
        }
    }

    if (!errored) {
        // Now we have all of the short options that this argument represents. No
        // option is allowed to have a value, except possibly the last one.
        for (size_t i = 0; i < options_for_argument.size(); i++) {
            const option_t &opt = options_for_argument.at(i);
            if (opt.has_value()) {
                if (i + 1 == options_for_argument.size()) {
                    // This is the last option
                    last_option_has_argument = true;
                } else {
                    // This is not the last option
                    // This i+1 is the position in the argument and needs some
                    // explanation. We have a leading dash and then an argument,
                    // which is parsed into short options - one per character, including
                    // the dash. Hence we can map from index-in-option to index-in-argument,
                    // unless there was an unknown option error above. In that case this
                    // will be wrong (but we typically only show the first error anyways)
                    this->error(out_errors, error_option_unexpected_argument,
                                      "Option may not have a value unless it is the last option",
                                      i + 1);
                    errored = true;
                }
            }
        }
    }

    // If we have an argument, determine the index of its name and its value
    rstring_t value_for_last_option;
    const size_t name_idx = this->idx;
    size_t val_idx_for_last_option = npos;
    if (!errored && last_option_has_argument) {
        // We don't support -f=bar style for short options.
        // TODO: support delimiter-free style (gcc -Dmacro=something)
        if (this->idx + 1 < this->argv.size()) {
            val_idx_for_last_option = this->idx + 1;
            value_for_last_option = rstring_t(this->argv.at(this->idx + 1));
        } else {
            // We are at the last argument, and we expect a value. Return the value as
            // a suggestion.
            this->suggest(options_for_argument.back().value);
            this->error(out_errors, error_option_has_missing_argument,
                              "Option expects an argument");
            errored = true;
        }
    }

    if (!errored) {
        // Construct resolved options
        for (size_t i = 0; i < options_for_argument.size(); i++) {
            // Most options have no value.
            size_t val_idx = npos;
            rstring_t value;
            if (i + 1 == options_for_argument.size() && last_option_has_argument) {
                // This is the last option
                value = value_for_last_option;
                val_idx = val_idx_for_last_option;
            }
            const option_t &opt = options_for_argument.at(i);
            this->classification.resolved_options.emplace_back(opt, name_idx, val_idx, value);
        }

        // Update the index
        this->idx += (last_option_has_argument ? 2 : 1);
    }
    return !errored;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, (%rsp)
movq %rdi, %r14
callq 0x9eea
movq %rax, %rbx
leaq 0x1d0a4(%rip), %rsi     # 0x255c4
movq %r14, %rdi
callq 0x9f1c
testb %al, %al
je 0x88ce
cmpq $0x1, 0x8(%rbx)
jbe 0x88ed
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
xorl %ebp, %ebp
cmpq $0x2, 0x8(%rbx)
jb 0x868e
movl $0x1, %r12d
xorl %ebp, %ebp
movl %ebp, 0x8(%rsp)
movq %rbx, %r15
movq (%rbx), %rax
movl (%rax,%r12,4), %ebx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %r14, %rbp
movq 0x8(%r14), %rax
movq (%rax), %r14
movq 0x8(%rax), %r13
cmpq %r13, %r14
je 0x85e2
cmpq $0x2, 0x8(%r14)
jb 0x85dc
movq (%r14), %rax
movq 0x10(%r14), %rcx
cmpl %ebx, 0x4(%rcx,%rax,4)
jne 0x85dc
movq 0x18(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x85cc
movl $0x10, %ecx
movq %rax, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
subq $-0x80, %rax
movq %rax, 0x18(%rsp)
jmp 0x85dc
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x1043e
subq $-0x80, %r14
jmp 0x858e
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rax
movq %rax, %rcx
subq %rdx, %rcx
cmpq $0x81, %rcx
jae 0x88af
cmpq %rdx, %rax
movq %rbp, %r14
movq %r15, %rbx
je 0x8633
movq 0x38(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x8653
movl $0x10, %ecx
movq %rax, %rdi
movq %rdx, %rsi
rep  movsq (%rsi), %es:(%rdi)
subq $-0x80, %rax
movq %rax, 0x38(%rsp)
movl 0x8(%rsp), %ebp
jmp 0x8664
movb $0x1, %bpl
movq %r14, %rdi
movq (%rsp), %rsi
movl $0x67, %edx
leaq 0x19d6c(%rip), %rcx     # 0x223b5
movq %r12, %r8
callq 0x9f74
jmp 0x8664
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x1043e
movl 0x8(%rsp), %ebp
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x867b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x7200
incq %r12
cmpq 0x8(%rbx), %r12
jae 0x868e
testb $0x1, %bpl
je 0x8561
testb $0x1, %bpl
jne 0x870b
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
subq %rcx, %rax
je 0x870b
sarq $0x7, %rax
movl $0x50, %r12d
xorl %r15d, %r15d
xorl %r13d, %r13d
movl %r15d, %ebx
cmpq $0x0, (%rcx,%r12)
je 0x86e9
leaq 0x1(%r13), %r8
movb $0x1, %r15b
cmpq %rax, %r8
je 0x86ec
movb $0x1, %bpl
movq %r14, %rdi
movq (%rsp), %rsi
movl $0x65, %edx
leaq 0x19ceb(%rip), %rcx     # 0x223ca
callq 0x9f74
movl %ebx, %r15d
jmp 0x86ec
movl %ebx, %r15d
incq %r13
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rax
subq %rcx, %rax
sarq $0x7, %rax
subq $-0x80, %r12
cmpq %rax, %r13
jb 0x86b3
jmp 0x870e
xorl %r15d, %r15d
movq 0x20(%r14), %rbx
movq %rbx, 0x60(%rsp)
movl %r15d, %eax
notb %al
orb %bpl, %al
movq $0x0, 0x8(%rsp)
testb $0x1, %al
je 0x8737
movq $0x0, 0x50(%rsp)
jmp 0x87ad
incq %rbx
movq (%r14), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rbx
jae 0x876c
movq %rbx, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x8(%rax,%rcx), %rax
movq %rax, 0x50(%rsp)
jmp 0x87b4
movq 0x38(%rsp), %rsi
addq $-0x38, %rsi
movq %r14, %rdi
callq 0x9fcc
movq $0x0, 0x50(%rsp)
leaq 0x19afb(%rip), %rcx     # 0x22288
movq %r14, %rdi
movq (%rsp), %rsi
movl $0x64, %edx
xorl %r8d, %r8d
callq 0x9f74
movb $0x1, %bpl
movq $0x0, 0x8(%rsp)
movq $-0x1, %rbx
testb $0x1, %bpl
jne 0x8880
movq %r14, (%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rax
subq %rsi, %rax
je 0x8867
sarq $0x7, %rax
movq (%rsp), %rcx
leaq 0x40(%rcx), %r14
xorl %r13d, %r13d
xorl %r12d, %r12d
movq $-0x1, 0x58(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
incq %r12
cmpq %rax, %r12
sete %al
andb %r15b, %al
cmpb $0x1, %al
jne 0x8833
movq $0x0, 0x10(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %rbx, 0x58(%rsp)
addq %r13, %rsi
movq %r14, %rdi
leaq 0x60(%rsp), %rdx
leaq 0x58(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0xa0d8
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rax
subq %rsi, %rax
sarq $0x7, %rax
subq $-0x80, %r13
cmpq %rax, %r12
jb 0x87e7
movzbl %r15b, %eax
andl $0x1, %eax
movq (%rsp), %rbx
movq 0x20(%rbx), %rcx
addq %rcx, %rax
incq %rax
movq %rax, 0x20(%rbx)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8897
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x7200
notb %bpl
andb $0x1, %bpl
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19aee(%rip), %rdi     # 0x223a4
leaq 0x19777(%rip), %rsi     # 0x22034
leaq 0x19a7a(%rip), %rcx     # 0x2233e
movl $0x26a, %edx            # imm = 0x26A
callq 0x7120
leaq 0x19a4f(%rip), %rdi     # 0x22324
leaq 0x19758(%rip), %rsi     # 0x22034
leaq 0x19a5b(%rip), %rcx     # 0x2233e
movl $0x256, %edx            # imm = 0x256
callq 0x7120
leaq 0x19a9f(%rip), %rdi     # 0x22393
leaq 0x19739(%rip), %rsi     # 0x22034
leaq 0x19a3c(%rip), %rcx     # 0x2233e
movl $0x257, %edx            # imm = 0x257
callq 0x7120
jmp 0x8912
jmp 0x8912
jmp 0x8917
movq %rax, %rbx
jmp 0x8931
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8931
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x7200
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8948
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x7200
movq %rbx, %rdi
callq 0x7360