// File: /workspace/github_c_makefile_star2_O2/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 $0x118, %rsp            # imm = 0x118
movq %rsi, %rbp
movq %rdi, 0x48(%rsp)
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %rax
andq $0x0, 0x10(%rax)
movaps %xmm0, (%rax)
movq (%rdx), %rsi
movq 0x8(%rdx), %rax
movq %rax, 0x50(%rsp)
leaq 0x80(%rsp), %rbx
leaq 0xd8(%rsp), %r14
leaq 0xa8(%rsp), %r15
cmpq 0x50(%rsp), %rsi
je 0xda19
movq %r14, %rdi
movq %rsi, 0x58(%rsp)
callq 0x90d8
movq %rbp, %rdi
movq %r14, %rsi
callq 0xddb2
movq %r15, %rdi
movq %rax, %rsi
callq 0xe1f2
movq %r15, %r13
movq %rbx, %r15
movq %rbp, %r12
movq %rbp, %rdi
leaq 0xf8(%rsp), %rsi
callq 0xddb2
leaq 0x78(%rsp), %rdi
movq %rax, %rsi
callq 0xe1f2
andq $0x0, 0x40(%rsp)
andq $0x0, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x10(%rsp)
movq 0xc0(%rsp), %rdi
movq 0x90(%rsp), %rdx
leaq 0xb0(%rsp), %rbx
movq %rbx, %rsi
movq %r15, %rbp
movq %r15, %rcx
leaq 0x30(%rsp), %r8
callq 0xf000
movq 0xc0(%rsp), %rdi
movq 0x90(%rsp), %rdx
movq %rbx, %rsi
movq %rbp, %rcx
leaq 0x10(%rsp), %r8
callq 0xf090
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
sarq $0x5, %rax
js 0xd97a
cvtsi2ss %rax, %xmm0
jmp 0xd98f
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
movq %r15, %rbx
movq %r13, %r15
movq %r12, %rbp
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x5, %rax
js 0xd9af
cvtsi2ss %rax, %xmm1
jmp 0xd9c4
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0xdd90
leaq 0x10(%rsp), %rdi
callq 0x74e0
leaq 0x30(%rsp), %rdi
callq 0x74e0
leaq 0x78(%rsp), %rdi
callq 0x792e
movq %r15, %rdi
callq 0x792e
movq %r14, %rdi
callq 0x913e
movq 0x58(%rsp), %rsi
addq $0x40, %rsi
jmp 0xd8ab
leaq 0x60(%rsp), %rdi
movaps (%rdi), %xmm0
movq 0x48(%rsp), %rbx
movups %xmm0, (%rbx)
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0xb026
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xda62
movq %rax, %rbx
jmp 0xdaa2
movq %rax, %rbx
jmp 0xda83
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x74e0
leaq 0x30(%rsp), %rdi
callq 0x74e0
leaq 0x78(%rsp), %rdi
callq 0x792e
leaq 0xa8(%rsp), %rdi
callq 0x792e
jmp 0xda95
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x913e
leaq 0x60(%rsp), %rdi
callq 0xb026
movq %rbx, %rdi
callq 0x65a0