// File: /workspace/github_cpp_makefile_star2_O2/tetsuok[P]kernel-pa/learner.cc
// Function: kernel::Learner::Load(char const*)
bool Learner::Load(const char* filename) {
  std::ifstream bifs(filename, std::ios::in | std::ios::binary);
  if (!bifs) {
    LOG(ERROR) << "Failed to load " << filename;
    return false;
  }

  bifs.read(reinterpret_cast<char *>(&C_), sizeof(C_));
  bifs.read(reinterpret_cast<char *>(&d_), sizeof(d_));

  std::size_t alpha_size;
  bifs.read(reinterpret_cast<char *>(&alpha_size), sizeof(alpha_size));
  alpha_.resize(alpha_size);
  bifs.read(reinterpret_cast<char *>(&alpha_[0]), alpha_.size() * sizeof(float));

  std::size_t sv_size;
  bifs.read(reinterpret_cast<char *>(&sv_size), sizeof(sv_size));
  sv_index_.resize(sv_size);

  for (fv& x : sv_index_) {
    std::size_t x_size;
    bifs.read(reinterpret_cast<char *>(&x_size), sizeof(x_size));
    x.resize(x_size);
    for (auto& p : x) {
      bifs.read(reinterpret_cast<char *>(&p.first), sizeof(p.first));
      bifs.read(reinterpret_cast<char *>(&p.second), sizeof(p.second));
    }
  }

  margin_.resize(alpha_.size(), 0.0f);

  bifs.close();
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rsp), %rbx
pushq $0xc
popq %rdx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x50(%rsp,%rax), %eax
movl %eax, 0x1c(%rsp)
testb $0x5, %al
je 0x31b8
movl $0x2, 0x10(%rsp)
movq 0x4ec3(%rip), %rdi      # 0x7ff0
leaq 0x1f07(%rip), %rsi      # 0x503b
callq 0x2130
leaq 0x1f00(%rip), %rsi      # 0x5040
movq %rax, %rdi
callq 0x2130
leaq 0x1ef7(%rip), %rsi      # 0x5046
movq %rax, %rdi
callq 0x2130
leaq 0x1fec(%rip), %rsi      # 0x514a
movq %rax, %rdi
callq 0x2130
leaq 0x1ed1(%rip), %rsi      # 0x503e
movq %rax, %rdi
callq 0x2130
pushq $0x4a
popq %rsi
movq %rax, %rdi
callq 0x2240
leaq 0x1ed9(%rip), %rsi      # 0x5060
movq %rax, %rdi
callq 0x2130
leaq 0x201f(%rip), %rsi      # 0x51b5
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
movq %r14, %rsi
callq 0x2130
leaq 0x10(%rsp), %rdi
callq 0x2858
jmp 0x32d9
leaq 0x8(%r15), %rsi
leaq 0x30(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x2190
leaq 0xc(%r15), %rsi
leaq 0x30(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x2190
movq %r15, 0x8(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x2190
movq 0x8(%rsp), %rax
leaq 0x10(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x37b8
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
subq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x2190
leaq 0x30(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x2190
movq 0x8(%rsp), %rbx
leaq 0x28(%rbx), %rdi
movq 0x28(%rsp), %rsi
callq 0x37ea
movq 0x28(%rbx), %r14
movq 0x30(%rbx), %r12
leaq 0x30(%rsp), %r15
pushq $0x4
popq %rbp
cmpq %r12, %r14
je 0x32ad
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x2190
movq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x3820
movq (%r14), %rbx
movq 0x8(%r14), %r13
cmpq %r13, %rbx
je 0x32a7
movq %r15, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x2190
addq $0x4, %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x2190
addq $0x4, %rbx
jmp 0x327c
addq $0x18, %r14
jmp 0x3253
movq 0x8(%rsp), %rax
leaq 0x40(%rax), %rdi
movq 0x18(%rax), %rsi
subq 0x10(%rax), %rsi
sarq $0x2, %rsi
leaq 0x20(%rsp), %rdx
andl $0x0, (%rdx)
callq 0x3852
leaq 0x30(%rsp), %rdi
callq 0x2070
testb $0x5, 0x1c(%rsp)
sete %bl
leaq 0x30(%rsp), %rdi
callq 0x2080
movl %ebx, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3318
jmp 0x3318
jmp 0x3318
jmp 0x3318
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2858
jmp 0x331b
jmp 0x3318
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2250
nop