// File: /workspace/github_cpp_makefile_star2_O1/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
xorpd %xmm0, %xmm0
movapd %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq 0x18(%rdi), %r12
addq $0x8, %r15
cmpq %r15, %r12
je 0x22ad2
leaq -0x40(%rbp), %r13
movsd -0x48(%rbp), %xmm0
ucomisd 0x40(%r12), %xmm0
jbe 0x22ac2
cmpq $0x3, 0x28(%r12)
jb 0x22ac2
leaq 0x20(%r12), %rsi
movq %r13, %rdi
callq 0x7f8c
movq %r12, %rdi
callq 0x4410
movq %rax, %r12
cmpq %r15, %rax
jne 0x22a9f
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x22988
movq 0x18(%rbx), %r14
addq $0x8, %rbx
cmpq %rbx, %r14
je 0x22b59
movq -0x40(%rbp), %rax
cmpq %rax, -0x38(%rbp)
je 0x22b49
leaq 0x20(%r14), %r15
movl $0x1, %r13d
xorl %r12d, %r12d
shlq $0x5, %r12
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0x4630
cmpq $-0x1, %rax
je 0x22b2f
movq 0x40(%r14), %rdi
addq -0x40(%rbp), %r12
movq %r12, %rsi
callq 0xf9ca
movl %r13d, %r12d
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
incl %r13d
cmpq %r12, %rcx
ja 0x22b02
movq %r14, %rdi
callq 0x4280
movq %rax, %r14
cmpq %rbx, %rax
jne 0x22aeb
leaq -0x40(%rbp), %rdi
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
shrq $0x5, %rbx
callq 0x5d54
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x22b82
jmp 0x22b82
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x5d54
movq %rbx, %rdi
callq 0x4650