// File: /workspace/github_cpp_makefile_star2_O2/aalto-speech[P]ftk/src/FactorGraph.cc
// Function: FactorGraph::create_nodes(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&, unsigned int, 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 map<string, flt_type> &vocab,
                          unsigned int maxlen,
                          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;

        for (unsigned int j=i; j<char_positions.size()-1 && (j-i < maxlen); j++) {
            unsigned int end_pos = text.size();
            if (j < (char_positions.size()-1)) end_pos = char_positions[j+1];
            if (vocab.find(text.substr(start_pos, end_pos-start_pos)) != vocab.end()) {
                nodes.push_back(Node(start_pos, end_pos-start_pos));
                incoming[end_pos].insert(start_pos);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r8, -0x40(%rbp)
movl %ecx, -0x34(%rbp)
movq %rdx, -0x50(%rbp)
movq %rsi, %r14
movq %rdi, %rbx
addq $0x40, %rdi
leaq -0xc8(%rbp), %rsi
andw $0x0, (%rsi)
movb $0x0, 0x2(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsi)
movups %xmm0, 0x18(%rsi)
movups %xmm0, 0x28(%rsi)
movq %rdi, -0x78(%rbp)
callq 0xeddc
leaq -0xc8(%rbp), %rdi
callq 0xe6fe
leaq -0x70(%rbp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movzbl 0x70(%rbx), %edx
movq %r14, -0x48(%rbp)
movq %r14, %rdi
callq 0xd689
movq -0x50(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x80(%rbp)
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
xorl %r8d, %r8d
pushq $0x1
popq %rdx
movq %rdx, -0x30(%rbp)
leaq -0xc8(%rbp), %r12
movq -0x48(%rbp), %rsi
movl %r8d, %r8d
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
decq %rdx
cmpq %r8, %rdx
jbe 0xd623
movl (%rax,%r8,4), %r9d
movq -0x40(%rbp), %rdx
movq (%rdx), %rdx
imulq $0x38, %r9, %rdi
cmpq $0x0, 0x18(%rdx,%rdi)
je 0xd611
xorl %r10d, %r10d
movq %r8, -0x88(%rbp)
cmpl -0x34(%rbp), %r10d
jae 0xd611
leal (%r8,%r10), %edx
movq %rcx, %rdi
subq %rax, %rdi
sarq $0x2, %rdi
decq %rdi
cmpq %rdx, %rdi
jbe 0xd611
movq -0x30(%rbp), %rcx
movq %r10, -0x90(%rbp)
addl %r10d, %ecx
movl (%rax,%rcx,4), %r13d
movl %r13d, %r15d
subl %r9d, %r15d
movq %r12, %rdi
movq %r9, %r14
movq %r9, %rdx
movq %r15, %rcx
callq 0x4360
movq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0xc3dc
movq %rax, %rbx
movq %r12, %rdi
callq 0x46b8
cmpq -0x80(%rbp), %rbx
je 0xd5ec
movq %r14, %rbx
movw %bx, -0xc8(%rbp)
movb %r15b, -0xc6(%rbp)
leaq -0xc0(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq -0x78(%rbp), %rdi
movq %r12, %rsi
callq 0xeddc
movq %r12, %rdi
callq 0xe6fe
imulq $0x38, %r13, %rdi
movq -0x40(%rbp), %rax
addq (%rax), %rdi
movw %bx, -0xc8(%rbp)
movq %r12, %rsi
callq 0xf180
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movq -0x90(%rbp), %r10
incl %r10d
movq -0x48(%rbp), %rsi
movq -0x88(%rbp), %r8
movq %r14, %r9
jmp 0xd52e
incl %r8d
movq -0x30(%rbp), %rdx
incl %edx
movq %rdx, -0x30(%rbp)
jmp 0xd4f0
leaq -0x70(%rbp), %rdi
callq 0xed7a
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd664
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0xe6fe
jmp 0xd681
jmp 0xd664
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0xe6fe
jmp 0xd678
movq %rax, %rbx
jmp 0xd678
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x46b8
leaq -0x70(%rbp), %rdi
callq 0xed7a
movq %rbx, %rdi
callq 0x45f0