// File: /workspace/github_cpp_makefile_star2_O1/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 0xc698
movslq %ebp, %rcx
imulq %rcx, %rax
movq (%rbx), %rcx
movslq 0x9c(%rcx), %rcx
cqto
idivq %rcx
leaq 0x190(%rsp), %rdi
movq %rax, %rsi
callq 0xc6b1
movq 0x20(%rbx), %rax
movq %rax, 0x70(%rsp)
movq 0x28(%rbx), %rax
movq %rax, 0x78(%rsp)
testq %rax, %rax
je 0xe092
movq 0x9f3c(%rip), %rcx      # 0x17fc0
cmpb $0x0, (%rcx)
je 0xe08e
incl 0x8(%rax)
jmp 0xe092
lock
incl 0x8(%rax)
movq 0x30(%rbx), %rax
movq %rax, 0x60(%rsp)
movq 0x38(%rbx), %rax
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0xe0be
movq 0x9f10(%rip), %rcx      # 0x17fc0
cmpb $0x0, (%rcx)
je 0xe0ba
incl 0x8(%rax)
jmp 0xe0be
lock
incl 0x8(%rax)
movq (%rbx), %rax
movq %rax, 0x50(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0xe0e9
movq 0x9ee5(%rip), %rcx      # 0x17fc0
cmpb $0x0, (%rcx)
je 0xe0e5
incl 0x8(%rax)
jmp 0xe0e9
lock
incl 0x8(%rax)
leaq 0x80(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x60(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movl %ebp, %r8d
callq 0x9960
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xe117
callq 0x77d4
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xe126
callq 0x77d4
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xe135
callq 0x77d4
movq (%rbx), %rax
cmpl $0x3, 0x8c(%rax)
movl %ebp, 0x1c(%rsp)
jne 0xe168
movq 0x10(%rbx), %rsi
movq %rsp, %rdi
movl $0x1, %edx
callq 0x5e24
leaq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0xadae
jmp 0xe186
movq 0x10(%rbx), %rsi
movq %rsp, %rdi
xorl %edx, %edx
callq 0x5e24
leaq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0xadae
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe19c
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq 0x10(%rbx), %rdi
callq 0x4db8
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 0xe34a
xorl %ebp, %ebp
movq %rsp, %r13
leaq 0x3b84(%rip), %r12      # 0x11d68
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 0x33e0(%rip), %xmm1     # 0x11600
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 0x5fc2
movl %eax, %r15d
movq (%rbx), %rax
movl 0x8c(%rax), %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0xe2e7
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 0xd19c
jmp 0xe2e7
movss %xmm0, 0x20(%rsp)
movq 0x10(%rbx), %rdi
movl 0x84(%rax), %edx
movq %r13, %rsi
callq 0x5eb8
leaq 0x80(%rsp), %rsi
movss 0x20(%rsp), %xmm0
movq %r13, %rdx
leaq 0x30(%rsp), %rcx
callq 0xd128
jmp 0xe2e7
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
movq %r13, %rdx
callq 0xd304
jmp 0xe2e7
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
movq %r13, %rdx
callq 0xd478
movslq %r15d, %rax
addq %rax, %rbp
movq (%rbx), %rax
movslq 0x68(%rax), %rax
cmpq %rax, %rbp
jle 0xe332
lock
addq %rbp, 0x50(%rbx)
cmpl $0x0, 0x1c(%rsp)
jne 0xe330
movq (%rbx), %rax
cmpl $0x2, 0xc8(%rax)
jl 0xe330
leaq 0x80(%rsp), %rdi
callq 0xb2d8
movapd %xmm0, %xmm1
movq %rbx, %rdi
movss 0x2c(%rsp), %xmm0
callq 0xced4
xorl %ebp, %ebp
movq 0x50(%rbx), %rcx
movq (%rbx), %rax
movslq 0x74(%rax), %rdx
imulq %r14, %rdx
cmpq %rdx, %rcx
jl 0xe1e4
cmpl $0x0, 0x1c(%rsp)
jne 0xe3a9
cmpl $0x0, 0xc8(%rax)
jle 0xe3a9
leaq 0x80(%rsp), %rdi
callq 0xb2d8
movaps %xmm0, %xmm1
movss 0x3786(%rip), %xmm0     # 0x11af8
movq %rbx, %rdi
callq 0xced4
movq 0x9c47(%rip), %rdi      # 0x17fc8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x9c2c(%rip), %rdi      # 0x17fc8
callq 0x3040
movq %rax, %rdi
callq 0x3180
leaq 0x190(%rsp), %rdi
callq 0x3050
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xe3cd
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe3e3
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
leaq 0x80(%rsp), %rdi
callq 0x9ca8
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 0xe411
movq %rax, %rbx
jmp 0xe472
jmp 0xe41a
jmp 0xe41a
movq %rax, %rbx
jmp 0xe488
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xe431
callq 0x77d4
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xe440
callq 0x77d4
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xe495
callq 0x77d4
jmp 0xe495
movq %rax, %rbx
jmp 0xe495
jmp 0xe458
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xe472
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xe488
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
leaq 0x80(%rsp), %rdi
callq 0x9ca8
leaq 0x190(%rsp), %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x3450