// File: /workspace/github_cpp_makefile_star2_O2/epfml[P]Bi-Sent2Vec/src/fasttext.cc
// Function: fasttext::FastText::bisent2vec(fasttext::Model&, float, std::vector<int, std::allocator<int>> const&)
void FastText::bisent2vec(Model& model, real lr, const std::vector<int32_t>& line){
  if (line.size() <= 1) return;
  std::vector<int32_t> context;
  std::vector<int32_t> line1;
  std::vector<int32_t> line2;
  int32_t flag = 0;
  for (int32_t i=0; i<line.size(); ++i){
    if (line[i] == dict_->getId("<<split>>")){
      flag = 1;
      continue;
    }
    if (flag==0)
      line1.push_back(line[i]);
    else
      line2.push_back(line[i]);
  }
  std::uniform_real_distribution<> uniform(0, 1);
  for (int32_t i=0; i<line1.size(); ++i){
    if (uniform(model.rng) > dict_->getPDiscard(line1[i]) || dict_->getTokenCount(line1[i]) < args_->minCountLabel)
      continue;
    context = line1;
    context[i] = 0;
    dict_->addNgrams(context, args_->wordNgrams, args_->dropoutK, model.rng);
    model.update(context, line1[i], lr);
    context = line2;
    dict_->addNgrams(context, args_->wordNgrams, args_->dropoutK, model.rng);
    model.update(context, line1[i], lr);

  }
  for (int32_t i=0; i<line2.size(); ++i){
    if (uniform(model.rng) > dict_->getPDiscard(line2[i]) || dict_->getTokenCount(line2[i]) < args_->minCountLabel)
      continue;
    context = line2;
    context[i] = 0;
    dict_->addNgrams(context, args_->wordNgrams, args_->dropoutK, model.rng);
    model.update(context, line2[i], lr);
    context = line1;
    dict_->addNgrams(context, args_->wordNgrams, args_->dropoutK, model.rng);
    model.update(context, line2[i], lr);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movss %xmm0, 0x8(%rsp)
movq %rsi, 0x18(%rsp)
movq (%rdx), %rax
movq %rdx, 0x10(%rsp)
movq 0x8(%rdx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x5, %rdx
jb 0x11b8b
movq %rdi, 0x58(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
leaq 0x40(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x20(%rsp), %rdx
andq $0x0, 0x10(%rdx)
movaps %xmm0, (%rdx)
xorl %r15d, %r15d
leaq 0x80(%rsp), %r12
xorl %r13d, %r13d
xorl %ebp, %ebp
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r13, %rcx
jbe 0x1190d
movl (%rax,%r13,4), %r14d
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rbx
movq %r12, %rdi
leaq 0x9fab(%rip), %rsi      # 0x1b841
leaq 0xf(%rsp), %rdx
callq 0x5b64
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5f5e
movl %eax, %ebx
movq %r12, %rdi
callq 0x46c8
pushq $0x1
popq %r12
cmpl %ebx, %r14d
je 0x118ea
movq 0x10(%rsp), %rax
movq (%rax), %rsi
addq %r15, %rsi
testl %ebp, %ebp
je 0x118dd
leaq 0x20(%rsp), %rdi
callq 0x87c4
pushq $0x1
popq %r12
jmp 0x118ea
xorl %r12d, %r12d
leaq 0x40(%rsp), %rdi
callq 0x87c4
incq %r13
movq 0x10(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
addq $0x4, %r15
movl %r12d, %ebp
leaq 0x80(%rsp), %r12
jmp 0x1186f
xorps %xmm0, %xmm0
movhps 0x8fd1(%rip), %xmm0     # xmm0 = xmm0[0,1],mem[0,1]
leaq 0x80(%rsp), %r12
movaps %xmm0, (%r12)
movq 0x18(%rsp), %rax
leaq 0x110(%rax), %r15
xorl %ebx, %ebx
leaq 0x60(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq 0x58(%rsp), %r14
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
sarq $0x2, %rax
cmpq %rbx, %rax
jbe 0x11a4d
movq %r12, %rdi
movq %r15, %rsi
callq 0x89a8
movsd %xmm0, 0x10(%rsp)
movq 0x10(%r14), %rdi
movq 0x40(%rsp), %rax
movl (%rax,%rbx,4), %esi
callq 0x64ba
cvtss2sd %xmm0, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x11a45
movq 0x10(%r14), %rdi
movq 0x40(%rsp), %rax
movl (%rax,%rbx,4), %esi
callq 0x6460
movq (%r14), %rcx
movslq 0xac(%rcx), %rcx
cmpq %rcx, %rax
jl 0x11a45
movq %r13, %rdi
leaq 0x40(%rsp), %rsi
callq 0x8a02
movq 0x60(%rsp), %rax
andl $0x0, (%rax,%rbx,4)
movq (%r14), %rax
movq 0x10(%r14), %rdi
movl 0x9c(%rax), %ecx
movl 0xb4(%rax), %edx
movq %r13, %rsi
movq %r15, %r8
callq 0x71aa
movq 0x40(%rsp), %rax
movl (%rax,%rbx,4), %edx
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movss 0x8(%rsp), %xmm0
callq 0xe22a
movq %r13, %rdi
movq %rbp, %rsi
callq 0x8a02
movq (%r14), %rax
movq 0x10(%r14), %rdi
movl 0x9c(%rax), %ecx
movl 0xb4(%rax), %edx
movq %r13, %rsi
movq %r15, %r8
callq 0x71aa
movq 0x40(%rsp), %rax
movl (%rax,%rbx,4), %edx
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movss 0x8(%rsp), %xmm0
callq 0xe22a
incq %rbx
jmp 0x11941
xorl %ebx, %ebx
leaq 0x80(%rsp), %r12
leaq 0x60(%rsp), %r13
leaq 0x40(%rsp), %rbp
movq 0x28(%rsp), %rax
subq 0x20(%rsp), %rax
sarq $0x2, %rax
cmpq %rbx, %rax
jbe 0x11b6d
movq %r12, %rdi
movq %r15, %rsi
callq 0x89a8
movsd %xmm0, 0x10(%rsp)
movq 0x10(%r14), %rdi
movq 0x20(%rsp), %rax
movl (%rax,%rbx,4), %esi
callq 0x64ba
cvtss2sd %xmm0, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x11b65
movq 0x10(%r14), %rdi
movq 0x20(%rsp), %rax
movl (%rax,%rbx,4), %esi
callq 0x6460
movq (%r14), %rcx
movslq 0xac(%rcx), %rcx
cmpq %rcx, %rax
jl 0x11b65
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
callq 0x8a02
movq 0x60(%rsp), %rax
andl $0x0, (%rax,%rbx,4)
movq (%r14), %rax
movq 0x10(%r14), %rdi
movl 0x9c(%rax), %ecx
movl 0xb4(%rax), %edx
movq %r13, %rsi
movq %r15, %r8
callq 0x71aa
movq 0x20(%rsp), %rax
movl (%rax,%rbx,4), %edx
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movss 0x8(%rsp), %xmm0
callq 0xe22a
movq %r13, %rdi
movq %rbp, %rsi
callq 0x8a02
movq (%r14), %rax
movq 0x10(%r14), %rdi
movl 0x9c(%rax), %ecx
movl 0xb4(%rax), %edx
movq %r13, %rsi
movq %r15, %r8
callq 0x71aa
movq 0x20(%rsp), %rax
movl (%rax,%rbx,4), %edx
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movss 0x8(%rsp), %xmm0
callq 0xe22a
incq %rbx
jmp 0x11a61
leaq 0x20(%rsp), %rdi
callq 0x8c0e
leaq 0x40(%rsp), %rdi
callq 0x8c0e
leaq 0x60(%rsp), %rdi
callq 0x8c0e
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11bb5
jmp 0x11bb5
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x46c8
jmp 0x11bb8
jmp 0x11bb5
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8c0e
leaq 0x40(%rsp), %rdi
callq 0x8c0e
leaq 0x60(%rsp), %rdi
callq 0x8c0e
movq %rbx, %rdi
callq 0x45d0