// File: /workspace/github_cpp_makefile_star2_O2/epfml[P]Bi-Sent2Vec/src/fasttext.cc
// Function: fasttext::FastText::test(std::istream&, int)
void FastText::test(std::istream& in, int32_t k) {
  int32_t nexamples = 0, nlabels = 0;
  double precision = 0.0;
  std::vector<int32_t> line, labels;

  while (in.peek() != EOF) {
    dict_->getLine(in, line, labels, model_->rng);
    if (labels.size() > 0 && line.size() > 0) {
      std::vector<std::pair<real, int32_t>> modelPredictions;
      model_->predict(line, k, modelPredictions);
      for (auto it = modelPredictions.cbegin(); it != modelPredictions.cend(); it++) {
        if (std::find(labels.begin(), labels.end(), it->second) != labels.end()) {
          precision += 1.0;
        }
      }
      nexamples++;
      nlabels += labels.size();
    }
  }
  std::cout << "N" << "\t" << nexamples << std::endl;
  std::cout << std::setprecision(3);
  std::cout << "P@" << k << "\t" << precision / (k * nexamples) << std::endl;
  std::cout << "R@" << k << "\t" << precision / nlabels << std::endl;
  std::cerr << "Number of examples: " << nexamples << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edx, 0xc(%rsp)
movq %rsi, %r14
movq %rdi, %r15
xorpd %xmm0, %xmm0
leaq 0x60(%rsp), %r12
andq $0x0, 0x10(%r12)
leaq 0x20(%rsp), %r13
andq $0x0, 0x10(%r13)
movapd %xmm0, (%r12)
movapd %xmm0, (%r13)
movl $0x0, 0x8(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x110, %ebp            # imm = 0x110
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x4130
cmpl $-0x1, %eax
je 0x11d04
movq 0x10(%r15), %rdi
movq 0x60(%r15), %r8
addq %rbp, %r8
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x7650
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x11c34
movq 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
je 0x11c34
movl %ebx, 0x1c(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movq 0x60(%r15), %rdi
movq %r12, %rsi
movl 0xc(%rsp), %edx
leaq 0x40(%rsp), %rcx
callq 0xe21c
movq 0x40(%rsp), %rbx
movq 0x28(%rsp), %rsi
cmpq 0x48(%rsp), %rbx
je 0x11ce2
movq 0x20(%rsp), %rdi
addq $0x4, %rbx
movq %rbx, %rdx
callq 0x1700a
movsd 0x10(%rsp), %xmm0
addsd 0x8c19(%rip), %xmm0     # 0x1a8e8
cmpq 0x28(%rsp), %rax
je 0x11cdc
movsd %xmm0, 0x10(%rsp)
addq $0x4, %rbx
jmp 0x11ca4
movl 0x1c(%rsp), %ebx
incl %ebx
subq 0x20(%rsp), %rsi
shrq $0x2, %rsi
addl %esi, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x16fec
jmp 0x11c34
movq 0x162b5(%rip), %r14     # 0x27fc0
leaq 0x9b39(%rip), %rsi      # 0x1b84b
movq %r14, %rdi
callq 0x4330
movl 0xc(%rsp), %ebp
leaq 0x9b28(%rip), %rsi      # 0x1b84d
movq %rax, %rdi
callq 0x4330
movq %rax, %rdi
movl %ebx, %esi
callq 0x45b0
movq %rax, %rdi
callq 0x4190
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x8(%r14,%rax)
leaq 0x9af9(%rip), %rsi      # 0x1b84f
movq %r14, %rdi
callq 0x4330
movq %rax, %rdi
movl %ebp, %esi
callq 0x45b0
leaq 0x9ade(%rip), %rsi      # 0x1b84d
movq %rax, %rdi
callq 0x4330
movl %ebx, %ecx
imull %ebp, %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x4510
movq %rax, %rdi
callq 0x4190
movq 0x1621f(%rip), %rdi     # 0x27fc0
leaq 0x9aaa(%rip), %rsi      # 0x1b852
callq 0x4330
movq %rax, %rdi
movl %ebp, %esi
callq 0x45b0
leaq 0x9a8f(%rip), %rsi      # 0x1b84d
movq %rax, %rdi
callq 0x4330
cvtsi2sdl 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x4510
movq %rax, %rdi
callq 0x4190
movq 0x16203(%rip), %rdi     # 0x27ff0
leaq 0x9a61(%rip), %rsi      # 0x1b855
callq 0x4330
movq %rax, %rdi
movl %ebx, %esi
callq 0x45b0
movq %rax, %rdi
callq 0x4190
leaq 0x20(%rsp), %rdi
callq 0x8c0e
leaq 0x60(%rsp), %rdi
callq 0x8c0e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11e32
jmp 0x11e41
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x16fec
jmp 0x11e44
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8c0e
leaq 0x60(%rsp), %rdi
callq 0x8c0e
movq %rbx, %rdi
callq 0x45d0