// File: /workspace/github_cpp_makefile_star2_O1/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 $0x28, %rsp
movapd %xmm0, -0x50(%rbp)
movq %rdi, %rbx
movq 0x18(%rdi), %r14
addq $0x8, %rbx
cmpq %rbx, %r14
je 0x2198c
movabsq $0x7ff0000000000000, %r12 # imm = 0x7FF0000000000000
movq 0x58(%r14), %r15
leaq 0x48(%r14), %r13
movsd 0x4fe4(%rip), %xmm0     # 0x26810
movapd %xmm0, -0x40(%rbp)
cmpq %r13, %r15
je 0x21908
movsd 0x4fce(%rip), %xmm0     # 0x26810
movaps %xmm0, -0x40(%rbp)
movq 0x40(%r15), %xmm0
callq 0x42f0
movq %xmm0, %rax
btrq $0x3f, %rax
movdqa -0x50(%rbp), %xmm2
movdqa %xmm2, %xmm1
cmpq %r12, %rax
movdqa %xmm2, %xmm4
je 0x21871
movdqa %xmm0, %xmm1
movdqa %xmm0, %xmm2
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(%r15)
movapd -0x40(%rbp), %xmm3
movapd %xmm3, %xmm2
subsd %xmm0, %xmm2
movapd %xmm2, %xmm1
xorpd 0x4f62(%rip), %xmm1     # 0x26820
movapd %xmm1, %xmm4
cmpltsd %xmm2, %xmm4
andpd %xmm4, %xmm3
andnpd %xmm0, %xmm4
orpd %xmm3, %xmm4
movapd %xmm4, -0x40(%rbp)
minsd %xmm2, %xmm1
movapd %xmm1, %xmm0
callq 0x4660
callq 0x46e0
addsd -0x40(%rbp), %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r15, %rdi
callq 0x4280
movq %rax, %r15
cmpq %r13, %rax
jne 0x21846
movq 0x58(%r14), %rax
cmpq %r13, %rax
je 0x21978
movsd 0x40(%rax), %xmm0
subsd -0x40(%rbp), %xmm0
movq %xmm0, %rcx
btrq $0x3f, %rcx
movapd -0x50(%rbp), %xmm2
movapd %xmm2, %xmm1
cmpq %r12, %rcx
movapd %xmm2, %xmm4
je 0x2193b
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
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 0x4280
jmp 0x2190c
movq %r14, %rdi
callq 0x4280
movq %rax, %r14
cmpq %rbx, %rax
jne 0x2181c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop