// File: /workspace/github_cpp_makefile_star2_O3/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 $0x88, %rsp
movl %r9d, 0xc(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, %r15
movq %rdi, 0x50(%rsp)
movl %r8d, 0x8(%rsp)
movl %r8d, %r14d
movl %ecx, 0x10(%rsp)
subl %ecx, %r14d
xorl %eax, %eax
leaq 0x60(%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 0xa744
leal -0x1(%r14), %eax
movl $0x0, 0x38(%rsp)
movl %eax, 0x3c(%rsp)
cmpl $0x0, 0xc0(%rsp)
setle %al
cmpl $0x3, %r14d
setl %cl
orb %al, %cl
jne 0x7e9f
xorl %r12d, %r12d
movabsq $-0x8000000000000000, %rbp # imm = 0x8000000000000000
leaq 0x38(%rsp), %r13
leaq 0x3f(%rbp), %rbx
movq %r13, %rdi
movq 0xc8(%rsp), %rsi
movq %r13, %rdx
callq 0xc07c
movslq %eax, %r8
leal 0x3f(%r8), %ecx
testl %r8d, %r8d
cmovnsl %r8d, %ecx
sarl $0x6, %ecx
movslq %ecx, %rdx
shlq $0x3, %rdx
addq 0x60(%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 0x7e8a
leaq -0x8(,%rsi,8), %rcx
orq %rdi, %rax
movq %rax, (%rdx,%rcx)
incl %r12d
cmpl 0xc0(%rsp), %r12d
jge 0x7e9f
movl %r14d, %eax
subl %r12d, %eax
cmpl $0x2, %eax
jg 0x7e24
movl 0x10(%rsp), %eax
cmpl %eax, 0x8(%rsp)
jl 0x803f
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movslq %eax, %rbp
movl 0x8(%rsp), %eax
movslq %eax, %rsi
movq %rsi, 0x30(%rsp)
movslq 0xc(%rsp), %rsi
movq %rsi, 0x40(%rsp)
incl %eax
movl %eax, 0x8(%rsp)
movq %rbp, %rax
negq %rax
movq %rax, 0x58(%rsp)
movl $0x1, %r13d
leaq 0x3f(%rcx), %rax
movq %rax, 0x10(%rsp)
movq %rbp, 0x48(%rsp)
leaq 0x1(%rbp), %rax
movq %rax, 0x20(%rsp)
movq %rbp, %rax
subq 0x48(%rsp), %rax
leal 0x3f(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq 0x60(%rsp), %rcx
movq %rax, %rdx
andq 0x10(%rsp), %rdx
xorl %esi, %esi
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
cmpq %rdi, %rdx
setbe %sil
movq -0x8(%rcx,%rsi,8), %rcx
btq %rax, %rcx
jb 0x802d
cmpl $0x2, 0xc(%rsp)
setl %al
cmpq 0x30(%rsp), %rbp
setge %cl
orb %al, %cl
jne 0x802d
movslq 0x20(%rsp), %r12
movq 0x28(%rsp), %rax
movq (%rax), %rax
movslq (%rax,%rbp,4), %rbx
addq 0x40(%rsp), %rbp
movl %r13d, %r14d
movq 0x58(%rsp), %rax
addq %r12, %rax
leal 0x3f(%r14), %ecx
testl %r14d, %r14d
cmovnsl %r14d, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq 0x60(%rsp), %rcx
movq %rax, %rdx
andq 0x10(%rsp), %rdx
xorl %esi, %esi
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
cmpq %rdi, %rdx
setbe %sil
movq -0x8(%rcx,%rsi,8), %rcx
btq %rax, %rcx
jb 0x802d
imulq $0x6eac5db, %rbx, %rax  # imm = 0x6EAC5DB
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movslq (%rcx,%r12,4), %rbx
addq %rax, %rbx
movq 0x50(%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 0x800a
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%r15)
jmp 0x8017
movq %r15, %rdi
leaq 0x1c(%rsp), %rdx
callq 0xb082
cmpq 0x30(%rsp), %r12
jge 0x802d
incq %r12
incl %r14d
cmpq %rbp, %r12
jl 0x7f78
incl %r13d
movq 0x20(%rsp), %rbp
cmpl %ebp, 0x8(%rsp)
jne 0x7ef5
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x8059
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x806f
jmp 0x806f
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x808c
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq %rbx, %rdi
callq 0x45b0