// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movq (%rsi), %r15
cmpq 0x8(%rsi), %r15
je 0x8c67
leaq 0x8(%rsp), %r13
movq %rsp, %rbp
leaq 0x20(%rsp), %r12
movl (%r15), %eax
cmpl 0x5c(%rbx), %eax
jge 0x8c41
movq 0x8(%rsp), %rsi
movq %rbp, %rdi
movq %r13, %rcx
cmpq 0x10(%rsp), %rsi
je 0x8c55
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rcx)
jmp 0x8c5d
movq 0x28(%rsp), %rsi
movq %r12, %rdi
leaq 0x28(%rsp), %rcx
cmpq 0x30(%rsp), %rsi
jne 0x8c36
movq %r15, %rdx
callq 0xad24
addq $0x4, %r15
cmpq 0x8(%r14), %r15
jne 0x8c1c
movq (%rsp), %r15
movq 0x8(%rsp), %r12
cmpq %r12, %r15
je 0x8ca2
movq %r12, %rax
subq %r15, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0xc691
movq %r15, %rdi
movq %r12, %rsi
callq 0xc774
movq %rsp, %rsi
movq %r14, %rdi
callq 0xa78c
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
cmpq %r13, %rbp
je 0x8d0a
movq %r14, 0x40(%rsp)
leaq 0x78(%rbx), %r15
xorl %r14d, %r14d
leaq 0x4c(%rsp), %r12
movl (%r13), %eax
subl 0x5c(%rbx), %eax
movl %eax, 0x4c(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xc9e4
movl %r14d, (%rax)
incl %r14d
addq $0x4, %r13
cmpq %rbp, %r13
jne 0x8ccd
movq 0x40(%rsp), %rdi
movq 0x8(%rdi), %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0xca8c
movq 0x90(%rbx), %rax
movq %rax, 0x70(%rbx)
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rdx
cmpq %rdx, %rdi
je 0x8d3b
subq %rdi, %rdx
addq $-0x4, %rdx
andq $-0x4, %rdx
addq $0x4, %rdx
movl $0xff, %esi
callq 0x41b0
leaq 0x28(%rbx), %rax
movq %rax, 0x50(%rsp)
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdx
subq %rax, %rdx
je 0x8e36
xorl %r15d, %r15d
movl $0x30, %ebp
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x6cd2
movslq %r14d, %rcx
cmpb $0x1, %al
jne 0x8de5
movl %r14d, 0x40(%rsp)
movq %rbx, %r14
movq 0x50(%rsp), %rax
movq (%rax), %rbx
leaq (%rbx,%rbp), %rsi
addq $-0x30, %rsi
leaq (%rcx,%rcx,8), %r12
leaq (%rbx,%r12,8), %r13
movq %r13, %rdi
callq 0x41a0
leaq (%rbx,%rbp), %rsi
movb -0x8(%rbx,%rbp), %al
movb %al, 0x28(%r13)
movq -0x10(%rbx,%rbp), %rax
movq %rax, 0x20(%r13)
addq $0x30, %r13
movq %r13, %rdi
callq 0xa78c
shlq $0x3, %r12
movq %r14, %rbx
addq 0x28(%r14), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x632e
movq 0x10(%r14), %rcx
movl %eax, %eax
movl 0x40(%rsp), %r14d
movl %r14d, (%rcx,%rax,4)
incl %r14d
jmp 0x8e06
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rcx, %rdx
jbe 0x8e06
movl (%rax,%rcx,4), %eax
cmpq %rax, %r15
je 0x8d72
incq %r15
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdx
subq %rax, %rdx
movq %rdx, %rcx
sarq $0x3, %rcx
movabsq $-0x71c71c71c71c71c7, %rsi # imm = 0x8E38E38E38E38E39
imulq %rsi, %rcx
addq $0x48, %rbp
cmpq %r15, %rcx
ja 0x8d60
movq 0x8(%rsp), %rcx
subq (%rsp), %rcx
shrq $0x2, %rcx
movl %ecx, 0x5c(%rbx)
movslq 0x60(%rbx), %rsi
movslq %ecx, %rcx
addq %rsi, %rcx
movl %ecx, 0x58(%rbx)
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,8), %rsi
addq %rax, %rdx
movq 0x50(%rsp), %rdi
callq 0xb360
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8e7f
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8e95
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8eae
jmp 0x8eae
jmp 0x8eae
jmp 0x8eae
jmp 0x8eae
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8ec8
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8ede
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq %rbx, %rdi
callq 0x45b0