// File: /workspace/github_cpp_makefile_star2_O2/epfml[P]sent2vec/src/fasttext.cc
// Function: fasttext::FastText::loadModelWithSharedMemory(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
void FastText::loadModelWithSharedMemory(std::istream& in,
                                         const std::string& filename,
                                         const int timeout_sec) {
  std::string shmem_name = "s2v_" + basename(filename) + "_input_matrix";

  args_ = std::make_shared<Args>();
  args_->load(in);

  dict_ = std::make_shared<Dictionary>(args_);
  dict_->load(in);

  in.read((char*) &quant_, sizeof(bool));

  input_ = ShmemMatrix::load(in, shmem_name, timeout_sec);

  in.read((char*) &args_->qout, sizeof(bool));

  output_ = std::make_shared<Matrix>();
  in.read((char*) &(output_->m_), sizeof(int64_t));
  in.read((char*) &(output_->n_), sizeof(int64_t));

  model_ = std::make_shared<Model>(input_, output_, args_, 0);

  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 %ecx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x4460
leaq 0xa58e(%rip), %rsi      # 0x1ac81
pushq $-0x1
popq %rdx
movq %r15, %rdi
callq 0x4310
cmpq $-0x1, %rax
je 0x10716
incq %rax
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x40b0
leaq 0x28(%rsp), %rdi
pushq $0x2e
popq %rsi
pushq $-0x1
popq %rdx
callq 0x4690
cmpq $-0x1, %rax
je 0x1073c
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rdx
movq %rax, %rsi
callq 0x40b0
leaq 0xa327(%rip), %rsi      # 0x1aa6a
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x1582e
leaq 0xa316(%rip), %rdx      # 0x1aa6f
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x156f2
leaq 0x8(%rsp), %rdi
callq 0x46c8
leaq 0x28(%rsp), %rdi
callq 0x46c8
leaq 0x8(%rsp), %rdi
callq 0x156b9
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x15d56
leaq 0x10(%rsp), %rdi
callq 0x8d50
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x5b9e
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x156d4
leaq 0x10(%rbx), %r15
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x15f9e
leaq 0x10(%rsp), %rdi
callq 0x8d50
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x7a20
leaq 0x80(%rbx), %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x43e0
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %r14, %rsi
movl %ebp, %ecx
callq 0xc72a
leaq 0x20(%rbx), %r12
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x16578
leaq 0x10(%rsp), %rdi
callq 0x8d50
movl $0x12c, %esi            # imm = 0x12C
addq (%rbx), %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x43e0
leaq 0x8(%rsp), %rdi
callq 0x157d1
leaq 0x30(%rbx), %r13
leaq 0x8(%rsp), %rsi
movq %r13, %rdi
callq 0x16130
leaq 0x10(%rsp), %rdi
callq 0x8d50
movq 0x30(%rbx), %rsi
addq $0x8, %rsi
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x43e0
movq (%r13), %rsi
addq $0x10, %rsi
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x43e0
leaq 0x28(%rsp), %r8
andl $0x0, (%r8)
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x15807
leaq 0x60(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1654a
leaq 0x10(%rsp), %rdi
callq 0x8d50
movq (%rbx), %rax
movq 0x60(%rbx), %rbx
cmpl $0x3, 0xc0(%rax)
jne 0x108de
movq (%r15), %rsi
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rdx
callq 0x6fb2
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0xe6b6
jmp 0x108fa
movq (%r15), %rsi
leaq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0x6fb2
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0xe6b6
leaq 0x8(%rsp), %rdi
callq 0x9c12
leaq 0x48(%rsp), %rdi
callq 0x46c8
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1091f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x9c12
jmp 0x1095c
jmp 0x10959
jmp 0x10959
jmp 0x1094f
jmp 0x1094f
jmp 0x10959
jmp 0x10959
jmp 0x10959
jmp 0x10959
jmp 0x10959
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x46c8
jmp 0x10952
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x10961
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x46c8
movq %rbx, %rdi
callq 0x45d0