// File: aalto-speech[P]ftk/src/MSFG.cc
// Function: MultiStringFactorGraph::collect_arcs(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::map<unsigned int, std::vector<MultiStringFactorGraph::Arc*, std::allocator<MultiStringFactorGraph::Arc*>>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::vector<MultiStringFactorGraph::Arc*, std::allocator<MultiStringFactorGraph::Arc*>>>>>&) const
void
MultiStringFactorGraph::collect_arcs(const string &text,
                                     map<msfg_node_idx_t, vector<Arc*> > &arcs) const
{
    msfg_node_idx_t end_node = string_end_nodes.at(text);
    set<msfg_node_idx_t> nodes_to_process; nodes_to_process.insert(end_node);

    while(nodes_to_process.size() > 0) {

        msfg_node_idx_t i = *(nodes_to_process.rbegin());

        const Node &node = nodes[i];
        for (auto arc = node.incoming.begin(); arc != node.incoming.end(); ++arc) {
            arcs[(**arc).source_node].push_back(*arc);
            nodes_to_process.insert((**arc).source_node);
        }

        nodes_to_process.erase(i);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
addq $0x38, %rdi
movq -0x10(%rbp), %rsi
callq 0x30970
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x30b10
movq -0xc0(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x30b30
movb %dl, -0xb1(%rbp)
movq %rax, -0xb0(%rbp)
jmp 0x2f383
movb -0xb1(%rbp), %al
movq -0xb0(%rbp), %rcx
movq %rcx, -0x70(%rbp)
movb %al, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x30b80
cmpq $0x0, %rax
jbe 0x2f50e
leaq -0x80(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
leaq -0x50(%rbp), %rsi
callq 0x30ba0
movq -0xd8(%rbp), %rdi
callq 0x30bd0
movq %rax, -0xd0(%rbp)
jmp 0x2f3d3
movq -0xc8(%rbp), %rdi
movq -0xd0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x74(%rbp)
addq $0x20, %rdi
movl -0x74(%rbp), %eax
movl %eax, %esi
callq 0x30c00
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
addq $0x20, %rdi
callq 0x30260
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
addq $0x20, %rdi
callq 0x302c0
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x30290
testb $0x1, %al
jne 0x2f445
jmp 0x2f4fa
movq -0x18(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x302f0
movq -0xe8(%rbp), %rdi
movq (%rax), %rsi
callq 0x31740
movq %rax, -0xe0(%rbp)
jmp 0x2f474
leaq -0x90(%rbp), %rdi
callq 0x302f0
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
callq 0x316b0
jmp 0x2f491
leaq -0x90(%rbp), %rdi
callq 0x302f0
movq (%rax), %rsi
leaq -0x50(%rbp), %rdi
callq 0x30b30
movb %dl, -0xf1(%rbp)
movq %rax, -0xf0(%rbp)
jmp 0x2f4b8
movb -0xf1(%rbp), %al
movq -0xf0(%rbp), %rcx
movq %rcx, -0xa8(%rbp)
movb %al, -0xa0(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x30320
jmp 0x2f412
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x30d30
jmp 0x2f520
leaq -0x50(%rbp), %rdi
leaq -0x74(%rbp), %rsi
callq 0x30c20
jmp 0x2f509
jmp 0x2f397
leaq -0x50(%rbp), %rdi
callq 0x30d30
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x46e0
nopl (%rax)