// File: epfml[P]Bi-Sent2Vec/src/fasttext.cc
// Function: fasttext::FastText::loadModelForInference(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
void FastText::loadModelForInference(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);

  model_->setTargetCounts(dict_->getCounts(entry_type::word));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x29f00
movq -0x108(%rbp), %rdx
leaq 0x19fee(%rip), %rsi     # 0x43775
leaq -0x60(%rbp), %rdi
callq 0x34680
jmp 0x29792
leaq 0x19fe1(%rip), %rdx     # 0x4377a
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x34070
jmp 0x297a8
leaq -0x60(%rbp), %rdi
callq 0x58d8
leaq -0x80(%rbp), %rdi
callq 0x58d8
leaq -0xa0(%rbp), %rdi
callq 0x342b0
jmp 0x297c8
movq -0x110(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movq %rsi, -0x118(%rbp)
callq 0x34320
movq -0x118(%rbp), %rdi
callq 0xe1b0
movq -0x110(%rbp), %rdi
callq 0xe6e0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x7ab0
jmp 0x29808
movq -0x110(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x34350
jmp 0x2981d
movq -0x110(%rbp), %rdi
addq $0x10, %rdi
movq %rdi, -0x120(%rbp)
leaq -0xb0(%rbp), %rsi
movq %rsi, -0x128(%rbp)
callq 0x343c0
movq -0x128(%rbp), %rdi
callq 0x343f0
movq -0x120(%rbp), %rdi
callq 0x34050
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0xafe0
jmp 0x29868
movq -0x110(%rbp), %rsi
movq -0x10(%rbp), %rdi
subq $-0x80, %rsi
movl $0x1, %edx
callq 0x5540
jmp 0x29883
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %ecx
leaq -0xc0(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x1ea60
jmp 0x2989c
movq -0x110(%rbp), %rdi
addq $0x20, %rdi
leaq -0xc0(%rbp), %rsi
movq %rsi, -0x138(%rbp)
callq 0x346d0
movq -0x138(%rbp), %rdi
callq 0x34700
movq -0x110(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x130(%rbp)
callq 0xe6e0
movq -0x130(%rbp), %rdi
movq %rax, %rsi
addq $0x12c, %rsi            # imm = 0x12C
movl $0x1, %edx
callq 0x5540
jmp 0x298fa
leaq -0xd0(%rbp), %rdi
callq 0x34410
jmp 0x29908
movq -0x110(%rbp), %rdi
addq $0x30, %rdi
movq %rdi, -0x148(%rbp)
leaq -0xd0(%rbp), %rsi
movq %rsi, -0x150(%rbp)
callq 0x34480
movq -0x150(%rbp), %rdi
callq 0x23810
movq -0x148(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x140(%rbp)
callq 0x235f0
movq -0x140(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
movl $0x8, %edx
callq 0x5540
jmp 0x2996a
movq -0x110(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x158(%rbp)
addq $0x30, %rdi
callq 0x235f0
movq -0x158(%rbp), %rdi
movq %rax, %rsi
addq $0x10, %rsi
movl $0x8, %edx
callq 0x5540
jmp 0x2999f
movq -0x110(%rbp), %rcx
movq %rcx, %rsi
addq $0x20, %rsi
movq %rcx, %rdx
addq $0x30, %rdx
movl $0x0, -0xe4(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe4(%rbp), %r8
callq 0x34550
jmp 0x299d3
movq -0x110(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0x168(%rbp)
leaq -0xe0(%rbp), %rsi
movq %rsi, -0x170(%rbp)
callq 0x345e0
movq -0x170(%rbp), %rdi
callq 0x34610
movq -0x168(%rbp), %rdi
callq 0x34630
movq -0x110(%rbp), %rdi
movq %rax, -0x160(%rbp)
addq $0x10, %rdi
callq 0x34050
movq %rax, %rsi
leaq -0x100(%rbp), %rdi
xorl %edx, %edx
callq 0x9e50
jmp 0x29a3a
movq -0x160(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x22e20
jmp 0x29a4f
leaq -0x100(%rbp), %rdi
callq 0xecf0
leaq -0x40(%rbp), %rdi
callq 0x58d8
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x29a9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x58d8
leaq -0x80(%rbp), %rdi
callq 0x58d8
jmp 0x29ae2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x29ad9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xecf0
leaq -0x40(%rbp), %rdi
callq 0x58d8
movq -0x88(%rbp), %rdi
callq 0x57a0
nop