// File: /workspace/github_cpp_makefile_star2_O2/tetsuok[P]kernel-pa/learner.cc
// Function: kernel::Learner::Read(char const*, std::vector<std::pair<std::vector<std::pair<unsigned int, float>, std::allocator<std::pair<unsigned int, float>>>, short>, std::allocator<std::pair<std::vector<std::pair<unsigned int, float>, std::allocator<std::pair<unsigned int, float>>>, short>>>&, unsigned long*)
bool Learner::Read(const char* train_file,
                   vector<example>& examples,
                   size_t* maxid) {
  ifstream ifs(train_file);
  if (!ifs) {
    LOG(ERROR) << "no such file or directory " << train_file;
    return false;
  }

  string line;
  size_t line_num = 0;
  while (std::getline(ifs, line)) {
    ++line_num;
    if (line[0] == '#' || line.empty()) continue;

    short label = 0;                      // true label
    fv vec;
    if (!Tokenize(line.c_str(), &vec, &label, maxid)) {
      LOG(ERROR) << "Invalid line: " << line_num;
      return false;
    }
    examples.push_back(make_pair(vec, label));
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
leaq 0x80(%rsp), %r15
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x2260
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xa0(%rsp,%rax)
je 0x2cb1
movl $0x2, 0x10(%rsp)
movq 0x53cd(%rip), %rdi      # 0x7ff0
leaq 0x2411(%rip), %rsi      # 0x503b
callq 0x2130
leaq 0x240a(%rip), %rsi      # 0x5040
movq %rax, %rdi
callq 0x2130
leaq 0x2401(%rip), %rsi      # 0x5046
movq %rax, %rdi
callq 0x2130
leaq 0x24f6(%rip), %rsi      # 0x514a
movq %rax, %rdi
callq 0x2130
leaq 0x23db(%rip), %rsi      # 0x503e
movq %rax, %rdi
callq 0x2130
pushq $0x16
popq %rsi
movq %rax, %rdi
callq 0x2240
leaq 0x23e3(%rip), %rsi      # 0x5060
movq %rax, %rdi
callq 0x2130
leaq 0x23e4(%rip), %rsi      # 0x5070
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
movq %r14, %rsi
callq 0x2130
leaq 0x10(%rsp), %rdi
callq 0x2858
xorl %r14d, %r14d
jmp 0x2e45
movq %rbx, 0x38(%rsp)
movq %r12, 0x30(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
pushq $0x1
popq %rbx
leaq 0x80(%rsp), %r12
leaq 0x10(%rsp), %r13
leaq 0x40(%rsp), %rbp
leaq 0x60(%rsp), %r15
movq %r12, %rdi
movq %r13, %rsi
callq 0x2060
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
setne %r14b
jne 0x2e3b
movq 0x10(%rsp), %rdi
cmpb $0x23, (%rdi)
je 0x2e33
cmpq $0x0, 0x18(%rsp)
je 0x2e33
andw $0x0, 0xe(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movq %rbp, %rsi
leaq 0xe(%rsp), %rdx
movq 0x38(%rsp), %rcx
callq 0x44d0
movl %eax, %r12d
testb %al, %al
je 0x2d86
movq %rbp, %rsi
movq %r15, %rbp
movq %r15, %rdi
movq %rsi, %r13
callq 0x3886
movzwl 0xe(%rsp), %eax
movw %ax, 0x78(%rsp)
movq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x3e86
movq %rbp, %rdi
callq 0x2b28
movq %r13, %rbp
jmp 0x2e19
movl $0x2, 0x60(%rsp)
movq 0x525b(%rip), %rdi      # 0x7ff0
leaq 0x229f(%rip), %rsi      # 0x503b
callq 0x2130
movq %rax, %rdi
leaq 0x2295(%rip), %rsi      # 0x5040
callq 0x2130
movq %rax, %rdi
leaq 0x228c(%rip), %rsi      # 0x5046
callq 0x2130
movq %rax, %rdi
leaq 0x2381(%rip), %rsi      # 0x514a
callq 0x2130
movq %rax, %rdi
leaq 0x2266(%rip), %rsi      # 0x503e
callq 0x2130
movq %rax, %rdi
pushq $0x23
popq %rsi
callq 0x2240
movq %rax, %rdi
leaq 0x226e(%rip), %rsi      # 0x5060
callq 0x2130
movq %rax, %rdi
leaq 0x2354(%rip), %rsi      # 0x5155
callq 0x2130
movq %rax, %rdi
movq %rbx, %rsi
callq 0x20f0
movq %r15, %rdi
callq 0x2858
movq %rbp, %rdi
callq 0x2b28
testb %r12b, %r12b
leaq 0x80(%rsp), %r12
leaq 0x10(%rsp), %r13
je 0x2e3b
incq %rbx
jmp 0x2ce6
leaq 0x10(%rsp), %rdi
callq 0x20c0
leaq 0x80(%rsp), %rdi
callq 0x2080
movl %r14d, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2b28
jmp 0x2e9e
jmp 0x2e78
movq %rax, %rbx
jmp 0x2e9e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2858
jmp 0x2eb2
movq %rax, %rbx
jmp 0x2ea8
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2858
leaq 0x40(%rsp), %rdi
callq 0x2b28
leaq 0x10(%rsp), %rdi
callq 0x20c0
leaq 0x80(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2250
nop