// File: /workspace/github_c_makefile_star2_O3/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
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 0xe8d5
movq %rdi, 0x30(%rsp)
leaq 0x68(%rsp), %r12
leaq 0x48(%rsp), %r13
leaq 0xb8(%rsp), %rbx
movq %r13, %rdi
movq %rsi, 0x40(%rsp)
callq 0x8e46
movq %r14, %rdi
movq %r13, %rsi
callq 0xed6a
movq (%rax), %rbp
movq %r14, %rdi
movq %r13, %rsi
callq 0xed6a
movq 0x8(%rax), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xee46
movq %r14, %rdi
movq %r12, %rsi
callq 0xed6a
movq (%rax), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0xed6a
movq 0x8(%rax), %rdx
leaq 0x88(%rsp), %rdi
movq %rbp, %rsi
callq 0xee46
xorl %ebx, %ebx
xorl %ebp, %ebp
movq %r14, %rdi
movq %r13, %rsi
callq 0xed6a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
jbe 0xe7fc
movq %r14, %rdi
movq %r13, %rsi
callq 0xed6a
movq (%rax), %rax
movl (%rax,%rbx,4), %r15d
movq %r14, %rdi
movq %r12, %rsi
callq 0xed6a
movq (%rax), %rax
xorl %ecx, %ecx
cmpl (%rax,%rbx,4), %r15d
sete %cl
addl %ecx, %ebp
incq %rbx
jmp 0xe7b1
movq %r14, %rdi
movq %r13, %rsi
callq 0xed6a
leaq 0xb8(%rsp), %rbx
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
js 0xe823
cvtsi2ss %rcx, %xmm0
jmp 0xe838
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 0xe864
movss %xmm1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xe873
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xfe4e
leaq 0x88(%rsp), %rdi
callq 0xf1ec
movq %rbx, %rdi
callq 0xf1ec
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xe89c
callq 0x5300
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xe8b0
callq 0x5300
movq 0x40(%rsp), %rsi
addq $0x40, %rsi
cmpq 0x38(%rsp), %rsi
jne 0xe74b
movaps 0x10(%rsp), %xmm0
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rdi
jmp 0xe8d7
xorl %eax, %eax
movups %xmm0, (%rdi)
movq %rax, 0x10(%rdi)
movq %rdi, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xe92b
jmp 0xe904
movq %rax, %rbx
jmp 0xe921
movq %rax, %rbx
jmp 0xe914
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xf1ec
leaq 0xb8(%rsp), %rdi
callq 0xf1ec
leaq 0x48(%rsp), %rdi
callq 0xee1c
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xe93a
callq 0x5300
movq %rbx, %rdi
callq 0x55b0