// File: epfml[P]Bi-Sent2Vec/src/fasttext.cc
// Function: fasttext::FastText::selectEmbeddings(int) const
std::vector<int32_t> FastText::selectEmbeddings(int32_t cutoff) const {
  Vector norms(input_->m_);
  input_->l2NormRow(norms);
  std::vector<int32_t> idx(input_->m_, 0);
  std::iota(idx.begin(), idx.end(), 0);
  auto eosid = dict_->getId(Dictionary::EOS);
  std::sort(idx.begin(), idx.end(),
      [&norms, eosid] (size_t i1, size_t i2) {
      return eosid ==i1 || (eosid != i2 && norms[i1] > norms[i2]);
      });
  idx.erase(idx.begin() + cutoff, idx.end());
  return idx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0xd0(%rbp)
movq %rdi, %rax
movq %rax, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
addq $0x20, %rdi
movq %rdi, -0xb8(%rbp)
callq 0x235f0
movq 0x8(%rax), %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x20c00
movq -0xb8(%rbp), %rdi
callq 0x235f0
movq -0xb0(%rbp), %rsi
movq %rax, %rdi
callq 0x1e5e0
jmp 0x2a2c3
movq -0xc0(%rbp), %rdi
movb $0x0, -0x35(%rbp)
addq $0x20, %rdi
callq 0x235f0
movq 0x8(%rax), %rax
movq %rax, -0xe0(%rbp)
movl $0x0, -0x3c(%rbp)
leaq -0x3d(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0xe090
movq -0xd0(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rcx
leaq -0x3c(%rbp), %rdx
callq 0xe0b0
jmp 0x2a319
leaq -0x3d(%rbp), %rdi
callq 0xe130
movq -0xd0(%rbp), %rdi
callq 0xea10
movq -0xd0(%rbp), %rdi
movq %rax, -0x48(%rbp)
callq 0xea40
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x1d370
jmp 0x2a353
movq -0xc0(%rbp), %rdi
addq $0x10, %rdi
callq 0x34050
movq %rax, %rdi
leaq 0x35123(%rip), %rsi     # 0x5f490
callq 0x8570
movl %eax, -0xe4(%rbp)
jmp 0x2a37a
movq -0xd0(%rbp), %rdi
movl -0xe4(%rbp), %eax
movl %eax, -0x54(%rbp)
callq 0xea10
movq -0xd0(%rbp), %rdi
movq %rax, -0x60(%rbp)
callq 0xea40
movq %rax, -0x68(%rbp)
leaq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x78(%rbp), %rdx
movl -0x70(%rbp), %ecx
callq 0x2a4e0
jmp 0x2a3c7
movq -0xd0(%rbp), %rdi
callq 0xea10
movq %rax, -0x90(%rbp)
movslq -0x14(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x19ba0
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xf840
movq -0xd0(%rbp), %rdi
callq 0xea40
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xf840
movq -0xd0(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x98(%rbp), %rdx
callq 0x347e0
movq %rax, -0xf0(%rbp)
jmp 0x2a447
movq -0xf0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movb $0x1, -0x35(%rbp)
testb $0x1, -0x35(%rbp)
jne 0x2a4ac
jmp 0x2a4a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2a4c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x3d(%rbp), %rdi
callq 0xe130
jmp 0x2a4c5
movq -0xd0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0xe530
jmp 0x2a4c5
movq -0xd0(%rbp), %rdi
callq 0xe530
leaq -0x28(%rbp), %rdi
callq 0x20c60
movq -0xc8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x20c60
movq -0x30(%rbp), %rdi
callq 0x57a0
nopw (%rax,%rax)