// File: /workspace/github_cpp_makefile_star2_O2/epfml[P]Bi-Sent2Vec/src/fasttext.cc
// Function: fasttext::FastText::findNNSent(fasttext::Matrix const&, fasttext::Vector const&, int, 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&, long, std::vector<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&)
void FastText::findNNSent(const Matrix& sentenceVectors, const Vector& queryVec,
                          int32_t k, const std::set<std::string>& banSet, int64_t numSent,
                          const std::vector<std::string>& sentences) {
  real queryNorm = queryVec.norm();
  if (std::abs(queryNorm) < 1e-8) {
    queryNorm = 1;
  }
  std::priority_queue<std::pair<real, std::string>> heap;
  Vector vec(args_->dim);

  for (int32_t i = 0; i < numSent; i++) {
    std::string sentence = std::to_string(i) + " " + sentences[i];
    real dp = sentenceVectors.dotRow(queryVec, i);
    heap.push(std::make_pair(dp / queryNorm, sentence));
  }

  int32_t i = 0;
  while (i < k && heap.size() > 0) {
    auto it = banSet.find(heap.top().second);
    if (!std::isnan(heap.top().first)) {
      std::cout << heap.top().first << " "
                                    << heap.top().second << " "
                                    << std::endl;
      i++;
    }
    heap.pop();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, %r13
movq %r8, 0x38(%rsp)
movl %ecx, 0xc(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdi, %rbx
movq %rdx, 0x48(%rsp)
movq %rdx, %rdi
callq 0xd090
movaps 0x8103(%rip), %xmm1     # 0x1b480
movaps %xmm0, 0x50(%rsp)
andps %xmm0, %xmm1
cvtss2sd %xmm1, %xmm0
movsd 0x8377(%rip), %xmm1     # 0x1b708
ucomisd %xmm0, %xmm1
jbe 0x133a4
movss 0x7dd1(%rip), %xmm0     # 0x1b170
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq (%rbx), %rax
movslq 0x94(%rax), %rsi
leaq 0x60(%rsp), %rdi
callq 0xd03c
xorl %r14d, %r14d
testq %r13, %r13
cmovleq %r14, %r13
leaq 0x98(%rsp), %rbx
leaq 0x70(%rsp), %rbp
leaq 0xb8(%rsp), %r12
xorl %r15d, %r15d
cmpq %r15, %r13
je 0x1348d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x15b33
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x7760(%rip), %rdx      # 0x1ab69
callq 0x15aad
movq 0x110(%rsp), %rax
movq (%rax), %rdx
addq %r14, %rdx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x8765
movq %rbp, %rdi
callq 0x46c8
movq %rbx, %rdi
callq 0x46c8
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %r15, %rdx
callq 0xbf6c
divss 0x50(%rsp), %xmm0
movss %xmm0, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
movq %r12, %rsi
callq 0x4460
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x15d4c
leaq 0x78(%rsp), %rdi
callq 0x46c8
movq %r12, %rdi
callq 0x46c8
incq %r15
addq $0x20, %r14
jmp 0x133e8
xorl %ebp, %ebp
leaq 0x10(%rsp), %r14
movq 0x14b25(%rip), %r15     # 0x27fc0
leaq 0x76c7(%rip), %rbx      # 0x1ab69
cmpl 0xc(%rsp), %ebp
jge 0x13513
movq 0x10(%rsp), %rsi
cmpq %rsi, 0x18(%rsp)
je 0x13513
addq $0x8, %rsi
movq 0x38(%rsp), %rdi
callq 0x17714
movq 0x10(%rsp), %rax
movss (%rax), %xmm0
ucomiss %xmm0, %xmm0
jp 0x13509
movq %r15, %rdi
callq 0x4270
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4330
movq 0x10(%rsp), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x42f0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4330
movq %rax, %rdi
callq 0x4190
incl %ebp
movq %r14, %rdi
callq 0x15d62
jmp 0x134a2
leaq 0x60(%rsp), %rdi
callq 0xd066
leaq 0x10(%rsp), %rdi
callq 0x15d0c
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1358c
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x46c8
jmp 0x13570
jmp 0x1354f
movq %rax, %rbx
jmp 0x13561
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x46c8
leaq 0xb8(%rsp), %rdi
jmp 0x13578
jmp 0x1357f
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x46c8
jmp 0x13582
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xd066
leaq 0x10(%rsp), %rdi
callq 0x15d0c
movq %rbx, %rdi
callq 0x45d0