// File: /workspace/github_cpp_makefile_star2_O3/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 0x8cc8
leaq 0x8(%rsp), %r13
movq %rsp, %rbp
leaq 0x20(%rsp), %r12
movl (%r15), %eax
cmpl 0x5c(%rbx), %eax
jge 0x8c67
movq 0x8(%rsp), %rsi
movq %rbp, %rdi
movq %r13, %rcx
cmpq 0x10(%rsp), %rsi
je 0x8c7b
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rcx)
jmp 0x8c83
movq 0x28(%rsp), %rsi
movq %r12, %rdi
leaq 0x28(%rsp), %rcx
cmpq 0x30(%rsp), %rsi
jne 0x8c5c
movq %r15, %rdx
callq 0xad56
addq $0x4, %r15
cmpq 0x8(%r14), %r15
jne 0x8c42
movq (%rsp), %r15
movq 0x8(%rsp), %r12
cmpq %r12, %r15
je 0x8cc8
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 0xc649
movq %r15, %rdi
movq %r12, %rsi
callq 0xc72c
movq %rsp, %rsi
movq %r14, %rdi
callq 0xa7b2
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
cmpq %r13, %rbp
je 0x8d30
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 0xc978
movl %r14d, (%rax)
incl %r14d
addq $0x4, %r13
cmpq %rbp, %r13
jne 0x8cf3
movq 0x40(%rsp), %rdi
movq 0x8(%rdi), %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0xca34
movq 0x90(%rbx), %rax
movq %rax, 0x70(%rbx)
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rdx
cmpq %rdx, %rdi
je 0x8d61
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
xorl %r12d, %r12d
cmpq %rax, 0x30(%rbx)
je 0x8e5e
movl $0x30, %r14d
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x6d06
movslq %r12d, %rcx
cmpb $0x1, %al
jne 0x8e0b
movq %r12, 0x40(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rbp
leaq (%r14,%rbp), %rsi
addq $-0x30, %rsi
leaq (%rcx,%rcx,8), %r12
leaq (,%r12,8), %r13
addq %rbp, %r13
movq %r13, %rdi
callq 0x41a0
leaq (%r14,%rbp), %rsi
movb -0x8(%rbp,%r14), %al
movb %al, 0x28(%r13)
movq -0x10(%rbp,%r14), %rax
movq %rax, 0x20(%r13)
addq $0x30, %r13
movq %r13, %rdi
callq 0xa7b2
shlq $0x3, %r12
addq 0x28(%rbx), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6332
movq 0x10(%rbx), %rcx
movl %eax, %eax
movq 0x40(%rsp), %r12
movl %r12d, (%rcx,%rax,4)
incl %r12d
jmp 0x8e2c
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rcx, %rdx
jbe 0x8e2c
movl (%rax,%rcx,4), %eax
cmpq %rax, %r15
je 0x8d96
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, %r14
cmpq %r15, %rcx
ja 0x8d84
jmp 0x8e60
xorl %edx, %edx
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 0xb368
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8ea9
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8ebf
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 0x8ed8
jmp 0x8ed8
jmp 0x8ed8
jmp 0x8ed8
jmp 0x8ed8
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8ef2
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8f08
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq %rbx, %rdi
callq 0x45b0