// File: ddu1[P]polarizedtext/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;
  for (int32_t i = 0; i < MAX_VOCAB_SIZE; i++) {
    word2int_[i] = -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 $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
addq $0x28, %rdi
callq 0xa900
movq -0xa0(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x28, %rdi
callq 0xa930
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x7dd0
movq -0xa0(%rbp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, -0xa8(%rbp)
addq $0x28, %rdi
callq 0xa900
movq -0xa0(%rbp), %rdi
movq %rax, -0x48(%rbp)
addq $0x28, %rdi
callq 0xa930
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 0x7e10
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xa9f0
movq -0xa0(%rbp), %rdi
addq $0x28, %rdi
callq 0xa930
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xa9f0
movq -0xa8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0xa960
movq -0xa0(%rbp), %rdi
movq %rax, -0x78(%rbp)
addq $0x28, %rdi
callq 0xaa30
movq -0xa0(%rbp), %rax
movl $0x0, 0x58(%rax)
movl $0x0, 0x5c(%rax)
movl $0x0, 0x60(%rax)
movl $0x0, -0x7c(%rbp)
cmpl $0x1c9c380, -0x7c(%rbp) # imm = 0x1C9C380
jge 0x7be6
movq -0xa0(%rbp), %rdi
addq $0x10, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x9f60
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x7bb8
movq -0xa0(%rbp), %rdi
addq $0x28, %rdi
callq 0xa900
movq %rax, -0x88(%rbp)
movq -0xa0(%rbp), %rdi
addq $0x28, %rdi
callq 0xa930
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xaa50
testb $0x1, %al
jne 0x7c30
jmp 0x7cd6
leaq -0x88(%rbp), %rdi
callq 0xaa90
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x66c0
movq -0xa0(%rbp), %rdi
movl %eax, -0x94(%rbp)
movl 0x58(%rdi), %eax
movl %eax, -0xac(%rbp)
addl $0x1, %eax
movl %eax, 0x58(%rdi)
addq $0x10, %rdi
movslq -0x94(%rbp), %rsi
callq 0x9f60
movl -0xac(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x88(%rbp), %rdi
callq 0xaa90
cmpb $0x0, 0x28(%rax)
jne 0x7ca1
movq -0xa0(%rbp), %rax
movl 0x5c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x5c(%rax)
leaq -0x88(%rbp), %rdi
callq 0xaa90
cmpb $0x1, 0x28(%rax)
jne 0x7cc3
movq -0xa0(%rbp), %rax
movl 0x60(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x60(%rax)
jmp 0x7cc5
leaq -0x88(%rbp), %rdi
callq 0xaab0
jmp 0x7bfd
addq $0xb0, %rsp
popq %rbp
retq
nop