// File: /workspace/github_c_makefile_star2_O3/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, 0xc0(%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 0x734c
movq 0xcfe6(%rip), %rdi      # 0x19ff0
leaq 0x56ef(%rip), %rsi      # 0x12700
movl $0x6, %edx
callq 0x5380
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rdx
movq 0xcfbe(%rip), %rdi      # 0x19ff0
callq 0x5380
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5310
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5230
leaq 0x40(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
xorl %edx, %edx
callq 0x54c0
cmpl $0x3, 0x40(%rsp)
jne 0xd578
leaq 0x20(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
xorl %edx, %edx
callq 0xecb4
movq $0x0, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0xd0c6
lock
incl (%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0xd0d2
lock
incl (%rax)
jmp 0xd0d2
movq $0x0, 0x90(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0xf444
leaq 0x90(%rsp), %rdi
callq 0xf062
leaq 0x40(%rsp), %rdi
callq 0xf062
leaq 0x18(%rsp), %rdi
callq 0xf062
leaq 0x20(%rsp), %rdi
callq 0xf062
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0xd126
lock
incl (%rax)
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xd138
lock
incl (%rax)
movq 0xc0(%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), %r14
leaq 0x120(%rsp), %rbp
leaq 0xc8(%rsp), %r12
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %rax
cmpq %rax, %rbx
je 0xd548
testq %rbx, %rbx
je 0xd19a
cmpq $0x0, 0x38(%rbx)
jne 0xd1c2
testq %rax, %rax
je 0xd548
cmpq $0x0, 0x38(%rax)
je 0xd548
testq %rbx, %rbx
je 0xd59c
cmpq $0x0, 0x38(%rbx)
je 0xd59c
leaq 0x8(%rbx), %r13
cmpb $0x0, 0x4(%rsp)
je 0xd244
movl $0x12, %edx
movq 0xce17(%rip), %rdi      # 0x19ff0
leaq 0x5527(%rip), %rsi      # 0x12707
callq 0x5380
movq %r14, %rdi
movq %r13, %rsi
callq 0x52d0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0xcdef(%rip), %rdi      # 0x19ff0
callq 0x5380
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5310
movsbl %al, %esi
movq %r15, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5230
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xd244
callq 0x5300
callq 0x5210
movq %rax, %r15
leaq 0x130(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
movq %rbp, %rbx
movq %rbp, %rdi
callq 0x734c
movq 0xc0(%rsp), %rax
movl 0x8(%rax), %edx
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0xd6e0
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0xd2a7
callq 0x5300
leaq 0x140(%rsp), %rdi
movq 0x118(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0xb84c
cmpb $0x0, 0x4(%rsp)
je 0xd388
movl $0xd, %edx
movq 0xcd15(%rip), %rdi      # 0x19ff0
leaq 0x5438(%rip), %rsi      # 0x1271a
callq 0x5380
movq 0xb8(%rsp), %rsi
movq 0xccfa(%rip), %rdi      # 0x19ff0
callq 0x5220
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5310
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5230
movl $0x6, %edx
movq 0xccbf(%rip), %rdi      # 0x19ff0
leaq 0x53f0(%rip), %rsi      # 0x12728
callq 0x5380
callq 0x5210
subq %r15, %rax
cvtsi2sd %rax, %xmm0
divsd 0x539e(%rip), %xmm0     # 0x126f0
movq 0xcc97(%rip), %rdi      # 0x19ff0
callq 0x5500
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5310
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5230
movq %r12, %rbx
movq %r12, %rdi
movq %r13, %rsi
callq 0x52d0
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x140(%rsp), %rdx
callq 0xf0aa
movq 0x110(%rsp), %rdi
movq %r14, %rsi
callq 0xf4a2
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xd3c8
callq 0x5300
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xd3dc
callq 0x5300
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xd3f6
callq 0x5300
cmpb $0x0, 0x2c(%rsp)
je 0xd518
movq %r12, %rdi
movq %r13, %rsi
callq 0x52d0
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x734c
movq 0xa0(%rsp), %rcx
testq %rcx, %rcx
je 0xd4a0
movl 0x98(%rsp), %eax
movq %rcx, 0x70(%rsp)
movupd 0xa8(%rsp), %xmm0
movupd %xmm0, 0x78(%rsp)
leaq 0x68(%rsp), %rdx
movq %rdx, 0x8(%rcx)
movq 0xb8(%rsp), %rcx
movq %rcx, 0x88(%rsp)
movq $0x0, 0xa0(%rsp)
leaq 0x98(%rsp), %rcx
movq %rcx, 0xa8(%rsp)
movq %rcx, 0xb0(%rsp)
leaq 0xb8(%rsp), %rcx
jmp 0xd4c5
movq $0x0, 0x70(%rsp)
leaq 0x68(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %rax, 0x80(%rsp)
xorl %eax, %eax
leaq 0x88(%rsp), %rcx
movq $0x0, (%rcx)
movl %eax, 0x68(%rsp)
movq 0x108(%rsp), %rdi
movq %r14, %rsi
callq 0xf6a0
leaq 0x60(%rsp), %rdi
callq 0x7078
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xd4fe
callq 0x5300
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xd518
callq 0x5300
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0xd52a
callq 0x5300
leaq 0x90(%rsp), %rdi
callq 0x7078
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x5430
jmp 0xd17b
leaq 0x10(%rsp), %rdi
callq 0xf062
leaq 0x8(%rsp), %rdi
callq 0xf062
leaq 0x38(%rsp), %rdi
callq 0xf062
leaq 0x30(%rsp), %rdi
callq 0xf062
leaq 0xf8(%rsp), %r14
movq 0xe8(%rsp), %rdi
cmpq %r14, %rdi
je 0xd58a
callq 0x5300
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x521c(%rip), %rdi      # 0x127bf
leaq 0x5254(%rip), %rsi      # 0x127fe
leaq 0x5279(%rip), %rcx      # 0x1282a
movl $0x140, %edx            # imm = 0x140
callq 0x5200
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xf062
leaq 0x40(%rsp), %rdi
callq 0xf062
leaq 0x18(%rsp), %rdi
callq 0xf062
leaq 0x20(%rsp), %rdi
jmp 0xd6b9
jmp 0xd602
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xed0a
jmp 0xd63f
jmp 0xd63c
jmp 0xd674
jmp 0xd622
jmp 0xd622
movq %rax, %rbx
jmp 0xd6be
jmp 0xd622
jmp 0xd674
movq %rax, %rbx
jmp 0xd689
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xece4
jmp 0xd63f
movq %rax, %rbx
jmp 0xd696
movq %rax, %rbx
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
jmp 0xd668
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xd677
callq 0x5300
jmp 0xd677
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xd696
callq 0x5300
jmp 0xd696
movq %rax, %rbx
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0xd689
callq 0x5300
leaq 0x90(%rsp), %rdi
callq 0x7078
leaq 0x10(%rsp), %rdi
callq 0xf062
leaq 0x8(%rsp), %rdi
callq 0xf062
leaq 0x38(%rsp), %rdi
callq 0xf062
leaq 0x30(%rsp), %rdi
callq 0xf062
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0xd6d8
callq 0x5300
movq %rbx, %rdi
callq 0x55b0