// File: /workspace/github_cpp_makefile_star2_O3/epfml[P]Bi-Sent2Vec/src/fasttext.cc
// Function: fasttext::FastText::transgram(fasttext::Model&, float, std::vector<int, std::allocator<int>> const&)
void FastText::transgram(Model& model, real lr,
                        const std::vector<int32_t>& line) {
  if (line.size() <= 1) return;
  std::uniform_int_distribution<> uniform(1, args_->ws);
  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]);
  }
  for (int32_t w = 0; w < line1.size(); w++) {
    int32_t boundary = uniform(model.rng);
    std::vector<int32_t> word;
    word.push_back(line1[w]);
    for (int32_t c = -boundary; c <= boundary; c++) {
      if (c != 0 && w + c >= 0 && w + c < line1.size()) {
        model.update(word, line1[w + c], lr);
      }
    }
    for (int32_t i=0; i<line2.size(); ++i){
        model.update(word, line2[i], lr);
    }
  }
  for (int32_t w = 0; w < line2.size(); w++) {
    int32_t boundary = uniform(model.rng);
    std::vector<int32_t> word;
    word.push_back(line2[w]);
    for (int32_t c = -boundary; c <= boundary; c++) {
      if (c != 0 && w + c >= 0 && w + c < line2.size()) {
        model.update(word, line2[w + c], lr);
      }
    }
    for (int32_t i=0; i<line1.size(); ++i){
        model.update(word, line1[i], lr);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movss %xmm0, 0x4(%rsp)
movq (%rdx), %rax
movq %rdx, 0x28(%rsp)
movq 0x8(%rdx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x5, %rdx
jb 0x148bb
movq %rsi, %rbx
movq %rdi, %r12
movq (%rdi), %rdx
movl 0x98(%rdx), %edx
movl $0x1, 0x78(%rsp)
movl %edx, 0x7c(%rsp)
xorl %edx, %edx
movq %rdx, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq %rdx, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
cmpq %rax, %rcx
je 0x1475d
leaq 0x50(%rsp), %rdi
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %rdx, 0x80(%rsp)
movq %r15, 0x8(%rsp)
movl (%rax,%r15), %r14d
movq %r12, %rbp
movq 0x10(%r12), %r12
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %rdi, %r15
leaq 0xb2f5(%rip), %rsi      # 0x1f849
leaq 0xb2f7(%rip), %rdx      # 0x1f852
callq 0x61ba
movq %r12, %rdi
movq %r15, %rsi
callq 0x6724
movl %eax, %r12d
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x1458a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4300
movl $0x1, %edi
cmpl %r12d, %r14d
movq %rbp, %r12
movq 0x8(%rsp), %r15
je 0x14601
movq 0x28(%rsp), %rax
movq (%rax), %rdx
addq %r15, %rdx
cmpl $0x0, 0x80(%rsp)
je 0x145c4
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x145e4
leaq 0x38(%rsp), %rax
jmp 0x145d7
movq 0x18(%rsp), %rsi
xorl %edi, %edi
cmpq 0x20(%rsp), %rsi
je 0x145f5
leaq 0x18(%rsp), %rax
movl (%rdx), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, (%rax)
jmp 0x14601
leaq 0x30(%rsp), %rdi
callq 0xad56
movl $0x1, %edi
jmp 0x14601
leaq 0x10(%rsp), %rdi
callq 0xad56
xorl %edi, %edi
incq %r13
movq 0x28(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
addq $0x4, %r15
movl %edi, %edx
cmpq %r13, %rcx
leaq 0x50(%rsp), %rdi
ja 0x14527
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x1475d
leaq 0x110(%rbx), %rax
movq %rax, 0x28(%rsp)
xorl %r14d, %r14d
leaq 0x50(%rsp), %r12
leaq 0x78(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rdi, %rdx
callq 0xc07c
movl %eax, %r13d
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq %r14, 0x8(%rsp)
leaq (,%r14,4), %rdx
addq 0x10(%rsp), %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0xad56
testl %r13d, %r13d
js 0x146ea
leal 0x1(,%r13,2), %r14d
movq 0x8(%rsp), %rax
movl %eax, %r15d
subl %r13d, %r15d
xorl %ebp, %ebp
cmpl %ebp, %r13d
je 0x146e3
movl %r15d, %eax
addl %ebp, %eax
js 0x146e3
movl %eax, %eax
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x146e3
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
movss 0x4(%rsp), %xmm0
callq 0x10618
incl %ebp
cmpl %ebp, %r14d
jne 0x146ab
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x14727
xorl %r14d, %r14d
movl (%rax,%r14,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
movss 0x4(%rsp), %xmm0
callq 0x10618
incq %r14
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
ja 0x146f9
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1473e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x8(%rsp), %r14
incq %r14
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x2, %rax
cmpq %r14, %rax
ja 0x1464f
movq 0x30(%rsp), %rdi
cmpq %rdi, 0x38(%rsp)
je 0x14892
leaq 0x110(%rbx), %rax
movq %rax, 0x28(%rsp)
xorl %r14d, %r14d
leaq 0x50(%rsp), %r12
leaq 0x78(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rdi, %rdx
callq 0xc07c
movl %eax, %r13d
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq %r14, 0x8(%rsp)
leaq (,%r14,4), %rdx
addq 0x30(%rsp), %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0xad56
testl %r13d, %r13d
js 0x1481c
leal 0x1(,%r13,2), %r14d
movq 0x8(%rsp), %rax
movl %eax, %r15d
subl %r13d, %r15d
xorl %ebp, %ebp
cmpl %ebp, %r13d
je 0x14815
movl %r15d, %eax
addl %ebp, %eax
js 0x14815
movl %eax, %eax
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x14815
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
movss 0x4(%rsp), %xmm0
callq 0x10618
incl %ebp
cmpl %ebp, %r14d
jne 0x147dd
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x14859
xorl %r14d, %r14d
movl (%rax,%r14,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
movss 0x4(%rsp), %xmm0
callq 0x10618
incq %r14
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
ja 0x1482b
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x14870
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x8(%rsp), %r14
incq %r14
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rax
subq %rdi, %rax
sarq $0x2, %rax
cmpq %r14, %rax
ja 0x14781
testq %rdi, %rdi
je 0x148a4
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x148bb
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x148d7
jmp 0x148d7
jmp 0x148fe
jmp 0x148d7
jmp 0x148fe
movq %rax, %rbx
jmp 0x14918
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x14918
movq 0x60(%rsp), %rsi
incq %rsi
jmp 0x14913
jmp 0x148fe
jmp 0x148fe
jmp 0x148fe
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x14918
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1492f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14946
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq %rbx, %rdi
callq 0x45b0