// 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>>>>>>&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, FactorGraph*, 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, FactorGraph*>>>&)
int
Bigrams::remove_least_common(const map<string, flt_type> &unigram_stats,
                             unsigned int num_removals,
                             transitions_t &transitions,
                             map<string, FactorGraph*> &fg_words)
{
    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 (auto fgit = fg_words.begin(); fgit != fg_words.end(); ++fgit) {
        for (unsigned int i=0; i<num_removals; i++) {
            size_t found = fgit->first.find(sorted_stats[i].first);
            if (found != std::string::npos) fgit->second->remove_arcs(sorted_stats[i].first);
        }
    }

    return to_remove.size();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, -0x30(%rbp)
movq %rdx, %r15
movl %esi, %r14d
xorps %xmm0, %xmm0
leaq -0x70(%rbp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
xorl %edx, %edx
callq 0x1dc30
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x70(%rbp), %r12
movq -0x68(%rbp), %rax
movl %r14d, %r13d
cmpq %rax, %r12
je 0x22b67
leaq -0x50(%rbp), %rdi
cmpq $0x3, 0x8(%r12)
jae 0x22b3e
addq $0x28, %r12
cmpq %rax, %r12
jne 0x22b2b
jmp 0x22b67
movq %rdi, %rbx
movq %r12, %rsi
callq 0x7f60
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x5, %rax
cmpq %r13, %rax
jae 0x22b67
movq %rbx, %rdi
addq $0x28, %r12
movq -0x68(%rbp), %rax
jmp 0x22b37
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x227ac
movq -0x30(%rbp), %rbx
movq 0x18(%rbx), %r15
addq $0x8, %rbx
movq %rbx, -0x30(%rbp)
cmpq %rbx, %r15
je 0x22bea
shlq $0x3, %r13
leaq (%r13,%r13,4), %r13
movl %r14d, %ebx
testl %r14d, %r14d
je 0x22bd6
leaq 0x20(%r15), %r12
xorl %r14d, %r14d
movq -0x70(%rbp), %rax
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rcx
movq %r12, %rdi
xorl %edx, %edx
callq 0x4630
cmpq $-0x1, %rax
je 0x22bcd
movq 0x40(%r15), %rdi
movq -0x70(%rbp), %rsi
addq %r14, %rsi
callq 0xf898
addq $0x28, %r14
cmpq %r14, %r13
jne 0x22ba0
movq %r15, %rdi
callq 0x4280
movq %rax, %r15
cmpq -0x30(%rbp), %rax
movl %ebx, %r14d
jne 0x22b91
leaq -0x50(%rbp), %rdi
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
shrq $0x5, %rbx
callq 0x5d4e
leaq -0x70(%rbp), %rdi
callq 0x1fbf4
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x22c21
jmp 0x22c21
movq %rax, %rbx
jmp 0x22c2d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x5d4e
leaq -0x70(%rbp), %rdi
callq 0x1fbf4
movq %rbx, %rdi
callq 0x4650