// File: 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>>>>>>&, MultiStringFactorGraph&)
int
Bigrams::cutoff(const map<string, flt_type> &unigram_stats,
                flt_type cutoff,
                transitions_t &transitions,
                MultiStringFactorGraph &msfg)
{
    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 (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
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xa160
movq -0x8(%rbp), %rdi
callq 0x1b450
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1b480
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1b290
testb $0x1, %al
jne 0x5ebff
jmp 0x5ec72
leaq -0x40(%rbp), %rdi
callq 0x1b2f0
movsd 0x20(%rax), %xmm1
movsd -0x10(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5ec62
leaq -0x40(%rbp), %rdi
callq 0x1b2f0
movq %rax, %rdi
callq 0x45e0
cmpq $0x2, %rax
jbe 0x5ec62
leaq -0x40(%rbp), %rdi
callq 0x1b2f0
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0xabb0
jmp 0x5ec46
jmp 0x5ec62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x6970
jmp 0x5ecf3
jmp 0x5ec64
leaq -0x40(%rbp), %rdi
callq 0x1b320
jmp 0x5ebdf
movq -0x18(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x5e820
jmp 0x5ec81
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq %rax, -0x60(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x5f70
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x5ecd5
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x58(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x5f90
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x2e1c0
jmp 0x5ecc8
jmp 0x5ecca
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x5ec88
leaq -0x38(%rbp), %rdi
callq 0x5f70
movl %eax, -0x6c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x6970
movl -0x6c(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x46e0
nopl (%rax)