// File: /workspace/github_cpp_makefile_star2_O2/epfml[P]Bi-Sent2Vec/src/dictionary.cc
// Function: fasttext::Dictionary::addNgrams(std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, int, int, int, int, std::linear_congruential_engine<unsigned long, 48271ul, 0ul, 2147483647ul>&)
void Dictionary::addNgrams(std::vector<int32_t>& out, std::vector<int32_t>& line, int32_t start, int32_t end, int32_t n, int32_t k, std::minstd_rand& rng) {
  int32_t num_discarded = 0;
  int32_t line_size = end - start;
  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 = start; i <= end; i++) {
    if (discard[i - start]) continue;
    uint64_t h = line[i];
    for (int32_t j = i + 1; j <= end && j < i + n; j++) {
      if (discard[j - start]) break;
      h = h * 116049371 + line[j];
      out.push_back(nwords_ + (h % args_->bucket));
    }
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r9d, 0x10(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, 0x40(%rsp)
leaq 0x48(%rsp), %rax
andq $0x0, (%rax)
movq %rdi, 0x38(%rsp)
andl $0x0, 0x8(%rax)
movl %r8d, 0x8(%rsp)
movl %r8d, %ebx
andq $0x0, 0x10(%rax)
movl %ecx, 0x18(%rsp)
subl %ecx, %ebx
andl $0x0, 0x18(%rax)
andq $0x0, 0x20(%rax)
movslq %ebx, %rsi
xorl %r14d, %r14d
movq %rax, %rdi
xorl %edx, %edx
callq 0x88be
leaq 0x70(%rsp), %r12
andl $0x0, (%r12)
movl 0xb0(%rsp), %ecx
leal -0x1(%rbx), %eax
movl %eax, 0x4(%r12)
leaq 0x48(%rsp), %r13
cmpl %ecx, %r14d
setl %al
movl %ebx, %ecx
subl %r14d, %ecx
cmpl $0x3, %ecx
setge %r15b
andb %al, %r15b
testb %r15b, %r15b
je 0x7090
movq %r12, %rdi
movq 0xb8(%rsp), %rsi
callq 0x892c
movslq %eax, %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x8934
testq %rdx, (%rax)
jne 0x704e
movq %r13, %rdi
movq %rbp, %rsi
callq 0x8934
orq %rdx, (%rax)
incl %r14d
movl 0xb0(%rsp), %ecx
jmp 0x7039
movslq 0x18(%rsp), %rax
movslq 0x8(%rsp), %r14
movslq 0x10(%rsp), %rcx
movq %rcx, 0x30(%rsp)
pushq $0x1
popq %rcx
movq %rcx, 0x8(%rsp)
movq %rax, 0x18(%rsp)
movq %rax, %rsi
cmpq %r14, %rsi
jg 0x7170
movq %rsi, 0x10(%rsp)
subq 0x18(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x8934
testq %rdx, (%rax)
je 0x70e5
movq 0x10(%rsp), %rsi
incq %rsi
incq 0x8(%rsp)
jmp 0x70b4
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %r15
movslq (%rax,%r15,4), %r13
movq 0x30(%rsp), %rax
leaq (%r15,%rax), %r12
movq 0x8(%rsp), %rbp
cmpq %r14, %r15
jge 0x70d6
leaq 0x1(%r15), %rbx
cmpq %r12, %rbx
jge 0x70d6
leaq 0x48(%rsp), %rdi
movq %rbp, %rsi
callq 0x8934
testq %rdx, (%rax)
jne 0x70d6
imulq $0x6eac5db, %r13, %rax  # imm = 0x6EAC5DB
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movslq 0x4(%rcx,%r15,4), %r13
addq %rax, %r13
movq 0x38(%rsp), %rsi
movq (%rsi), %rax
movslq 0xc4(%rax), %rcx
movq %r13, %rax
xorl %edx, %edx
divq %rcx
addl 0x5c(%rsi), %edx
movl %edx, 0x24(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x24(%rsp), %rsi
callq 0x9292
incq %rbp
movq %rbx, %r15
jmp 0x7104
leaq 0x48(%rsp), %rdi
callq 0x896e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7195
jmp 0x7195
jmp 0x7195
jmp 0x7195
jmp 0x7195
jmp 0x7195
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x896e
movq %rbx, %rdi
callq 0x45d0