// File: /workspace/github_cpp_makefile_star2_O1/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)
cmpq 0x28(%rsi), %rbx
je 0x190d6
movq 0x68(%rbx), %rax
leaq 0x58(%rbx), %r14
cmpq %r14, %rax
je 0x190c8
movq 0x20(%rax), %rcx
movq $0x0, 0x8(%rcx)
movq %rax, %rdi
callq 0x4410
jmp 0x190ad
subq $-0x80, %rbx
movq -0x30(%rbp), %rax
cmpq 0x28(%rax), %rbx
jne 0x190a5
movq 0x18(%r15), %rcx
movq %r15, -0x48(%rbp)
leaq 0x8(%r15), %rax
movq %rax, -0x38(%rbp)
cmpq %rax, %rcx
je 0x191bf
movq -0x30(%rbp), %rax
addq $0x98, %rax
movq %rax, -0x50(%rbp)
movq %rcx, -0x40(%rbp)
leaq 0x20(%rcx), %rsi
movq -0x50(%rbp), %rdi
callq 0x1b5ee
movq (%rax), %rcx
movq %rax, -0x58(%rbp)
cmpq 0x8(%rax), %rcx
je 0x191a9
movq -0x40(%rbp), %rax
leaq 0x40(%rax), %r14
leaq 0x48(%rax), %rbx
movq %rcx, -0x60(%rbp)
movl (%rcx), %eax
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rcx
shlq $0x7, %rax
leaq (%rcx,%rax), %r13
addq $0x58, %r13
movq 0x10(%r13), %r12
cmpq %r13, %r12
je 0x19197
movq 0x20(%r12), %rax
movl 0x4(%rax), %r15d
shlq $0x7, %r15
movq -0x30(%rbp), %rax
addq 0x20(%rax), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1bc58
cmpq %rbx, %rax
je 0x19187
movq %r14, %rdi
movq %r15, %rsi
callq 0x1b64c
movq 0x20(%r12), %rcx
movq %rax, 0x8(%rcx)
movq %r12, %rdi
callq 0x4410
movq %rax, %r12
cmpq %r13, %rax
jne 0x1914e
movq -0x60(%rbp), %rcx
addq $0x4, %rcx
movq -0x58(%rbp), %rax
cmpq 0x8(%rax), %rcx
jne 0x1912b
movq -0x40(%rbp), %rdi
callq 0x4280
movq %rax, %rcx
cmpq -0x38(%rbp), %rax
jne 0x190fd
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 -0x30(%rbp), %rax
movq 0x20(%rax), %rbx
cmpq 0x28(%rax), %rbx
je 0x1923b
leaq -0x90(%rbp), %r14
movq 0x68(%rbx), %r15
leaq 0x58(%rbx), %r13
cmpq %r13, %r15
je 0x1922d
movq 0x20(%r15), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1921d
leaq 0x20(%r15), %rsi
movq %r14, %rdi
callq 0x159c8
movq %r15, %rdi
callq 0x4410
movq %rax, %r15
cmpq %r13, %rax
jne 0x19206
subq $-0x80, %rbx
movq -0x30(%rbp), %rax
cmpq 0x28(%rax), %rbx
jne 0x191f9
movq -0x78(%rbp), %r14
cmpq %r12, %r14
je 0x19261
movq 0x20(%r14), %rsi
movq -0x30(%rbp), %rdi
callq 0x12288
movq %r14, %rdi
callq 0x4410
movq %rax, %r14
cmpq %r12, %rax
jne 0x19244
movq -0x30(%rbp), %rax
movq 0xb0(%rax), %r14
leaq 0xa0(%rax), %rbx
cmpq %rbx, %r14
movq -0x48(%rbp), %r12
je 0x192ad
leaq 0x20(%r14), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x1615e
cmpq -0x38(%rbp), %rax
jne 0x1929d
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x12308
movq %r14, %rdi
callq 0x4280
movq %rax, %r14
cmpq %rbx, %rax
jne 0x1927c
leaq -0x90(%rbp), %rdi
callq 0x13ea2
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x192ce
jmp 0x192ce
jmp 0x192ce
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x13ea2
movq %rbx, %rdi
callq 0x4650