// File: /workspace/github_c_makefile_star2_O1/perdisci[P]LSH/lsh.cpp
// Function: rp::LSH::compute_minhash_similarities(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<unsigned int, std::allocator<unsigned int>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::vector<unsigned int, std::allocator<unsigned int>>>>> const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&)
std::vector<float> LSH::compute_minhash_similarities(const MinHashMap& mh_map, const std::vector<CandidatePair>& cpv) {
        
        std::vector<float> js_vect;
        
        for(CandidatePair cp : cpv) {
            std::set<std::uint32_t> v1(mh_map.at(cp.first).begin(),mh_map.at(cp.first).end());
            std::set<std::uint32_t> v2(mh_map.at(cp.second).begin(),mh_map.at(cp.second).end());
            
            unsigned common = 0;
            for(int i=0; i<mh_map.at(cp.first).size(); i++)
                if(mh_map.at(cp.first)[i] == mh_map.at(cp.second)[i])
                    common++;
            
            
            float js = float(common)/mh_map.at(cp.first).size(); // minhash-based Jaccard similarity
            js_vect.push_back(js);
        }
        
        return std::move(js_vect);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %r14
movq %rdi, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rdx), %rsi
movq 0x8(%rdx), %rax
movq %rax, 0x38(%rsp)
cmpq %rax, %rsi
je 0xf9a4
leaq 0x68(%rsp), %r12
leaq 0x48(%rsp), %r13
leaq 0xb8(%rsp), %rbx
movq %r13, %rdi
movq %rsi, 0x40(%rsp)
callq 0x9e7c
movq %r14, %rdi
movq %r13, %rsi
callq 0xfe6a
movq (%rax), %rbp
movq %r14, %rdi
movq %r13, %rsi
callq 0xfe6a
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xff46
movq %r14, %rdi
movq %r12, %rsi
callq 0xfe6a
movq (%rax), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0xfe6a
movq 0x8(%rax), %rdx
leaq 0x88(%rsp), %rdi
movq %rbp, %rsi
callq 0xff46
xorl %ebx, %ebx
xorl %ebp, %ebp
movq %r14, %rdi
movq %r13, %rsi
callq 0xfe6a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
jbe 0xf8dc
movq %r14, %rdi
movq %r13, %rsi
callq 0xfe6a
movq (%rax), %rax
movl (%rax,%rbx,4), %r15d
movq %r14, %rdi
movq %r12, %rsi
callq 0xfe6a
movq (%rax), %rax
xorl %ecx, %ecx
cmpl (%rax,%rbx,4), %r15d
sete %cl
addl %ecx, %ebp
incq %rbx
jmp 0xf891
movq %r14, %rdi
movq %r13, %rsi
callq 0xfe6a
leaq 0xb8(%rsp), %rbx
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
js 0xf903
cvtsi2ss %rcx, %xmm0
jmp 0xf918
movq %rcx, %rax
shrq %rax
andl $0x1, %ecx
orq %rax, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
movl %ebp, %eax
cvtsi2ss %rax, %xmm1
divss %xmm0, %xmm1
movss %xmm1, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xf944
movss %xmm1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xf953
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x10ff4
leaq 0x88(%rsp), %rdi
callq 0x102f8
movq %rbx, %rdi
callq 0x102f8
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xf97c
callq 0x6300
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xf990
callq 0x6300
movq 0x40(%rsp), %rsi
addq $0x40, %rsi
cmpq 0x38(%rsp), %rsi
jne 0xf82b
movaps 0x10(%rsp), %xmm0
movq 0x30(%rsp), %rax
movups %xmm0, (%rax)
movq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rax)
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xfa04
jmp 0xf9dd
movq %rax, %rbx
jmp 0xf9fa
movq %rax, %rbx
jmp 0xf9ed
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x102f8
leaq 0xb8(%rsp), %rdi
callq 0x102f8
leaq 0x48(%rsp), %rdi
callq 0xff1c
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xfa13
callq 0x6300
movq %rbx, %rdi
callq 0x65b0
nop