// File: /workspace/github_c_makefile_star2_O2/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 $0x168, %rsp            # imm = 0x168
movl %ecx, 0xc(%rsp)
movl %edx, 0x2c(%rsp)
movq %rdi, 0x30(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x6430
movq 0xd7b7(%rip), %rdi      # 0x19ff0
leaq 0x4e80(%rip), %rsi      # 0x116c0
callq 0x6310
leaq 0x70(%rsp), %rsi
movq %rax, %rdi
callq 0x62e0
movq %rax, %rdi
callq 0x6170
leaq 0x70(%rsp), %rdi
callq 0xdb3b
testb %al, %al
je 0xcad6
leaq 0x20(%rsp), %rdi
leaq 0x70(%rsp), %rsi
xorl %edx, %edx
callq 0xdbce
leaq 0x38(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xdb5e
leaq 0x38(%rsp), %rdi
callq 0xdf9c
leaq 0x20(%rsp), %rdi
callq 0xdf9c
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0xc8bb
lock
incl (%rax)
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xc8cd
lock
incl (%rax)
movq 0x30(%rsp), %rax
leaq 0x10(%rax), %rcx
movq %rcx, 0x60(%rsp)
leaq 0x68(%rax), %rcx
movq %rcx, 0x58(%rsp)
addq $0xc8, %rax
movq %rax, 0x50(%rsp)
leaq 0x18(%rsp), %r12
leaq 0x118(%rsp), %rbp
leaq 0xe8(%rsp), %r15
leaq 0xa8(%rsp), %rbx
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0xdbfb
testb %al, %al
je 0xcab8
movq %r12, %rdi
callq 0xe418
movq %rax, %r13
cmpb $0x0, 0xc(%rsp)
je 0xc96f
movq 0xd6b6(%rip), %rdi      # 0x19ff0
leaq 0x4d86(%rip), %rsi      # 0x116c7
callq 0x6310
movq %rax, %r14
movq %rbp, %rdi
movq %r13, %rsi
callq 0x62c0
movq %r14, %rdi
movq %rbp, %rsi
callq 0x62e0
movq %rax, %rdi
callq 0x6170
movq %rbp, %rdi
callq 0x6658
callq 0x6220
movq %rax, 0x68(%rsp)
leaq 0xc8(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x6430
movq 0x30(%rsp), %rax
movl 0x8(%rax), %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0xcbd0
movq %r14, %rdi
callq 0x6658
leaq 0x90(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq %r15, %rdx
callq 0xb2e2
cmpb $0x0, 0xc(%rsp)
je 0xca1e
movq 0xd626(%rip), %rdi      # 0x19ff0
leaq 0x4d09(%rip), %rsi      # 0x116da
callq 0x6310
movq 0x110(%rsp), %rsi
movq %rax, %rdi
callq 0x6230
movq %rax, %rdi
callq 0x6170
movq 0xd5fb(%rip), %rdi      # 0x19ff0
leaq 0x4cec(%rip), %rsi      # 0x116e8
callq 0x6310
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0xdc06
movq %r14, %rdi
callq 0x64f0
movq %rax, %rdi
callq 0x6170
movq %rbx, %rdi
movq %r13, %rsi
callq 0x62c0
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x90(%rsp), %rdx
callq 0xdfe0
movq 0x58(%rsp), %rdi
movq %rbp, %rsi
callq 0xe524
movq %rbp, %rdi
callq 0xdc22
movq %rbx, %rdi
callq 0x6658
cmpb $0x0, 0x2c(%rsp)
je 0xca96
movq %rbx, %rdi
movq %r13, %rsi
callq 0x62c0
movq %rbp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xe016
movq 0x50(%rsp), %rdi
movq %rbp, %rsi
callq 0xe6e2
movq %rbp, %rdi
callq 0xdc38
movq %rbx, %rdi
callq 0x6658
leaq 0x90(%rsp), %rdi
callq 0x781e
movq %r15, %rdi
callq 0x792e
movq %r12, %rdi
callq 0xe51c
jmp 0xc90c
leaq 0x10(%rsp), %rdi
callq 0xdf9c
leaq 0x18(%rsp), %rdi
callq 0xdf9c
leaq 0x40(%rsp), %rdi
callq 0xdc4e
leaq 0x70(%rsp), %rdi
callq 0x6658
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xdf9c
leaq 0x20(%rsp), %rdi
callq 0xdf9c
jmp 0xcbbe
jmp 0xcb10
movq %rax, %rbx
jmp 0xcbbe
jmp 0xcb7e
jmp 0xcb6c
jmp 0xcb7e
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0xdc38
jmp 0xcb6f
jmp 0xcb83
jmp 0xcb7e
jmp 0xcb83
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0xcb65
movq %rax, %rbx
jmp 0xcb93
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0xdc22
jmp 0xcb6f
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x6658
jmp 0xcba0
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x6658
jmp 0xcb86
movq %rax, %rbx
jmp 0xcba0
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x781e
leaq 0xe8(%rsp), %rdi
callq 0x792e
leaq 0x10(%rsp), %rdi
callq 0xdf9c
leaq 0x18(%rsp), %rdi
callq 0xdf9c
leaq 0x40(%rsp), %rdi
callq 0xdc4e
leaq 0x70(%rsp), %rdi
callq 0x6658
movq %rbx, %rdi
callq 0x65a0