// File: /workspace/github_cpp_makefile_star2_O2/epfml[P]sent2vec/src/fasttext.cc
// Function: fasttext::FastText::loadModel(std::istream&, bool)
void FastText::loadModel(std::istream& in, bool load_output_matrix /* = true */) {
  args_ = std::make_shared<Args>();
  dict_ = std::make_shared<Dictionary>(args_);
  input_ = std::make_shared<Matrix>();
  output_ = std::make_shared<Matrix>();
  qinput_ = std::make_shared<QMatrix>();
  qoutput_ = std::make_shared<QMatrix>();
  args_->load(in);

  dict_->load(in);

  bool quant_input;
  in.read((char*) &quant_input, sizeof(bool));
  if (quant_input) {
    quant_ = true;
    qinput_->load(in);
  } else {
    input_->load(in);
  }

  // Only load qoutput_ and output_ matrices if explicitly requested
  if (load_output_matrix) {
      in.read((char*) &args_->qout, sizeof(bool));
      if (quant_ && args_->qout) {
        qoutput_->load(in);
      } else {
        output_->load(in);
      }
  }

  model_ = std::make_shared<Model>(input_, output_, args_, 0);
  model_->quant_ = quant_;
  model_->setQuantizePointer(qinput_, qoutput_, args_->qout);

  if (args_->model == model_name::sup) {
    model_->setTargetCounts(dict_->getCounts(entry_type::label));
  } else {
    model_->setTargetCounts(dict_->getCounts(entry_type::word));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, 0x2c(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x156b9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x15d56
leaq 0x18(%rsp), %rdi
callq 0x8d50
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x156d4
leaq 0x10(%rbx), %rdi
movq %rdi, 0x30(%rsp)
movq %r14, %rsi
callq 0x15f9e
leaq 0x18(%rsp), %rdi
callq 0x8d50
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x157d1
leaq 0x20(%rbx), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x16130
leaq 0x18(%rsp), %rdi
callq 0x8d50
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x157d1
leaq 0x30(%rbx), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x16130
leaq 0x18(%rsp), %rdi
callq 0x8d50
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x157ec
leaq 0x40(%rbx), %rdi
movq %rdi, 0x38(%rsp)
movq %r14, %rsi
callq 0x162c2
leaq 0x18(%rsp), %rdi
callq 0x8d50
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x157ec
leaq 0x50(%rbx), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x162c2
leaq 0x18(%rsp), %rdi
callq 0x8d50
movq (%rbx), %rdi
movq %r15, %rsi
callq 0x5b9e
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x7a20
leaq 0xf(%rsp), %r13
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x43e0
cmpb $0x1, (%r13)
jne 0x10ab3
movb $0x1, 0x80(%rbx)
movq 0x40(%rbx), %rdi
movq %r15, %rsi
callq 0xd078
jmp 0x10abf
movq (%r12), %rdi
movq %r15, %rsi
callq 0xc56c
cmpb $0x0, 0x2c(%rsp)
je 0x10b07
movl $0x12c, %esi            # imm = 0x12C
addq (%rbx), %rsi
pushq $0x1
popq %rdx
movq %r15, %rdi
callq 0x43e0
cmpb $0x1, 0x80(%rbx)
jne 0x10afb
movq (%rbx), %rax
cmpb $0x1, 0x12c(%rax)
jne 0x10afb
movq (%r14), %rdi
movq %r15, %rsi
callq 0xd078
jmp 0x10b07
movq (%rbp), %rdi
movq %r15, %rsi
callq 0xc56c
leaq 0x44(%rsp), %r8
andl $0x0, (%r8)
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x15807
leaq 0x60(%rbx), %rdi
movq %r15, %rsi
callq 0x1654a
leaq 0x18(%rsp), %rdi
callq 0x8d50
movb 0x80(%rbx), %al
movq 0x60(%rbx), %r15
movb %al, 0x118(%r15)
leaq 0x58(%rsp), %r12
movq %r12, %rdi
movq 0x38(%rsp), %rsi
callq 0x15af8
leaq 0x48(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x15af8
movq (%rbx), %rax
movzbl 0x12c(%rax), %ecx
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xda3e
leaq 0x50(%rsp), %rdi
callq 0x8d50
leaq 0x60(%rsp), %rdi
callq 0x8d50
movq (%rbx), %rax
movq 0x60(%rbx), %rbx
cmpl $0x3, 0xc0(%rax)
jne 0x10bd0
movq 0x30(%rsp), %rax
movq (%rax), %rsi
leaq 0x10(%rsp), %r14
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x6fb2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe6b6
jmp 0x10bf2
movq 0x30(%rsp), %rax
movq (%rax), %rsi
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %edx, %edx
callq 0x6fb2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe6b6
leaq 0x10(%rsp), %rdi
callq 0x9c12
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10c0d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x9c12
jmp 0x10c33
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8d50
leaq 0x60(%rsp), %rdi
callq 0x8d50
movq %rbx, %rdi
callq 0x45d0
nop