// File: /workspace/github_cpp_makefile_star2_O2/aalto-speech[P]ftk/src/Bigrams.cc
// Function: Bigrams::freqs_to_logprobs(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>>>>>>&, double)
void
Bigrams::freqs_to_logprobs(transitions_t &trans_stats,
                           flt_type min_lp)
{
    for (auto srcit = trans_stats.begin(); srcit != trans_stats.end(); ++srcit) {
        flt_type normalizer = SMALL_LP;
        for (auto tgtit = srcit->second.begin(); tgtit != srcit->second.end(); ++tgtit) {
            tgtit->second = log(tgtit->second);
            if (tgtit->second < min_lp || std::isinf(tgtit->second) || std::isnan(tgtit->second))
                tgtit->second = min_lp;
            normalizer = add_log_domain_probs(normalizer, tgtit->second);
        }

        for (auto tgtit = srcit->second.begin(); tgtit != srcit->second.end(); ++tgtit) {
            tgtit->second -= normalizer;
            if (tgtit->second < min_lp || std::isinf(tgtit->second) || std::isnan(tgtit->second))
                tgtit->second = min_lp;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movapd %xmm0, -0x40(%rbp)
movq %rdi, %rbx
movq 0x18(%rdi), %r14
addq $0x8, %rbx
movabsq $0x7ff0000000000000, %r12 # imm = 0x7FF0000000000000
cmpq %rbx, %r14
je 0x1f2e6
movq 0x58(%r14), %r15
leaq 0x48(%r14), %r13
movsd 0x45c0(%rip), %xmm0     # 0x237a0
movsd %xmm0, -0x30(%rbp)
cmpq %r13, %r15
je 0x1f269
movq 0x40(%r15), %xmm0
callq 0x42e0
movdqa %xmm0, %xmm1
movq %xmm0, %rax
btrq $0x3f, %rax
movdqa -0x40(%rbp), %xmm0
cmpq %r12, %rax
je 0x1f211
movdqa %xmm1, %xmm0
movdqa %xmm1, %xmm2
movapd -0x40(%rbp), %xmm4
cmpltsd %xmm4, %xmm2
movapd %xmm2, %xmm3
andnpd %xmm0, %xmm3
andpd %xmm4, %xmm2
orpd %xmm3, %xmm2
cmpunordsd %xmm1, %xmm1
movapd %xmm1, %xmm0
andnpd %xmm2, %xmm0
andpd %xmm4, %xmm1
orpd %xmm0, %xmm1
movlpd %xmm1, 0x40(%r15)
movsd -0x30(%rbp), %xmm0
callq 0x1fbdb
movsd %xmm0, -0x30(%rbp)
movq %r15, %rdi
callq 0x4270
movq %rax, %r15
jmp 0x1f1e5
movq 0x58(%r14), %rax
cmpq %r13, %rax
je 0x1f2d6
movsd 0x40(%rax), %xmm0
subsd -0x30(%rbp), %xmm0
movq %xmm0, %rcx
btrq $0x3f, %rcx
movapd -0x40(%rbp), %xmm1
cmpq %r12, %rcx
je 0x1f294
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
movapd -0x40(%rbp), %xmm4
cmpltsd %xmm4, %xmm2
movapd %xmm2, %xmm3
andnpd %xmm1, %xmm3
andpd %xmm4, %xmm2
orpd %xmm3, %xmm2
cmpunordsd %xmm0, %xmm0
movapd %xmm0, %xmm1
andnpd %xmm2, %xmm1
andpd %xmm4, %xmm0
orpd %xmm1, %xmm0
movlpd %xmm0, 0x40(%rax)
movq %rax, %rdi
callq 0x4270
jmp 0x1f26d
movq %r14, %rdi
callq 0x4270
movq %rax, %r14
jmp 0x1f1c7
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop