// File: /workspace/github_cpp_makefile_star2_O2/ridiculousfish[P]docopt_fish/docopt_fish.cpp
// Function: docopt_fish::docopt_impl::combine_short_suggestions(std::vector<docopt_fish::suggestion_t, std::allocator<docopt_fish::suggestion_t>>*, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>> const&) const
void combine_short_suggestions(suggestion_list_t *suggestions, const string_t &partial_str) const {
        // Verify it starts with a - and at least one other character
        // Verify that every character in partial is a combinable short option in our suggestions
        // If so, append as a suggestion every combinable short option that doesn't appear in partial
        if (partial_str.length() <= 1 || partial_str.at(0) != '-') {
            return; // EARLY OUT
        }

        constexpr size_t short_option_name_length = 2;
        
        // Helper to return an option with the given short name
        auto short_option_named = [&](const string_t &name){
            const option_t *result = nullptr;
            if (name.length() == short_option_name_length) {
                const rstring_t rname(name);
                for (const option_t &opt : this->all_options) {
                    if (opt.names[option_t::single_short] == rname) {
                        result = &opt;
                        break;
                    }
                }
            }
            return result;
        };
        
        // Helper to indicate if the suggestion corresponds to a short option
        auto is_short_option_suggestion = [&](const suggestion_t &s) {
            return short_option_named(s.token) != nullptr;
        };
        
        
        // Generate map from character to suggestion for each short suggestion
        // e.g. an option '-e' would have an entry 'e' -> suggestion
        std::map<string_t::value_type, suggestion_t> char_to_suggestion;
        for (const suggestion_t &s : *suggestions) {
            if (is_short_option_suggestion(s)) {
                assert(s.token.length() == short_option_name_length);
                char_to_suggestion[s.token.at(1)] = s;
            }
        }
        
        // Verify that every character in the partial arg is in our suggestions,
        // and that the corresponding option does not require a value
        // If so, remove the corresponding suggestion (so that we only pick it up once)
        // Start at 1 to skip the leading dash
        // TODO: handle options with multiplicities (-vvv)
        bool partial_arg_is_valid_combined_shorts = true;
        for (rstring_t::char_t c : rstring_t(partial_str, 1)) {
            if (! char_to_suggestion.erase(c)) {
                // Not found in the map
                // So some character in the partial is not a suggestion
                partial_arg_is_valid_combined_shorts = false;
                break;
            }
            
            // Check for a value; short options with values must be last in a combined option,
            // and therefore cannot appear in partial strings
            // We should always have a short option, else it would not have been found
            // in char_to_suggestion
            const option_t *opt = short_option_named({'-', c});
            assert(opt != nullptr);
            if (opt->has_value()) {
                partial_arg_is_valid_combined_shorts = false;
                break;
            }
        }
        
        if (partial_arg_is_valid_combined_shorts) {
            // Whatever's left are our new suggestions
            // Erase all short suggestions, and append our new ones
            // New suggestions are the partial string, with each short option appended,
            // along with that short option's metadata
            suggestions->erase(std::remove_if(suggestions->begin(), suggestions->end(),
                                              is_short_option_suggestion),
                               suggestions->end());
            for (const auto &p : char_to_suggestion) {
                suggestions->emplace_back(partial_str + p.first, p.second.md);
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpq $0x2, 0x8(%rdx)
jb 0xb65c
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rdi
xorl %esi, %esi
callq 0x73d0
cmpl $0x2d, (%rax)
jne 0xb65c
leaq 0x20(%rsp), %rax
movq %r15, (%rax)
leaq 0x18(%rsp), %r15
movq %rax, (%r15)
leaq 0x50(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq (%r14), %r12
movq %r14, 0x10(%rsp)
movq 0x8(%r14), %r14
pushq $0x1
popq %r13
leaq 0x48(%rsp), %rbp
cmpq %r14, %r12
je 0xb5c0
movq %r15, %rdi
movq %r12, %rsi
callq 0xbc2e
testb %al, %al
je 0xb5b7
cmpq $0x2, 0x8(%r12)
jne 0xb6db
movq %r12, %rdi
movq %r13, %rsi
callq 0x73d0
movq %rbp, %rdi
movq %rax, %rsi
callq 0xbc40
movq %rax, %rdi
movq %r12, %rsi
callq 0xbc8e
addq $0x90, %r12
jmp 0xb576
movq (%rbx), %r13
movq 0x8(%rbx), %r12
shlq $0x2, %r12
pushq $0x4
popq %r14
leaq 0x28(%rsp), %rbp
cmpq %r14, %r12
je 0xb66b
movl (%r13,%r14), %eax
movl %eax, 0x4(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0xc0fc
testq %rax, %rax
je 0xb652
movl $0x2d, 0x8(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0xc(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0xc2b6
leaq 0x20(%rsp), %rdi
movq %rbp, %rsi
callq 0xbcc4
movq %rax, %r15
movq %rbp, %rdi
callq 0x7050
testq %r15, %r15
je 0xb6fa
addq $0x4, %r14
cmpq $0x0, 0x50(%r15)
je 0xb5d4
leaq 0x48(%rsp), %rdi
callq 0xc728
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %r14
movq (%r14), %rdi
movq 0x8(%r14), %rsi
movq 0x18(%rsp), %rdx
callq 0xc40c
movq 0x8(%r14), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0xbd20
movq 0x60(%rsp), %r12
leaq 0x28(%rsp), %r15
leaq 0x50(%rsp), %rax
cmpq %rax, %r12
je 0xb652
movl 0x20(%r12), %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xbd65
leaq 0x48(%r12), %rdx
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0xbd26
movq %r15, %rdi
callq 0x7050
movq %r12, %rdi
callq 0x7160
movq %rax, %r12
jmp 0xb69a
leaq 0x1123d(%rip), %rdi     # 0x1c91f
leaq 0x1094b(%rip), %rsi     # 0x1c034
leaq 0x1125c(%rip), %rcx     # 0x1c94c
movl $0x470, %edx            # imm = 0x470
callq 0x7150
leaq 0x112b1(%rip), %rdi     # 0x1c9b2
leaq 0x1092c(%rip), %rsi     # 0x1c034
leaq 0x1123d(%rip), %rcx     # 0x1c94c
movl $0x488, %edx            # imm = 0x488
callq 0x7150
jmp 0xb734
jmp 0xb734
jmp 0xb723
jmp 0xb734
jmp 0xb734
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x7050
jmp 0xb737
jmp 0xb734
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xc728
movq %rbx, %rdi
callq 0x7390
nop