// File: ridiculousfish[P]docopt_fish/docopt_fish.cpp
// Function: docopt_fish::docopt_impl::preflight(std::vector<docopt_fish::error_t, std::allocator<docopt_fish::error_t>>*)
bool preflight(error_list_t *out_errors) {
        // If we have no usage, apply the default one
        if (this->usages.empty()) {
            this->usages.push_back(usage_t::make_default());
        }

        // Extract options from the usage section
        option_list_t usage_options = collect_options(this->usages);

        // Combine these into a single list
        this->all_options.reserve(usage_options.size() + this->shortcut_options.size());
        this->all_options.insert(this->all_options.end(), usage_options.begin(),
                                 usage_options.end());
        this->all_options.insert(this->all_options.end(), this->shortcut_options.begin(),
                                 this->shortcut_options.end());
        uniqueize_options(&this->all_options, false /* do not error on duplicates */, out_errors);

        // Hackish. Consider the following usage:
         // usage: prog [options] [-a]
         // options: -a
         //
         // invoked as: prog -a -a
         //
         // Naively we would expect options to match the first -a arg, and the -a from
         // usage to match the second. But we don't. Instead, if an option appears explicitly
         // in a usage pattern, we excise it from the shortcuts.
         //
         // What Python docopt does is assert, if an option appears anywhere in any
         // usage, it may not be matched by [options]. This seems reasonable, because
         // it means that that option has more particular use cases. So remove all items
         // from shortcut_options() that appear in usage_options.
         //
         // TODO: this currently only removes the matched variant. For example,
         // prog -a --alpha
         // would still be allowed.
        auto opt_is_in_usage = [&](const option_t &shortcut_opt) {
            for (const option_t &usage_opt : usage_options) {
                if (shortcut_opt.has_same_name(usage_opt)) {
                    return true;
                }
            }
            return false;
        };

        this->shortcut_options.erase(std::remove_if(this->shortcut_options.begin(),
                                                    this->shortcut_options.end(), opt_is_in_usage),
                                     this->shortcut_options.end());

        // Example of how to dump
        if ((0)) {
            for (const usage_t &usage : this->usages) {
                errstream() << dump_usage(usage) << "\n";
            }
        }

        // Successfully preflighted
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x21030
testb $0x1, %al
jne 0xe439
jmp 0xe483
leaq -0x40(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x26d90
movq -0x108(%rbp), %rdi
movq -0x110(%rbp), %rsi
callq 0x1bf50
jmp 0xe45e
leaq -0x40(%rbp), %rdi
callq 0x1bf80
jmp 0xe483
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x1bf80
jmp 0xe72e
movq -0x108(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x27340
movq -0x128(%rbp), %rdi
movq -0x108(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x118(%rbp)
callq 0xcab0
movq -0x108(%rbp), %rdi
movq %rax, -0x120(%rbp)
addq $0x50, %rdi
callq 0xcab0
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rdi
addq %rax, %rsi
callq 0x21070
jmp 0xe4e7
movq -0x108(%rbp), %rdi
addq $0x68, %rdi
movq %rdi, -0x138(%rbp)
callq 0x1ca00
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x21220
leaq -0x68(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x1cb80
movq -0x140(%rbp), %rdi
movq %rax, -0x80(%rbp)
callq 0x1ca00
movq -0x138(%rbp), %rdi
movq %rax, -0x88(%rbp)
movq -0x70(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0x88(%rbp), %rcx
callq 0x21170
movq %rax, -0x130(%rbp)
jmp 0xe55a
movq -0x108(%rbp), %rdi
movq -0x130(%rbp), %rax
movq %rax, -0x90(%rbp)
addq $0x68, %rdi
movq %rdi, -0x150(%rbp)
callq 0x1ca00
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x21220
movq -0x108(%rbp), %rdi
addq $0x50, %rdi
movq %rdi, -0x158(%rbp)
callq 0x1cb80
movq -0x158(%rbp), %rdi
movq %rax, -0xa8(%rbp)
callq 0x1ca00
movq -0x150(%rbp), %rdi
movq %rax, -0xb0(%rbp)
movq -0x98(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq -0xb0(%rbp), %rcx
callq 0x21170
movq %rax, -0x148(%rbp)
jmp 0xe5f4
movq -0x108(%rbp), %rdi
movq -0x148(%rbp), %rax
movq %rax, -0xb8(%rbp)
addq $0x68, %rdi
movq -0x10(%rbp), %rdx
xorl %esi, %esi
callq 0xb740
jmp 0xe61a
movq -0x108(%rbp), %rdi
leaq -0x68(%rbp), %rax
movq %rax, -0xc0(%rbp)
addq $0x50, %rdi
movq %rdi, -0x168(%rbp)
callq 0x1cb80
movq -0x168(%rbp), %rdi
movq %rax, -0xd8(%rbp)
callq 0x1ca00
movq %rax, -0xe0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
callq 0x212f0
movq %rax, -0x160(%rbp)
jmp 0xe687
movq -0x160(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x21220
movq -0x108(%rbp), %rdi
addq $0x50, %rdi
callq 0x1ca00
movq %rax, -0xf8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x21220
movq -0x168(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq -0xf0(%rbp), %rdx
callq 0x21260
movq %rax, -0x170(%rbp)
jmp 0xe6f5
movq -0x170(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xcb80
movb $0x1, %al
andb $0x1, %al
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xcb80
movq -0x48(%rbp), %rdi
callq 0x85d0
nopw (%rax,%rax)