// File: /workspace/github_c_makefile_star2_O1/perdisci[P]LSH/lsh.cpp
// Function: rp::LSH::load_ngrams_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int)
set<string> LSH::load_ngrams_from_file(const string file_name, const unsigned ngram_len) {
        
        const unsigned n = ngram_len;
        set<string> ngrams_set;
        
        std::ifstream f(file_name);
        string line;
        string prev_line;
        
        
        vector<string> last_ngram;
        while(std::getline(f,line)) {
            
            boost::trim(line);
            if(line.length()==0)
                continue;
            
            if(n>1 && !last_ngram.empty()) {
                string last_ngram_str;
                for(int i=1; i<last_ngram.size(); i++)
                    last_ngram_str += last_ngram[i] + " ";
                line = last_ngram_str + line;
            }
            else if(!prev_line.empty())
                line = prev_line + " " + line;
            
            vector<string> tokens;
            boost::algorithm::split(tokens,line,boost::algorithm::is_space());
            
            if(tokens.size() >= n) {
                for(int i=0; i<tokens.size()-n+1; i++) {
                    string ngram;
                    for(int j=i; j<(i+n); j++)
                        ngram += tokens[j] + " ";
                    boost::trim(ngram);
                    ngrams_set.insert(ngram);
                }
                
                vector<string>::const_iterator last = tokens.end();
                vector<string>::const_iterator first = tokens.end() - n;
                last_ngram = vector<string>(first,last);
                prev_line = string();
            }
            else {
                prev_line = line;
                last_ngram = vector<string>();
            }
            
        }
        
        return std::move(ngrams_set);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
movl %edx, %r14d
movq %rdi, 0xe8(%rsp)
leaq 0x118(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x140(%rsp), %r15
movq %r15, %rdi
movl $0x8, %edx
callq 0x6510
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %ecx, %ecx
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
movq %rcx, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
leaq 0x8(%rsp), %rbp
leaq 0xc0(%rsp), %rbx
movl %r14d, %eax
movq %rax, %rcx
negq %rcx
movl $0x1, %edx
movq %rax, 0xf8(%rsp)
subq %rax, %rdx
movq %rdx, 0xa8(%rsp)
leaq 0x20(%rsp), %r13
shlq $0x5, %rcx
movq %rcx, 0xf0(%rsp)
movq %r14, 0xa0(%rsp)
movq 0x140(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x6310
movsbl %al, %edx
movq %r15, %rdi
leaq 0x80(%rsp), %rsi
callq 0x6600
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xedde
movq %r13, %rdi
callq 0x6650
movw $0x2000, (%rsp)         # imm = 0x2000
movq %rbp, %rdi
movq %r13, %rsi
callq 0x61d0
leaq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0x11312
movq %rbp, %rdi
callq 0x6470
movq %r13, %rdi
callq 0x6470
cmpq $0x0, 0x88(%rsp)
je 0xe841
cmpl $0x2, %r14d
jb 0xe9e2
movq 0x40(%rsp), %rax
cmpq 0x48(%rsp), %rax
je 0xe9e2
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
cmpq $0x21, %rcx
jb 0xe986
movl $0x1, %ebx
movl $0x28, %r14d
leaq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq -0x8(%rax,%r14), %rsi
movq (%rax,%r14), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x833e
movq %r13, %rdi
leaq 0x4835(%rip), %rsi      # 0x13173
callq 0x6620
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rsp, %rdi
callq 0x60e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xe969
callq 0x6300
incq %rbx
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r14
cmpq %rbx, %rcx
ja 0xe916
movq %r13, %rdi
movq %rsp, %rsi
leaq 0x80(%rsp), %rbx
movq %rbx, %rdx
callq 0x1001c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x63e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
leaq 0xc0(%rsp), %rbx
je 0xe9c3
callq 0x6300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
movq 0xa0(%rsp), %r14
jne 0xeab0
jmp 0xeab5
movq 0xd0(%rsp), %rdx
testq %rdx, %rdx
je 0xeab5
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xc8(%rsp), %rsi
addq %rsi, %rdx
movq %r13, %rdi
callq 0x833e
movq %r13, %rdi
leaq 0x4759(%rip), %rsi      # 0x13173
callq 0x6620
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq %r13, %rdi
callq 0x60e0
leaq 0x10(%rsp), %rbx
movq %rbx, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xea5d
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xea63
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0x63e0
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0xea99
callq 0x6300
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
leaq 0xc0(%rsp), %rbx
je 0xeab5
callq 0x6300
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movq %rsp, %r12
movq %r12, %rdi
callq 0x6650
movw $0x2000, 0xb8(%rsp)     # imm = 0x2000
movq %rbx, %rdi
movq %r12, %rsi
callq 0x61d0
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
movl $0x1, %ecx
callq 0x10070
movq %rbx, %rdi
callq 0x6470
movq %r12, %rdi
callq 0x6470
movq 0x68(%rsp), %rax
subq 0x60(%rsp), %rax
sarq $0x5, %rax
cmpq 0xf8(%rsp), %rax
jae 0xeba4
leaq 0xc8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x61a0
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
xorl %edx, %edx
movq %rdx, 0x30(%rsp)
movaps %xmm0, (%rsp)
movaps 0x40(%rsp), %xmm0
movq 0x50(%rsp), %rax
movq %rdx, 0x40(%rsp)
movq 0x28(%rsp), %rcx
movq %rcx, 0x48(%rsp)
movq 0x30(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq %rax, 0x10(%rsp)
movaps (%rsp), %xmm1
movaps %xmm0, (%rsp)
movaps %xmm1, 0x20(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsp, %rdi
callq 0x7caa
movq %r13, %rdi
callq 0x7caa
jmp 0xedcf
movq 0x68(%rsp), %rdx
movq %rdx, %rax
subq 0x60(%rsp), %rax
sarq $0x5, %rax
addq 0xa8(%rsp), %rax
je 0xed1b
movl $0x8, %ebp
movl %r14d, %ebx
xorl %r15d, %r15d
movl %ebx, %ebx
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
leal (%r15,%r14), %eax
movq %rbx, 0x108(%rsp)
movq %rbp, %r14
cmpq %rax, %r15
jae 0xec5f
movq 0x60(%rsp), %rax
leaq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq -0x8(%rax,%r14), %rsi
movq (%rax,%r14), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x833e
movq %r13, %rdi
leaq 0x454b(%rip), %rsi      # 0x13173
callq 0x6620
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rsp, %rdi
callq 0x60e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xec53
callq 0x6300
addq $0x20, %r14
decq %rbx
cmpq %rbx, %r15
jne 0xebfb
movq %rbp, 0x100(%rsp)
movq %r13, %rbp
leaq 0xb0(%rsp), %r13
movq %r13, %rdi
callq 0x6650
movw $0x2000, 0x20(%rsp)     # imm = 0x2000
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x61d0
movq %rsp, %rbx
movq %rbx, %rdi
movq %rbp, %r12
movq %rbp, %rsi
callq 0x11312
movq %r14, %rdi
callq 0x6470
movq %r13, %rdi
callq 0x6470
leaq 0x110(%rsp), %rdi
movq %rbx, %rsi
callq 0x1213a
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xecd5
callq 0x6300
incq %r15
movq 0x68(%rsp), %rdx
movq %rdx, %rax
subq 0x60(%rsp), %rax
sarq $0x5, %rax
addq 0xa8(%rsp), %rax
movq 0x108(%rsp), %rbx
incl %ebx
movq 0x100(%rsp), %rbp
addq $0x20, %rbp
cmpq %r15, %rax
movq 0xa0(%rsp), %r14
movq %r12, %r13
ja 0xebce
movq 0xf0(%rsp), %rax
leaq (%rdx,%rax), %rsi
movq %r13, %rdi
leaq 0xb0(%rsp), %rcx
callq 0x1012e
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps 0x40(%rsp), %xmm0
movq 0x50(%rsp), %rax
movaps 0x20(%rsp), %xmm1
movaps %xmm1, 0x40(%rsp)
movq 0x30(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq %rax, 0x10(%rsp)
movaps (%rsp), %xmm1
movaps %xmm0, (%rsp)
movaps %xmm1, 0x20(%rsp)
xorl %r12d, %r12d
movq %r12, 0x30(%rsp)
movq %rsp, %r15
movq %r15, %rdi
callq 0x7caa
movq %r13, %rdi
callq 0x7caa
leaq 0x10(%rsp), %rbx
movq %rbx, (%rsp)
movq %r12, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
leaq 0xc8(%rsp), %rdi
movq %r15, %rsi
callq 0x63e0
movq (%rsp), %rdi
cmpq %rbx, %rdi
leaq 0x140(%rsp), %r15
leaq 0x8(%rsp), %rbp
je 0xedc7
callq 0x6300
leaq 0xc0(%rsp), %rbx
leaq 0x60(%rsp), %rdi
callq 0x7caa
jmp 0xe841
movq 0xe8(%rsp), %rbx
leaq 0x8(%rbx), %rcx
movq 0x120(%rsp), %rdx
testq %rdx, %rdx
je 0xee36
leaq 0x138(%rsp), %rax
movl -0x20(%rax), %esi
movl %esi, 0x8(%rbx)
movq %rdx, 0x10(%rbx)
movups -0x10(%rax), %xmm0
movups %xmm0, 0x18(%rbx)
movq %rcx, 0x8(%rdx)
movq (%rax), %rcx
movq %rcx, 0x28(%rbx)
movq $0x0, -0x18(%rax)
leaq 0x118(%rsp), %rcx
movq %rcx, -0x10(%rax)
movq %rcx, -0x8(%rax)
jmp 0xee54
movl $0x0, 0x8(%rbx)
movq $0x0, 0x10(%rbx)
movq %rcx, 0x18(%rbx)
movq %rcx, 0x20(%rbx)
movq %rbx, %rax
addq $0x28, %rax
movq $0x0, (%rax)
leaq 0x40(%rsp), %rdi
callq 0x7caa
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xee7f
callq 0x6300
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xee99
callq 0x6300
leaq 0x140(%rsp), %rdi
callq 0x60c0
leaq 0x110(%rsp), %rdi
callq 0x807c
movq %rbx, %rax
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xeffe
jmp 0xef2b
jmp 0xeed4
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
jmp 0xef50
jmp 0xef21
jmp 0xeee7
movq %rax, %rbx
jmp 0xefa9
movq %rbx, %rdi
movq %rax, %rbx
callq 0x6470
movq %rsp, %rdi
callq 0x6470
jmp 0xefa9
movq %rax, %rbx
movq %rbp, %rdi
callq 0x6470
leaq 0x20(%rsp), %rdi
callq 0x6470
jmp 0xefb3
movq %rax, %rbx
jmp 0xefb3
jmp 0xef30
movq %rax, %rbx
jmp 0xef47
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xef47
callq 0x6300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xefb3
callq 0x6300
jmp 0xefb3
jmp 0xef93
movq %rax, %rbx
movq %r14, %rdi
callq 0x6470
leaq 0xb0(%rsp), %rdi
callq 0x6470
jmp 0xef96
jmp 0xef7a
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xef96
callq 0x6300
jmp 0xef96
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xefa9
callq 0x6300
leaq 0x60(%rsp), %rdi
callq 0x7caa
leaq 0x40(%rsp), %rdi
callq 0x7caa
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xefd7
callq 0x6300
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xeff1
callq 0x6300
leaq 0x140(%rsp), %rdi
callq 0x60c0
leaq 0x110(%rsp), %rdi
callq 0x807c
movq %rbx, %rdi
callq 0x65b0
nop