// File: /workspace/github_cpp_makefile_star2_O2/aalto-speech[P]ftk/src/EM.cc
// Function: likelihood_fb(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, MultiStringFactorGraph const&)
flt_type
likelihood_fb(const string &text,
              const MultiStringFactorGraph &msfg)
{
    map<msfg_node_idx_t, flt_type> fw;
    int text_end_node = msfg.string_end_nodes.at(text);
    set<int> nodes_to_process; nodes_to_process.insert(text_end_node);
    fw[text_end_node] = 0.0;

    while(nodes_to_process.size() > 0) {

        int i = *(nodes_to_process.rbegin());

        const MultiStringFactorGraph::Node &node = msfg.nodes[i];

        for (auto arc = node.incoming.begin(); arc != node.incoming.end(); ++arc) {
            int src_node = (**arc).source_node;
            flt_type cost = fw[i] + *(**arc).cost;
            if (fw.find(src_node) == fw.end()) fw[src_node] = cost;
            else fw[src_node] = add_log_domain_probs(fw[src_node], cost);
            nodes_to_process.insert(src_node);
        }

        nodes_to_process.erase(i);
    }

    return fw.at(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
leaq -0xa8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rdi, %rcx
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %rsi, -0x50(%rbp)
leaq 0x38(%rsi), %rdi
movq %rcx, %rsi
callq 0x11d8e
movl (%rax), %eax
leaq -0x48(%rbp), %rsi
movl %eax, (%rsi)
leaq -0x78(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0x80(%rbp), %rdi
callq 0x1af16
movl -0x48(%rbp), %eax
leaq -0x34(%rbp), %rsi
movl %eax, (%rsi)
leaq -0xb0(%rbp), %rdi
callq 0x192e6
andq $0x0, (%rax)
leaq -0x80(%rbp), %r15
leaq -0xb0(%rbp), %r13
leaq -0x30(%rbp), %r14
cmpq $0x0, -0x58(%rbp)
je 0x17cb9
leaq -0x78(%rbp), %rdi
callq 0x4210
movslq 0x20(%rax), %rax
movl %eax, -0x34(%rbp)
movq -0x50(%rbp), %rcx
movq 0x20(%rcx), %rcx
shlq $0x7, %rax
leaq (%rcx,%rax), %r12
addq $0x28, %r12
movq 0x10(%r12), %rbx
cmpq %r12, %rbx
je 0x17ca8
movq 0x20(%rbx), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x30(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x192e6
movsd (%rax), %xmm0
movq 0x20(%rbx), %rax
movq 0x8(%rax), %rax
addsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x1ae0e
leaq -0xa8(%rbp), %rcx
cmpq %rcx, %rax
je 0x17c72
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x192e6
movsd (%rax), %xmm0
movsd -0x40(%rbp), %xmm1
callq 0x15a53
movsd %xmm0, -0x40(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x44(%rbp)
movq %r13, %rdi
leaq -0x44(%rbp), %rsi
callq 0x192e6
jmp 0x17c83
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x192e6
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %r15, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x1af16
movq %rbx, %rdi
callq 0x43b0
movq %rax, %rbx
jmp 0x17be5
movq %r15, %rdi
leaq -0x34(%rbp), %rsi
callq 0x1b0a6
jmp 0x17bb1
leaq -0x34(%rbp), %rsi
andl $0x0, (%rsi)
leaq -0xb0(%rbp), %rdi
callq 0x19338
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x196aa
leaq -0xb0(%rbp), %rdi
callq 0x19654
movsd -0x40(%rbp), %xmm0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17d18
jmp 0x17d18
jmp 0x17d18
movq %rax, %rbx
jmp 0x17d24
jmp 0x17d18
jmp 0x17d18
jmp 0x17d18
jmp 0x17d18
jmp 0x17d18
jmp 0x17d18
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x196aa
leaq -0xb0(%rbp), %rdi
callq 0x19654
movq %rbx, %rdi
callq 0x45f0