// File: /workspace/github_cpp_makefile_star2_O1/aalto-speech[P]ftk/src/EM.cc
// Function: forward(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&, MultiStringFactorGraph const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, bool)
flt_type
forward(const map<string, flt_type> &words,
        const MultiStringFactorGraph &msfg,
        const set<string> &words_to_fb,
        bool full_forward_pass)
{
    flt_type total_lp = 0.0;

    if (full_forward_pass) {
        vector<flt_type> fw;
        forward(msfg, fw);
        for (auto wit = words_to_fb.cbegin(); wit != words_to_fb.cend(); ++wit)
            total_lp += words.at(*wit) * fw.at(msfg.string_end_nodes.at(*wit));
    }
    else {
        for (auto wit = words_to_fb.cbegin(); wit != words_to_fb.cend(); ++wit) {
            map<msfg_node_idx_t, flt_type> fw;
            total_lp += words.at(*wit) * forward(*wit, msfg, fw);
        }
    }

    return total_lp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x198ef
xorpd %xmm0, %xmm0
leaq -0x70(%rbp), %rsi
movapd %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq %r14, %rdi
callq 0x194cc
movq 0x18(%rbx), %r12
addq $0x8, %rbx
cmpq %rbx, %r12
je 0x19987
addq $0x38, %r14
xorpd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
leaq 0x20(%r12), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x1b4d8
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x139bc
movl (%rax), %esi
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0x199bd
movsd -0x38(%rbp), %xmm1
mulsd (%rax,%rsi,8), %xmm1
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r12, %rdi
callq 0x4410
movq %rax, %r12
cmpq %rbx, %rax
jne 0x19884
jmp 0x19990
movq 0x18(%rbx), %r12
addq $0x8, %rbx
cmpq %rbx, %r12
je 0x199a0
movq %r15, -0x78(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
leaq -0x70(%rbp), %r13
movl $0x0, -0x68(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x60(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x58(%rbp)
movq %rax, -0x50(%rbp)
movq %rcx, -0x48(%rbp)
leaq 0x20(%r12), %r15
movq -0x78(%rbp), %rdi
movq %r15, %rsi
callq 0x1b4d8
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x195e9
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r13, %rdi
callq 0x1baf8
movq %r12, %rdi
callq 0x4410
movq %rax, %r12
cmpq %rbx, %rax
jne 0x19911
jmp 0x199a9
xorpd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x199a9
callq 0x4350
jmp 0x199a9
xorpd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xce92(%rip), %rdi      # 0x26856
xorl %eax, %eax
callq 0x4530
jmp 0x199cd
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x199ec
callq 0x4350
jmp 0x199ec
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x1baf8
movq %rbx, %rdi
callq 0x4650