// File: /workspace/github_cpp_makefile_star2_O1/epfml[P]sent2vec/src/fasttext.cc
// Function: fasttext::FastText::loadVectors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void FastText::loadVectors(std::string filename) {
  std::ifstream in(filename);
  std::vector<std::string> words;
  std::shared_ptr<Matrix> mat; // temp. matrix for pretrained vectors
  int64_t n, dim;
  if (!in.is_open()) {
    std::cerr << "Pretrained vectors file cannot be opened!" << std::endl;
    exit(EXIT_FAILURE);
  }
  in >> n >> dim;
  if (dim != args_->dim) {
    std::cerr << "Dimension of pretrained vectors does not match -dim option"
              << std::endl;
    exit(EXIT_FAILURE);
  }
  mat = std::make_shared<Matrix>(n, dim);
  for (size_t i = 0; i < n; i++) {
    std::string word;
    in >> word;
    words.push_back(word);
    dict_->add(word);
    for (size_t j = 0; j < dim; j++) {
      in >> mat->data_[i * dim + j];
    }
  }
  in.close();

  dict_->threshold(1, 0);
  input_ = std::make_shared<Matrix>(dict_->nwords()+args_->bucket, args_->dim);
  input_->uniform(1.0 / args_->dim);

  for (size_t i = 0; i < n; i++) {
    int32_t idx = dict_->getId(words[i]);
    if (idx < 0 || idx >= dict_->nwords()) continue;
    for (size_t j = 0; j < dim; j++) {
      input_->data_[idx * dim + j] = mat->data_[i * dim + j];
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdi, %r14
leaq 0x70(%rsp), %rdi
movl $0x8, %edx
callq 0x44f0
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x40b0
xorl %r13d, %r13d
testb %al, %al
je 0x184f9
leaq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x4310
xorl %r13d, %r13d
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x4310
movq (%r14), %rax
movslq 0x94(%rax), %rax
cmpq %rax, 0x10(%rsp)
jne 0x18522
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0x44(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0x1b316
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %rax
movq %rax, 0x48(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x182d2
callq 0xaa70
cmpq $0x0, 0x18(%rsp)
je 0x18394
leaq 0x30(%rsp), %r12
xorl %r13d, %r13d
leaq 0x70(%rsp), %r15
xorl %ebp, %ebp
movq %r14, 0x68(%rsp)
movq %r12, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
movq %r15, %rdi
leaq 0x20(%rsp), %r12
movq %r12, %rsi
callq 0x43d0
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0xa81a
movq 0x10(%r14), %rdi
movq %r12, %rsi
callq 0x6572
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x18361
xorl %r14d, %r14d
xorl %r12d, %r12d
imulq %r13, %rsi
addq (%rbx), %rsi
addq %r14, %rsi
movq %r15, %rdi
callq 0x4670
incq %r12
movq 0x10(%rsp), %rsi
addq $0x4, %r14
cmpq %rsi, %r12
jb 0x1833e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %r12
cmpq %r12, %rdi
je 0x1837d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4300
incq %rbp
addq $0x4, %r13
cmpq 0x18(%rsp), %rbp
movq 0x68(%rsp), %r14
jb 0x182f2
leaq 0x70(%rsp), %rdi
movq 0x48(%rsp), %r13
callq 0x4090
movq 0x10(%r14), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x775c
movq 0x10(%r14), %rdi
callq 0x66a8
movq (%r14), %r8
addl 0xc4(%r8), %eax
leaq 0x44(%rsp), %rcx
movl %eax, (%rcx)
addq $0x94, %r8
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0x1b396
movaps 0x20(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x20(%rsp)
movq 0x28(%r14), %rdi
movups %xmm0, 0x20(%r14)
testq %rdi, %rdi
je 0x18410
callq 0xaa70
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1841f
callq 0xaa70
movq (%r14), %rax
movq 0x20(%r14), %rdi
xorps %xmm0, %xmm0
cvtsi2sdl 0x94(%rax), %xmm0
movsd 0x6527(%rip), %xmm1     # 0x1e960
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
callq 0xe010
cmpq $0x0, 0x18(%rsp)
je 0x184c6
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x10(%r14), %rdi
movq %r12, %rsi
shlq $0x5, %rsi
addq 0x50(%rsp), %rsi
callq 0x6878
movl %eax, %ebp
testl %eax, %eax
js 0x184b8
movq 0x10(%r14), %rdi
callq 0x66a8
cmpl %eax, %ebp
jge 0x184b8
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x184b8
movq 0x20(%r14), %rdx
movl %ebp, %ecx
imulq %rax, %rcx
shlq $0x2, %rcx
addq (%rdx), %rcx
movq %rax, %rdx
imulq %r15, %rdx
addq (%rbx), %rdx
xorl %esi, %esi
movss (%rdx,%rsi,4), %xmm0
movss %xmm0, (%rcx,%rsi,4)
incq %rsi
cmpq %rsi, %rax
jne 0x184a6
incq %r12
addq $0x4, %r15
cmpq 0x18(%rsp), %r12
jb 0x18457
testq %r13, %r13
je 0x184d3
movq %r13, %rdi
callq 0xaa70
leaq 0x50(%rsp), %rdi
callq 0xa858
leaq 0x70(%rsp), %rdi
callq 0x40c0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x11af0(%rip), %rdi     # 0x29ff0
leaq 0x76cf(%rip), %rsi      # 0x1fbd6
movl $0x29, %edx
callq 0x4350
xorl %r13d, %r13d
movq 0x11ad5(%rip), %rdi     # 0x29ff0
callq 0x4170
jmp 0x1854c
xorl %r13d, %r13d
movq 0x11ac4(%rip), %rdi     # 0x29ff0
leaq 0x76cd(%rip), %rsi      # 0x1fc00
movl $0x3a, %edx
callq 0x4350
xorl %r13d, %r13d
movq 0x11aa9(%rip), %rdi     # 0x29ff0
callq 0x4170
movl $0x1, %edi
callq 0x4380
movq %rax, %r14
xorl %r13d, %r13d
jmp 0x1858d
jmp 0x18562
jmp 0x18562
movq %rax, %r14
jmp 0x1858d
jmp 0x18569
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
movq 0x48(%rsp), %r13
je 0x1858d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4300
testq %r13, %r13
je 0x1859a
movq %r13, %rdi
callq 0xaa70
leaq 0x50(%rsp), %rdi
callq 0xa858
leaq 0x70(%rsp), %rdi
callq 0x40c0
movq %r14, %rdi
callq 0x45b0