// File: /workspace/github_cpp_makefile_star2_O3/ddu1[P]polarizedtext/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);
    dict_->addNgrams(line, args_->wordNgrams);
    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 << std::setprecision(3);
  std::cout << "P@" << k << ": " << precision / (k * nexamples) << std::endl;
  std::cout << "R@" << k << ": " << precision / nlabels << std::endl;
  std::cout << "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 0x30d0
cmpl $-0x1, %eax
je 0xd5cc
movq 0x10(%r15), %rdi
movq 0x40(%r15), %r8
movl $0x108, %eax            # imm = 0x108
addq %rax, %r8
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x5ff8
movq (%r15), %rax
movq 0x10(%r15), %rdi
movl 0x84(%rax), %edx
movq %r12, %rsi
callq 0x5eee
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0xd4b6
movq 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
je 0xd4b6
movq %rbx, 0x80(%rsp)
movl %ebp, 0x1c(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x40(%r15), %rdi
movq %r12, %rsi
movl 0xc(%rsp), %edx
leaq 0x40(%rsp), %rcx
callq 0xaa6a
movq 0x40(%rsp), %rbp
movq 0x28(%rsp), %rbx
cmpq 0x48(%rsp), %rbp
je 0xd596
movq 0x20(%rsp), %rdi
leaq 0x4(%rbp), %rdx
movq %rbx, %rsi
callq 0xf847
movq 0x28(%rsp), %rbx
movsd 0x10(%rsp), %xmm0
addsd 0x40b5(%rip), %xmm0     # 0x11630
cmpq %rbx, %rax
je 0xd586
movsd %xmm0, 0x10(%rsp)
addq $0x8, %rbp
cmpq 0x48(%rsp), %rbp
jne 0xd557
movq 0x40(%rsp), %rbp
subq 0x20(%rsp), %rbx
testq %rbp, %rbp
je 0xd5b0
movq 0x50(%rsp), %rsi
subq %rbp, %rsi
movq %rbp, %rdi
callq 0x3260
movl 0x1c(%rsp), %ebp
incl %ebp
shrq $0x2, %rbx
movq 0x80(%rsp), %rax
addl %ebx, %eax
movq %rax, %rbx
jmp 0xd4b6
movq %rbx, %r14
movq 0xa9f2(%rip), %rdi      # 0x17fc8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x8(%rdi,%rax)
leaq 0x48eb(%rip), %rsi      # 0x11ed8
movl $0x2, %edx
callq 0x3290
movl 0xc(%rsp), %r15d
movq 0xa9c5(%rip), %rdi      # 0x17fc8
movl %r15d, %esi
callq 0x3420
movq %rax, %rbx
leaq 0x48bd(%rip), %rsi      # 0x11ed2
movl $0x2, %edx
movq %rax, %rdi
callq 0x3290
movl %ebp, %eax
imull %r15d, %eax
cvtsi2sd %eax, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x33b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0xa959(%rip), %rdi      # 0x17fc8
leaq 0x4865(%rip), %rsi      # 0x11edb
movl $0x2, %edx
callq 0x3290
movq 0xa941(%rip), %rdi      # 0x17fc8
movl %r15d, %esi
callq 0x3420
movq %rax, %rbx
leaq 0x4839(%rip), %rsi      # 0x11ed2
movl $0x2, %edx
movq %rax, %rdi
callq 0x3290
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x33b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0xa8d7(%rip), %rdi      # 0x17fc8
leaq 0x47e6(%rip), %rsi      # 0x11ede
movl $0x14, %edx
callq 0x3290
movq 0xa8bf(%rip), %rdi      # 0x17fc8
movl %ebp, %esi
callq 0x3420
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xd751
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xd768
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd77c
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xd79d
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
jmp 0xd79d
jmp 0xd79a
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xd7b4
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xd7cb
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3450
nop