// File: /workspace/github_cpp_makefile_star2_O1/epfml[P]Bi-Sent2Vec/src/fasttext.cc
// Function: fasttext::FastText::savedDictTrain(std::shared_ptr<fasttext::Args>)
void FastText::savedDictTrain(std::shared_ptr<Args> args) {
  loadDict(args_->dict);
  if (args_->input == "-") {
    // manage expectations
    std::cerr << "Cannot use stdin for training!" << std::endl;
    exit(EXIT_FAILURE);
  }
  std::ifstream ifs(args_->input);
  if (!ifs.is_open()) {
    std::cerr << "Input file cannot be opened!" << std::endl;
    exit(EXIT_FAILURE);
  }
  dict_->readFromFile(ifs);
  ifs.close();

  if (args_->pretrainedVectors.size() != 0) {
    loadVectors(args_->pretrainedVectors);
  } else {
    input_ = std::make_shared<Matrix>(dict_->nwords()+args_->bucket, args_->dim);
    input_->uniform(1.0 / args_->dim);
  }

  output_ = std::make_shared<Matrix>(dict_->nwords(), args_->dim);
  output_->zero();

  start = clock();
  tokenCount = 0;
  if (args_->thread > 1) {
    std::vector<std::thread> threads;
    for (int32_t i = 0; i < args_->thread; i++) {
      threads.push_back(std::thread([=]() { trainThread(i); }));
    }
    for (auto it = threads.begin(); it != threads.end(); ++it) {
      it->join();
    }
  } else {
    trainThread(0);
  }
  model_ = std::make_shared<Model>(input_, output_, args_, 0);

  saveModel();
  if (args_->model != model_name::bisent2vec) {
    saveVectors();
    if (args_->saveOutput > 0) {
      saveOutput();
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rdi, %rbx
movq (%rdi), %rsi
addq $0x60, %rsi
callq 0x1295e
movq (%rbx), %rdi
leaq 0x6a90(%rip), %rsi      # 0x1f9b8
callq 0x40e0
testl %eax, %eax
je 0x19280
movq (%rbx), %rsi
leaq 0x60(%rsp), %rdi
movl $0x8, %edx
callq 0x44f0
leaq 0xd8(%rsp), %rdi
callq 0x40b0
testb %al, %al
je 0x192a5
movq 0x10(%rbx), %rdi
leaq 0x60(%rsp), %rsi
callq 0x712e
leaq 0x60(%rsp), %rdi
callq 0x4090
movq (%rbx), %rax
movq 0x110(%rax), %rdx
testq %rdx, %rdx
je 0x18fcd
leaq 0x50(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x108(%rax), %rsi
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0xa8dc
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x18678
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x19062
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x19062
movq 0x10(%rbx), %rdi
callq 0x6550
movq (%rbx), %r8
addl 0xc4(%r8), %eax
leaq 0x8(%rsp), %rcx
movl %eax, (%rcx)
addq $0x94, %r8
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x1bc38
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x28(%rbx), %rdi
movups %xmm0, 0x20(%rbx)
testq %rdi, %rdi
je 0x19029
callq 0xa86c
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x19038
callq 0xa86c
movq (%rbx), %rax
movq 0x20(%rbx), %rdi
xorps %xmm0, %xmm0
cvtsi2sdl 0x94(%rax), %xmm0
movsd 0x589e(%rip), %xmm1     # 0x1e8f0
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
callq 0xde0c
movq 0x10(%rbx), %rdi
callq 0x6550
leaq 0x8(%rsp), %r14
movl %eax, (%r14)
movl $0x94, %r8d
addq (%rbx), %r8
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %r14, %rcx
callq 0x1bc38
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x38(%rbx), %rdi
movups %xmm0, 0x30(%rbx)
testq %rdi, %rdi
je 0x190ba
callq 0xa86c
leaq 0x30(%rbx), %r15
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x190cd
callq 0xa86c
movq (%r15), %rdi
callq 0xddee
callq 0x41e0
movq %rax, 0x78(%rbx)
xorl %eax, %eax
xchgq %rax, 0x70(%rbx)
movq (%rbx), %rax
cmpl $0x2, 0xd4(%rax)
jl 0x191ca
movq %r15, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rbx), %rax
cmpl $0x0, 0xd4(%rax)
jle 0x19195
xorl %r14d, %r14d
leaq 0x10ba0(%rip), %r15     # 0x29cc0
leaq 0x30(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq $0x0, 0x30(%rsp)
movl $0x18, %edi
callq 0x42f0
movq %r15, (%rax)
movq %rbx, 0x8(%rax)
movl %r14d, 0x10(%rax)
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x42b0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1916f
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x1a9d8
cmpq $0x0, 0x30(%rsp)
jne 0x1931a
incl %r14d
movq (%rbx), %rax
cmpl 0xd4(%rax), %r14d
jl 0x1912f
movq 0x10(%rsp), %r12
cmpq 0x18(%rsp), %r12
leaq 0x8(%rsp), %r14
movq 0x38(%rsp), %r15
je 0x191be
movq %r12, %rdi
callq 0x4570
addq $0x8, %r12
cmpq 0x18(%rsp), %r12
jne 0x191ab
leaq 0x10(%rsp), %rdi
callq 0x1a05e
jmp 0x191d4
movq %rbx, %rdi
xorl %esi, %esi
callq 0x180bc
leaq 0x20(%rbx), %rcx
movl $0x0, 0x8(%rsp)
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r14, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %r15, %r8
movq %rbx, %r9
callq 0x1a752
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x68(%rbx), %rdi
movups %xmm0, 0x60(%rbx)
testq %rdi, %rdi
je 0x19225
callq 0xa86c
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x19234
callq 0xa86c
movq %rbx, %rdi
callq 0x12af4
movq (%rbx), %rax
cmpl $0x4, 0xc0(%rax)
je 0x19264
movq %rbx, %rdi
callq 0x11cfa
movq (%rbx), %rax
cmpl $0x0, 0x128(%rax)
jle 0x19264
movq %rbx, %rdi
callq 0x124da
leaq 0x60(%rsp), %rdi
callq 0x40c0
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10d69(%rip), %rdi     # 0x29ff0
leaq 0x672c(%rip), %rsi      # 0x1f9ba
callq 0x42e0
movq %rax, %rdi
callq 0x4170
movl $0x1, %edi
callq 0x4380
movq 0x10d44(%rip), %rdi     # 0x29ff0
leaq 0x6726(%rip), %rsi      # 0x1f9d9
movl $0x1c, %edx
callq 0x4350
movq 0x10d2c(%rip), %rdi     # 0x29ff0
callq 0x4170
jmp 0x1929b
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x1932c
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x1932c
jmp 0x192ed
jmp 0x192ed
jmp 0x192ed
movq %rax, %rbx
jmp 0x1932c
jmp 0x1931f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x19307
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x8(%rsp)
jmp 0x19322
cmpq $0x0, 0x30(%rsp)
je 0x1931f
callq 0x40d0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1a05e
leaq 0x60(%rsp), %rdi
callq 0x40c0
movq %rbx, %rdi
callq 0x45b0