// File: /workspace/github_cpp_makefile_star2_O2/aalto-speech[P]ftk/src/Bigrams.cc
// Function: Bigrams::cutoff(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&, double, 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::cutoff(const map<string, flt_type> &unigram_stats,
                flt_type cutoff,
                transitions_t &transitions,
                map<string, FactorGraph*> &fg_words)
{
    vector<string> to_remove;
    for (auto it = unigram_stats.begin(); it != unigram_stats.end(); ++it)
        if (it->second < cutoff && it->first.length() > 2) to_remove.push_back(it->first);

    remove_transitions(to_remove, transitions);

    for (auto fgit = fg_words.begin(); fgit != fg_words.end(); ++fgit) {
        for (unsigned int i=0; i<to_remove.size(); i++) {
            size_t found = fgit->first.find(to_remove[i]);
            if (found != std::string::npos) fgit->second->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 $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movsd %xmm0, -0x48(%rbp)
movq %rdi, %r15
leaq -0x40(%rbp), %r12
andq $0x0, 0x10(%r12)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r12)
movq 0x18(%rdi), %r13
addq $0x8, %r15
cmpq %r15, %r13
je 0x2022b
movsd -0x48(%rbp), %xmm0
ucomisd 0x40(%r13), %xmm0
jbe 0x2021e
cmpq $0x3, 0x28(%r13)
jb 0x2021e
leaq 0x20(%r13), %rsi
movq %r12, %rdi
callq 0x719e
movq %r13, %rdi
callq 0x43b0
movq %rax, %r13
jmp 0x201f9
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x200fc
movq 0x18(%rbx), %r14
addq $0x8, %rbx
cmpq %rbx, %r14
je 0x2029e
leaq 0x20(%r14), %r15
xorl %r13d, %r13d
movl %r13d, %r13d
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r13, %rax
jbe 0x20291
movq %r13, %r12
shlq $0x5, %r12
addq %r12, %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x46a0
cmpq $-0x1, %rax
je 0x2028c
movq 0x40(%r14), %rdi
addq -0x40(%rbp), %r12
movq %r12, %rsi
callq 0xe364
incl %r13d
jmp 0x2024b
movq %r14, %rdi
callq 0x4270
movq %rax, %r14
jmp 0x2023f
leaq -0x40(%rbp), %rdi
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
shrq $0x5, %rbx
callq 0x54b6
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x202c7
jmp 0x202c7
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x54b6
movq %rbx, %rdi
callq 0x45f0
nop