// File: epfml[P]Bi-Sent2Vec/src/dictionary.cc
// Function: fasttext::Dictionary::getLine(std::istream&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::linear_congruential_engine<unsigned long, 48271ul, 0ul, 2147483647ul>&) const
int32_t Dictionary::getLine(std::istream& in,
                            std::vector<int32_t>& words,
                            std::vector<int32_t>& word_hashes,
                            std::vector<int32_t>& labels,
                            std::minstd_rand& rng) const {
  std::uniform_real_distribution<> uniform(0, 1);

  if (in.eof()) {
    in.clear();
    in.seekg(std::streampos(0));
  }

  words.clear();
  labels.clear();
  word_hashes.clear();
  int32_t ntokens = 0;
  std::string token;
  while (readWord(in, token)) {
    if (token == EOS && (args_-> model == model_name::bisent2vec)){
       break;
    }
    int32_t h = find(token);
    int32_t wid = word2int_[h];
    if (wid < 0) {
      entry_type type = getType(token);
      if (type == entry_type::word) word_hashes.push_back(hash(token));
      continue;
    }
    entry_type type = getType(wid);
    ntokens++;
    if (type == entry_type::word && !discard(wid, uniform(rng))) {
      words.push_back(wid);
      word_hashes.push_back(hash(token));
    }
    if (type == entry_type::label) {
      labels.push_back(wid - nwords_);
    }
    if (token == EOS) break;
    if (ntokens > MAX_LINE_SIZE && args_->model != model_name::bisent2vec) break;
  }
  return ntokens;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x40(%rbp), %rdi
xorps %xmm0, %xmm0
movsd 0x37f3b(%rip), %xmm1    # 0x428b8
callq 0xf070
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
callq 0x5820
testb $0x1, %al
jne 0xa998
jmp 0xa9d6
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
xorl %esi, %esi
callq 0x5740
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x50(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xf0a0
movq -0xb0(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x5550
movq -0x18(%rbp), %rdi
callq 0xe590
movq -0x28(%rbp), %rdi
callq 0xe590
movq -0x20(%rbp), %rdi
callq 0xe590
movl $0x0, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x5600
movq -0xa8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x91b0
movb %al, -0xb1(%rbp)
jmp 0xaa1d
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0xaa2c
jmp 0xac50
leaq -0x78(%rbp), %rdi
leaq 0x54a59(%rip), %rsi     # 0x5f490
callq 0xf0e0
testb $0x1, %al
jne 0xaa42
jmp 0xaa79
movq -0xa8(%rbp), %rdi
callq 0xe6e0
cmpl $0x4, 0xc0(%rax)
jne 0xaa79
jmp 0xac50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x58d8
jmp 0xac71
movq -0xa8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x8070
movl %eax, -0xb8(%rbp)
jmp 0xaa91
movq -0xa8(%rbp), %rdi
movl -0xb8(%rbp), %eax
movl %eax, -0x88(%rbp)
addq $0x10, %rdi
movslq -0x88(%rbp), %rsi
callq 0xe1d0
movl (%rax), %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
jge 0xab21
movq -0xa8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x82e0
movb %al, -0x8d(%rbp)
cmpb $0x0, -0x8d(%rbp)
jne 0xab1c
movq -0xa8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x8120
movq -0xc0(%rbp), %rdi
movl %eax, -0x94(%rbp)
leaq -0x94(%rbp), %rsi
callq 0xe6b0
jmp 0xab1a
jmp 0xab1c
jmp 0xaa01
movq -0xa8(%rbp), %rdi
movl -0x8c(%rbp), %esi
callq 0x8d50
movb %al, -0x95(%rbp)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
cmpb $0x0, -0x95(%rbp)
jne 0xabde
movl -0x8c(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0x30(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xf170
movsd %xmm0, -0xc8(%rbp)
jmp 0xab72
movl -0xcc(%rbp), %esi
movq -0xa8(%rbp), %rdi
movsd -0xc8(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0x8c90
testb $0x1, %al
jne 0xabde
movq -0x18(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
callq 0xe5d0
jmp 0xaba6
movq -0xa8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x8120
movq -0xd8(%rbp), %rdi
movl %eax, -0x9c(%rbp)
leaq -0x9c(%rbp), %rsi
callq 0xe6b0
jmp 0xabdc
jmp 0xabde
cmpb $0x1, -0x95(%rbp)
jne 0xac13
movq -0xa8(%rbp), %rcx
movq -0x28(%rbp), %rdi
movl -0x8c(%rbp), %eax
movl 0x5c(%rcx), %ecx
subl %ecx, %eax
movl %eax, -0xa0(%rbp)
leaq -0xa0(%rbp), %rsi
callq 0xe6b0
jmp 0xac11
jmp 0xac13
leaq -0x78(%rbp), %rdi
leaq 0x54872(%rip), %rsi     # 0x5f490
callq 0xf0e0
testb $0x1, %al
jne 0xac29
jmp 0xac2b
jmp 0xac50
cmpl $0x400, -0x54(%rbp)     # imm = 0x400
jle 0xac4b
movq -0xa8(%rbp), %rdi
callq 0xe6e0
cmpl $0x4, 0xc0(%rax)
je 0xac4b
jmp 0xac50
jmp 0xaa01
movl -0x54(%rbp), %eax
movl %eax, -0xdc(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x58d8
movl -0xdc(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x57a0
nopw (%rax,%rax)