// File: /workspace/github_cpp_makefile_star2_O1/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 0x10042
movss (%rax), %xmm0
ucomiss 0x8(%rsp), %xmm0
ja 0x10346
movslq %edx, %rax
movq 0xf8(%r15), %rcx
movq %rax, %r13
shlq $0x5, %r13
cmpl $-0x1, 0x4(%rcx,%r13)
jne 0x10068
addq %r13, %rcx
cmpl $-0x1, 0x8(%rcx)
je 0x101ac
cmpb $0x1, 0x118(%r15)
jne 0x1009a
movq 0x40(%r15), %rcx
cmpb $0x1, 0x12c(%rcx)
jne 0x1009a
movq 0x30(%r15), %rdi
movslq 0x88(%r15), %rcx
subq %rcx, %rax
movq %r14, %rsi
movq %rax, %rdx
callq 0xec74
jmp 0x100b3
movq 0x10(%r15), %rdi
movslq 0x88(%r15), %rcx
subq %rcx, %rax
movq %r14, %rsi
movq %rax, %rdx
callq 0xde92
xorps %xmm2, %xmm2
movss 0xf39e(%rip), %xmm1     # 0x1f45c
ucomiss %xmm0, %xmm1
ja 0x10106
ucomiss 0xf396(%rip), %xmm0     # 0x1f460
movss 0xf09e(%rip), %xmm2     # 0x1f170
ja 0x10106
addss 0xf384(%rip), %xmm0     # 0x1f460
mulss 0xf380(%rip), %xmm0     # 0x1f464
mulss 0xf37c(%rip), %xmm0     # 0x1f468
mulss 0xf378(%rip), %xmm0     # 0x1f46c
cvttss2si %xmm0, %eax
movq 0x98(%r15), %rcx
cltq
movss (%rcx,%rax,4), %xmm2
movq 0xf8(%r15), %rax
movl 0x4(%rax,%r13), %edx
movss 0xf056(%rip), %xmm0     # 0x1f170
movaps %xmm0, %xmm1
movss %xmm2, 0xc(%rsp)
subss %xmm2, %xmm1
ucomiss %xmm0, %xmm1
xorps %xmm0, %xmm0
ja 0x10149
mulss 0xf32d(%rip), %xmm1     # 0x1f464
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 0xfffe
movq 0xf8(%r15), %rax
movl 0x8(%rax,%r13), %edx
movss 0xc(%rsp), %xmm0
ucomiss 0xeff8(%rip), %xmm0     # 0x1f170
xorps %xmm1, %xmm1
ja 0x10197
mulss 0xf2df(%rip), %xmm0     # 0x1f464
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 0x10020
leaq 0x10(%rsp), %rsi
movss 0x8(%rsp), %xmm0
movss %xmm0, (%rsi)
movl %edx, 0x4(%rsi)
movq %rbx, %rdi
callq 0x111ec
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movss -0x8(%rsi), %xmm0
movl -0x4(%rsi), %ecx
movq %rsi, %rdx
subq %rax, %rdx
movq %rdx, %rdi
sarq $0x3, %rdi
leaq -0x1(%rdi), %r8
cmpq $0x2, %rdi
jl 0x10223
leaq -0x1(%r8), %r9
shrq $0x3f, %r9
addq %r8, %r9
decq %r9
sarq %r9
movss (%rax,%r9,8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x10223
movss %xmm1, (%rax,%r8,8)
movl 0x4(%rax,%r9,8), %r10d
movl %r10d, 0x4(%rax,%r8,8)
cmpq $0x2, %r8
movq %r9, %r8
jg 0x101ec
jmp 0x10226
movq %r8, %r9
movss %xmm0, (%rax,%r9,8)
movl %ecx, 0x4(%rax,%r9,8)
cmpq %r12, %rdi
jbe 0x10346
leaq -0x8(%rsi), %rcx
cmpq $0x9, %rdx
jl 0x10342
movss -0x8(%rsi), %xmm0
movl -0x4(%rsi), %edx
movss (%rax), %xmm1
movss %xmm1, -0x8(%rsi)
movl 0x4(%rax), %edi
movl %edi, -0x4(%rsi)
movq %rcx, %r8
subq %rax, %r8
movq %r8, %rdi
sarq $0x3, %rdi
cmpq $0x3, %rdi
jl 0x102c9
leaq -0x1(%rdi), %rsi
shrq $0x3f, %rsi
leaq (%rdi,%rsi), %r9
decq %r9
sarq %r9
xorl %r10d, %r10d
leaq (%r10,%r10), %rsi
movss 0x10(%rax,%rsi,8), %xmm1
ucomiss 0x8(%rax,%rsi,8), %xmm1
ja 0x102a2
leaq 0x2(,%r10,2), %rsi
jmp 0x102aa
leaq 0x1(,%r10,2), %rsi
movss (%rax,%rsi,8), %xmm1
movss %xmm1, (%rax,%r10,8)
movl 0x4(%rax,%rsi,8), %r11d
movl %r11d, 0x4(%rax,%r10,8)
movq %rsi, %r10
cmpq %r9, %rsi
jl 0x10287
jmp 0x102cb
xorl %esi, %esi
testb $0x8, %r8b
jne 0x102fc
addq $-0x2, %rdi
sarq %rdi
cmpq %rdi, %rsi
jne 0x102fc
leaq (%rsi,%rsi), %rdi
movss 0x8(%rax,%rdi,8), %xmm1
movss %xmm1, (%rax,%rsi,8)
movl 0xc(%rax,%rdi,8), %edi
movl %edi, 0x4(%rax,%rsi,8)
leaq 0x1(,%rsi,2), %rsi
testq %rsi, %rsi
jle 0x10336
leaq -0x1(%rsi), %rdi
shrq $0x3f, %rdi
addq %rsi, %rdi
decq %rdi
sarq %rdi
movss (%rax,%rdi,8), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x10336
movss %xmm1, (%rax,%rsi,8)
movl 0x4(%rax,%rdi,8), %r8d
movl %r8d, 0x4(%rax,%rsi,8)
cmpq $0x2, %rsi
movq %rdi, %rsi
jg 0x10301
jmp 0x10339
movq %rsi, %rdi
movss %xmm0, (%rax,%rdi,8)
movl %edx, 0x4(%rax,%rdi,8)
movq %rcx, 0x8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop