// File: epfml[P]Bi-Sent2Vec/src/dictionary.cc
// Function: fasttext::Dictionary::threshold(long, long)
void Dictionary::threshold(int64_t t, int64_t tl) {
  sort(words_.begin(), words_.end(), [](const entry& e1, const entry& e2) {
      if (e1.type != e2.type) return e1.type < e2.type;
      return e1.count > e2.count;
  });
  words_.erase(remove_if(words_.begin(), words_.end(), [&](const entry& e) {
        return (e.type == entry_type::word && e.count < t) ||
               (e.type == entry_type::label && e.count < tl);
  }), words_.end());
  words_.shrink_to_fit();
  size_ = 0;
  nwords_ = 0;
  nlabels_ = 0;
  std::fill(word2int_.begin(), word2int_.end(), -1);
  for (auto it = words_.begin(); it != words_.end(); ++it) {
    int32_t h = find(it->word);
    word2int_[h] = size_++;
    if (it->type == entry_type::word) nwords_++;
    if (it->type == entry_type::label) nlabels_++;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
addq $0x28, %rdi
callq 0xe880
movq -0xb0(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x28, %rdi
callq 0xe8b0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x9d60
movq -0xb0(%rbp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, -0xb8(%rbp)
addq $0x28, %rdi
callq 0xe880
movq -0xb0(%rbp), %rdi
movq %rax, -0x48(%rbp)
addq $0x28, %rdi
callq 0xe8b0
movq %rax, -0x50(%rbp)
leaq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x9da0
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xe970
movq -0xb0(%rbp), %rdi
addq $0x28, %rdi
callq 0xe8b0
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xe970
movq -0xb8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0xe8e0
movq -0xb0(%rbp), %rdi
movq %rax, -0x78(%rbp)
addq $0x28, %rdi
callq 0xe9b0
movq -0xb0(%rbp), %rdi
movl $0x0, 0x58(%rdi)
movl $0x0, 0x5c(%rdi)
movl $0x0, 0x60(%rdi)
addq $0x10, %rdi
callq 0xea10
movq -0xb0(%rbp), %rdi
movq %rax, -0x80(%rbp)
addq $0x10, %rdi
callq 0xea40
movq %rax, -0x88(%rbp)
movl $0xffffffff, -0x8c(%rbp) # imm = 0xFFFFFFFF
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
leaq -0x8c(%rbp), %rdx
callq 0xe9d0
movq -0xb0(%rbp), %rdi
addq $0x28, %rdi
callq 0xe880
movq %rax, -0x98(%rbp)
movq -0xb0(%rbp), %rdi
addq $0x28, %rdi
callq 0xe8b0
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xea70
testb $0x1, %al
jne 0x9a20
jmp 0x9ac6
leaq -0x98(%rbp), %rdi
callq 0xeab0
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x8070
movq -0xb0(%rbp), %rdi
movl %eax, -0xa4(%rbp)
movl 0x58(%rdi), %eax
movl %eax, -0xbc(%rbp)
addl $0x1, %eax
movl %eax, 0x58(%rdi)
addq $0x10, %rdi
movslq -0xa4(%rbp), %rsi
callq 0xe240
movl -0xbc(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x98(%rbp), %rdi
callq 0xeab0
cmpb $0x0, 0x28(%rax)
jne 0x9a91
movq -0xb0(%rbp), %rax
movl 0x5c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x5c(%rax)
leaq -0x98(%rbp), %rdi
callq 0xeab0
cmpb $0x1, 0x28(%rax)
jne 0x9ab3
movq -0xb0(%rbp), %rax
movl 0x60(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x60(%rax)
jmp 0x9ab5
leaq -0x98(%rbp), %rdi
callq 0xead0
jmp 0x99ed
addq $0xc0, %rsp
popq %rbp
retq
nop