// File: ridiculousfish[P]docopt_fish/docopt_matching.cpp
// Function: void docopt_fish::repeat_matching<docopt_fish::simple_clause_t>(docopt_fish::simple_clause_t const&, unsigned long, docopt_fish::match_context_t const&, std::vector<docopt_fish::match_state_t, std::allocator<docopt_fish::match_state_t>>*)
static void repeat_matching(const Node &node, size_t init_prior_state_count, const match_context_t &ctx,
                            match_state_list_t *resulting_states) {
    assert(resulting_states->size() >= init_prior_state_count);
    // Get the number of existing states
    // Keep going until we stop getting new states
    size_t prior_state_count = init_prior_state_count;
    while (prior_state_count < resulting_states->size()) {
        // Get a vector of intermediate states
        match_state_list_t intermediate_states;
        intermediate_states.reserve(resulting_states->size() - prior_state_count);
        for (size_t i = prior_state_count; i < resulting_states->size(); i++) {
            intermediate_states.push_back(resulting_states->at(i).copy());
        }
        prior_state_count = resulting_states->size();
        match_list(node, std::move(intermediate_states), ctx, resulting_states, true /* require progress */);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x33300
cmpq -0x10(%rbp), %rax
jb 0x30fdc
jmp 0x30ffb
leaq 0x1b55d(%rip), %rdi     # 0x4c540
leaq 0x1b249(%rip), %rsi     # 0x4c233
movl $0x1a7, %edx            # imm = 0x1A7
leaq 0x1b57d(%rip), %rcx     # 0x4c573
callq 0x81e0
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x33300
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq %rcx, %rax
jae 0x31148
leaq -0x40(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x32070
movq -0x20(%rbp), %rdi
callq 0x33300
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
movq -0x28(%rbp), %rax
subq %rax, %rsi
callq 0x351f0
jmp 0x3105b
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x33300
movq %rax, %rcx
movq -0xd0(%rbp), %rax
cmpq %rcx, %rax
jae 0x31105
movq -0x20(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x352f0
movq %rax, -0xd8(%rbp)
jmp 0x3109c
movq -0xd8(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x32ab0
jmp 0x310b1
leaq -0x40(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x32d70
jmp 0x310c3
leaq -0xb8(%rbp), %rdi
callq 0x321f0
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x31063
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3113d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x321f0
jmp 0x3113d
movq -0x20(%rbp), %rdi
callq 0x33300
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq -0x40(%rbp), %rsi
movl $0x1, %r8d
callq 0x31b70
jmp 0x3112f
leaq -0x40(%rbp), %rdi
callq 0x32990
jmp 0x31003
leaq -0x40(%rbp), %rdi
callq 0x32990
jmp 0x31151
addq $0xe0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x85d0
nopw (%rax,%rax)