// File: /workspace/github_cpp_makefile_star2_O3/aalto-speech[P]ftk/src/Bigrams.cc
// Function: Bigrams::disable_string(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>>>>>> const&, 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>>> const&, 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_string(const transitions_t &reverse_transitions,
                        const string &text,
                        const map<string, flt_type> &unigram_stats,
                        transitions_t &transitions,
                        transitions_t &changes)
{
    changes.clear();
    flt_type total_ll_diff = 0.0;

    for (auto it = transitions[text].begin(); it != transitions[text].begin(); ++it) {
        changes[text][it->first] = it->second;
        it->second = SMALL_LP;
    }

    for (auto contit = reverse_transitions.at(text).begin(); contit != reverse_transitions.at(text).end(); ++contit) {

        changes[contit->first][text] = transitions[contit->first][text];
        flt_type renormalizer = sub_log_domain_probs(0, transitions[contit->first][text]);
        flt_type ll_diff = 0.0;

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

        changes[contit->first][text] = transitions[contit->first][text];
        transitions[contit->first][text] = SMALL_LP;

        total_ll_diff += ll_diff;
    }

    return total_ll_diff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r13
movq %rcx, %r14
movq %rdx, -0x60(%rbp)
movq %rsi, %r12
movq %rdi, -0x50(%rbp)
movq %r8, %rdi
callq 0x1c43c
movq %r14, %rdi
movq %r12, %rsi
callq 0x1b318
movq 0x18(%rax), %rbx
movq %r14, %rdi
movq %r12, %rsi
callq 0x1b318
cmpq 0x18(%rax), %rbx
je 0x22f3e
leaq 0x20(%rbx), %r15
movsd 0x40(%rbx), %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r13, %rdi
movq %r12, %rsi
callq 0x1b318
movq %rax, %rdi
movq %r15, %rsi
callq 0x1af86
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movabsq $-0x3fa7000000000000, %rax # imm = 0xC059000000000000
movq %rax, 0x40(%rbx)
movq %rbx, %rdi
callq 0x4280
movq %rax, %rbx
jmp 0x22ee5
movq %r13, -0x40(%rbp)
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1b398
movq 0x18(%rax), %r15
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1b398
addq $0x8, %rax
xorpd %xmm0, %xmm0
cmpq %rax, %r15
je 0x2318c
movsd %xmm0, -0x38(%rbp)
movq -0x40(%rbp), %rbx
movq %r15, -0x58(%rbp)
leaq 0x20(%r15), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b318
movq %rax, %rdi
movq %r12, %rsi
callq 0x1af86
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1b318
movq %rax, %rdi
movq %r12, %rsi
callq 0x1af86
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b318
movq %rax, %rdi
movq %r12, %rsi
callq 0x1af86
movsd (%rax), %xmm0
callq 0x231a5
movsd %xmm0, -0x68(%rbp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b318
movq 0x18(%rax), %r15
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b318
addq $0x8, %rax
xorpd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
cmpq %rax, %r15
je 0x230f1
movsd %xmm0, -0x30(%rbp)
leaq 0x20(%r15), %rbx
movq 0x28(%r15), %rdx
cmpq 0x8(%r12), %rdx
jne 0x23045
testq %rdx, %rdx
je 0x230ce
movq (%r12), %rsi
movq (%rbx), %rdi
callq 0x43a0
testl %eax, %eax
je 0x230ce
movq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x1b3f6
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0x40(%r15), %xmm0
callq 0x4660
mulsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd 0x40(%r15), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x40(%rbp), %rdi
movq %r13, %rsi
callq 0x1b318
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1af86
movsd -0x70(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd 0x40(%r15), %xmm0
movsd -0x48(%rbp), %xmm3
movapd %xmm3, %xmm1
mulsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm2
subsd %xmm1, %xmm2
subsd -0x68(%rbp), %xmm0
movsd %xmm0, 0x40(%r15)
mulsd %xmm3, %xmm0
addsd %xmm0, %xmm2
movsd %xmm2, -0x30(%rbp)
movq %r15, %rdi
callq 0x4280
movq %rax, %r15
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b318
addq $0x8, %rax
cmpq %rax, %r15
jne 0x23019
movsd -0x38(%rbp), %xmm0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b318
movq %rax, %rdi
movq %r12, %rsi
callq 0x1af86
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1b318
movq %rax, %rdi
movq %r12, %rsi
callq 0x1af86
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b318
movq %rax, %rdi
movq %r12, %rsi
callq 0x1af86
movabsq $-0x3fa7000000000000, %rcx # imm = 0xC059000000000000
movq %rcx, (%rax)
movq -0x58(%rbp), %rdi
callq 0x4410
movq %rax, %r15
movq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0x1b398
addq $0x8, %rax
cmpq %rax, %r15
jne 0x22f7a
jmp 0x23191
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq