// File: /workspace/github_c_makefile_star2_O3/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, 0x118(%rsp)
leaq 0xd0(%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 0x5510
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %ecx, %ecx
movq %rcx, -0x8(%rax)
movb %cl, (%rax)
leaq 0x108(%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, 0x128(%rsp)
subq %rax, %rdx
movq %rdx, 0xa8(%rsp)
leaq 0x20(%rsp), %r13
shlq $0x5, %rcx
movq %rcx, 0x120(%rsp)
movq %r14, 0xa0(%rsp)
movq 0x140(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5310
movsbl %al, %edx
movq %r15, %rdi
leaq 0x60(%rsp), %rsi
callq 0x5600
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xdd03
movq %r13, %rdi
callq 0x5650
movw $0x2000, (%rsp)         # imm = 0x2000
movq %rbp, %rdi
movq %r13, %rsi
callq 0x51d0
leaq 0x60(%rsp), %rdi
movq %rsp, %rsi
callq 0x1016c
movq %rbp, %rdi
callq 0x5470
movq %r13, %rdi
callq 0x5470
cmpq $0x0, 0x68(%rsp)
je 0xd7a8
cmpl $0x2, %r14d
jb 0xd932
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq %rcx, %rax
je 0xd932
leaq 0x10(%rsp), %rdx
movq %rdx, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
subq %rax, %rcx
cmpq $0x21, %rcx
jb 0xd8d9
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 0x734c
movq %r13, %rdi
leaq 0x48e2(%rip), %rsi      # 0x12173
callq 0x5620
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rsp, %rdi
callq 0x50e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xd8bc
callq 0x5300
incq %rbx
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r14
cmpq %rbx, %rcx
ja 0xd869
movq %r13, %rdi
movq %rsp, %rsi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdx
callq 0xef16
movq %rbx, %rdi
movq %r13, %rsi
callq 0x53e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
leaq 0xc0(%rsp), %rbx
je 0xd913
callq 0x5300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
movq 0xa0(%rsp), %r14
jne 0xd9f7
jmp 0xd9fc
movq 0x100(%rsp), %rdx
testq %rdx, %rdx
je 0xd9fc
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xf8(%rsp), %rsi
addq %rsi, %rdx
movq %r13, %rdi
callq 0x734c
movq %r13, %rdi
leaq 0x4809(%rip), %rsi      # 0x12173
callq 0x5620
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %r13, %rdi
callq 0x50e0
leaq 0x10(%rsp), %rbx
movq %rbx, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xd9a7
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xd9ad
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 0x60(%rsp), %rdi
movq %rsp, %rsi
callq 0x53e0
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0xd9e0
callq 0x5300
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
leaq 0xc0(%rsp), %rbx
je 0xd9fc
callq 0x5300
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movq %rsp, %r12
movq %r12, %rdi
callq 0x5650
movw $0x2000, 0xb8(%rsp)     # imm = 0x2000
movq %rbx, %rdi
movq %r12, %rsi
callq 0x51d0
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
movl $0x1, %ecx
callq 0xef6a
movq %rbx, %rdi
callq 0x5470
movq %r12, %rdi
callq 0x5470
movq 0x88(%rsp), %rdx
movq %rdx, %rax
subq 0x80(%rsp), %rax
sarq $0x5, %rax
cmpq 0x128(%rsp), %rax
jae 0xdad6
leaq 0xf8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x51a0
movq 0x50(%rsp), %rax
movaps 0x40(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x40(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x50(%rsp)
movaps %xmm0, (%rsp)
movq %rax, 0x10(%rsp)
movaps %xmm1, 0x20(%rsp)
movq %rcx, 0x30(%rsp)
movq %rsp, %rdi
callq 0x6ca0
movq %r13, %rdi
callq 0x6ca0
jmp 0xdcf1
addq 0xa8(%rsp), %rax
je 0xdc45
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, 0x138(%rsp)
movq %rbp, %r14
cmpq %rax, %r15
jae 0xdb83
movq 0x80(%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 0x734c
movq %r13, %rdi
leaq 0x4627(%rip), %rsi      # 0x12173
callq 0x5620
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rsp, %rdi
callq 0x50e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xdb77
callq 0x5300
addq $0x20, %r14
decq %rbx
cmpq %rbx, %r15
jne 0xdb1c
movq %rbp, 0x130(%rsp)
movq %r13, %rbp
leaq 0xb0(%rsp), %r13
movq %r13, %rdi
callq 0x5650
movw $0x2000, 0x20(%rsp)     # imm = 0x2000
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x51d0
movq %rsp, %rbx
movq %rbx, %rdi
movq %rbp, %r12
movq %rbp, %rsi
callq 0x1016c
movq %r14, %rdi
callq 0x5470
movq %r13, %rdi
callq 0x5470
leaq 0xc8(%rsp), %rdi
movq %rbx, %rsi
callq 0x10f96
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xdbf9
callq 0x5300
incq %r15
movq 0x88(%rsp), %rdx
movq %rdx, %rax
subq 0x80(%rsp), %rax
sarq $0x5, %rax
addq 0xa8(%rsp), %rax
movq 0x138(%rsp), %rbx
incl %ebx
movq 0x130(%rsp), %rbp
addq $0x20, %rbp
cmpq %r15, %rax
movq 0xa0(%rsp), %r14
movq %r12, %r13
ja 0xdaef
movq 0x120(%rsp), %rax
leaq (%rdx,%rax), %rsi
movq %r13, %rdi
leaq 0xb0(%rsp), %rcx
callq 0xf028
movq 0x50(%rsp), %rax
movaps 0x20(%rsp), %xmm0
movq 0x30(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movaps 0x40(%rsp), %xmm1
movaps %xmm0, 0x40(%rsp)
movaps %xmm1, (%rsp)
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
xorl %r12d, %r12d
movq %r12, 0x30(%rsp)
movq %rsp, %r15
movq %r15, %rdi
callq 0x6ca0
movq %r13, %rdi
callq 0x6ca0
leaq 0x10(%rsp), %rbx
movq %rbx, (%rsp)
movq %r12, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
leaq 0xf8(%rsp), %rdi
movq %r15, %rsi
callq 0x53e0
movq (%rsp), %rdi
cmpq %rbx, %rdi
leaq 0x140(%rsp), %r15
leaq 0x8(%rsp), %rbp
je 0xdce9
callq 0x5300
leaq 0xc0(%rsp), %rbx
leaq 0x80(%rsp), %rdi
callq 0x6ca0
jmp 0xd7a8
movq 0x118(%rsp), %rbx
leaq 0x8(%rbx), %rax
movq 0xd8(%rsp), %rsi
testq %rsi, %rsi
je 0xdd78
movl 0xd0(%rsp), %ecx
movq %rsi, 0x10(%rbx)
movq 0xe0(%rsp), %rdi
movq 0xe8(%rsp), %rdx
movq %rax, 0x8(%rsi)
movq 0xf0(%rsp), %rax
movq %rax, 0x28(%rbx)
movq $0x0, 0xd8(%rsp)
leaq 0xd0(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq %rax, 0xe8(%rsp)
movq %rdi, %rax
leaq 0xf0(%rsp), %rsi
jmp 0xdd89
movq $0x0, 0x10(%rbx)
leaq 0x28(%rbx), %rsi
xorl %ecx, %ecx
movq %rax, %rdx
movq %rax, 0x18(%rbx)
movq %rdx, 0x20(%rbx)
movq $0x0, (%rsi)
movl %ecx, 0x8(%rbx)
leaq 0x40(%rsp), %rdi
callq 0x6ca0
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0xddbf
callq 0x5300
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xddd3
callq 0x5300
leaq 0x140(%rsp), %rdi
callq 0x50c0
leaq 0xc8(%rsp), %rdi
callq 0x7078
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 0xdf35
jmp 0xde65
jmp 0xde0e
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
jmp 0xde8a
jmp 0xde5b
jmp 0xde21
movq %rax, %rbx
jmp 0xdee3
movq %rbx, %rdi
movq %rax, %rbx
callq 0x5470
movq %rsp, %rdi
callq 0x5470
jmp 0xdee3
movq %rax, %rbx
movq %rbp, %rdi
callq 0x5470
leaq 0x20(%rsp), %rdi
callq 0x5470
jmp 0xdef0
movq %rax, %rbx
jmp 0xdef0
jmp 0xde6a
movq %rax, %rbx
jmp 0xde81
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xde81
callq 0x5300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xdef0
callq 0x5300
jmp 0xdef0
jmp 0xdecd
movq %rax, %rbx
movq %r14, %rdi
callq 0x5470
leaq 0xb0(%rsp), %rdi
callq 0x5470
jmp 0xded0
jmp 0xdeb4
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xded0
callq 0x5300
jmp 0xded0
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xdee3
callq 0x5300
leaq 0x80(%rsp), %rdi
callq 0x6ca0
leaq 0x40(%rsp), %rdi
callq 0x6ca0
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0xdf14
callq 0x5300
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xdf28
callq 0x5300
leaq 0x140(%rsp), %rdi
callq 0x50c0
leaq 0xc8(%rsp), %rdi
callq 0x7078
movq %rbx, %rdi
callq 0x55b0