// 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&, 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, -0x38(%rbp)
movl %ecx, -0x30(%rbp)
movq %rdx, -0x40(%rbp)
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x40(%rdi), %rdi
leaq -0xc8(%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, -0x78(%rbp)
callq 0x10560
leaq -0xc8(%rbp), %rdi
callq 0xfea4
leaq -0x70(%rbp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movzbl 0x70(%rbx), %edx
movq %r14, %rdi
callq 0xe802
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rax
movq %rax, %rcx
subq %rdi, %rcx
cmpq $0x4, %rcx
je 0xe78a
movq -0x40(%rbp), %rcx
addq $0x8, %rcx
movq %rcx, -0x80(%rbp)
xorl %esi, %esi
leaq -0xc8(%rbp), %r12
movq %r14, -0x88(%rbp)
movl (%rdi,%rsi,4), %r8d
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x38, %r8, %rdx
cmpq $0x0, 0x18(%rcx,%rdx)
je 0xe76c
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
decq %rcx
cmpl $0x0, -0x30(%rbp)
je 0xe77f
movl %esi, %edx
cmpq %rdx, %rcx
jbe 0xe77f
movq %r8, -0x50(%rbp)
movl $0x1, %r14d
movq %rsi, -0x48(%rbp)
leal (%rsi,%r14), %eax
movq %rax, -0x90(%rbp)
movl (%rdi,%rax,4), %ebx
movl %ebx, %r15d
movq -0x50(%rbp), %rdx
subl %edx, %r15d
movq %r12, %rdi
movq -0x88(%rbp), %rsi
movq %r15, %rcx
callq 0x43b0
movq -0x40(%rbp), %rdi
movq %r12, %r13
movq %r12, %rsi
callq 0xd62a
movq %rax, %r12
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0xe6d2
callq 0x4350
cmpq -0x80(%rbp), %r12
movq %r13, %r12
je 0xe73b
movq -0x50(%rbp), %r13
movw %r13w, -0xc8(%rbp)
movb %r15b, -0xc6(%rbp)
leaq -0xb8(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movups %xmm0, -0x8(%rax)
movq -0x78(%rbp), %rdi
movq %r12, %rsi
callq 0x10560
movq %r12, %rdi
callq 0xfea4
imulq $0x38, %rbx, %rdi
movq -0x38(%rbp), %rax
addq (%rax), %rdi
movw %r13w, -0x2a(%rbp)
movq %rdi, -0xc8(%rbp)
leaq -0x2a(%rbp), %rsi
movq %r12, %rdx
callq 0x10960
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rax
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
decq %rcx
cmpl -0x30(%rbp), %r14d
jae 0xe77b
incl %r14d
cmpq -0x90(%rbp), %rcx
movq -0x48(%rbp), %rsi
ja 0xe67e
jmp 0xe77f
movq %rax, %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
decq %rcx
jmp 0xe77f
movq -0x48(%rbp), %rsi
incl %esi
cmpq %rsi, %rcx
ja 0xe633
testq %rdi, %rdi
je 0xe794
callq 0x4350
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe7cc
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0xfea4
jmp 0xe7fa
jmp 0xe7cc
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0xfea4
jmp 0xe7ec
movq %rax, %rbx
jmp 0xe7ec
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0xe7ec
callq 0x4350
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0xe7fa
callq 0x4350
movq %rbx, %rdi
callq 0x4650