// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, -0x48(%rbp)
movq %r8, %rdi
callq 0x1a3dc
movq %r14, %rdi
movq %r12, %rsi
callq 0x19048
movq %rax, %rdi
movq %r15, %rsi
callq 0x18d90
movsd (%rax), %xmm0
callq 0x209c4
movsd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x19048
movq %rax, %rdi
movq %r15, %rsi
callq 0x18d90
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq %rbx, -0x50(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x19048
movq %rax, %rdi
movq %r15, %rsi
callq 0x18d90
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %r14, %rdi
movq %r12, %rsi
callq 0x19048
movq %rax, %rdi
movq %r15, %rsi
callq 0x18d90
movabsq $-0x3fa7000000000000, %rcx # imm = 0xC059000000000000
movq %rcx, (%rax)
movq %r14, %rdi
movq %r12, %rsi
callq 0x19048
movq 0x18(%rax), %r13
xorpd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x19048
addq $0x8, %rax
cmpq %rax, %r13
je 0x20ba8
leaq 0x20(%r13), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xea17
testb %al, %al
je 0x20b98
movq -0x48(%rbp), %rdi
movq %r12, %rsi
callq 0x19102
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x40(%r13), %xmm0
callq 0x4600
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd 0x40(%r13), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0x19048
movq %rax, %rdi
movq %rbx, %rsi
callq 0x18d90
movsd -0x58(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd 0x40(%r13), %xmm0
movsd -0x38(%rbp), %xmm3
movapd %xmm3, %xmm1
mulsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm2
subsd %xmm1, %xmm2
subsd -0x40(%rbp), %xmm0
movsd %xmm0, 0x40(%r13)
mulsd %xmm3, %xmm0
addsd %xmm0, %xmm2
movsd %xmm2, -0x30(%rbp)
movq %r13, %rdi
callq 0x4270
movq %rax, %r13
jmp 0x20ae0
movsd -0x30(%rbp), %xmm0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq