// File: /workspace/github_cpp_makefile_star2_O3/aalto-speech[P]ftk/src/FactorGraph.cc
// Function: FactorGraph::create_nodes(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, StringSet const&, std::vector<std::unordered_set<unsigned short, std::hash<unsigned short>, std::equal_to<unsigned short>, std::allocator<unsigned short>>, std::allocator<std::unordered_set<unsigned short, std::hash<unsigned short>, std::equal_to<unsigned short>, std::allocator<unsigned short>>>>&)
void
FactorGraph::create_nodes(const string &text,
                          const StringSet &vocab,
                          vector<unordered_set<fg_node_idx_t> > &incoming)
{
    nodes.push_back(Node(0,0));

    vector<unsigned int> char_positions;
    get_character_positions(text, char_positions, utf8);

    for (unsigned int i=0; i<char_positions.size()-1; i++) {

        unsigned int start_pos = char_positions[i];
        if (incoming[start_pos].size() == 0) continue;

        const StringSet::Node *node = &vocab.root_node;
        for (unsigned int j=start_pos; j<text.length(); j++) {

            StringSet::Arc *arc = vocab.find_arc(text[j], node);

            if (arc == NULL) break;
            node = arc->target_node;

            // String associated with this node
            if (arc->factor.length() > 0) {
                nodes.push_back(Node(start_pos, j+1-start_pos));
                incoming[j+1].insert(start_pos);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rsi, %r15
movq %rdi, %r14
addq $0x40, %rdi
leaq -0xa8(%rbp), %rsi
movw $0x0, (%rsi)
movb $0x0, 0x2(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsi)
movups %xmm0, 0x18(%rsi)
movups %xmm0, 0x28(%rsi)
movq %rdi, -0x70(%rbp)
callq 0x10560
leaq -0xa8(%rbp), %rdi
callq 0xfea4
leaq -0x60(%rbp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movzbl 0x70(%r14), %edx
movq %r15, %rdi
callq 0xe802
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rax
movq %rax, %rcx
subq %rdi, %rcx
cmpq $0x4, %rcx
je 0xed85
xorl %esi, %esi
movl (%rdi,%rsi,4), %ebx
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x38, %rbx, %rdx
cmpq $0x0, 0x18(%rcx,%rdx)
je 0xed6d
cmpq %rbx, 0x8(%r15)
jbe 0xed6d
movq %rsi, -0x68(%rbp)
movq %rbx, %r12
movl %ebx, %r13d
movq -0x40(%rbp), %r14
movq (%r15), %rax
movsbl (%rax,%r12), %esi
movq -0x40(%rbp), %rdi
movq %r14, %rdx
callq 0xcd82
testq %rax, %rax
je 0xed61
movq 0x28(%rax), %r14
cmpq $0x0, 0x10(%rax)
je 0xed51
incl %r13d
movl %r13d, %eax
subl %ebx, %eax
movw %bx, -0xa8(%rbp)
movb %al, -0xa6(%rbp)
leaq -0xa0(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq -0x70(%rbp), %rdi
leaq -0xa8(%rbp), %r12
movq %r12, %rsi
callq 0x10560
movq %r12, %rdi
callq 0xfea4
movq %r12, %rdx
movl %r13d, %r12d
imulq $0x38, %r12, %rdi
movq -0x38(%rbp), %rax
addq (%rax), %rdi
movw %bx, -0x2a(%rbp)
movq %rdi, -0xa8(%rbp)
leaq -0x2a(%rbp), %rsi
callq 0x10960
jmp 0xed57
incl %r13d
movq %r13, %r12
cmpq %r12, 0x8(%r15)
ja 0xecbd
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rsi
incl %esi
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
decq %rcx
cmpq %rsi, %rcx
ja 0xec8b
testq %rdi, %rdi
je 0xed8f
callq 0x4350
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xedc7
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0xfea4
jmp 0xedd8
jmp 0xedc7
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0xfea4
jmp 0xedca
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0xedd8
callq 0x4350
movq %rbx, %rdi
callq 0x4650