// 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>>, 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 %rdx, %r8
movq 0x40(%rsi), %rdx
movq %rsi, -0x38(%rbp)
cmpq %rdx, 0x48(%rsi)
je 0x1807a
xorl %ecx, %ecx
movq (%r8), %rax
movq %rcx, -0x30(%rbp)
movsd (%rax,%rcx,8), %xmm0
ucomisd 0xe95b(%rip), %xmm0     # 0x26800
leaq -0x68(%rbp), %rdi
jne 0x17ede
jp 0x17ede
movq -0x30(%rbp), %rcx
incl %ecx
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rdx
movq 0x48(%rax), %rax
subq %rdx, %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rsi # imm = 0x6DB6DB6DB6DB6DB7
imulq %rsi, %rax
cmpq %rcx, %rax
ja 0x17e91
jmp 0x1807a
imulq $0x38, -0x30(%rbp), %rax
movq 0x20(%rdx,%rax), %rbx
cmpq 0x28(%rdx,%rax), %rbx
je 0x17ead
addq %rax, %rdx
movq %rdx, -0x48(%rbp)
movq %r8, %r14
movq (%rbx), %rax
movzwl 0x2(%rax), %r13d
movq -0x38(%rbp), %rsi
movq %rdi, %r15
callq 0x10332
movq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x1b47a
movq %rax, %r15
leaq -0x88(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
movl %r13d, %edx
callq 0x10378
movq %r15, %rdi
movq %r12, %rsi
callq 0x1b4d8
movsd (%rax), %xmm0
movq (%rbx), %rax
movsd %xmm0, 0x8(%rax)
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x17f5e
callq 0x4350
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x17f70
callq 0x4350
movq (%r14), %rax
movq -0x30(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq (%rbx), %rcx
addsd 0x8(%rcx), %xmm1
movl %r13d, %r15d
movsd (%rax,%r15,8), %xmm2
ucomisd 0xe86b(%rip), %xmm2     # 0x26800
jne 0x17fa4
jp 0x17fa4
movq %r14, %r8
movsd %xmm1, (%rax,%r15,8)
jmp 0x17ff7
movapd %xmm2, %xmm3
subsd %xmm1, %xmm3
movapd %xmm3, %xmm0
xorpd 0xe868(%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 %r14, %r8
addsd -0xa0(%rbp), %xmm0
movq (%r14), %rax
movsd %xmm0, (%rax,%r15,8)
addq $0x8, %rbx
movq -0x48(%rbp), %rdx
cmpq 0x28(%rdx), %rbx
leaq -0x68(%rbp), %rdi
jne 0x17ef6
jmp 0x17ead
movq %rdx, %r12
movq %rax, %r15
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x18037
callq 0x4350
jmp 0x18037
jmp 0x18031
movq %rdx, %r12
movq %rax, %r15
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x18051
callq 0x4350
jmp 0x18051
movq %rdx, %r12
movq %rax, %r15
movq %r15, %rdi
cmpl $0x1, %r12d
jne 0x18089
callq 0x4160
movq (%rbx), %rax
movabsq $-0x3fa7000000000000, %rcx # imm = 0xC059000000000000
movq %rcx, 0x8(%rax)
callq 0x45c0
jmp 0x17f70
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4650