// File: /workspace/github_cpp_makefile_star2_O3/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 0xf200
movaps 0x865b(%rip), %xmm1     # 0x1f4a0
movaps %xmm0, 0xb0(%rsp)
andps %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd 0x88b1(%rip), %xmm1     # 0x1f710
ucomisd %xmm0, %xmm1
jbe 0x16e75
movss 0x831b(%rip), %xmm0     # 0x1f188
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 0xf1ac
cmpq $0x0, 0x50(%rsp)
jle 0x170e4
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 0x16f14
movl $0x4, %r12d
movl %ebx, %eax
cmpl $0x63, %eax
jbe 0x16f0b
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x16f11
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x16f14
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x16edb
addl $-0x3, %r12d
jmp 0x16f14
addl $-0x2, %r12d
jmp 0x16f14
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 0x1a1f4
movq %r14, %r15
movq %r14, %rdi
leaq 0x7c0f(%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 0x16f83
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x16f8a
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 0x16fea
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x16ff1
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 0x17020
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x17042
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0xa0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq %rbx, %rdx
callq 0xe10c
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 0xa910
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1afc8
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x1b487
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x170ba
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x170d1
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4300
incq %rbx
cmpq 0x50(%rsp), %rbx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
jne 0x16ec7
xorl %ebp, %ebp
leaq 0x30(%rsp), %rbx
movq 0x12ece(%rip), %r14     # 0x29fc0
leaq 0x7a69(%rip), %r15      # 0x1eb62
movq 0x98(%rsp), %r13
cmpl 0x4(%rsp), %ebp
jge 0x171b3
movq 0x30(%rsp), %rsi
cmpq %rsi, 0x38(%rsp)
je 0x171b3
addq $0x8, %rsi
movq %r13, %rdi
callq 0x1b6a8
movq 0x30(%rsp), %rax
movss (%rax), %xmm0
ucomiss %xmm0, %xmm0
jp 0x171a6
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 0x1a19e
jmp 0x17101
leaq 0xc8(%rsp), %rdi
callq 0xf1d6
leaq 0x30(%rsp), %rdi
callq 0x1a140
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1726b
jmp 0x1725b
movq %rax, %rbx
jmp 0x17205
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x17205
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x1725e
movq 0x88(%rsp), %rsi
jmp 0x17251
jmp 0x17223
movq %rax, %rbx
jmp 0x17242
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x17242
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x1725e
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x1725e
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0xf1d6
leaq 0x30(%rsp), %rdi
callq 0x1a140
movq %rbx, %rdi
callq 0x45b0
nop