// File: epfml[P]Bi-Sent2Vec/src/fasttext.cc
// Function: fasttext::FastText::saveModel(int)
void FastText::saveModel(int32_t checkpoint) {
  std::string fn(args_->output + "_Chk" + std::to_string(checkpoint) + ".ckpt");
  if (quant_) {
    fn += ".ftz";
  } else {
    fn += ".bin";
  }
  std::ofstream ofs(fn, std::ofstream::binary);
  if (!ofs.is_open()) {
    std::cerr << "Model file cannot be opened for saving!" << std::endl;
    exit(EXIT_FAILURE);
  }
  signModel(ofs);
  args_->save(ofs);
  dict_->save(ofs);

  ofs.write((char*)&(quant_), sizeof(bool));
  if (quant_) {
    qinput_->save(ofs);
  } else {
    input_->save(ofs);
  }

  ofs.write((char*)&(args_->qout), sizeof(bool));
  if (quant_ && args_->qout) {
    qoutput_->save(ofs);
  } else {
    output_->save(ofs);
  }

  ofs.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0xe6e0
movq %rax, %rsi
addq $0x40, %rsi
leaq 0x1a47b(%rip), %rdx     # 0x436db
leaq -0x70(%rbp), %rdi
callq 0x1ed90
movl -0xc(%rbp), %esi
leaq -0x90(%rbp), %rdi
callq 0x34190
jmp 0x2927a
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x340c0
jmp 0x29290
leaq 0x1a4d8(%rip), %rdx     # 0x4376f
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x34070
jmp 0x292a6
leaq -0x50(%rbp), %rdi
callq 0x58d8
leaq -0x90(%rbp), %rdi
callq 0x58d8
leaq -0x70(%rbp), %rdi
callq 0x58d8
movq -0x2a8(%rbp), %rax
testb $0x1, 0x80(%rax)
je 0x29363
leaq 0x1a486(%rip), %rsi     # 0x43765
leaq -0x30(%rbp), %rdi
callq 0x5410
jmp 0x292ea
jmp 0x29377
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x2933e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x29332
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x58d8
leaq -0x90(%rbp), %rdi
callq 0x58d8
leaq -0x70(%rbp), %rdi
callq 0x58d8
jmp 0x2959c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x29593
leaq 0x1a400(%rip), %rsi     # 0x4376a
leaq -0x30(%rbp), %rdi
callq 0x5410
jmp 0x29375
jmp 0x29377
leaq -0x2a0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x4, %edx
callq 0x5860
jmp 0x2938e
leaq -0x2a0(%rbp), %rdi
callq 0x5350
movb %al, -0x2a9(%rbp)
jmp 0x293a2
movb -0x2a9(%rbp), %al
testb $0x1, %al
jne 0x2940c
jmp 0x293ae
movq 0x35c3b(%rip), %rdi     # 0x5eff0
leaq 0x1a336(%rip), %rsi     # 0x436f2
callq 0x5420
movq %rax, -0x2b8(%rbp)
jmp 0x293ca
movq -0x2b8(%rbp), %rdi
movq 0x35bb8(%rip), %rsi     # 0x5ef90
callq 0x5460
jmp 0x293df
movl $0x1, %edi
callq 0x54f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x5660
jmp 0x29593
movq -0x2a8(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x28bd0
jmp 0x29421
movq -0x2a8(%rbp), %rdi
callq 0xe6e0
movq %rax, %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x7950
jmp 0x2943e
movq -0x2a8(%rbp), %rdi
addq $0x10, %rdi
callq 0x34050
movq %rax, %rdi
leaq -0x2a0(%rbp), %rsi
callq 0xadc0
jmp 0x2945f
movq -0x2a8(%rbp), %rsi
subq $-0x80, %rsi
leaq -0x2a0(%rbp), %rdi
movl $0x1, %edx
callq 0x55b0
jmp 0x2947d
movq -0x2a8(%rbp), %rax
testb $0x1, 0x80(%rax)
je 0x294b0
movq -0x2a8(%rbp), %rdi
addq $0x40, %rdi
callq 0x23860
movq %rax, %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x20260
jmp 0x294ae
jmp 0x294d3
movq -0x2a8(%rbp), %rdi
addq $0x20, %rdi
callq 0x235f0
movq %rax, %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x1e680
jmp 0x294d1
jmp 0x294d3
movq -0x2a8(%rbp), %rdi
callq 0xe6e0
movq %rax, %rsi
addq $0x12c, %rsi            # imm = 0x12C
leaq -0x2a0(%rbp), %rdi
movl $0x1, %edx
callq 0x55b0
jmp 0x294fc
movq -0x2a8(%rbp), %rax
testb $0x1, 0x80(%rax)
je 0x29544
movq -0x2a8(%rbp), %rdi
callq 0xe6e0
testb $0x1, 0x12c(%rax)
je 0x29544
movq -0x2a8(%rbp), %rdi
addq $0x50, %rdi
callq 0x23860
movq %rax, %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x20260
jmp 0x29542
jmp 0x29567
movq -0x2a8(%rbp), %rdi
addq $0x30, %rdi
callq 0x235f0
movq %rax, %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x1e680
jmp 0x29565
jmp 0x29567
leaq -0x2a0(%rbp), %rdi
callq 0x5620
jmp 0x29575
leaq -0x2a0(%rbp), %rdi
callq 0x5660
leaq -0x30(%rbp), %rdi
callq 0x58d8
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x58d8
movq -0x98(%rbp), %rdi
callq 0x57a0
nopl (%rax,%rax)