// File: /workspace/github_cpp_makefile_star2_O3/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 $0x88, %rsp
movl %edx, 0xc(%rsp)
movq %rsi, %r14
movq %rdi, %r15
xorpd %xmm0, %xmm0
leaq 0x60(%rsp), %r12
movapd %xmm0, (%r12)
xorl %ebx, %ebx
movq %rbx, 0x10(%r12)
leaq 0x20(%rsp), %r13
movq %rbx, 0x10(%r13)
movapd %xmm0, (%r13)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x4130
cmpl $-0x1, %eax
je 0x150b7
movq 0x10(%r15), %rdi
movq 0x60(%r15), %r8
movl $0x110, %eax            # imm = 0x110
addq %rax, %r8
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x8716
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x14fb6
movq 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
je 0x14fb6
movq %rbx, 0x80(%rsp)
movl %ebp, 0x1c(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x60(%r15), %rdi
movq %r12, %rsi
movl 0xc(%rsp), %edx
leaq 0x40(%rsp), %rcx
callq 0x1060a
movq 0x40(%rsp), %rbp
movq 0x28(%rsp), %rbx
cmpq 0x48(%rsp), %rbp
je 0x15081
movq 0x20(%rsp), %rdi
leaq 0x4(%rbp), %rdx
movq %rbx, %rsi
callq 0x1aed1
movq 0x28(%rsp), %rbx
movsd 0x10(%rsp), %xmm0
addsd 0x9892(%rip), %xmm0     # 0x1e8f8
cmpq %rbx, %rax
je 0x15071
movsd %xmm0, 0x10(%rsp)
addq $0x8, %rbp
cmpq 0x48(%rsp), %rbp
jne 0x15042
movq 0x40(%rsp), %rbp
subq 0x20(%rsp), %rbx
testq %rbp, %rbp
je 0x1509b
movq 0x50(%rsp), %rsi
subq %rbp, %rsi
movq %rbp, %rdi
callq 0x4300
movl 0x1c(%rsp), %ebp
incl %ebp
shrq $0x2, %rbx
movq 0x80(%rsp), %rax
addl %ebx, %eax
movq %rax, %rbx
jmp 0x14fb6
movq %rbx, %r15
movq 0x14eff(%rip), %rdi     # 0x29fc0
leaq 0xa78b(%rip), %rsi      # 0x1f853
movl $0x1, %edx
callq 0x4350
movl 0xc(%rsp), %r12d
movq 0x14ee2(%rip), %rdi     # 0x29fc0
leaq 0xa770(%rip), %rsi      # 0x1f855
movl $0x1, %edx
callq 0x4350
movq 0x14eca(%rip), %rbx     # 0x29fc0
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4580
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4200
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x8(%rbx,%rax)
leaq 0xa716(%rip), %rsi      # 0x1f857
movl $0x2, %edx
movq %rbx, %rdi
callq 0x4350
movq 0x14e6b(%rip), %rdi     # 0x29fc0
movl %r12d, %esi
callq 0x4580
movq %rax, %rbx
leaq 0xa6ee(%rip), %rsi      # 0x1f855
movl $0x1, %edx
movq %rax, %rdi
callq 0x4350
movl %ebp, %eax
imull %r12d, %eax
cvtsi2sd %eax, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x44e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4200
movq 0x14dff(%rip), %rdi     # 0x29fc0
leaq 0xa692(%rip), %rsi      # 0x1f85a
movl $0x2, %edx
callq 0x4350
movq 0x14de7(%rip), %rdi     # 0x29fc0
movl %r12d, %esi
callq 0x4580
movq %rax, %rbx
leaq 0xa66a(%rip), %rsi      # 0x1f855
movl $0x1, %edx
movq %rax, %rdi
callq 0x4350
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x44e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4200
movq 0x14dad(%rip), %rdi     # 0x29ff0
leaq 0xa613(%rip), %rsi      # 0x1f85d
movl $0x14, %edx
callq 0x4350
movq 0x14d95(%rip), %rdi     # 0x29ff0
movl %ebp, %esi
callq 0x4580
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4200
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x152a3
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x152ba
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x152ce
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x152ef
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
jmp 0x152ef
jmp 0x152ec
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x15306
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x1531d
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq %rbx, %rdi
callq 0x45b0
nop