// File: aalto-speech[P]ftk/src/Bigrams.cc
// Function: Bigrams::disable_transition(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&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, 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>>, 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>>, 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>>>>>>&)
flt_type
Bigrams::disable_transition(const map<string, flt_type> &unigram_stats,
                            string src,
                            string tgt,
                            transitions_t &transitions,
                            transitions_t &changes)
{
    changes.clear();

    flt_type renormalizer = sub_log_domain_probs(0, transitions[src][tgt]);
    flt_type ll_diff = 0.0;
    changes[src][tgt] = transitions[src][tgt];
    transitions[src][tgt] = SMALL_LP;

    for (auto it = transitions[src].begin(); it != transitions[src].end(); ++it) {
        if (it->first != tgt) {
            flt_type count = unigram_stats.at(src) * exp(it->second);
            changes[src][it->first] = it->second;
            ll_diff -= count * it->second;
            it->second -= renormalizer;
            ll_diff += count * it->second;
        }
    }

    return ll_diff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rsi, -0x58(%rbp)
movq %rdx, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x48490
movq -0x58(%rbp), %rsi
movq -0x20(%rbp), %rdi
callq 0x48700
movq -0x60(%rbp), %rsi
movq %rax, %rdi
callq 0x47db0
movsd (%rax), %xmm1
xorps %xmm0, %xmm0
callq 0x5f7f0
movq -0x58(%rbp), %rsi
movsd %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x20(%rbp), %rdi
callq 0x48700
movq -0x60(%rbp), %rsi
movq %rax, %rdi
callq 0x47db0
movq -0x58(%rbp), %rsi
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x28(%rbp), %rdi
callq 0x48700
movq -0x60(%rbp), %rsi
movq %rax, %rdi
callq 0x47db0
movsd -0x68(%rbp), %xmm0
movq -0x58(%rbp), %rsi
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rdi
callq 0x48700
movq -0x60(%rbp), %rsi
movq %rax, %rdi
callq 0x47db0
movq -0x58(%rbp), %rsi
movsd 0x6e2d(%rip), %xmm0     # 0x66788
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rdi
callq 0x48700
movq %rax, %rdi
callq 0x58790
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rsi
movq -0x20(%rbp), %rdi
callq 0x48700
movq %rax, %rdi
callq 0x48c90
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x48c30
testb $0x1, %al
jne 0x5f9a3
jmp 0x5fafa
leaq -0x40(%rbp), %rdi
callq 0x587c0
movq -0x60(%rbp), %rsi
movq %rax, %rdi
callq 0x24420
testb $0x1, %al
jne 0x5f9c1
jmp 0x5faea
movq -0x58(%rbp), %rsi
movq -0x8(%rbp), %rdi
callq 0x48880
movsd (%rax), %xmm0
movsd %xmm0, -0x98(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x587c0
movsd 0x20(%rax), %xmm0
callq 0x4710
movaps %xmm0, %xmm1
movsd -0x98(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x587c0
movq -0x58(%rbp), %rsi
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x28(%rbp), %rdi
callq 0x48700
movq %rax, -0x90(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x587c0
movq -0x90(%rbp), %rdi
movq %rax, %rsi
callq 0x47db0
movsd -0x88(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x587c0
movsd -0x80(%rbp), %xmm0
movsd 0x20(%rax), %xmm2
movsd -0x38(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x587c0
movsd -0x78(%rbp), %xmm1
movsd 0x20(%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x587c0
movsd -0x70(%rbp), %xmm0
movsd 0x20(%rax), %xmm2
movsd -0x38(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
jmp 0x5faec
leaq -0x40(%rbp), %rdi
callq 0x4bba0
jmp 0x5f974
movsd -0x38(%rbp), %xmm0
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)