// File: /workspace/github_cpp_makefile_star2_O1/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, 0xc(%rsp)
movq %rdx, 0x50(%rsp)
movq %rsi, %r15
movq %rdi, 0x70(%rsp)
movl %r8d, 0x8(%rsp)
movl %r8d, %r14d
movl %ecx, 0x10(%rsp)
subl %ecx, %r14d
xorl %eax, %eax
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
movl %eax, 0x8(%rdi)
movq %rax, 0x10(%rdi)
movl %eax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movslq %r14d, %rsi
xorl %edx, %edx
callq 0xa71e
leal -0x1(%r14), %eax
movl $0x0, 0x58(%rsp)
movl %eax, 0x5c(%rsp)
cmpl $0x0, 0xb0(%rsp)
setle %al
cmpl $0x3, %r14d
setl %cl
orb %al, %cl
jne 0x7e46
xorl %r12d, %r12d
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
leaq 0x58(%rsp), %r13
leaq 0x3f(%rbp), %rbx
movq %r13, %rdi
movq 0xb8(%rsp), %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 0x20(%rsp), %rdx
movq %r8, %rcx
andq %rbx, %rcx
xorl %esi, %esi
cmpq %rbp, %rcx
setbe %sil
movl $0x1, %edi
movl %eax, %ecx
shlq %cl, %rdi
movq -0x8(%rdx,%rsi,8), %rax
btq %r8, %rax
jb 0x7e31
leaq -0x8(,%rsi,8), %rcx
orq %rdi, %rax
movq %rax, (%rdx,%rcx)
incl %r12d
cmpl 0xb0(%rsp), %r12d
jge 0x7e46
movl %r14d, %eax
subl %r12d, %eax
cmpl $0x2, %eax
jg 0x7dcd
movl 0x10(%rsp), %eax
cmpl %eax, 0x8(%rsp)
jl 0x7fbc
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movslq %eax, %rbp
movl 0x8(%rsp), %eax
movslq %eax, %rsi
movq %rsi, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
movq %rsi, 0x60(%rsp)
incl %eax
movl %eax, 0x8(%rsp)
movq %rbp, %r14
negq %r14
leaq 0x3f(%rcx), %r13
movq %rbp, 0x68(%rsp)
leaq 0x1(%rbp), %rax
movq %rax, 0x48(%rsp)
movq %rbp, %rax
subq 0x68(%rsp), %rax
movq %rax, %rcx
shrq $0x3, %rcx
andq $-0x8, %rcx
addq 0x20(%rsp), %rcx
movq %rax, %rdx
andq %r13, %rdx
xorl %esi, %esi
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
cmpq %rdi, %rdx
setbe %sil
movq -0x8(%rcx,%rsi,8), %rcx
btq %rax, %rcx
jb 0x7fad
cmpl $0x2, 0xc(%rsp)
setl %al
cmpq 0x10(%rsp), %rbp
setge %cl
orb %al, %cl
jne 0x7fad
movslq 0x48(%rsp), %r12
movq 0x50(%rsp), %rax
movq (%rax), %rax
movslq (%rax,%rbp,4), %rbx
addq 0x60(%rsp), %rbp
movq %r14, %rax
addq %r12, %rax
leaq 0x3f(%r14,%r12), %rcx
cmovnsq %rax, %rcx
sarq $0x6, %rcx
shlq $0x3, %rcx
addq 0x20(%rsp), %rcx
movq %rax, %rdx
andq %r13, %rdx
xorl %esi, %esi
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
cmpq %rdi, %rdx
setbe %sil
movq -0x8(%rcx,%rsi,8), %rcx
btq %rax, %rcx
jb 0x7fad
imulq $0x6eac5db, %rbx, %rax  # imm = 0x6EAC5DB
movq 0x50(%rsp), %rcx
movq (%rcx), %rcx
movslq (%rcx,%r12,4), %rbx
addq %rax, %rbx
movq 0x70(%rsp), %rsi
movq (%rsi), %rax
movslq 0xc4(%rax), %rcx
movq %rbx, %rax
xorl %edx, %edx
divq %rcx
addl 0x5c(%rsi), %edx
movl %edx, 0x1c(%rsp)
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0x7f8d
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%r15)
jmp 0x7f9a
movq %r15, %rdi
leaq 0x1c(%rsp), %rdx
callq 0xb088
cmpq 0x10(%rsp), %r12
jge 0x7fad
incq %r12
cmpq %rbp, %r12
jl 0x7f03
movq 0x48(%rsp), %rbp
cmpl %ebp, 0x8(%rsp)
jne 0x7e8c
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x7fec
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7fff
jmp 0x7fff
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8032
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq %rbx, %rdi
callq 0x45b0