// File: /workspace/github_cpp_makefile_star2_O1/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, 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 $0x108, %ebp            # imm = 0x108
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x30d0
cmpl $-0x1, %eax
je 0xd6ce
movq 0x10(%r15), %rdi
movq 0x40(%r15), %r8
addq %rbp, %r8
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x5fc2
movq (%r15), %rax
movq 0x10(%r15), %rdi
movl 0x84(%rax), %edx
movq %r12, %rsi
callq 0x5eb8
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0xd5cd
movq 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
je 0xd5cd
movl %ebx, 0x3c(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x40(%r15), %rdi
movq %r12, %rsi
movl 0x4(%rsp), %edx
leaq 0x40(%rsp), %rcx
callq 0xab9e
movq 0x40(%rsp), %rbx
cmpq 0x48(%rsp), %rbx
je 0xd690
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq 0x4(%rbx), %rdx
callq 0xf99b
movsd 0x8(%rsp), %xmm0
addsd 0x3f83(%rip), %xmm0     # 0x11600
cmpq 0x18(%rsp), %rax
je 0xd68a
movsd %xmm0, 0x8(%rsp)
addq $0x8, %rbx
jmp 0xd655
movq 0x18(%rsp), %rbx
subq 0x10(%rsp), %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xd6b1
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movl 0x3c(%rsp), %eax
incl %eax
shrq $0x2, %rbx
movq 0x30(%rsp), %rcx
addl %ebx, %ecx
movq %rcx, 0x30(%rsp)
movl %eax, %ebx
jmp 0xd5cd
movq 0xa8f3(%rip), %rdi      # 0x17fc8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x8(%rdi,%rax)
leaq 0x47bc(%rip), %rsi      # 0x11ea8
movl $0x2, %edx
callq 0x3290
movl 0x4(%rsp), %ebp
movq 0xa8c7(%rip), %rdi      # 0x17fc8
movl %ebp, %esi
callq 0x3420
movq %rax, %r14
leaq 0x4790(%rip), %rsi      # 0x11ea2
movl $0x2, %edx
movq %rax, %rdi
callq 0x3290
movl %ebx, %eax
imull %ebp, %eax
cvtsi2sd %eax, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %r14, %rdi
callq 0x33b0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0xa85d(%rip), %rdi      # 0x17fc8
leaq 0x4739(%rip), %rsi      # 0x11eab
movl $0x2, %edx
callq 0x3290
movq 0xa845(%rip), %rdi      # 0x17fc8
movl %ebp, %esi
callq 0x3420
movq %rax, %r14
leaq 0x470e(%rip), %rsi      # 0x11ea2
movl $0x2, %edx
movq %rax, %rdi
callq 0x3290
xorps %xmm1, %xmm1
cvtsi2sdl 0x30(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %r14, %rdi
callq 0x33b0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0xa7db(%rip), %rdi      # 0x17fc8
leaq 0x46ba(%rip), %rsi      # 0x11eae
movl $0x14, %edx
callq 0x3290
movq 0xa7c3(%rip), %rdi      # 0x17fc8
movl %ebx, %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 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xd84d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xd864
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd875
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xd896
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
jmp 0xd896
jmp 0xd893
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xd8ad
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xd8c4
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3450