// File: /workspace/github_cpp_makefile_star2_O1/ridiculousfish[P]docopt_fish/docopt_matching.cpp
// Function: docopt_fish::match(docopt_fish::expression_t const&, docopt_fish::match_state_t, docopt_fish::match_context_t const&, std::vector<docopt_fish::match_state_t, std::allocator<docopt_fish::match_state_t>>*)
static void match(const expression_t &node, match_state_t state, const match_context_t &ctx,
                  match_state_list_t *resulting_states) {
    // Check to see if we have ellipsis. If so, we keep going as long as we can.
    bool has_ellipsis = node.opt_ellipsis.present;

    switch (node.production) {
        case 0: {
            // This is a simple clause which may have ellipsis, like foo...
            // If we have ellipsis, we match one time, and then construct a sequence of
            // 'intermediate state lists'.
            //  An intermediate state represents the result of matching N times. Each time
            //  we construct a new intermediate state, we append (copy) all of its states into the
            //  result; thus we may match one time, two times, three times...
            //  We stop when we get no more matches, which usually happens when we run out
            //  of positionals.
            assert(node.simple_clause.get() != nullptr);
            size_t prior_state_count = resulting_states->size();
            match(*node.simple_clause, state.move(), ctx, resulting_states);
            // Now we know that all states starting at state_count_before are newly added.
            // If we have ellipsis, go until we stop getting new states.
            if (has_ellipsis) {
                repeat_matching(*node.simple_clause, prior_state_count, ctx, resulting_states);
            }
            break;
        }

        case 1: {
            // This is a parenthesized clause which may have ellipsis, like (foo)...
            // Same algorithm as the simple clause above.
            size_t prior_state_count = resulting_states->size();
            assert(node.alternation_list.get() != nullptr);
            match(*node.alternation_list, state.move(), ctx, resulting_states);
            if (has_ellipsis) {
                repeat_matching(*node.alternation_list, prior_state_count, ctx, resulting_states);
            }
            break;
        }

        case 2: {
            // This is a square-bracketed clause which may have ellipsis, like [foo]...
            // Same algorithm as the simple clause above, except that we also append the
            // initial state as a not-taken branch.
            assert(node.alternation_list.get() != nullptr);
            resulting_states->push_back(state.copy());  // append the not-taken-branch
            size_t prior_state_count = resulting_states->size();
            match(*node.alternation_list, std::move(state), ctx, resulting_states);
            if (has_ellipsis) {
                repeat_matching(*node.alternation_list, prior_state_count, ctx, resulting_states);
            }
            break;
        }

        case 3: {
            // This is the [options] clause. It does not have ellipsis.
            assert(node.options_shortcut.present);
            if (!match_options(ctx.shortcut_options, &state, ctx)) {
                // No match, but matches are not required
                if (ctx.flags & flag_generate_suggestions) {
                    for (const option_t &opt : ctx.shortcut_options) {
                        state.suggested_next_arguments.insert(opt.best_name());
                    }
                }
            }
            resulting_states->push_back(state.move());
            break;
        }

        default:
            assert(0 && "unknown production");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movzbl 0x61(%rdi), %eax
cmpq $0x3, %rax
ja 0x14b5c
movq %rcx, %rbx
movq %rdx, %r12
movq %rdi, %r15
movb 0x58(%rdi), %bpl
leaq 0xeaff(%rip), %rcx      # 0x23140
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb %bpl, (%rsp)
movq (%r15), %r13
testq %r13, %r13
je 0x14b7b
movq 0x8(%rbx), %rbp
subq (%rbx), %rbp
leaq 0x158(%rsp), %r14
movq %r14, %rdi
callq 0x15dda
movq %r13, %rdi
movq %r14, %rsi
movq %r12, 0x30(%rsp)
movq %r12, %rdx
movq %rbx, %rcx
callq 0x14d13
leaq 0x180(%rsp), %r12
movq %r12, %rdi
callq 0xc244
movq -0x10(%r12), %rdi
testq %rdi, %rdi
je 0x146a6
callq 0x167a2
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x146b8
callq 0x167a2
cmpb $0x0, (%rsp)
je 0x14afb
sarq $0x5, %rbp
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
imulq %rax, %rbp
sarq $0x5, %rsi
imulq %rax, %rsi
cmpq %rbp, %rsi
jb 0x14bf7
jbe 0x14afb
movq (%r15), %rax
movq %rax, 0x28(%rsp)
leaq 0x10(%rsp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
subq %rbp, %rsi
movq %r14, %rdi
callq 0x1659e
movq (%rbx), %rsi
movq 0x8(%rbx), %r15
subq %rsi, %r15
sarq $0x5, %r15
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r15
cmpq %r15, %rbp
leaq 0x38(%rsp), %r14
jae 0x147b4
movq %rbp, %rax
shlq $0x5, %rax
leaq (%rax,%rax,2), %r12
addq %r12, %rsi
movq %r14, %rdi
callq 0x16bc0
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x15ec2
leaq 0x60(%rsp), %rdi
callq 0xc244
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1477d
callq 0x167a2
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1478c
callq 0x167a2
incq %rbp
movq (%rbx), %rsi
movq 0x8(%rbx), %r15
subq %rsi, %r15
sarq $0x5, %r15
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r15
addq $0x60, %r12
cmpq %r15, %rbp
jb 0x1474c
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq %rax, %rbp
je 0x148d0
movq %rbp, %rdi
callq 0x1664e
movq %rax, %r13
movq 0x8(%rbx), %r12
subq (%rbx), %r12
movq %r14, %rdi
movq %rbp, %rsi
callq 0x15dda
movq 0x28(%rsp), %rdi
movq %r14, %rsi
movq 0x30(%rsp), %rdx
movq %rbx, %rcx
callq 0x14d13
leaq 0x60(%rsp), %rdi
callq 0xc244
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x14817
callq 0x167a2
movq %rbp, (%rsp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1482a
callq 0x167a2
sarq $0x5, %r12
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r12
sarq $0x5, %rsi
imulq %rax, %rsi
cmpq %r12, %rsi
jb 0x14b3d
jbe 0x148b8
leaq (%rsi,%rsi,2), %r14
shlq $0x5, %r14
addq $-0x60, %r14
leaq -0x1(%rsi), %rbp
movq (%rbx), %rdi
movq 0x8(%rbx), %rdx
subq %rdi, %rdx
sarq $0x5, %rdx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdx
cmpq %rbp, %rdx
jbe 0x14b2c
addq %r14, %rdi
callq 0x1664e
cmpq %r13, %rax
jb 0x14b0d
jne 0x148ac
movq (%rbx), %rsi
addq %r14, %rsi
movq %rbx, %rdi
callq 0x166c0
addq $-0x60, %r14
movq %rbp, %rsi
cmpq %r12, %rbp
ja 0x14862
movq (%rsp), %rbp
addq $0x60, %rbp
cmpq 0x8(%rsp), %rbp
leaq 0x38(%rsp), %r14
jne 0x147cc
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x15daa
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x5, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq %r15, %rbp
cmpq %rsi, %r15
jb 0x146ff
jmp 0x14afb
cmpq $0x0, 0x20(%r15)
je 0x14b9a
leaq 0x38(%rsp), %r13
movq %r13, %rdi
movq %rsi, 0x8(%rsp)
callq 0x16bc0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x15ec2
leaq 0x60(%rsp), %r13
movq %r13, %rdi
callq 0xc244
movq -0x10(%r13), %rdi
testq %rdi, %rdi
je 0x1494a
callq 0x167a2
movb %bpl, (%rsp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1495d
callq 0x167a2
movq 0x8(%rbx), %r14
subq (%rbx), %r14
movq 0x20(%r15), %r13
leaq 0x98(%rsp), %rbp
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x15dda
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %r13
movq %r12, %rdx
movq %rbx, %rcx
callq 0x1415d
leaq 0xc0(%rsp), %r12
movq %r12, %rdi
callq 0xc244
movq -0x10(%r12), %rdi
testq %rdi, %rdi
movb (%rsp), %bpl
je 0x149b4
callq 0x167a2
movq 0xa0(%rsp), %rdi
jmp 0x14acb
cmpb $0x0, 0x60(%r15)
je 0x14bb9
movq 0x8(%r12), %rdi
movq %rsi, 0x8(%rsp)
movq %r12, %rdx
callq 0x153b6
testb %al, %al
jne 0x14a46
testb $0x1, 0x2(%r12)
je 0x14a46
movq 0x8(%r12), %rax
movq (%rax), %r15
movq 0x8(%rax), %r13
cmpq %r13, %r15
je 0x14a46
movq 0x8(%rsp), %rax
leaq 0x28(%rax), %r14
leaq 0x30(%r15), %rbp
movl $0x80, %r12d
xorl %eax, %eax
leaq -0x18(%rax), %rcx
cmpq $-0x60, %rcx
je 0x14a30
cmpq $0x0, 0x38(%r15,%rax)
leaq (%rbp,%rax), %rax
cmovneq %rax, %rsi
movq %rcx, %rax
je 0x14a10
jmp 0x14a33
movq %r15, %rsi
movq %r14, %rdi
callq 0xdcc4
addq %r12, %r15
addq %r12, %rbp
cmpq %r13, %r15
jne 0x14a0e
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x15ec2
movb %bpl, (%rsp)
movq 0x20(%r15), %r13
testq %r13, %r13
je 0x14bd8
movq 0x8(%rbx), %r14
subq (%rbx), %r14
leaq 0xf8(%rsp), %rbp
movq %rbp, %rdi
callq 0x15dda
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %r13
movq %r12, %rdx
movq %rbx, %rcx
callq 0x1415d
leaq 0x120(%rsp), %r12
movq %r12, %rdi
callq 0xc244
movq -0x10(%r12), %rdi
testq %rdi, %rdi
movb (%rsp), %bpl
je 0x14ac3
callq 0x167a2
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x14ad5
callq 0x167a2
testb %bpl, %bpl
je 0x14afb
sarq $0x5, %r14
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %r14, %rsi
movq 0x20(%r15), %rdi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x150d3
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xeaf0(%rip), %rdi      # 0x23604
leaq 0xe674(%rip), %rsi      # 0x2318f
leaq 0xea4b(%rip), %rcx      # 0x2356d
movl $0x148, %edx            # imm = 0x148
callq 0x7120
decq %rsi
leaq 0xe2e9(%rip), %rdi      # 0x22e1f
xorl %eax, %eax
callq 0x7300
leaq 0xea18(%rip), %rdi      # 0x2355c
leaq 0xe644(%rip), %rsi      # 0x2318f
leaq 0xea1b(%rip), %rcx      # 0x2356d
movl $0x145, %edx            # imm = 0x145
callq 0x7120
leaq 0xe813(%rip), %rdi      # 0x23376
leaq 0xe625(%rip), %rsi      # 0x2318f
leaq 0xe754(%rip), %rcx      # 0x232c5
movl $0x1fb, %edx            # imm = 0x1FB
callq 0x7120
leaq 0xe71f(%rip), %rdi      # 0x232a1
leaq 0xe606(%rip), %rsi      # 0x2318f
leaq 0xe735(%rip), %rcx      # 0x232c5
movl $0x1c6, %edx            # imm = 0x1C6
callq 0x7120
leaq 0xe790(%rip), %rdi      # 0x23331
leaq 0xe5e7(%rip), %rsi      # 0x2318f
leaq 0xe716(%rip), %rcx      # 0x232c5
movl $0x1e1, %edx            # imm = 0x1E1
callq 0x7120
leaq 0xe798(%rip), %rdi      # 0x23358
leaq 0xe5c8(%rip), %rsi      # 0x2318f
leaq 0xe6f7(%rip), %rcx      # 0x232c5
movl $0x1ed, %edx            # imm = 0x1ED
callq 0x7120
leaq 0xe752(%rip), %rdi      # 0x23331
leaq 0xe5a9(%rip), %rsi      # 0x2318f
leaq 0xe6d8(%rip), %rcx      # 0x232c5
movl $0x1d5, %edx            # imm = 0x1D5
callq 0x7120
leaq 0xe89e(%rip), %rdi      # 0x2349c
leaq 0xe58a(%rip), %rsi      # 0x2318f
leaq 0xe8c3(%rip), %rcx      # 0x234cf
movl $0x1a7, %edx            # imm = 0x1A7
callq 0x7120
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x14c45
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
jmp 0x14c45
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x14c45
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0x158a2
jmp 0x14c72
jmp 0x14c65
jmp 0x14c54
jmp 0x14c65
jmp 0x14c65
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x158a2
jmp 0x14c68
jmp 0x14c65
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x15daa
movq %rbx, %rdi
callq 0x7360