// File: /workspace/github_cpp_makefile_star2_O1/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, 0x50(%rsp)
movq %r8, %r14
movl %ecx, 0x4(%rsp)
movq %rsi, 0xa0(%rsp)
movq %rdi, %rbx
movq %rdx, 0xa8(%rsp)
movq %rdx, %rdi
callq 0xefe4
movaps 0x873f(%rip), %xmm1     # 0x1f490
movaps %xmm0, 0xb0(%rsp)
andps %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd 0x8995(%rip), %xmm1     # 0x1f700
ucomisd %xmm0, %xmm1
jbe 0x16d81
movss 0x83f7(%rip), %xmm0     # 0x1f170
movaps %xmm0, 0xb0(%rsp)
movq %r14, 0x98(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq (%rbx), %rax
movslq 0x94(%rax), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xef90
cmpq $0x0, 0x50(%rsp)
jle 0x16ff0
leaq 0x18(%rsp), %rbp
leaq 0x68(%rsp), %r14
xorl %ebx, %ebx
leaq 0x78(%rsp), %r15
movl $0xd1b71759, %edx       # imm = 0xD1B71759
movl $0x1, %r12d
cmpq $0xa, %rbx
jb 0x16e20
movl $0x4, %r12d
movl %ebx, %eax
cmpl $0x63, %eax
jbe 0x16e17
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x16e1d
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x16e20
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x16de7
addl $-0x3, %r12d
jmp 0x16e20
addl $-0x2, %r12d
jmp 0x16e20
decl %r12d
movq %r14, %r13
movl %r12d, %esi
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %r15, %r14
movq %r15, %rdi
movl $0x2d, %edx
callq 0x4360
movq 0x78(%rsp), %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x1a14c
movq %r14, %r15
movq %r14, %rdi
leaq 0x7d03(%rip), %rsi      # 0x1eb62
callq 0x4620
movq %rbp, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq 0x20(%rsp), %r12
movq %r13, %r14
je 0x16e8f
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x16e96
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x110(%rsp), %rax
movq (%rax), %rax
movq %rbx, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
leaq 0x8(%rsp), %rdi
callq 0x4100
movq %r14, 0x58(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x16ef6
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x16efd
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x16f2c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x16f4e
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq %rbx, %rdx
callq 0xde92
divss 0xb0(%rsp), %xmm0
movss %xmm0, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xa8dc
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1af6c
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x1b429
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x16fc6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x16fdd
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4300
incq %rbx
cmpq 0x50(%rsp), %rbx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
jne 0x16dd3
xorl %ebp, %ebp
leaq 0x30(%rsp), %rbx
movq 0x12fc2(%rip), %r14     # 0x29fc0
leaq 0x7b5d(%rip), %r15      # 0x1eb62
movq 0x98(%rsp), %r13
cmpl 0x4(%rsp), %ebp
jge 0x170bf
movq 0x30(%rsp), %rsi
cmpq %rsi, 0x38(%rsp)
je 0x170bf
addq $0x8, %rsi
movq %r13, %rdi
callq 0x1b656
movq 0x30(%rsp), %rax
movss (%rax), %xmm0
ucomiss %xmm0, %xmm0
jp 0x170b2
cvtss2sd %xmm0, %xmm0
movq %r14, %rdi
callq 0x44e0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4350
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r12, %rdi
callq 0x4350
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4350
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4200
incl %ebp
movq %rbx, %rdi
callq 0x1a0f6
jmp 0x1700d
leaq 0xc8(%rsp), %rdi
callq 0xefba
leaq 0x30(%rsp), %rdi
callq 0x1a09a
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x17177
jmp 0x17167
movq %rax, %rbx
jmp 0x17111
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17111
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x1716a
movq 0x88(%rsp), %rsi
jmp 0x1715d
jmp 0x1712f
movq %rax, %rbx
jmp 0x1714e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x1714e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x1716a
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x1716a
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xefba
leaq 0x30(%rsp), %rdi
callq 0x1a09a
movq %rbx, %rdi
callq 0x45b0
nop