// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
callq 0x922e
movq %rax, %r15
leaq 0x17519(%rip), %rsi     # 0x1f62c
movq %rbx, %rdi
callq 0x923e
testb %al, %al
je 0x845c
movq 0x8(%r15), %rax
cmpq $0x1, %rax
jbe 0x847b
leaq 0x40(%rsp), %rcx
andq $0x0, 0x10(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rcx)
pushq $0x1
popq %r13
movq $0x0, 0x8(%rsp)
movq %r13, %r12
movq %r15, 0x18(%rsp)
cmpq %rax, %r12
jae 0x8244
testb $0x1, 0x8(%rsp)
jne 0x8244
movq %rbx, %r14
movq %r15, %rdi
movq %r12, %rbp
movq %r12, %rsi
callq 0x73d0
movl (%rax), %ebx
andq $0x0, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%r14), %rax
movq (%rax), %r12
movq 0x8(%rax), %r15
cmpq %r15, %r12
je 0x81c5
cmpq $0x2, 0x8(%r12)
jb 0x81bf
movq %r12, %rdi
movq %r13, %rsi
callq 0xa94e
cmpl %ebx, %eax
jne 0x81bf
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x9370
subq $-0x80, %r12
jmp 0x8196
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x81, %rdx
jae 0x843d
cmpq %rax, %rcx
movq %r14, %rbx
movq 0x18(%rsp), %r15
movq %rbp, %r12
je 0x820d
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x939a
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x9370
jmp 0x822e
movb $0x1, %al
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
pushq $0x67
popq %rdx
leaq 0x1418f(%rip), %rcx     # 0x1c3b5
movq %r12, %r8
callq 0x927e
leaq 0x20(%rsp), %rdi
callq 0xef34
incq %r12
movq 0x8(%r15), %rax
jmp 0x8156
testb $0x1, 0x8(%rsp)
je 0x8288
xorl %r13d, %r13d
movq 0x20(%rbx), %r15
movq %r15, 0x70(%rsp)
movl %r13d, %r14d
notb %r14b
movq 0x8(%rsp), %rax
orb %r14b, %al
testb $0x1, %al
je 0x82fb
pushq $-0x1
popq %r15
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
jmp 0x832e
xorl %r14d, %r14d
leaq 0x40(%rsp), %r15
leaq 0x14133(%rip), %r12     # 0x1c3ca
pushq $0x65
popq %rbp
xorl %r13d, %r13d
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
sarq $0x7, %rax
cmpq %rax, %r14
jae 0x824e
movq %r15, %rdi
movq %r14, %rsi
callq 0x93bc
incq %r14
cmpq $0x0, 0x50(%rax)
je 0x829d
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
sarq $0x7, %rax
cmpq %r14, %rax
je 0x82f6
movb $0x1, %al
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movl %ebp, %edx
movq %r12, %rcx
movq %r14, %r8
callq 0x927e
jmp 0x829d
movb $0x1, %r13b
jmp 0x829d
incq %r15
movq (%rbx), %rdi
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x5, %rax
cmpq %rax, %r15
jae 0x83f3
movq %r15, %rsi
callq 0x9290
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
testb $0x1, 0x8(%rsp)
je 0x833d
xorl %r14d, %r14d
jmp 0x8421
movq %r15, 0x8(%rsp)
movl %r13d, 0x64(%rsp)
leaq 0x40(%rbx), %r15
xorl %r12d, %r12d
leaq 0x68(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
sarq $0x7, %rax
cmpq %rax, %r12
jae 0x83d8
orq $-0x1, 0x68(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
incq %r12
cmpq %rax, %r12
setne %al
orb %r14b, %al
testb $0x1, %al
jne 0x83ad
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x68(%rsp)
decq %r12
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x93bc
movq %r15, %rdi
movq %rax, %rsi
leaq 0x70(%rsp), %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x92fa
incq %r12
jmp 0x8358
movzbl 0x64(%rsp), %eax
andl $0x1, %eax
movq 0x20(%rbx), %rcx
addq %rcx, %rax
incq %rax
movq %rax, 0x20(%rbx)
movb $0x1, %r14b
jmp 0x8421
movq 0x48(%rsp), %rsi
addq $-0x38, %rsi
movq %rbx, %rdi
callq 0x92b2
xorl %r14d, %r14d
leaq 0x13e7a(%rip), %rcx     # 0x1c288
pushq $0x64
popq %rdx
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
xorl %r8d, %r8d
callq 0x927e
leaq 0x40(%rsp), %rdi
callq 0xef34
movl %r14d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13f60(%rip), %rdi     # 0x1c3a4
leaq 0x13be9(%rip), %rsi     # 0x1c034
leaq 0x13eec(%rip), %rcx     # 0x1c33e
movl $0x26a, %edx            # imm = 0x26A
callq 0x7150
leaq 0x13ec1(%rip), %rdi     # 0x1c324
leaq 0x13bca(%rip), %rsi     # 0x1c034
leaq 0x13ecd(%rip), %rcx     # 0x1c33e
movl $0x256, %edx            # imm = 0x256
callq 0x7150
leaq 0x13f11(%rip), %rdi     # 0x1c393
leaq 0x13bab(%rip), %rsi     # 0x1c034
leaq 0x13eae(%rip), %rcx     # 0x1c33e
movl $0x257, %edx            # imm = 0x257
callq 0x7150
jmp 0x84a4
jmp 0x84a4
jmp 0x84a4
jmp 0x84a4
jmp 0x84a4
movq %rax, %rbx
jmp 0x84b8
jmp 0x84ab
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xef34
leaq 0x40(%rsp), %rdi
callq 0xef34
movq %rbx, %rdi
callq 0x7390