// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movq %rdi, -0x40(%rbp)
movq 0x40(%rsi), %rax
movq %rsi, -0x30(%rbp)
movq 0x48(%rsi), %rcx
cmpq %rax, %rcx
je 0x17f3d
movq %rdx, %rdi
movq %rax, %r9
movq (%rdx), %rax
xorl %esi, %esi
movabsq $0x6db6db6db6db6db7, %r8 # imm = 0x6DB6DB6DB6DB6DB7
movsd (%rax,%rsi,8), %xmm0
ucomisd 0xeaa4(%rip), %xmm0     # 0x26800
jne 0x17d64
jnp 0x17f24
imulq $0x38, %rsi, %rdx
movq 0x20(%r9,%rdx), %r14
cmpq 0x28(%r9,%rdx), %r14
je 0x17f1a
movq %r9, %r8
movq %rsi, -0x38(%rbp)
addq %rdx, %r8
movq %r8, %rdx
movq %r8, -0x48(%rbp)
movq %rdi, %rbx
movq (%r14), %rax
movzwl 0x2(%rax), %r13d
leaq -0x88(%rbp), %r15
movq %r15, %rdi
movq -0x30(%rbp), %rsi
callq 0x10242
movq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x1b398
movq %rax, %r15
leaq -0x68(%rbp), %r12
movq %r12, %rdi
movq -0x30(%rbp), %rsi
movl %r13d, %edx
callq 0x10288
movq %r15, %rdi
movq %r12, %rsi
callq 0x1b3f6
movsd (%rax), %xmm0
movq (%r14), %rax
movsd %xmm0, 0x8(%rax)
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x17df2
callq 0x4350
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x17e07
callq 0x4350
movq (%rbx), %rax
movq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq (%r14), %rcx
addsd 0x8(%rcx), %xmm1
movl %r13d, %r15d
movsd (%rax,%r15,8), %xmm2
ucomisd 0xe9d4(%rip), %xmm2     # 0x26800
jne 0x17e3b
jp 0x17e3b
movq %rbx, %rdi
movsd %xmm1, (%rax,%r15,8)
jmp 0x17e8e
movapd %xmm2, %xmm3
subsd %xmm1, %xmm3
movapd %xmm3, %xmm0
xorpd 0xe9d1(%rip), %xmm0     # 0x26820
movapd %xmm0, %xmm4
cmpltsd %xmm3, %xmm4
andpd %xmm4, %xmm2
andnpd %xmm1, %xmm4
orpd %xmm2, %xmm4
movapd %xmm4, -0xa0(%rbp)
minsd %xmm3, %xmm0
callq 0x4660
callq 0x46e0
movq %rbx, %rdi
addsd -0xa0(%rbp), %xmm0
movq (%rbx), %rax
movsd %xmm0, (%rax,%r15,8)
addq $0x8, %r14
movq -0x48(%rbp), %rdx
cmpq 0x28(%rdx), %r14
jne 0x17d89
jmp 0x17f0a
movq %rdx, %r12
movq %rax, %r15
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x17ec4
callq 0x4350
jmp 0x17ec4
jmp 0x17ebe
movq %rdx, %r12
movq %rax, %r15
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x17ee1
callq 0x4350
jmp 0x17ee1
movq %rdx, %r12
movq %rax, %r15
movq %r15, %rdi
cmpl $0x1, %r12d
jne 0x17f4c
callq 0x4160
movq (%r14), %rax
movabsq $-0x3fa7000000000000, %rcx # imm = 0xC059000000000000
movq %rcx, 0x8(%rax)
callq 0x45c0
jmp 0x17e07
movq -0x30(%rbp), %rcx
movq 0x40(%rcx), %r9
movq 0x48(%rcx), %rcx
movq -0x38(%rbp), %rsi
movabsq $0x6db6db6db6db6db7, %r8 # imm = 0x6DB6DB6DB6DB6DB7
incl %esi
movq %rcx, %rdx
subq %r9, %rdx
sarq $0x3, %rdx
imulq %r8, %rdx
cmpq %rsi, %rdx
ja 0x17d4f
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4650