// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x508, %rsp            # imm = 0x508
movq %rsi, 0x70(%rsp)
movq %rdi, 0x60(%rsp)
movq %rdi, %rax
movq %rax, 0x68(%rsp)
movq %rdi, 0x500(%rsp)
movq %rsi, 0x4f8(%rsp)
movl %edx, 0x4f4(%rsp)
movl 0x4f4(%rsp), %eax
movl %eax, 0x4f0(%rsp)
leaq 0x4c0(%rsp), %rdi
callq 0x25860
movq 0x70(%rsp), %rsi
leaq 0x2b8(%rsp), %rdi
movl $0x8, %edx
callq 0x8750
jmp 0x22784
leaq 0x288(%rsp), %rdi
callq 0x8680
leaq 0x268(%rsp), %rdi
callq 0x8680
leaq 0x250(%rsp), %rdi
callq 0x15360
leaq 0x2b8(%rsp), %rdi
leaq 0x288(%rsp), %rsi
callq 0x80a0
movq %rax, 0x58(%rsp)
jmp 0x227c7
movq 0x58(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x85a0
movb %al, 0x57(%rsp)
jmp 0x227e1
movb 0x57(%rsp), %al
testb $0x1, %al
jne 0x227ee
jmp 0x22f3a
leaq 0x248(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x8910
movq 0x48(%rsp), %rsi
leaq 0x288(%rsp), %rdi
callq 0x25870
jmp 0x22814
leaq 0x248(%rsp), %rdi
callq 0x86a0
leaq 0x288(%rsp), %rdi
callq 0x8700
cmpq $0x0, %rax
jne 0x22891
jmp 0x227ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0x22fce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0x22f9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x248(%rsp), %rdi
callq 0x86a0
jmp 0x22f9a
cmpl $0x1, 0x4f0(%rsp)
jbe 0x229fd
leaq 0x250(%rsp), %rdi
callq 0xf160
testb $0x1, %al
jne 0x229fd
leaq 0x228(%rsp), %rdi
callq 0x8680
movl $0x1, 0x224(%rsp)
movslq 0x224(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x250(%rsp), %rdi
callq 0xf8c0
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
jae 0x22998
movslq 0x224(%rsp), %rsi
leaq 0x250(%rsp), %rdi
callq 0x25340
movq %rax, %rsi
leaq 0xf841(%rip), %rdx      # 0x32157
leaq 0x200(%rsp), %rdi
callq 0xe1b0
jmp 0x22925
leaq 0x228(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x85c0
jmp 0x2293c
leaq 0x200(%rsp), %rdi
callq 0x8928
movl 0x224(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x224(%rsp)
jmp 0x228cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0x229eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x200(%rsp), %rdi
callq 0x8928
jmp 0x229eb
leaq 0x1e0(%rsp), %rdi
leaq 0x228(%rsp), %rsi
leaq 0x288(%rsp), %rdx
callq 0x258e0
jmp 0x229b7
leaq 0x288(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x8570
leaq 0x1e0(%rsp), %rdi
callq 0x8928
leaq 0x228(%rsp), %rdi
callq 0x8928
jmp 0x22aa8
leaq 0x228(%rsp), %rdi
callq 0x8928
jmp 0x22f9a
leaq 0x268(%rsp), %rdi
callq 0x8790
testb $0x1, %al
jne 0x22aa6
leaq 0xf73e(%rip), %rdx      # 0x32157
leaq 0x1a0(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0xe1b0
jmp 0x22a30
leaq 0x1c0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
leaq 0x288(%rsp), %rdx
callq 0xe030
jmp 0x22a4f
leaq 0x288(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x8570
leaq 0x1c0(%rsp), %rdi
callq 0x8928
leaq 0x1a0(%rsp), %rdi
callq 0x8928
jmp 0x22aa6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x1a0(%rsp), %rdi
callq 0x8928
jmp 0x22f9a
jmp 0x22aa8
leaq 0x188(%rsp), %rdi
callq 0x15360
leaq 0x170(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x8910
movq 0x38(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0x25a50
jmp 0x22adb
leaq 0x188(%rsp), %rdi
leaq 0x288(%rsp), %rsi
leaq 0x178(%rsp), %rdx
movl $0x1, %ecx
callq 0x25970
jmp 0x22aff
leaq 0x178(%rsp), %rdi
callq 0x25a80
leaq 0x170(%rsp), %rdi
callq 0x86a0
leaq 0x188(%rsp), %rdi
callq 0xf8c0
movl 0x4f0(%rsp), %ecx
cmpq %rcx, %rax
jb 0x22eb3
movl $0x0, 0x16c(%rsp)
movslq 0x16c(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x188(%rsp), %rdi
callq 0xf8c0
movq %rax, %rcx
movq 0x30(%rsp), %rax
movl 0x4f0(%rsp), %edx
subq %rdx, %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0x22d63
leaq 0x148(%rsp), %rdi
callq 0x8680
movl 0x16c(%rsp), %eax
movl %eax, 0x144(%rsp)
movl 0x144(%rsp), %eax
movl 0x16c(%rsp), %ecx
addl 0x4f0(%rsp), %ecx
cmpl %ecx, %eax
jae 0x22ca2
movslq 0x144(%rsp), %rsi
leaq 0x188(%rsp), %rdi
callq 0x25340
movq %rax, %rsi
leaq 0xf586(%rip), %rdx      # 0x32157
leaq 0x120(%rsp), %rdi
callq 0xe1b0
jmp 0x22be0
leaq 0x148(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x85c0
jmp 0x22bf7
leaq 0x120(%rsp), %rdi
callq 0x8928
movl 0x144(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x144(%rsp)
jmp 0x22b95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0x22c51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x25a80
leaq 0x170(%rsp), %rdi
callq 0x86a0
jmp 0x22f2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0x22d51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x8928
jmp 0x22d51
leaq 0x118(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x8910
movq 0x28(%rsp), %rsi
leaq 0x148(%rsp), %rdi
callq 0x25870
jmp 0x22cc8
leaq 0x118(%rsp), %rdi
callq 0x86a0
leaq 0x4c0(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x25aa0
movb %dl, 0x1f(%rsp)
movq %rax, 0x20(%rsp)
jmp 0x22cf5
movb 0x1f(%rsp), %al
movq 0x20(%rsp), %rcx
movq %rcx, 0x108(%rsp)
movb %al, 0x110(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x8928
movl 0x16c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x16c(%rsp)
jmp 0x22b41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x86a0
leaq 0x148(%rsp), %rdi
callq 0x8928
jmp 0x22f2b
leaq 0x188(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x156a0
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x25b00
movq 0x8(%rsp), %rdi
callq 0x156a0
movq %rax, 0xe0(%rsp)
movl 0x4f0(%rsp), %eax
movl %eax, %esi
leaq 0xe0(%rsp), %rdi
callq 0x25b40
movq %rax, 0xe8(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x25b00
movq 0xf0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0xb8(%rsp)
leaq 0xb7(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x152b0
movq 0x10(%rsp), %rcx
movq 0xc0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x25b90
jmp 0x22e2d
leaq 0x250(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x25c20
leaq 0xc8(%rsp), %rdi
callq 0xa7e0
leaq 0xb7(%rsp), %rdi
callq 0x15350
leaq 0x90(%rsp), %rdi
callq 0x8680
leaq 0x268(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x8570
leaq 0x90(%rsp), %rdi
callq 0x8928
jmp 0x22f19
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0xb7(%rsp), %rdi
callq 0x15350
jmp 0x22f2b
leaq 0x268(%rsp), %rdi
leaq 0x288(%rsp), %rsi
callq 0x8040
jmp 0x22eca
leaq 0x78(%rsp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x8220
leaq 0x78(%rsp), %rdi
callq 0x15360
leaq 0x250(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x25c20
leaq 0x78(%rsp), %rdi
callq 0xa7e0
jmp 0x22f19
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0x22f2b
leaq 0x188(%rsp), %rdi
callq 0xa7e0
jmp 0x227ab
leaq 0x188(%rsp), %rdi
callq 0xa7e0
jmp 0x22f9a
movq 0x60(%rsp), %rdi
leaq 0x4c0(%rsp), %rsi
callq 0x25c60
leaq 0x250(%rsp), %rdi
callq 0xa7e0
leaq 0x268(%rsp), %rdi
callq 0x8928
leaq 0x288(%rsp), %rdi
callq 0x8928
leaq 0x2b8(%rsp), %rdi
callq 0x8100
leaq 0x4c0(%rsp), %rdi
callq 0xc240
movq 0x68(%rsp), %rax
addq $0x508, %rsp            # imm = 0x508
retq
leaq 0x250(%rsp), %rdi
callq 0xa7e0
leaq 0x268(%rsp), %rdi
callq 0x8928
leaq 0x288(%rsp), %rdi
callq 0x8928
leaq 0x2b8(%rsp), %rdi
callq 0x8100
leaq 0x4c0(%rsp), %rdi
callq 0xc240
movq 0x2b0(%rsp), %rdi
callq 0x8820
nopl (%rax,%rax)