// File: /workspace/github_cpp_makefile_star2_O1/ridiculousfish[P]docopt_fish/docopt_fish.cpp
// Function: docopt_fish::uniqueize_options(std::vector<docopt_fish::option_t, std::allocator<docopt_fish::option_t>>*, bool, std::vector<docopt_fish::error_t, std::allocator<docopt_fish::error_t>>*)
static void uniqueize_options(option_list_t *options, bool error_on_duplicates,
                              error_list_t *errors) {
    // Maintain an outer cursor. For each option, loop over the remainder,
    // deleting those that share
    // a name
    // Grab the best description as we go
    // We "delete" from the middle of the vector by moving the last element into
    // the slot, and then
    // decrementing the length
    size_t options_count = options->size();  // note this changes as we go
    for (size_t outer = 0; outer < options_count; outer++) {
        const option_t representative = options->at(outer);

        // Find all options that share a name with this representative
        // Determine which one is best
        for (size_t match_cursor = outer + 1; match_cursor < options_count; match_cursor++) {
            option_t *candidate = &options->at(match_cursor);
            if (!representative.has_same_name(*candidate)) {
                continue;
            }

            // Ok, we know that candidate has the same name as the best match
            // Generate an error if we're supposed to
            // TODO: verify agreement in the parameters, etc.
            // Then we copy the description over if it's better, then "erase" the
            // candidate
            // That will cause us to skip over it later
            if (error_on_duplicates) {
                // Generate an error, and then continue on
                append_token_error(errors, candidate->best_name(),
                                    error_option_duplicated_in_options_section,
                                    "Option specified more than once");
            }

            // "Delete" candidate by overwriting it with the last value, and
            // decrementing the count
            *candidate = std::move(options->back());
            options->pop_back();
            options_count -= 1;
            match_cursor -= 1;  // have to re-evaluate this value
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, 0x10(%rsp)
movl %esi, 0x4(%rsp)
movq 0x8(%rdi), %r13
subq (%rdi), %r13
je 0x9b95
movq %rdi, %r14
sarq $0x7, %r13
xorl %r8d, %r8d
movq (%r14), %rsi
movq 0x8(%r14), %rdx
subq %rsi, %rdx
sarq $0x7, %rdx
cmpq %r8, %rdx
jbe 0x9bb8
movq %r8, %rax
shlq $0x7, %rax
addq %rax, %rsi
movl $0x10, %ecx
leaq 0x18(%rsp), %rdi
rep  movsq (%rsi), %es:(%rdi)
incq %r8
movq %r8, %r12
movq %r8, 0x8(%rsp)
cmpq %r13, %r8
jae 0x9b87
movq (%r14), %rbp
movq 0x8(%r14), %rdx
subq %rbp, %rdx
sarq $0x7, %rdx
cmpq %r12, %rdx
jbe 0x9ba7
movq %r12, %r15
shlq $0x7, %r15
leaq (%r15,%rbp), %rbx
leaq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0xf5a2
testb %al, %al
je 0x9b3f
cmpb $0x0, 0x4(%rsp)
je 0x9b5d
leaq (%r15,%rbp), %rcx
addq $0x30, %rcx
movq $-0x4, %rax
incq %rax
je 0x9b44
cmpq $0x0, 0x8(%rcx)
cmovneq %rcx, %rsi
leaq -0x18(%rcx), %rcx
je 0x9b29
jmp 0x9b47
incq %r12
jmp 0x9b7e
movq %rbx, %rsi
movq 0x10(%rsp), %rdi
movl $0xd, %edx
leaq 0x1921e(%rip), %rcx     # 0x22d76
callq 0x7c61
movq 0x8(%r14), %rax
leaq -0x80(%rax), %rsi
movl $0xf, %ecx
movq %rbx, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl -0x8(%rax), %eax
movl %eax, 0x78(%rbx)
addq $-0x80, 0x8(%r14)
decq %r13
cmpq %r13, %r12
jb 0x9ae0
movq 0x8(%rsp), %r8
cmpq %r13, %r8
jb 0x9a9e
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19271(%rip), %rdi     # 0x22e1f
movq %r12, %rsi
xorl %eax, %eax
callq 0x7300
leaq 0x19260(%rip), %rdi     # 0x22e1f
movq %r8, %rsi
jmp 0x9bb1