// File: /workspace/github_cpp_makefile_star2_O2/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, 0xc(%rsp)
movq (%rdx), %rax
movq %rdx, 0x58(%rsp)
movq 0x8(%rdx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x5, %rdx
jb 0x11666
movq %rsi, %rbx
movq (%rdi), %rdx
movl 0x98(%rdx), %edx
movl $0x1, 0x18(%rsp)
movl %edx, 0x1c(%rsp)
xorps %xmm0, %xmm0
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
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %rdi, 0x80(%rsp)
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
jbe 0x11497
movl %r12d, 0x14(%rsp)
movq %rbp, %r13
movl (%rax,%rbp,4), %r14d
movq 0x10(%rdi), %rbp
leaq 0x60(%rsp), %rdi
leaq 0xa429(%rip), %rsi      # 0x1b841
leaq 0x13(%rsp), %rdx
callq 0x5b64
movq %rbp, %rdi
leaq 0x60(%rsp), %r12
movq %r12, %rsi
callq 0x5f5e
movl %eax, %ebp
movq %r12, %rdi
callq 0x46c8
pushq $0x1
popq %r12
cmpl %ebp, %r14d
movq %r13, %rbp
je 0x11477
movq 0x58(%rsp), %rax
movq (%rax), %rsi
addq %r15, %rsi
cmpl $0x0, 0x14(%rsp)
je 0x1146a
leaq 0x20(%rsp), %rdi
callq 0x87c4
pushq $0x1
popq %r12
jmp 0x11477
xorl %r12d, %r12d
leaq 0x40(%rsp), %rdi
callq 0x87c4
incq %rbp
movq 0x58(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
addq $0x4, %r15
movq 0x80(%rsp), %rdi
jmp 0x113ec
leaq 0x110(%rbx), %r14
xorl %r13d, %r13d
leaq 0x60(%rsp), %r12
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
sarq $0x2, %rax
cmpq %r13, %rax
jbe 0x11578
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x892c
movl %eax, %r15d
andq $0x0, 0x70(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
leaq (,%r13,4), %rsi
addq 0x40(%rsp), %rsi
movq %r12, %rdi
callq 0x87c4
movl %r15d, %ebp
negl %ebp
cmpl %r15d, %ebp
jg 0x11535
testl %ebp, %ebp
je 0x11531
movl %r13d, %eax
addl %ebp, %eax
js 0x11531
movl %eax, %eax
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x11531
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
movss 0xc(%rsp), %xmm0
callq 0xe22a
incl %ebp
jmp 0x114f5
xorl %r15d, %r15d
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
jbe 0x11568
movl (%rax,%r15,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
movss 0xc(%rsp), %xmm0
callq 0xe22a
incq %r15
jmp 0x11538
movq %r12, %rdi
callq 0x8c0e
incq %r13
jmp 0x114a6
xorl %r13d, %r13d
leaq 0x60(%rsp), %r12
movq 0x28(%rsp), %rax
subq 0x20(%rsp), %rax
sarq $0x2, %rax
cmpq %r13, %rax
jbe 0x11652
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x892c
movl %eax, %r15d
andq $0x0, 0x70(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
leaq (,%r13,4), %rsi
addq 0x20(%rsp), %rsi
movq %r12, %rdi
callq 0x87c4
movl %r15d, %ebp
negl %ebp
cmpl %r15d, %ebp
jg 0x1160f
testl %ebp, %ebp
je 0x1160b
movl %r13d, %eax
addl %ebp, %eax
js 0x1160b
movl %eax, %eax
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x1160b
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
movss 0xc(%rsp), %xmm0
callq 0xe22a
incl %ebp
jmp 0x115cf
xorl %r15d, %r15d
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
jbe 0x11642
movl (%rax,%r15,4), %edx
movq %rbx, %rdi
movq %r12, %rsi
movss 0xc(%rsp), %xmm0
callq 0xe22a
incq %r15
jmp 0x11612
movq %r12, %rdi
callq 0x8c0e
incq %r13
jmp 0x11580
leaq 0x20(%rsp), %rdi
callq 0x8c0e
leaq 0x40(%rsp), %rdi
callq 0x8c0e
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11682
jmp 0x1169c
jmp 0x11682
jmp 0x1169c
jmp 0x11682
movq %rax, %rbx
jmp 0x116a9
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x46c8
jmp 0x116a9
jmp 0x1169c
jmp 0x1169c
jmp 0x1169c
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x8c0e
leaq 0x20(%rsp), %rdi
callq 0x8c0e
leaq 0x40(%rsp), %rdi
callq 0x8c0e
movq %rbx, %rdi
callq 0x45d0
nop