// File: /workspace/github_cpp_makefile_star2_O1/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, 0x4(%rsp)
movq %rsi, %r14
movq %rdi, %r15
xorpd %xmm0, %xmm0
leaq 0x60(%rsp), %r12
movapd %xmm0, (%r12)
xorl %eax, %eax
movq %rax, 0x10(%r12)
leaq 0x10(%rsp), %r13
movq $0x0, 0x30(%rsp)
movq %rax, 0x10(%r13)
movapd %xmm0, (%r13)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x110, %ebp            # imm = 0x110
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x4130
cmpl $-0x1, %eax
je 0x14fad
movq 0x10(%r15), %rdi
movq 0x60(%r15), %r8
addq %rbp, %r8
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x86f4
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x14ec1
movq 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
je 0x14ec1
movl %ebx, 0x3c(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x60(%r15), %rdi
movq %r12, %rsi
movl 0x4(%rsp), %edx
leaq 0x40(%rsp), %rcx
callq 0x105d2
movq 0x40(%rsp), %rbx
cmpq 0x48(%rsp), %rbx
je 0x14f6f
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq 0x4(%rbx), %rdx
callq 0x1ae81
movsd 0x8(%rsp), %xmm0
addsd 0x9994(%rip), %xmm0     # 0x1e8f0
cmpq 0x18(%rsp), %rax
je 0x14f69
movsd %xmm0, 0x8(%rsp)
addq $0x8, %rbx
jmp 0x14f34
movq 0x18(%rsp), %rbx
subq 0x10(%rsp), %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x14f90
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movl 0x3c(%rsp), %eax
incl %eax
shrq $0x2, %rbx
movq 0x30(%rsp), %rcx
addl %ebx, %ecx
movq %rcx, 0x30(%rsp)
movl %eax, %ebx
jmp 0x14ec1
movq 0x1500c(%rip), %rdi     # 0x29fc0
leaq 0xa888(%rip), %rsi      # 0x1f843
movl $0x1, %edx
callq 0x4350
movl 0x4(%rsp), %ebp
movq 0x14ff0(%rip), %rdi     # 0x29fc0
leaq 0xa86e(%rip), %rsi      # 0x1f845
movl $0x1, %edx
callq 0x4350
movq 0x14fd8(%rip), %r14     # 0x29fc0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4580
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4200
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x8(%r14,%rax)
leaq 0xa814(%rip), %rsi      # 0x1f847
movl $0x2, %edx
movq %r14, %rdi
callq 0x4350
movq 0x14f79(%rip), %rdi     # 0x29fc0
movl %ebp, %esi
callq 0x4580
movq %rax, %r14
leaq 0xa7ed(%rip), %rsi      # 0x1f845
movl $0x1, %edx
movq %rax, %rdi
callq 0x4350
movl %ebx, %eax
imull %ebp, %eax
cvtsi2sd %eax, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %r14, %rdi
callq 0x44e0
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 0x14f0f(%rip), %rdi     # 0x29fc0
leaq 0xa792(%rip), %rsi      # 0x1f84a
movl $0x2, %edx
callq 0x4350
movq 0x14ef7(%rip), %rdi     # 0x29fc0
movl %ebp, %esi
callq 0x4580
movq %rax, %r14
leaq 0xa76b(%rip), %rsi      # 0x1f845
movl $0x1, %edx
movq %rax, %rdi
callq 0x4350
xorps %xmm1, %xmm1
cvtsi2sdl 0x30(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %r14, %rdi
callq 0x44e0
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 0x14ebd(%rip), %rdi     # 0x29ff0
leaq 0xa713(%rip), %rsi      # 0x1f84d
movl $0x14, %edx
callq 0x4350
movq 0x14ea5(%rip), %rdi     # 0x29ff0
movl %ebx, %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 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x15193
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x151aa
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x151bb
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x151dc
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
jmp 0x151dc
jmp 0x151d9
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x151f3
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x1520a
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq %rbx, %rdi
callq 0x45b0