// File: /workspace/github_cpp_makefile_star2_O1/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 $0x78, %rsp
movl %ecx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0xaae0
leaq 0xccef(%rip), %rsi      # 0x1fc79
movl $0x2, %ecx
movq %r15, %rdi
movq $-0x1, %rdx
callq 0x4680
cmpq $-0x1, %rax
je 0x12fb6
incq %rax
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x40a0
leaq 0x38(%rsp), %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x4660
cmpq $-0x1, %rax
je 0x12fee
movq 0x40(%rsp), %rcx
cmpq %rax, %rcx
jb 0x13353
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rcx
movb $0x0, (%rcx,%rax)
leaq 0xca6d(%rip), %rcx      # 0x1fa62
leaq 0x38(%rsp), %rdi
movl $0x4, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x4340
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x13030
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x13037
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x10(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xca0d(%rip), %rsi      # 0x1fa67
callq 0x4620
leaq 0x68(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x13086
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x1308e
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x130bd
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x130d4
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4300
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x199d0
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
testq %rdi, %rdi
je 0x1310e
callq 0xaa70
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1311d
callq 0xaa70
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x619a
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %rbx, %rcx
callq 0x19b44
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x18(%rbx), %rdi
movups %xmm0, 0x10(%rbx)
testq %rdi, %rdi
je 0x13166
callq 0xaa70
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x13175
callq 0xaa70
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x8bc8
leaq 0x80(%rbx), %rsi
movl $0x1, %edx
movq %r14, %rdi
callq 0x43b0
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rdx
movq %r14, %rsi
movl %ebp, %ecx
callq 0xe698
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x28(%rbx), %rdi
movups %xmm0, 0x20(%rbx)
testq %rdi, %rdi
je 0x131c8
callq 0xaa70
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x131d7
callq 0xaa70
movl $0x12c, %esi            # imm = 0x12C
addq (%rbx), %rsi
movl $0x1, %edx
movq %r14, %rdi
callq 0x43b0
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x38(%rsp), %r15
movq %r15, %rdx
callq 0x19d0c
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x38(%rbx), %rdi
movups %xmm0, 0x30(%rbx)
testq %rdi, %rdi
je 0x1322a
callq 0xaa70
leaq 0x30(%rbx), %r12
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1323d
callq 0xaa70
movq (%r12), %rsi
addq $0x8, %rsi
movl $0x8, %edx
movq %r14, %rdi
callq 0x43b0
movq (%r12), %rsi
addq $0x10, %rsi
movl $0x8, %edx
movq %r14, %rdi
callq 0x43b0
leaq 0x20(%rbx), %rcx
movl $0x0, 0x38(%rsp)
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r15, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0x37(%rsp), %rdx
movq %r12, %r8
movq %rbx, %r9
callq 0x19eb0
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x68(%rbx), %rdi
movups %xmm0, 0x60(%rbx)
testq %rdi, %rdi
je 0x132b8
callq 0xaa70
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x132c7
callq 0xaa70
movq (%rbx), %rax
movq 0x60(%rbx), %r14
cmpl $0x3, 0xc0(%rax)
jne 0x132f9
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
callq 0x7cca
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x10a90
jmp 0x13316
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
xorl %edx, %edx
callq 0x7cca
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x10a90
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1332d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x13344
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4300
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc936(%rip), %rdi      # 0x1fc90
leaq 0xc91b(%rip), %rsi      # 0x1fc7c
movq %rax, %rdx
xorl %eax, %eax
callq 0x4490
jmp 0x1336d
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x133ce
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
jmp 0x133ce
jmp 0x133cb
jmp 0x133cb
jmp 0x133b7
jmp 0x133b7
jmp 0x133cb
jmp 0x133cb
jmp 0x133cb
jmp 0x133cb
jmp 0x133cb
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x133ba
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x133ba
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x133e5
movq 0x48(%rsp), %rsi
jmp 0x133dd
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x133e5
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4300
movq %rbx, %rdi
callq 0x45b0
nop