// File: /workspace/github_cpp_makefile_star2_O3/epfml[P]Bi-Sent2Vec/src/model.cc
// Function: fasttext::Model::dfs(int, int, float, std::vector<std::pair<float, int>, std::allocator<std::pair<float, int>>>&, fasttext::Vector&) const
void Model::dfs(int32_t k, int32_t node, real score,
                std::vector<std::pair<real, int32_t>>& heap,
                Vector& hidden) const {
  if (heap.size() == k && score < heap.front().first) {
    return;
  }

  if (tree[node].left == -1 && tree[node].right == -1) {
    heap.push_back(std::make_pair(score, node));
    std::push_heap(heap.begin(), heap.end(), comparePairs);
    if (heap.size() > k) {
      std::pop_heap(heap.begin(), heap.end(), comparePairs);
      heap.pop_back();
    }
    return;
  }

  real f;
  if (quant_ && args_->qout) {
    f= sigmoid(qwo_->dotRow(hidden, node - osz_));
  } else {
    f= sigmoid(wo_->dotRow(hidden, node - osz_));
  }

  dfs(k, tree[node].left, score + log(1.0 - f), heap, hidden);
  dfs(k, tree[node].right, score + log(f), heap, hidden);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movq %rcx, %rbx
movss %xmm0, 0x8(%rsp)
movl %esi, %ebp
movq %rdi, %r15
movslq %esi, %r12
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jne 0x1025e
movss (%rax), %xmm0
ucomiss 0x8(%rsp), %xmm0
ja 0x10469
movslq %edx, %rax
movq 0xf8(%r15), %rcx
movq %rax, %r13
shlq $0x5, %r13
cmpl $-0x1, 0x4(%rcx,%r13)
jne 0x10284
addq %r13, %rcx
cmpl $-0x1, 0x8(%rcx)
je 0x103c8
cmpb $0x1, 0x118(%r15)
jne 0x102b6
movq 0x40(%r15), %rcx
cmpb $0x1, 0x12c(%rcx)
jne 0x102b6
movq 0x30(%r15), %rdi
movslq 0x88(%r15), %rcx
subq %rcx, %rax
movq %r14, %rsi
movq %rax, %rdx
callq 0xeea6
jmp 0x102cf
movq 0x10(%r15), %rdi
movslq 0x88(%r15), %rcx
subq %rcx, %rax
movq %r14, %rsi
movq %rax, %rdx
callq 0xe10c
xorps %xmm2, %xmm2
movss 0xf19a(%rip), %xmm1     # 0x1f474
ucomiss %xmm0, %xmm1
ja 0x10322
ucomiss 0xf192(%rip), %xmm0     # 0x1f478
movss 0xee9a(%rip), %xmm2     # 0x1f188
ja 0x10322
addss 0xf180(%rip), %xmm0     # 0x1f478
mulss 0xf17c(%rip), %xmm0     # 0x1f47c
mulss 0xf178(%rip), %xmm0     # 0x1f480
mulss 0xf174(%rip), %xmm0     # 0x1f484
cvttss2si %xmm0, %eax
movq 0x98(%r15), %rcx
cltq
movss (%rcx,%rax,4), %xmm2
movq 0xf8(%r15), %rax
movl 0x4(%rax,%r13), %edx
movss 0xee52(%rip), %xmm0     # 0x1f188
movaps %xmm0, %xmm1
movss %xmm2, 0xc(%rsp)
subss %xmm2, %xmm1
ucomiss %xmm0, %xmm1
xorps %xmm0, %xmm0
ja 0x10365
mulss 0xf129(%rip), %xmm1     # 0x1f47c
cvttss2si %xmm1, %eax
movq 0xa0(%r15), %rcx
cltq
movss (%rcx,%rax,4), %xmm0
addss 0x8(%rsp), %xmm0
movq %r15, %rdi
movl %ebp, %esi
movq %rbx, %rcx
movq %r14, %r8
callq 0x1021a
movq 0xf8(%r15), %rax
movl 0x8(%rax,%r13), %edx
movss 0xc(%rsp), %xmm0
ucomiss 0xedf4(%rip), %xmm0     # 0x1f188
xorps %xmm1, %xmm1
ja 0x103b3
mulss 0xf0db(%rip), %xmm0     # 0x1f47c
cvttss2si %xmm0, %eax
movq 0xa0(%r15), %rcx
cltq
movss (%rcx,%rax,4), %xmm1
movss 0x8(%rsp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x8(%rsp)
jmp 0x1023c
leaq 0x10(%rsp), %r14
movss 0x8(%rsp), %xmm0
movss %xmm0, (%r14)
movl %edx, 0x4(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11234
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
leaq -0x2b5(%rip), %rax      # 0x10140
movq %rax, (%r14)
movq -0x8(%rsi), %rcx
subq %rdi, %rsi
sarq $0x3, %rsi
decq %rsi
leaq 0x10(%rsp), %r8
xorl %edx, %edx
callq 0x111a5
movq (%rbx), %rdi
movq 0x8(%rbx), %rax
movq %rax, %rcx
subq %rdi, %rcx
movq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
jbe 0x10469
cmpq $0x9, %rcx
jl 0x10461
leaq -0x8(%rax), %rdx
movq -0x8(%rax), %rcx
movss (%rdi), %xmm0
movss %xmm0, -0x8(%rax)
movl 0x4(%rdi), %esi
movl %esi, -0x4(%rax)
subq %rdi, %rdx
sarq $0x3, %rdx
leaq -0x316(%rip), %r8       # 0x10140
xorl %esi, %esi
callq 0x110c5
movq 0x8(%rbx), %rax
addq $-0x8, %rax
movq %rax, 0x8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq