// File: /workspace/github_cpp_makefile_star2_O2/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 0x101c6
movq (%rbx), %rdi
leaq 0x6c84(%rip), %rsi      # 0x1b9c0
callq 0x5b9f
testb %al, %al
jne 0x14fcb
movq (%rbx), %rsi
leaq 0x60(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x4520
leaq 0xd8(%rsp), %rdi
callq 0x40c0
testb %al, %al
je 0x14fee
movq 0x10(%rbx), %rdi
leaq 0x60(%rsp), %rsi
callq 0x66a2
leaq 0x60(%rsp), %rdi
callq 0x40a0
movq (%rbx), %rsi
cmpq $0x0, 0x110(%rsi)
je 0x14dbd
addq $0x108, %rsi            # imm = 0x108
leaq 0x40(%rsp), %rdi
callq 0x4460
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x146be
leaq 0x40(%rsp), %rdi
callq 0x46c8
jmp 0x14e23
movq 0x10(%rbx), %rdi
callq 0x5e34
movq (%rbx), %rdx
addl 0xc4(%rdx), %eax
leaq 0x8(%rsp), %rsi
movl %eax, (%rsi)
addq $0x94, %rdx
leaq 0x10(%rsp), %rdi
callq 0x15d9c
leaq 0x20(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1648e
leaq 0x18(%rsp), %rdi
callq 0x8b66
movq (%rbx), %rax
movq 0x20(%rbx), %rdi
cvtsi2sdl 0x94(%rax), %xmm0
movsd 0x5ad2(%rip), %xmm1     # 0x1a8e8
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
callq 0xbefe
movq 0x10(%rbx), %rdi
callq 0x5e34
leaq 0x8(%rsp), %rsi
movl %eax, (%rsi)
movl $0x94, %edx
addq (%rbx), %rdx
leaq 0x10(%rsp), %rdi
callq 0x15d9c
leaq 0x30(%rbx), %r12
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x1648e
leaq 0x18(%rsp), %rdi
callq 0x8b66
movq 0x30(%rbx), %rdi
callq 0xbee0
callq 0x4220
movq %rax, 0x78(%rbx)
xorl %eax, %eax
xchgq %rax, 0x70(%rbx)
xorl %r14d, %r14d
movq (%rbx), %rax
movl 0xd4(%rax), %eax
cmpl $0x2, %eax
jl 0x14f15
movq %r12, 0x38(%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x12e26(%rip), %r12     # 0x27cd0
leaq 0x30(%rsp), %r13
leaq 0x8(%rsp), %rbp
cmpl %eax, %r14d
jge 0x14f21
andq $0x0, 0x30(%rsp)
pushq $0x18
popq %rdi
callq 0x4340
movq %r12, (%rax)
movq %rbx, 0x8(%rax)
movl %r14d, 0x10(%rax)
movq %rax, 0x8(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x4300
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x14ef4
movq (%rdi), %rax
callq *0x8(%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x16a86
movq %r13, %rdi
callq 0x15c6c
incl %r14d
movq (%rbx), %rax
movl 0xd4(%rax), %eax
jmp 0x14eb4
movq %rbx, %rdi
xorl %esi, %esi
callq 0x14258
jmp 0x14f4a
movq 0x10(%rsp), %r15
movq 0x38(%rsp), %r12
cmpq 0x18(%rsp), %r15
je 0x14f40
movq %r15, %rdi
callq 0x45a0
addq $0x8, %r15
jmp 0x14f2b
leaq 0x10(%rsp), %rdi
callq 0x15c7a
leaq 0x20(%rbx), %rsi
leaq 0x8(%rsp), %r8
andl $0x0, (%r8)
leaq 0x10(%rsp), %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x15bfb
leaq 0x60(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x168a8
leaq 0x18(%rsp), %rdi
callq 0x8b66
movq %rbx, %rdi
callq 0x102f0
movq (%rbx), %rax
cmpl $0x4, 0xc0(%rax)
je 0x14faf
movq %rbx, %rdi
callq 0xfa4e
movq (%rbx), %rax
cmpl $0x0, 0x128(%rax)
jle 0x14faf
movq %rbx, %rdi
callq 0xfe96
leaq 0x60(%rsp), %rdi
callq 0x40e0
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1301e(%rip), %rdi     # 0x27ff0
leaq 0x69e9(%rip), %rsi      # 0x1b9c2
callq 0x4330
movq %rax, %rdi
callq 0x4190
pushq $0x1
popq %rdi
callq 0x43b0
movq 0x12ffb(%rip), %rdi     # 0x27ff0
leaq 0x69e5(%rip), %rsi      # 0x1b9e1
callq 0x4330
movq %rax, %rdi
callq 0x4190
jmp 0x14fe6
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x46c8
jmp 0x15058
jmp 0x15020
jmp 0x15020
jmp 0x15020
movq %rax, %rbx
jmp 0x15058
jmp 0x1504b
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x15c6c
jmp 0x1504e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1504e
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x1504e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x15c7a
leaq 0x60(%rsp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x45d0