// File: /workspace/github_cpp_makefile_star2_O2/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 $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 $0x108, %ebp            # imm = 0x108
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x30b0
cmpl $-0x1, %eax
je 0xb733
movq 0x10(%r15), %rdi
movq 0x40(%r15), %r8
addq %rbp, %r8
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x5502
movq (%r15), %rax
movq 0x10(%r15), %rdi
movl 0x84(%rax), %edx
movq %r12, %rsi
callq 0x5436
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0xb64e
movq 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
je 0xb64e
movl %ebx, 0x1c(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movq 0x40(%r15), %rdi
movq %r12, %rsi
movl 0xc(%rsp), %edx
leaq 0x40(%rsp), %rcx
callq 0x8e1e
movq 0x40(%rsp), %rbx
movq 0x28(%rsp), %rsi
cmpq 0x48(%rsp), %rbx
je 0xb711
movq 0x20(%rsp), %rdi
addq $0x4, %rbx
movq %rbx, %rdx
callq 0xd72c
movsd 0x10(%rsp), %xmm0
addsd 0x3eea(%rip), %xmm0     # 0xf5e8
cmpq 0x28(%rsp), %rax
je 0xb70b
movsd %xmm0, 0x10(%rsp)
addq $0x4, %rbx
jmp 0xb6d3
movl 0x1c(%rsp), %ebx
incl %ebx
subq 0x20(%rsp), %rsi
shrq $0x2, %rsi
addl %esi, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xd70e
jmp 0xb64e
movq 0xc88e(%rip), %rdi      # 0x17fc8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x8(%rdi,%rax)
leaq 0x4747(%rip), %rsi      # 0xfe98
callq 0x3240
movl 0xc(%rsp), %ebp
movq %rax, %rdi
movl %ebp, %esi
callq 0x3420
leaq 0x4727(%rip), %rsi      # 0xfe92
movq %rax, %rdi
callq 0x3240
movl %ebx, %ecx
imull %ebp, %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x33b0
movq %rax, %rdi
callq 0x3100
movq 0xc82b(%rip), %rdi      # 0x17fc8
leaq 0x46f7(%rip), %rsi      # 0xfe9b
callq 0x3240
movq %rax, %rdi
movl %ebp, %esi
callq 0x3420
leaq 0x46d8(%rip), %rsi      # 0xfe92
movq %rax, %rdi
callq 0x3240
cvtsi2sdl 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %rax, %rdi
callq 0x33b0
movq %rax, %rdi
callq 0x3100
movq 0xc7df(%rip), %rdi      # 0x17fc8
leaq 0x46ae(%rip), %rsi      # 0xfe9e
callq 0x3240
movq %rax, %rdi
movl %ebx, %esi
callq 0x3420
movq %rax, %rdi
callq 0x3100
leaq 0x20(%rsp), %rdi
callq 0x626a
leaq 0x60(%rsp), %rdi
callq 0x626a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb82e
jmp 0xb83d
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xd70e
jmp 0xb840
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x626a
leaq 0x60(%rsp), %rdi
callq 0x626a
movq %rbx, %rdi
callq 0x3440