// File: /workspace/github_cpp_makefile_star2_O1/aalto-speech[P]ftk/src/EM.cc
// Function: forward(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, MultiStringFactorGraph const&, std::map<unsigned int, double, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, double>>>&)
flt_type
forward(const string &text,
        const MultiStringFactorGraph &msfg,
        map<msfg_node_idx_t, flt_type> &fw)
{
    map<msfg_node_idx_t, vector<MultiStringFactorGraph::Arc*> > arcs;
    msfg.collect_arcs(text, arcs);

    for (auto ndit = arcs.begin(); ndit != arcs.end(); ++ndit) {

        const MultiStringFactorGraph::Node &node = msfg.nodes[ndit->first];
        for (auto arc = node.outgoing.begin(); arc != node.outgoing.end(); ++arc) {
            int tgt_node = (**arc).target_node;
            flt_type cost = fw[ndit->first] + *(**arc).cost;
            if (fw.find(tgt_node) == fw.end()) fw[tgt_node] = cost;
            else fw[tgt_node] = add_log_domain_probs(fw[tgt_node], cost);
        }
    }

    return fw.at(msfg.string_end_nodes.at(text));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movq %rsi, %rcx
movq %rdi, %rsi
leaq -0xb8(%rbp), %r14
movl $0x0, (%r14)
xorl %eax, %eax
movq %rax, 0x8(%r14)
movq %r14, 0x10(%r14)
movq %r14, 0x18(%r14)
movq %rax, 0x20(%r14)
leaq -0xc0(%rbp), %rdx
movq %rcx, -0x48(%rbp)
movq %rcx, %rdi
movq %rsi, -0x58(%rbp)
callq 0x12f6e
movq -0xa8(%rbp), %rcx
cmpq %r14, %rcx
je 0x197c1
leaq 0x8(%rbx), %r12
movq %rcx, -0x50(%rbp)
movl 0x20(%rcx), %eax
movq -0x48(%rbp), %rcx
movq 0x20(%rcx), %rcx
shlq $0x7, %rax
leaq (%rcx,%rax), %r13
addq $0x58, %r13
movq 0x10(%r13), %r15
cmpq %r13, %r15
je 0x197a5
movq -0x50(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x60(%rbp)
movq 0x20(%r15), %rax
movl 0x4(%rax), %r14d
movq %rbx, %rdi
movq -0x60(%rbp), %rsi
callq 0x1b6aa
movq 0x10(%rbx), %rdx
movq %r12, %rcx
testq %rdx, %rdx
je 0x196c0
movq %r12, %rcx
xorl %esi, %esi
cmpl %r14d, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x196a8
movq %r12, %rdx
cmpq %r12, %rcx
je 0x196d3
cmpl 0x20(%rcx), %r14d
cmovbq %r12, %rcx
movq %rcx, %rdx
movsd (%rax), %xmm0
movq 0x20(%r15), %rax
movq 0x8(%rax), %rax
addsd (%rax), %xmm0
movapd %xmm0, -0x40(%rbp)
cmpq %r12, %rdx
je 0x19778
movl %r14d, -0x2c(%rbp)
movq %rbx, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x1b712
movsd (%rax), %xmm0
movapd %xmm0, -0x90(%rbp)
movapd %xmm0, %xmm1
subsd -0x40(%rbp), %xmm1
movapd %xmm1, %xmm0
xorpd 0xd0fe(%rip), %xmm0     # 0x26820
movapd %xmm1, -0x80(%rbp)
minsd %xmm1, %xmm0
callq 0x4660
callq 0x46e0
movsd %xmm0, -0x68(%rbp)
movl %r14d, -0x30(%rbp)
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x1b712
xorpd %xmm0, %xmm0
cmpltsd -0x80(%rbp), %xmm0
movapd -0x90(%rbp), %xmm1
andpd %xmm0, %xmm1
andnpd -0x40(%rbp), %xmm0
orpd %xmm1, %xmm0
movsd -0x68(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rax)
jmp 0x19791
movl %r14d, -0x2c(%rbp)
movq %rbx, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x1b712
movapd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %r15, %rdi
callq 0x4410
movq %rax, %r15
cmpq %r13, %rax
jne 0x19685
movq -0x50(%rbp), %rdi
callq 0x4280
movq %rax, %rcx
leaq -0xb8(%rbp), %rax
cmpq %rax, %rcx
jne 0x19651
movq -0x48(%rbp), %rdi
addq $0x38, %rdi
movq -0x58(%rbp), %rsi
callq 0x139bc
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1b77a
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x1ba92
movsd -0x40(%rbp), %xmm0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19811
jmp 0x19811
jmp 0x19811
jmp 0x19811
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x1ba92
movq %rbx, %rdi
callq 0x4650