// File: /workspace/github_cpp_makefile_star2_O2/tetsuok[P]kernel-pa/learner.cc
// Function: kernel::Learner::Save(char const*) const
bool Learner::Save(const char* filename) const {
  std::ofstream bofs;
  bofs.open(filename, ios::out | ios::binary);
  if (!bofs) {
    LOG(ERROR) << "no such file or directory: " << filename;
    return false;
  }

  bofs.write(reinterpret_cast<const char *>(&C_), sizeof(C_));
  bofs.write(reinterpret_cast<const char *>(&d_), sizeof(d_));

  const std::size_t alpha_size = alpha_.size();
  bofs.write(reinterpret_cast<const char *>(&alpha_size), sizeof(alpha_size));
  bofs.write(reinterpret_cast<const char *>(&alpha_[0]), alpha_.size() * sizeof(float));

  const std::size_t sv_size = sv_index_.size();
  bofs.write(reinterpret_cast<const char *>(&sv_size), sizeof(sv_size));

  for (const fv& x : sv_index_) {
    const std::size_t x_size = x.size();
    bofs.write(reinterpret_cast<const char *>(&x_size), sizeof(x_size));

    for (const auto& p : x) {
      bofs.write(reinterpret_cast<const char *>(&p.first), sizeof(p.first));
      bofs.write(reinterpret_cast<const char *>(&p.second), sizeof(p.second));
    }
  }

  bofs.close();
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x2230
pushq $0x14
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2040
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x48(%rsp,%rax), %ebp
testb $0x5, %bpl
je 0x3411
movl $0x2, 0x8(%rsp)
movq 0x4c6a(%rip), %rdi      # 0x7ff0
leaq 0x1cae(%rip), %rsi      # 0x503b
callq 0x2130
leaq 0x1ca7(%rip), %rsi      # 0x5040
movq %rax, %rdi
callq 0x2130
leaq 0x1c9e(%rip), %rsi      # 0x5046
movq %rax, %rdi
callq 0x2130
leaq 0x1d93(%rip), %rsi      # 0x514a
movq %rax, %rdi
callq 0x2130
leaq 0x1c78(%rip), %rsi      # 0x503e
movq %rax, %rdi
callq 0x2130
pushq $0x6e
popq %rsi
movq %rax, %rdi
callq 0x2240
leaq 0x1c80(%rip), %rsi      # 0x5060
movq %rax, %rdi
callq 0x2130
leaq 0x1dd6(%rip), %rsi      # 0x51c5
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
leaq 0x8(%rsp), %rdi
callq 0x2858
jmp 0x3510
leaq 0x8(%r14), %rsi
leaq 0x28(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x21a0
leaq 0xc(%r14), %rsi
leaq 0x28(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x21a0
movq 0x18(%r14), %rax
subq 0x10(%r14), %rax
sarq $0x2, %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x28(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x21a0
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
subq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x21a0
movl %ebp, 0x14(%rsp)
movq 0x30(%r14), %rax
subq 0x28(%r14), %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x28(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x21a0
movq 0x28(%r14), %rbp
movq 0x30(%r14), %r14
leaq 0x28(%rsp), %rbx
pushq $0x4
popq %r12
cmpq %r14, %rbp
je 0x3502
movq 0x8(%rbp), %rax
subq (%rbp), %rax
sarq $0x3, %rax
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
leaq 0x18(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x21a0
movq (%rbp), %r13
movq 0x8(%rbp), %r15
cmpq %r15, %r13
je 0x34fc
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x21a0
addq $0x4, %r13
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x21a0
addq $0x4, %r13
jmp 0x34d1
addq $0x18, %rbp
jmp 0x34a3
leaq 0x28(%rsp), %rdi
callq 0x21b0
movl 0x14(%rsp), %ebp
testb $0x5, %bpl
sete %bl
leaq 0x28(%rsp), %rdi
callq 0x21e0
movl %ebx, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x354c
jmp 0x354c
jmp 0x354c
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2858
jmp 0x354f
jmp 0x354c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x21e0
movq %rbx, %rdi
callq 0x2250
nop