// File: /workspace/github_cpp_makefile_star2_O3/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
movq (%rdx), %rsi
leaq 0x48(%rsp), %r12
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
movq %r12, -0x10(%r12)
leaq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0xab14
leaq 0xccad(%rip), %rsi      # 0x1fc89
movl $0x2, %ecx
movq %r15, %rdi
movq $-0x1, %rdx
callq 0x4680
cmpq $-0x1, %rax
je 0x13008
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 0x13040
movq 0x40(%rsp), %rcx
cmpq %rax, %rcx
jb 0x133a5
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rcx
movb $0x0, (%rcx,%rax)
leaq 0xca2b(%rip), %rcx      # 0x1fa72
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 0x13082
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x13089
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 0xc9cb(%rip), %rsi      # 0x1fa77
callq 0x4620
leaq 0x68(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x130d8
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x130e0
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 0x1310f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x13126
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 0x19ace
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
testq %rdi, %rdi
je 0x1316f
callq 0xaaa4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1316f
callq 0xaaa4
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x619c
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %rbx, %rcx
callq 0x19c3c
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x18(%rbx), %rdi
movups %xmm0, 0x10(%rbx)
testq %rdi, %rdi
je 0x131c7
callq 0xaaa4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x131c7
callq 0xaaa4
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x8bea
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 0xe908
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x28(%rbx), %rdi
movups %xmm0, 0x20(%rbx)
testq %rdi, %rdi
je 0x13229
callq 0xaaa4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x13229
callq 0xaaa4
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 0x19dfe
leaq 0x30(%rbx), %r12
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x38(%rbx), %rdi
movups %xmm0, 0x30(%rbx)
testq %rdi, %rdi
je 0x1328f
callq 0xaaa4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1328f
callq 0xaaa4
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 0x19f96
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x68(%rbx), %rdi
movups %xmm0, 0x60(%rbx)
testq %rdi, %rdi
je 0x13319
callq 0xaaa4
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x13319
callq 0xaaa4
movq (%rbx), %rax
movq 0x60(%rbx), %r14
cmpl $0x3, 0xc0(%rax)
jne 0x1334b
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
callq 0x7d16
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x10ac8
jmp 0x13368
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
xorl %edx, %edx
callq 0x7d16
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x10ac8
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1337f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x13396
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 0xc8f4(%rip), %rdi      # 0x1fca0
leaq 0xc8d9(%rip), %rsi      # 0x1fc8c
movq %rax, %rdx
xorl %eax, %eax
callq 0x4490
jmp 0x133bf
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x13420
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4300
jmp 0x13420
jmp 0x1341d
jmp 0x1341d
jmp 0x13409
jmp 0x13409
jmp 0x1341d
jmp 0x1341d
jmp 0x1341d
jmp 0x1341d
jmp 0x1341d
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x1340c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4300
jmp 0x1340c
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x13437
movq 0x48(%rsp), %rsi
jmp 0x1342f
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x13437
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4300
movq %rbx, %rdi
callq 0x45b0
nop