// File: /workspace/github_cpp_makefile_star2_O3/ddu1[P]polarizedtext/src/fasttext.cc
// Function: fasttext::FastText::trainThread(int)
void FastText::trainThread(int32_t threadId) {
  std::ifstream ifs(args_->input);
  utils::seek(ifs, threadId * utils::size(ifs) / args_->thread);

  Model model(input_, output_, args_, threadId);
  if (args_->model == model_name::sup) {
    model.setTargetCounts(dict_->getCounts(entry_type::label));
  } else {
    model.setTargetCounts(dict_->getCounts(entry_type::word));
  }

  const int64_t ntokens = dict_->ntokens();
  int64_t localTokenCount = 0;
  std::vector<int32_t> line, labels;
  while (tokenCount < args_->epoch * ntokens) {
    real progress = real(tokenCount) / (args_->epoch * ntokens);
    real lr = args_->lr * (1.0 - progress);
    localTokenCount += dict_->getLine(ifs, line, labels, model.rng);
    if (args_->model == model_name::sup) {
      dict_->addNgrams(line, args_->wordNgrams);
      supervised(model, lr, line, labels);
    } else if (args_->model == model_name::cbow) {
      cbow(model, lr, line);
    } else if (args_->model == model_name::sg) {
      skipgram(model, lr, line);
    } else if (args_->model == model_name::pwv) { // updated
      pwv(model, lr, line);
    }     
    if (localTokenCount > args_->lrUpdateRate) {
      tokenCount += localTokenCount;
      localTokenCount = 0;
      if (threadId == 0 && args_->verbose > 1) {
        printInfo(progress, model.getLoss());
      }
    }
  }
  if (threadId == 0 && args_->verbose > 0) {
    printInfo(1.0, model.getLoss());
    std::cout << std::endl;
  }
  ifs.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x398, %rsp            # imm = 0x398
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x190(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x33c0
movq %r14, %rdi
callq 0xc574
movslq %ebp, %rcx
imulq %rcx, %rax
movq (%rbx), %rcx
movslq 0x9c(%rcx), %rcx
cqto
idivq %rcx
leaq 0x190(%rsp), %rdi
movq %rax, %rsi
callq 0xc58d
movq 0x20(%rbx), %rax
movq %rax, 0x70(%rsp)
movq 0x28(%rbx), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0xdfaa
movq 0xa024(%rip), %rcx      # 0x17fc0
cmpb $0x0, (%rcx)
je 0xdfa6
incl 0x8(%rax)
jmp 0xdfaa
lock
incl 0x8(%rax)
movq 0x30(%rbx), %rax
movq %rax, 0x60(%rsp)
movq 0x38(%rbx), %rax
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0xdfd6
movq 0x9ff8(%rip), %rcx      # 0x17fc0
cmpb $0x0, (%rcx)
je 0xdfd2
incl 0x8(%rax)
jmp 0xdfd6
lock
incl 0x8(%rax)
movq (%rbx), %rax
movq %rax, 0x50(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0xe001
movq 0x9fcd(%rip), %rcx      # 0x17fc0
cmpb $0x0, (%rcx)
je 0xdffd
incl 0x8(%rax)
jmp 0xe001
lock
incl 0x8(%rax)
leaq 0x80(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x60(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movl %ebp, %r8d
callq 0x9a10
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xe02f
callq 0x7832
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xe03e
callq 0x7832
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xe04d
callq 0x7832
movq (%rbx), %rax
cmpl $0x3, 0x8c(%rax)
movl %ebp, 0x1c(%rsp)
jne 0xe080
movq 0x10(%rbx), %rsi
movq %rsp, %rdi
movl $0x1, %edx
callq 0x5e5a
leaq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0xac7a
jmp 0xe09e
movq 0x10(%rbx), %rsi
movq %rsp, %rdi
xorl %edx, %edx
callq 0x5e5a
leaq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0xac7a
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe0b4
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq 0x10(%rbx), %rdi
callq 0x4dc2
movq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq 0x50(%rbx), %rcx
movq (%rbx), %rax
movslq 0x74(%rax), %rdx
imulq %r14, %rdx
cmpq %rdx, %rcx
jge 0xe262
xorl %ebp, %ebp
movq %rsp, %r13
leaq 0x3c9c(%rip), %r12      # 0x11d98
movq 0x50(%rbx), %rax
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
movq (%rbx), %rax
movslq 0x74(%rax), %rcx
imulq %r14, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
movq 0x10(%rbx), %rdi
divss %xmm0, %xmm1
movss %xmm1, 0x2c(%rsp)
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd 0x34f8(%rip), %xmm1     # 0x11630
subsd %xmm0, %xmm1
mulsd 0x60(%rax), %xmm1
movsd %xmm1, 0x20(%rsp)
leaq 0x190(%rsp), %rsi
movq %r13, %rdx
leaq 0x30(%rsp), %rcx
leaq 0x188(%rsp), %r8
callq 0x5ff8
movl %eax, %r15d
movq (%rbx), %rax
movl 0x8c(%rax), %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0xe1ff
xorps %xmm0, %xmm0
cvtsd2ss 0x20(%rsp), %xmm0
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
movq %r13, %rdx
callq 0xd094
jmp 0xe1ff
movss %xmm0, 0x20(%rsp)
movq 0x10(%rbx), %rdi
movl 0x84(%rax), %edx
movq %r13, %rsi
callq 0x5eee
leaq 0x80(%rsp), %rsi
movss 0x20(%rsp), %xmm0
movq %r13, %rdx
leaq 0x30(%rsp), %rcx
callq 0xd020
jmp 0xe1ff
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
movq %r13, %rdx
callq 0xd1f8
jmp 0xe1ff
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
movq %r13, %rdx
callq 0xd36c
movslq %r15d, %rax
addq %rax, %rbp
movq (%rbx), %rax
movslq 0x68(%rax), %rax
cmpq %rax, %rbp
jle 0xe24a
lock
addq %rbp, 0x50(%rbx)
cmpl $0x0, 0x1c(%rsp)
jne 0xe248
movq (%rbx), %rax
cmpl $0x2, 0xc8(%rax)
jl 0xe248
leaq 0x80(%rsp), %rdi
callq 0xb17c
movapd %xmm0, %xmm1
movq %rbx, %rdi
movss 0x2c(%rsp), %xmm0
callq 0xcdcc
xorl %ebp, %ebp
movq 0x50(%rbx), %rcx
movq (%rbx), %rax
movslq 0x74(%rax), %rdx
imulq %r14, %rdx
cmpq %rdx, %rcx
jl 0xe0fc
cmpl $0x0, 0x1c(%rsp)
jne 0xe2c1
cmpl $0x0, 0xc8(%rax)
jle 0xe2c1
leaq 0x80(%rsp), %rdi
callq 0xb17c
movaps %xmm0, %xmm1
movss 0x389e(%rip), %xmm0     # 0x11b28
movq %rbx, %rdi
callq 0xcdcc
movq 0x9d2f(%rip), %rdi      # 0x17fc8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x9d14(%rip), %rdi      # 0x17fc8
callq 0x3040
movq %rax, %rdi
callq 0x3180
leaq 0x190(%rsp), %rdi
callq 0x3050
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xe2e5
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe2fb
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
leaq 0x80(%rsp), %rdi
callq 0x9d58
leaq 0x190(%rsp), %rdi
callq 0x3070
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe329
movq %rax, %rbx
jmp 0xe38a
jmp 0xe332
jmp 0xe332
movq %rax, %rbx
jmp 0xe3a0
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xe349
callq 0x7832
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xe358
callq 0x7832
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xe3ad
callq 0x7832
jmp 0xe3ad
movq %rax, %rbx
jmp 0xe3ad
jmp 0xe370
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xe38a
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe3a0
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
leaq 0x80(%rsp), %rdi
callq 0x9d58
leaq 0x190(%rsp), %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x3450