// File: 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
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x18(%rbp), %rdi
callq 0x85a0
cmpq $0x1, %rax
jbe 0x14033
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8630
cmpl $0x2d, (%rax)
je 0x14038
jmp 0x14523
movq -0x198(%rbp), %rax
movq $0x2, -0x20(%rbp)
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x15fd0
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x15f00
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
callq 0x15d60
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x15ff0
testb $0x1, %al
jne 0x14094
jmp 0x1416a
leaq -0x70(%rbp), %rdi
callq 0x15fb0
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x16030
movb %al, -0x199(%rbp)
jmp 0x140b6
movb -0x199(%rbp), %al
testb $0x1, %al
jne 0x140c5
jmp 0x1415a
movq -0x80(%rbp), %rdi
callq 0x85a0
cmpq $0x2, %rax
jne 0x140d6
jmp 0x1410c
leaq 0x378b6(%rip), %rdi     # 0x4b993
leaq 0x36fa4(%rip), %rsi     # 0x4b088
movl $0x470, %edx            # imm = 0x470
leaq 0x378d0(%rip), %rcx     # 0x4b9c0
callq 0x81e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x1452c
movq -0x80(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
movl $0x1, %esi
callq 0x8630
movq %rax, -0x1a8(%rbp)
jmp 0x1412a
movq -0x1a8(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x16060
movq %rax, -0x1b8(%rbp)
jmp 0x14143
movq -0x1b0(%rbp), %rsi
movq -0x1b8(%rbp), %rdi
callq 0x16140
jmp 0x14158
jmp 0x1415a
jmp 0x1415c
leaq -0x70(%rbp), %rdi
callq 0x161a0
jmp 0x1407e
movb $0x1, -0x8d(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0xc430
jmp 0x1418f
leaq -0xb0(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0xf960
movq %rax, -0xb8(%rbp)
movq -0x98(%rbp), %rdi
callq 0x10030
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x1435e
movq -0xb8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xc4(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
callq 0x161c0
movq %rax, -0x1c0(%rbp)
jmp 0x141ff
movq -0x1c0(%rbp), %rax
cmpq $0x0, %rax
jne 0x14218
movb $0x0, -0x8d(%rbp)
jmp 0x1435e
movl $0x2d, -0x108(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, -0x104(%rbp)
leaq -0x108(%rbp), %rax
movq %rax, -0x100(%rbp)
movq $0x2, -0xf8(%rbp)
leaq -0x109(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x8130
movq -0x1c8(%rbp), %rcx
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x8510
jmp 0x1427d
leaq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x161f0
movq %rax, -0x1d0(%rbp)
jmp 0x14296
leaq -0xf0(%rbp), %rdi
callq 0x8590
leaq -0x109(%rbp), %rdi
callq 0x85f0
movq -0x1d0(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0xd0(%rbp)
je 0x142c8
jmp 0x1432a
leaq 0x37757(%rip), %rdi     # 0x4ba26
leaq 0x36db2(%rip), %rsi     # 0x4b088
movl $0x488, %edx            # imm = 0x488
leaq 0x376de(%rip), %rcx     # 0x4b9c0
callq 0x81e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14319
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x8590
leaq -0x109(%rbp), %rdi
callq 0x85f0
jmp 0x1452c
movq -0xd0(%rbp), %rdi
callq 0xc8e0
testb $0x1, %al
jne 0x1433c
jmp 0x14345
movb $0x0, -0x8d(%rbp)
jmp 0x1435e
jmp 0x14347
movq -0xb8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xb8(%rbp)
jmp 0x141c3
testb $0x1, -0x8d(%rbp)
je 0x1451a
movq -0x10(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x15f00
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rdi
callq 0x15d60
movq %rax, -0x130(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x128(%rbp), %rdi
movq -0x130(%rbp), %rsi
movq -0x138(%rbp), %rdx
callq 0x16360
movq %rax, -0x1d8(%rbp)
jmp 0x143c0
movq -0x1d8(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x163c0
movq -0x10(%rbp), %rdi
callq 0x15d60
movq %rax, -0x148(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x163c0
movq -0x1e0(%rbp), %rdi
movq -0x118(%rbp), %rsi
movq -0x140(%rbp), %rdx
callq 0x162d0
movq %rax, -0x1e8(%rbp)
jmp 0x14427
movq -0x1e8(%rbp), %rax
movq %rax, -0x150(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rdi
callq 0x16400
movq %rax, -0x160(%rbp)
movq -0x158(%rbp), %rdi
callq 0x16430
movq %rax, -0x168(%rbp)
leaq -0x160(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x16460
testb $0x1, %al
jne 0x14482
jmp 0x14518
leaq -0x160(%rbp), %rdi
callq 0x16490
movq %rax, -0x170(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x18(%rbp), %rsi
movq -0x170(%rbp), %rax
movl (%rax), %edx
leaq -0x190(%rbp), %rdi
callq 0x16540
jmp 0x144bb
movq -0x1f0(%rbp), %rdi
movq -0x170(%rbp), %rdx
addq $0x28, %rdx
leaq -0x190(%rbp), %rsi
callq 0x164b0
jmp 0x144db
leaq -0x190(%rbp), %rdi
callq 0x8590
leaq -0x160(%rbp), %rdi
callq 0x165c0
jmp 0x14466
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x8590
jmp 0x1452c
jmp 0x1451a
leaq -0x60(%rbp), %rdi
callq 0x165f0
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x165f0
movq -0x88(%rbp), %rdi
callq 0x85d0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)