// File: /workspace/github_c_makefile_star2_O1/perdisci[P]LSH/lsh.cpp
// Function: rp::LSH::minhash_corpus(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, bool)
void LSH::minhash_corpus(const std::string dir_name, bool keep_ngrams, bool progress) {
        
        boost::filesystem::path dir_path(dir_name);
        std::cerr << "Dir = " << dir_path.string() << std::endl;
        
        if(is_directory(dir_path)) {
            for(auto& file_name : boost::make_iterator_range(boost::filesystem::directory_iterator(dir_path), {})) {
                if(progress) std::cerr << "Processing file : " << file_name.path().filename().string() << std::endl;
                boost::timer t; // for profiling
                NGramSet ngrams = load_ngrams_from_file(file_name.path().string(), ngram_len);
                VUint32 sig = mh.minhash_universal(ngrams);
                // VUint32 sig = mh.minhash_xor(ngrams);
                if(progress) std::cerr << "Ngrams size: " << ngrams.size() << std::endl;
                if(progress) std::cerr << "Time: " << t.elapsed() << std::endl;
                /*
                std::cout << "MH sig for: " << file_name.path().filename().string() << std::endl;
                for(auto s : sig)
                    std::cout << s << " ";
                std::cout << std::endl;
                */
                mh_map.insert(std::move(std::make_pair(file_name.path().filename().string(), sig)));
                if(keep_ngrams)
                    ng_map.insert(std::move(std::make_pair(file_name.path().filename().string(),std::move(ngrams))));
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movl %ecx, 0x4(%rsp)
movl %edx, 0x2c(%rsp)
movq %rdi, 0x90(%rsp)
leaq 0xf8(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0xe8(%rsp), %rdi
movq %rax, %rsi
callq 0x833e
movq 0xcf28(%rip), %rdi      # 0x1aff0
leaq 0x5631(%rip), %rsi      # 0x13700
movl $0x6, %edx
callq 0x6380
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rdx
movq 0xcf00(%rip), %rdi      # 0x1aff0
callq 0x6380
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6310
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6030
movq %rax, %rdi
callq 0x6230
leaq 0x40(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
xorl %edx, %edx
callq 0x64c0
cmpl $0x3, 0x40(%rsp)
jne 0xe62a
leaq 0x20(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
xorl %edx, %edx
callq 0xfdb4
movq $0x0, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0xe16d
lock
incl (%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x98(%rsp)
testq %rax, %rax
je 0xe182
lock
incl (%rax)
leaq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x105aa
leaq 0x98(%rsp), %rdi
callq 0x10168
leaq 0x40(%rsp), %rdi
callq 0x10168
leaq 0x18(%rsp), %rdi
callq 0x10168
leaq 0x20(%rsp), %rdi
callq 0x10168
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0xe1d6
lock
incl (%rax)
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xe1e8
lock
incl (%rax)
movq 0x90(%rsp), %rax
leaq 0x10(%rax), %rcx
movq %rcx, 0x118(%rsp)
leaq 0x68(%rax), %rcx
movq %rcx, 0x110(%rsp)
addq $0xc8, %rax
movq %rax, 0x108(%rsp)
leaq 0x40(%rsp), %rbp
leaq 0x120(%rsp), %r12
leaq 0xc8(%rsp), %r15
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
cmpq %rax, %rcx
je 0xe5fa
testq %rcx, %rcx
je 0xe24a
cmpq $0x0, 0x38(%rcx)
jne 0xe25e
testq %rax, %rax
je 0xe5fa
cmpq $0x0, 0x38(%rax)
je 0xe5fa
leaq 0x8(%rsp), %rdi
callq 0x10550
movq %rax, %r13
cmpb $0x0, 0x4(%rsp)
je 0xe2e9
movl $0x12, %edx
movq 0xcd72(%rip), %rdi      # 0x1aff0
leaq 0x5482(%rip), %rsi      # 0x13707
callq 0x6380
movq %rbp, %rdi
movq %r13, %rsi
callq 0x62d0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0xcd4a(%rip), %rdi      # 0x1aff0
callq 0x6380
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6310
movsbl %al, %esi
movq %r14, %rdi
callq 0x6030
movq %rax, %rdi
callq 0x6230
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xe2e9
callq 0x6300
callq 0x6210
movq %rax, %r14
leaq 0x130(%rsp), %rax
movq %rax, 0x120(%rsp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
movq %r12, %rbx
movq %r12, %rdi
callq 0x833e
movq 0x90(%rsp), %rax
movl 0x8(%rax), %edx
leaq 0x98(%rsp), %rdi
movq %rbx, %rsi
callq 0xe776
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0xe34c
callq 0x6300
leaq 0x140(%rsp), %rdi
movq 0x118(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0xc920
cmpb $0x0, 0x4(%rsp)
je 0xe434
movl $0xd, %edx
movq 0xcc70(%rip), %rdi      # 0x1aff0
leaq 0x5393(%rip), %rsi      # 0x1371a
callq 0x6380
movq 0xc0(%rsp), %rsi
movq 0xcc55(%rip), %rdi      # 0x1aff0
callq 0x6220
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6310
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6030
movq %rax, %rdi
callq 0x6230
cmpb $0x0, 0x4(%rsp)
je 0xe434
movl $0x6, %edx
movq 0xcc13(%rip), %rdi      # 0x1aff0
leaq 0x5344(%rip), %rsi      # 0x13728
callq 0x6380
callq 0x6210
subq %r14, %rax
cvtsi2sd %rax, %xmm0
divsd 0x52f2(%rip), %xmm0     # 0x136f0
movq 0xcbeb(%rip), %rdi      # 0x1aff0
callq 0x6500
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6310
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6030
movq %rax, %rdi
callq 0x6230
movq %r15, %rbx
movq %r15, %rdi
movq %r13, %rsi
callq 0x62d0
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x140(%rsp), %rdx
callq 0x101b0
movq 0x110(%rsp), %rdi
movq %rbp, %rsi
callq 0x10608
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xe474
callq 0x6300
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xe488
callq 0x6300
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xe4a2
callq 0x6300
cmpb $0x0, 0x2c(%rsp)
je 0xe5ca
movq %r15, %rdi
movq %r13, %rsi
callq 0x62d0
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x833e
movq 0xa8(%rsp), %rax
testq %rax, %rax
je 0xe550
movl 0xa0(%rsp), %ecx
movl %ecx, 0x68(%rsp)
movq %rax, 0x70(%rsp)
movupd 0xb0(%rsp), %xmm0
movupd %xmm0, 0x78(%rsp)
leaq 0x68(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0xc0(%rsp), %rax
movq %rax, 0x88(%rsp)
movq $0x0, 0xa8(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq %rax, 0xb8(%rsp)
leaq 0xc0(%rsp), %rax
jmp 0xe57b
movl $0x0, 0x68(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x68(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rax
movq $0x0, (%rax)
movq 0x108(%rsp), %rdi
movq %rbp, %rsi
callq 0x10806
leaq 0x60(%rsp), %rdi
callq 0x807c
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xe5b0
callq 0x6300
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xe5ca
callq 0x6300
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0xe5dc
callq 0x6300
leaq 0x98(%rsp), %rdi
callq 0x807c
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x6430
jmp 0xe22b
leaq 0x10(%rsp), %rdi
callq 0x10168
leaq 0x8(%rsp), %rdi
callq 0x10168
leaq 0x38(%rsp), %rdi
callq 0x10168
leaq 0x30(%rsp), %rdi
callq 0x10168
leaq 0xf8(%rsp), %r14
movq 0xe8(%rsp), %rdi
cmpq %r14, %rdi
je 0xe63c
callq 0x6300
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x10168
leaq 0x40(%rsp), %rdi
callq 0x10168
leaq 0x18(%rsp), %rdi
callq 0x10168
leaq 0x20(%rsp), %rdi
jmp 0xe74f
jmp 0xe698
jmp 0xe70a
jmp 0xe6b1
jmp 0xe6b1
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xfe0a
jmp 0xe6b9
jmp 0xe6b6
movq %rax, %rbx
jmp 0xe754
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xfde4
jmp 0xe6b9
jmp 0xe6b1
movq %rax, %rbx
jmp 0xe72c
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xe70d
callq 0x6300
jmp 0xe70d
movq %rax, %rbx
jmp 0xe71f
jmp 0xe70a
movq %rax, %rbx
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
jmp 0xe6fe
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xe72c
callq 0x6300
jmp 0xe72c
movq %rax, %rbx
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0xe71f
callq 0x6300
leaq 0x98(%rsp), %rdi
callq 0x807c
leaq 0x10(%rsp), %rdi
callq 0x10168
leaq 0x8(%rsp), %rdi
callq 0x10168
leaq 0x38(%rsp), %rdi
callq 0x10168
leaq 0x30(%rsp), %rdi
callq 0x10168
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0xe76e
callq 0x6300
movq %rbx, %rdi
callq 0x65b0