// File: /workspace/github_c_makefile_star2_O3/perdisci[P]LSH/lsh.cpp
// Function: rp::LSH::compute_ngram_similarities(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, 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::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>> 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_ngram_similarities(const CorpusNGramsMap& ng_map, const std::vector<CandidatePair>& cpv) {
        
        std::vector<float> js_vect;
        
        for(CandidatePair cp : cpv) {
            std::set<std::string> v1 = ng_map.at(cp.first);
            std::set<std::string> v2 = ng_map.at(cp.second);
            
            std::vector<std::string> v_int;
            std::vector<std::string> v_uni;
            std::set_intersection(v1.begin(), v1.end(),
                                  v2.begin(), v2.end(),
                                  std::back_inserter(v_int));
            std::set_union(v1.begin(), v1.end(),
                           v2.begin(), v2.end(),
                           std::back_inserter(v_uni));
            
            float js = float(v_int.size())/v_uni.size(); // 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 $0x128, %rsp            # imm = 0x128
movq %rsi, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rdx), %rsi
movq 0x8(%rdx), %rax
movq %rax, 0x78(%rsp)
cmpq %rax, %rsi
je 0xebc2
movq %rdi, 0x70(%rsp)
leaq 0x90(%rsp), %r13
leaq 0xb8(%rsp), %rbx
leaq 0xf8(%rsp), %r14
movq %rbx, %rdi
movq %rsi, 0x80(%rsp)
callq 0x8e46
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xeec2
movq %r14, %rdi
movq %rax, %rsi
callq 0xf236
movq %rbx, %r12
movq %r13, %rbx
movq %rbp, %r15
movq %rbp, %rdi
leaq 0xd8(%rsp), %rsi
callq 0xeec2
leaq 0x88(%rsp), %rdi
movq %rax, %rsi
callq 0xf236
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x60(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq 0x110(%rsp), %rdi
movq 0xa0(%rsp), %rdx
leaq 0x100(%rsp), %r13
movq %r13, %rsi
movq %rbx, %rbp
movq %rbx, %rcx
leaq 0x50(%rsp), %r8
callq 0xffad
movq 0x110(%rsp), %rdi
movq 0xa0(%rsp), %rdx
movq %r13, %rsi
movq %rbp, %rcx
leaq 0x30(%rsp), %r8
callq 0x10058
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
sarq $0x5, %rax
js 0xeabc
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xead4
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
movq %rbx, %r13
movq %r12, %rbx
movq %r15, %rbp
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
sarq $0x5, %rax
js 0xeaf4
cvtsi2ss %rax, %xmm1
jmp 0xeb09
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xeb2e
movss %xmm0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xeb3d
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xfe4e
leaq 0x30(%rsp), %rdi
callq 0x6ca0
leaq 0x50(%rsp), %rdi
callq 0x6ca0
leaq 0x88(%rsp), %rdi
callq 0x7078
movq %r14, %rdi
callq 0x7078
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0xeb80
callq 0x5300
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xeb9a
callq 0x5300
movq 0x80(%rsp), %rsi
addq $0x40, %rsi
cmpq 0x78(%rsp), %rsi
jne 0xe9ef
movaps 0x10(%rsp), %xmm0
movq 0x20(%rsp), %rax
movq 0x70(%rsp), %rdi
jmp 0xebc4
xorl %eax, %eax
movups %xmm0, (%rdi)
movq %rax, 0x10(%rdi)
movq %rdi, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xebf1
movq %rax, %rbx
jmp 0xec2f
movq %rax, %rbx
jmp 0xec22
movq %rax, %rbx
jmp 0xec15
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6ca0
leaq 0x50(%rsp), %rdi
callq 0x6ca0
leaq 0x88(%rsp), %rdi
callq 0x7078
leaq 0xf8(%rsp), %rdi
callq 0x7078
leaq 0xb8(%rsp), %rdi
callq 0xee1c
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xec3e
callq 0x5300
movq %rbx, %rdi
callq 0x55b0