// File: /workspace/github_cpp_makefile_star2_O3/nilnilnil[P]autocomplete/./include/suggest.hpp
// Function: naive_suggest(PhraseMap&, SegmentTree&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int)
vp_t
naive_suggest(PhraseMap& pm, RMQ& st, std::string prefix, uint_t n = 16) {
    pvpi_t phrases = pm.query(prefix);
    std::vector<uint_t> indexes;
    vp_t ret;

    while (phrases.first != phrases.second) {
        indexes.push_back(phrases.first - pm.repr.begin());
        ++phrases.first;
    }

    while (ret.size() < n && !indexes.empty()) {
        uint_t mi = 0;
        for (size_t i = 1; i < indexes.size(); ++i) {
            if (pm.repr[indexes[i]].weight > pm.repr[indexes[mi]].weight) {
                mi = i;
            }
        }
        ret.push_back(pm.repr[indexes[mi]]);
        indexes.erase(indexes.begin() + mi);
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movq %rcx, %rdx
callq 0xcb69
movq %rax, %r13
xorl %eax, %eax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq %rax, 0x10(%rbx)
movups %xmm0, (%rbx)
movabsq $0x6db6db6db6db6db7, %rbp # imm = 0x6DB6DB6DB6DB6DB7
cmpq %rdx, %r13
je 0x71f3
movq %rdx, %r12
movl %r15d, 0x20(%rsp)
leaq 0x24(%rsp), %rbp
movq %r13, %r15
movq %r13, %rax
subq (%r14), %rax
shrq $0x3, %rax
imull $0xb6db6db7, %eax, %eax # imm = 0xB6DB6DB7
movl %eax, 0x24(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x71bd
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x71c8
movq %rsp, %rdi
movq %rbp, %rdx
callq 0xdf54
addq $0x38, %r15
addq $0x38, %r13
cmpq %r12, %r15
jne 0x7190
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rbp # imm = 0x6DB6DB6DB6DB6DB7
imulq %rbp, %rax
movl 0x20(%rsp), %r15d
movl %r15d, %r15d
cmpq %r15, %rax
jae 0x72b9
movq 0x8(%rsp), %rdx
movq (%rsp), %rdi
cmpq %rdx, %rdi
je 0x72bd
subq %rdi, %rdx
sarq $0x2, %rdx
movq (%r14), %rsi
cmpq $0x2, %rdx
jb 0x725b
xorl %ecx, %ecx
movl $0x1, %eax
movl (%rdi,%rax,4), %r8d
imulq $0x38, %r8, %r8
movl (%rsi,%r8), %r9d
movl %ecx, %r8d
movl (%rdi,%r8,4), %r8d
imulq $0x38, %r8, %r10
movl %eax, %r8d
cmpl (%rsi,%r10), %r9d
ja 0x724b
movl %ecx, %r8d
incq %rax
movl %r8d, %ecx
cmpq %rax, %rdx
jne 0x7228
movl %r8d, %r12d
jmp 0x725e
xorl %r12d, %r12d
movl (%rdi,%r12,4), %eax
imulq $0x38, %rax, %rax
addq %rax, %rsi
movq %rbx, %rdi
callq 0xc11c
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
leaq (%rax,%r12,4), %rsi
addq $0x4, %rsi
cmpq %rdx, %rsi
je 0x7298
leaq (%rax,%r12,4), %rdi
subq %rsi, %rdx
callq 0x5870
movq 0x8(%rsp), %rdx
addq $-0x4, %rdx
movq 0x8(%rbx), %rax
subq (%rbx), %rax
movq %rdx, 0x8(%rsp)
sarq $0x3, %rax
imulq %rbp, %rax
cmpq %r15, %rax
jb 0x7204
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x72cf
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x54c0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x72e3
movq %rax, %r14
movq %rbx, %rdi
callq 0xc17a
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x7304
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x54c0
movq %r14, %rdi
callq 0x58e0