// File: /workspace/github_cpp_makefile_star2_O3/aalto-speech[P]ftk/src/EM.cc
// Function: assign_scores(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>>>>>>&, MultiStringFactorGraph&)
void
assign_scores(transitions_t &transitions,
              MultiStringFactorGraph &msfg)
{
    for (auto ndit = msfg.nodes.begin(); ndit != msfg.nodes.end(); ++ndit)
        for (auto arc = ndit->outgoing.begin(); arc != ndit->outgoing.end(); ++arc)
            (**arc).cost = nullptr;

    for (auto it = transitions.begin(); it != transitions.end(); ++it) {
        vector<msfg_node_idx_t> &nodes = msfg.factor_node_map.at(it->first);
        for (auto ndit = nodes.begin(); ndit != nodes.end(); ++ndit) {
            MultiStringFactorGraph::Node &node = msfg.nodes[*ndit];
            for (auto arc = node.outgoing.begin(); arc != node.outgoing.end(); ++arc) {
                string &tgt_str = msfg.nodes[(**arc).target_node].factor;
                if (it->second.find(tgt_str) != it->second.end())
                    (**arc).cost = &(it->second.at(tgt_str));
            }
        }
    }

    set<MultiStringFactorGraph::Arc*> to_remove;
    for (auto ndit = msfg.nodes.begin(); ndit != msfg.nodes.end(); ++ndit)
        for (auto arc = ndit->outgoing.begin(); arc != ndit->outgoing.end(); ++arc)
            if ((**arc).cost == nullptr) to_remove.insert(*arc);
    for (auto trit = to_remove.begin(); trit != to_remove.end(); ++trit)
        msfg.remove_arc(*trit);

    for (auto fnit=msfg.factor_node_map.begin(); fnit != msfg.factor_node_map.end(); ++fnit)
        if (transitions.find(fnit->first) == transitions.end())
            msfg.remove_arcs(fnit->first);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r15
movq 0x20(%rsi), %rbx
movq %rsi, -0x30(%rbp)
movq 0x28(%rsi), %rcx
cmpq %rcx, %rbx
je 0x18fc4
movq 0x68(%rbx), %rax
leaq 0x58(%rbx), %r14
cmpq %r14, %rax
je 0x18fb9
movq 0x20(%rax), %rcx
movq $0x0, 0x8(%rcx)
movq %rax, %rdi
callq 0x4410
cmpq %r14, %rax
jne 0x18f98
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rcx
subq $-0x80, %rbx
cmpq %rcx, %rbx
jne 0x18f8b
jmp 0x18fc7
movq %rbx, %rcx
movq 0x18(%r15), %rax
movq %r15, -0x48(%rbp)
leaq 0x8(%r15), %rdx
movq %rdx, -0x38(%rbp)
cmpq %rdx, %rax
movq -0x30(%rbp), %rdi
je 0x190bc
leaq 0x98(%rdi), %rcx
movq %rcx, -0x50(%rbp)
movq %rax, -0x40(%rbp)
leaq 0x20(%rax), %rsi
movq -0x50(%rbp), %rdi
callq 0x1b50c
movq (%rax), %rdx
movq %rax, -0x58(%rbp)
movq 0x8(%rax), %rax
cmpq %rax, %rdx
movq -0x30(%rbp), %rsi
je 0x190a1
movq -0x40(%rbp), %rcx
leaq 0x40(%rcx), %r14
leaq 0x48(%rcx), %rbx
movq %rdx, -0x60(%rbp)
movl (%rdx), %ecx
movq 0x20(%rsi), %rdx
shlq $0x7, %rcx
leaq (%rdx,%rcx), %r13
addq $0x58, %r13
movq 0x10(%r13), %r12
cmpq %r13, %r12
je 0x19094
movq 0x20(%r12), %rax
movl 0x4(%rax), %r15d
shlq $0x7, %r15
addq 0x20(%rsi), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1bb6a
cmpq %rbx, %rax
je 0x19078
movq %r14, %rdi
movq %r15, %rsi
callq 0x1b56a
movq 0x20(%r12), %rcx
movq %rax, 0x8(%rcx)
movq %r12, %rdi
callq 0x4410
movq %rax, %r12
cmpq %r13, %rax
movq -0x30(%rbp), %rsi
jne 0x19043
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rdx
addq $0x4, %rdx
cmpq %rax, %rdx
jne 0x19024
movq -0x40(%rbp), %rdi
callq 0x4280
cmpq -0x38(%rbp), %rax
jne 0x18fef
movq -0x30(%rbp), %rdi
movq 0x28(%rdi), %rcx
leaq -0x88(%rbp), %r12
movl $0x0, (%r12)
xorl %eax, %eax
movq %rax, 0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
movq %rax, 0x20(%r12)
movq 0x20(%rdi), %rbx
cmpq %rcx, %rbx
je 0x1915c
leaq -0x90(%rbp), %r14
movq 0x68(%rbx), %r15
leaq 0x58(%rbx), %r13
cmpq %r13, %r15
je 0x1912d
movq 0x20(%r15), %rax
cmpq $0x0, 0x8(%rax)
jne 0x19115
leaq 0x20(%r15), %rsi
movq %r14, %rdi
callq 0x158b8
movq %r15, %rdi
callq 0x4410
movq %rax, %r15
cmpq %r13, %rax
jne 0x190fe
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rcx
subq $-0x80, %rbx
cmpq %rcx, %rbx
jne 0x190f1
movq -0x78(%rbp), %r14
cmpq %r12, %r14
movq -0x30(%rbp), %rdi
je 0x1915c
movq 0x20(%r14), %rsi
callq 0x12172
movq %r14, %rdi
callq 0x4410
movq %rax, %r14
cmpq %r12, %rax
jmp 0x1913d
movq 0xb0(%rdi), %r14
leaq 0xa0(%rdi), %rbx
cmpq %rbx, %r14
movq -0x48(%rbp), %r12
je 0x191a4
leaq 0x20(%r14), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x1604a
cmpq -0x38(%rbp), %rax
jne 0x19194
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x121ee
movq %r14, %rdi
callq 0x4280
movq %rax, %r14
cmpq %rbx, %rax
jne 0x19173
leaq -0x90(%rbp), %rdi
callq 0x13dca
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x191c5
jmp 0x191c5
jmp 0x191c5
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x13dca
movq %rbx, %rdi
callq 0x4650