// File: /workspace/github_cpp_makefile_star2_O2/epfml[P]Bi-Sent2Vec/src/dictionary.cc
// Function: fasttext::Dictionary::prune(std::vector<int, std::allocator<int>>&)
void Dictionary::prune(std::vector<int32_t>& idx) {
  std::vector<int32_t> words, ngrams;
  for (auto it = idx.cbegin(); it != idx.cend(); ++it) {
    if (*it < nwords_) {words.push_back(*it);}
    else {ngrams.push_back(*it);}
  }
  std::sort(words.begin(), words.end());
  idx = words;

  if (ngrams.size() != 0) {
    int32_t j = 0;
    for (const auto ngram : ngrams) {
      pruneidx_[ngram - nwords_] = j;
      j++;
    }
    idx.insert(idx.end(), ngrams.begin(), ngrams.end());
  }
  pruneidx_size_ = pruneidx_.size();

  std::fill(word2int_.begin(), word2int_.end(), -1);

  int32_t j = 0;
  for (int32_t i = 0; i < words_.size(); i++) {
    if (getType(i) == entry_type::label || (j < words.size() && words[j] == i)) {
      words_[j] = words_[i];
      word2int_[find(words_[j].word)] = j;
      j++;
    }
  }
  nwords_ = words.size();
  size_ = nwords_ +  nlabels_;
  words_.erase(words_.begin() + size_, words_.end());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r12
andq $0x0, 0x10(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
andq $0x0, 0x10(%r13)
movq (%rsi), %r15
cmpq 0x8(%r14), %r15
je 0x7a65
movl (%r15), %eax
movq %r12, %rdi
cmpl 0x5c(%rbx), %eax
jl 0x7a57
movq %r13, %rdi
movq %r15, %rsi
callq 0x87c4
addq $0x4, %r15
jmp 0x7a43
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xa88d
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x8a02
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rbp
cmpq %r13, %rbp
je 0x7ad6
leaq 0x78(%rbx), %r15
xorl %r12d, %r12d
cmpq %rbp, %r13
je 0x7ac0
movl (%r13), %eax
subl 0x5c(%rbx), %eax
movl %eax, 0xc(%rsp)
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
callq 0xacc0
movl %r12d, (%rax)
incl %r12d
addq $0x4, %r13
jmp 0x7a97
movq 0x8(%r14), %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq %r14, %rdi
callq 0x8acc
movq 0x90(%rbx), %rax
movq %rax, 0x70(%rbx)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
cmpq %rcx, %rax
je 0x7af7
orl $-0x1, (%rax)
addq $0x4, %rax
jmp 0x7ae9
leaq 0x28(%rbx), %r14
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rcx
movq %rcx, %rax
subq %rsi, %rax
cqto
pushq $0x48
popq %rdi
idivq %rdi
cmpq %r15, %rax
jbe 0x7b89
movq %rbx, %rdi
movl %r15d, %esi
callq 0x6362
movslq %ebp, %rcx
cmpb $0x1, %al
jne 0x7b5f
movq (%r14), %rdi
leaq (%rdi,%r13), %rsi
imulq $0x48, %rcx, %r12
addq %r12, %rdi
callq 0x8aec
addq 0x28(%rbx), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5cd6
movq 0x10(%rbx), %rcx
movl %eax, %eax
movl %ebp, (%rcx,%rax,4)
incl %ebp
jmp 0x7b7d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rcx, %rdx
jbe 0x7b7d
movl (%rax,%rcx,4), %eax
cmpq %rax, %r15
je 0x7b30
incq %r15
addq $0x48, %r13
jmp 0x7b03
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
shrq $0x2, %rax
movl %eax, 0x5c(%rbx)
movslq 0x60(%rbx), %rdx
cltq
addq %rdx, %rax
movl %eax, 0x58(%rbx)
imulq $0x48, %rax, %rax
addq %rax, %rsi
movq %r14, %rdi
movq %rcx, %rdx
callq 0x8830
leaq 0x30(%rsp), %rdi
callq 0x8c0e
leaq 0x10(%rsp), %rdi
callq 0x8c0e
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7be5
jmp 0x7be5
jmp 0x7be5
jmp 0x7be5
jmp 0x7be5
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x8c0e
leaq 0x10(%rsp), %rdi
callq 0x8c0e
movq %rbx, %rdi
callq 0x45d0