// File: /workspace/github_cpp_makefile_star2_O3/aalto-speech[P]ftk/src/Bigrams.cc
// Function: Bigrams::remove_least_common(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, double>>> const&, unsigned int, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, double>>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, double>>>>>>&, MultiStringFactorGraph&)
int
Bigrams::remove_least_common(const map<string, flt_type> &unigram_stats,
                             unsigned int num_removals,
                             transitions_t &transitions,
                             MultiStringFactorGraph &msfg)
{
    vector<pair<string, flt_type> > sorted_stats;
    Unigrams::sort_vocab(unigram_stats, sorted_stats, false);
    vector<string> to_remove;
    for (auto it = sorted_stats.begin(); it != sorted_stats.end(); ++it) {
        if (it->first.length() < 3) continue;
        to_remove.push_back(it->first);
        if (to_remove.size() >= num_removals) break;
    }

    remove_transitions(to_remove, transitions);

    for (unsigned int i=0; i<to_remove.size(); i++)
        msfg.remove_arcs(to_remove[i]);

    return to_remove.size();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %r12d
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
xorl %edx, %edx
callq 0x1dc30
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x60(%rbp), %r15
movq -0x58(%rbp), %rax
cmpq %rax, %r15
je 0x22ccc
movl %r12d, %r13d
leaq -0x40(%rbp), %r12
cmpq $0x3, 0x8(%r15)
jae 0x22ca6
addq $0x28, %r15
cmpq %rax, %r15
jne 0x22c94
jmp 0x22ccc
movq %r12, %rdi
movq %r15, %rsi
callq 0x7f60
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
sarq $0x5, %rax
cmpq %r13, %rax
jae 0x22ccc
addq $0x28, %r15
movq -0x58(%rbp), %rax
jmp 0x22c9f
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x227ac
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r14
subq %rax, %r14
je 0x22d18
movl $0x1, %r15d
xorl %esi, %esi
shlq $0x5, %rsi
addq %rax, %rsi
movq %rbx, %rdi
callq 0x121ee
movl %r15d, %esi
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r14
subq %rax, %r14
sarq $0x5, %r14
incl %r15d
cmpq %rsi, %r14
ja 0x22ced
jmp 0x22d1c
sarq $0x5, %r14
leaq -0x40(%rbp), %rdi
callq 0x5d4e
leaq -0x60(%rbp), %rdi
callq 0x1fbf4
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x22d49
jmp 0x22d49
movq %rax, %rbx
jmp 0x22d55
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x5d4e
leaq -0x60(%rbp), %rdi
callq 0x1fbf4
movq %rbx, %rdi
callq 0x4650