// File: /workspace/github_cpp_makefile_star2_O1/epfml[P]Bi-Sent2Vec/src/dictionary.cc
// Function: fasttext::Dictionary::addNgrams(std::vector<int, std::allocator<int>>&, int, int, std::linear_congruential_engine<unsigned long, 48271ul, 0ul, 2147483647ul>&) const
void Dictionary::addNgrams(std::vector<int32_t>& line, int32_t n, int32_t k, std::minstd_rand& rng) const {
  int32_t num_discarded = 0;
  int32_t line_size = line.size();
  std::vector<bool> discard;
  discard.resize(line_size, false);
  std::uniform_int_distribution<> uniform(0, line_size - 1);
  while (num_discarded < k && line_size - num_discarded > 2) {
    int32_t token_to_discard = uniform(rng);
    if (!discard[token_to_discard]) {
      discard[token_to_discard] = true;
      num_discarded++;
    }
  }
  for (int32_t i = 0; i < line_size; i++) {
    if (discard[i]) continue;
    uint64_t h = line[i];
    for (int32_t j = i + 1; j < line_size && j < i + n; j++) {
      if (discard[j]) break;
      h = h * 116049371 + line[j];
      line.push_back(nwords_ + (h % args_->bucket));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %r12
movl %ecx, %ebp
movq %rdx, 0x40(%rsp)
movq %rsi, %r14
movq %rdi, 0x60(%rsp)
movq 0x8(%rsi), %rbx
subq (%rsi), %rbx
shrq $0x2, %rbx
xorl %eax, %eax
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
movl %eax, 0x8(%rdi)
movq %rax, 0x10(%rdi)
movl %eax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movslq %ebx, %rsi
xorl %edx, %edx
callq 0xa71e
movq %rbx, 0x8(%rsp)
leal -0x1(%rbx), %eax
movl $0x0, 0x50(%rsp)
movl %eax, 0x54(%rsp)
testl %ebp, %ebp
jle 0x813b
cmpl $0x3, 0x8(%rsp)
jl 0x813b
xorl %ebx, %ebx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
leaq 0x50(%rsp), %r13
leaq 0x3f(%rax), %r15
movq %r13, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xc0d8
movslq %eax, %r8
leaq 0x3f(%r8), %rdx
testq %r8, %r8
cmovnsq %r8, %rdx
sarq $0x6, %rdx
shlq $0x3, %rdx
addq 0x18(%rsp), %rdx
movq %r8, %rcx
andq %r15, %rcx
xorl %esi, %esi
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
cmpq %rdi, %rcx
setbe %sil
movl $0x1, %edi
movl %eax, %ecx
shlq %cl, %rdi
movq -0x8(%rdx,%rsi,8), %rax
btq %r8, %rax
jb 0x812b
leaq -0x8(,%rsi,8), %rcx
orq %rdi, %rax
movq %rax, (%rdx,%rcx)
incl %ebx
cmpl %ebp, %ebx
jge 0x813b
movq 0x8(%rsp), %rax
subl %ebx, %eax
cmpl $0x2, %eax
jg 0x80c3
movq 0x8(%rsp), %r15
testl %r15d, %r15d
jle 0x823c
movl %r15d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x58(%rsp)
movl $0x1, %eax
movq %rax, 0x48(%rsp)
xorl %ebp, %ebp
movq 0x40(%rsp), %rax
movl %eax, %ebx
cmpl %r15d, %ebx
cmovll %ebx, %r15d
movq 0x18(%rsp), %rax
movq %rbp, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
btq %rbp, %rax
jb 0x8222
movq 0x40(%rsp), %rax
addl %ebp, %eax
movq 0x8(%rsp), %rcx
cmpl %eax, %ecx
cmovll %ecx, %eax
leaq 0x1(%rbp), %rcx
cltq
cmpq %rax, %rcx
jge 0x8222
movq (%r14), %rax
movslq (%rax,%rbp,4), %r13
movq 0x48(%rsp), %r12
movq 0x18(%rsp), %rax
movq %r12, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
btq %r12, %rax
jb 0x8222
imulq $0x6eac5db, %r13, %rax  # imm = 0x6EAC5DB
movq (%r14), %rcx
movslq (%rcx,%r12,4), %r13
addq %rax, %r13
movq 0x60(%rsp), %rsi
movq (%rsi), %rax
movslq 0xc4(%rax), %rcx
movq %r13, %rax
xorl %edx, %edx
divq %rcx
addl 0x5c(%rsi), %edx
movl %edx, 0x14(%rsp)
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0x820d
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%r14)
jmp 0x821a
movq %r14, %rdi
leaq 0x14(%rsp), %rdx
callq 0xb088
incq %r12
cmpq %r12, %r15
jne 0x81b2
incq %rbp
incq 0x48(%rsp)
incl %ebx
cmpq 0x58(%rsp), %rbp
movq 0x8(%rsp), %r15
jne 0x8169
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x826c
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
xorl %eax, %eax
movq %rax, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movl %eax, 0x30(%rsp)
movq %rax, 0x38(%rsp)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x827f
jmp 0x827f
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x82b2
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
xorl %eax, %eax
movq %rax, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movl %eax, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq %rbx, %rdi
callq 0x45b0