// File: /workspace/github_cpp_makefile_star2_O2/aalto-speech[P]ftk/src/EM.cc
// Function: forward(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>>>>>> const&, FactorGraph&, std::vector<double, std::allocator<double>>&)
void forward(const transitions_t &transitions,
             FactorGraph &text,
             vector<flt_type> &fw)
{
    for (unsigned int i=0; i<text.nodes.size(); i++) {

        if (fw[i] == MIN_FLOAT) continue;

        FactorGraph::Node &node = text.nodes[i];
        for (auto arc = node.outgoing.begin(); arc != node.outgoing.end(); ++arc) {

            int tgt_node = (**arc).target_node;
            try {
                (**arc).cost = transitions.at(text.get_factor(node)).at(text.get_factor(tgt_node));
            }
            catch (std::out_of_range &oor) {
                (**arc).cost = SMALL_LP;
            }

            flt_type cost = fw[i] + (**arc).cost;
            if (fw[tgt_node] == MIN_FLOAT) fw[tgt_node] = cost;
            else fw[tgt_node] = add_log_domain_probs(fw[tgt_node], cost);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r8
movq %rsi, -0x38(%rbp)
movq %rdi, -0x48(%rbp)
xorl %esi, %esi
leaq -0x90(%rbp), %r12
movq %rdx, -0x40(%rbp)
movl %esi, %esi
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rcx
movq 0x48(%rax), %rax
subq %rcx, %rax
cqto
pushq $0x38
popq %rdi
idivq %rdi
cmpq %rsi, %rax
jbe 0x165ea
movq (%r8), %rax
movq %rsi, -0x30(%rbp)
movsd (%rax,%rsi,8), %xmm0
ucomisd 0xd2de(%rip), %xmm0     # 0x23790
jne 0x164be
jp 0x164be
movq -0x30(%rbp), %rsi
incl %esi
jmp 0x1647c
imulq $0x38, -0x30(%rbp), %rax
leaq (%rcx,%rax), %rdx
movq 0x20(%rcx,%rax), %r13
movq %rdx, -0x50(%rbp)
cmpq 0x28(%rdx), %r13
je 0x164b6
movq %r12, %r14
movq (%r13), %rax
movzwl 0x2(%rax), %ebx
leaq -0x70(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0xea24
movq -0x48(%rbp), %rdi
movq %r12, %rsi
callq 0x190b2
movq %rax, %r15
movq %r14, %r12
movq %r14, %rdi
movq -0x38(%rbp), %rsi
movl %ebx, %edx
callq 0xea5a
movq %r15, %rdi
movq %r12, %rsi
callq 0x19102
movsd (%rax), %xmm0
movq (%r13), %rax
movsd %xmm0, 0x8(%rax)
movq %r12, %rdi
callq 0x46b8
leaq -0x70(%rbp), %rdi
callq 0x46b8
movq -0x40(%rbp), %r8
movq (%r8), %rax
movq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq (%r13), %rcx
addsd 0x8(%rcx), %xmm1
movl %ebx, %ebx
movsd (%rax,%rbx,8), %xmm0
ucomisd 0xd22e(%rip), %xmm0     # 0x23790
jne 0x1656d
jp 0x1656d
movsd %xmm1, (%rax,%rbx,8)
jmp 0x1657e
callq 0x15a53
movq -0x40(%rbp), %r8
movq (%r8), %rax
movsd %xmm0, (%rax,%rbx,8)
addq $0x8, %r13
movq -0x50(%rbp), %rdx
jmp 0x164d0
movq %rdx, %r14
movq %rax, %r15
movq %r12, %rdi
callq 0x46b8
jmp 0x165ac
movq %rdx, %r14
movq %rax, %r15
jmp 0x165ac
movq %rax, %r15
movq %r14, %r12
movq %rdx, %r14
leaq -0x70(%rbp), %rdi
callq 0x46b8
jmp 0x165c0
movq %rax, %r15
movq %r14, %r12
movq %rdx, %r14
movq %r15, %rdi
cmpl $0x1, %r14d
jne 0x165f9
callq 0x4150
movq (%r13), %rax
movabsq $-0x3fa7000000000000, %rcx # imm = 0xC059000000000000
movq %rcx, 0x8(%rax)
callq 0x4560
jmp 0x1653a
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x45f0