// File: /workspace/github_cpp_makefile_star2_O1/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 $0x278, %rsp            # imm = 0x278
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
leaq 0x70(%rsp), %r15
movq %r15, %rdi
movl $0x8, %edx
callq 0x2280
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x90(%rsp,%rax)
je 0x2f29
movl $0x2, 0x10(%rsp)
movq 0x5198(%rip), %rdi      # 0x7ff0
leaq 0x21dc(%rip), %rsi      # 0x503b
movl $0x4, %edx
callq 0x2180
movq 0x5180(%rip), %rdi      # 0x7ff0
leaq 0x21c9(%rip), %rsi      # 0x5040
movl $0x5, %edx
callq 0x2180
movq 0x5168(%rip), %rdi      # 0x7ff0
leaq 0x21b7(%rip), %rsi      # 0x5046
movl $0x3, %edx
callq 0x2180
movq 0x5150(%rip), %rdi      # 0x7ff0
leaq 0x22a3(%rip), %rsi      # 0x514a
movl $0xa, %edx
callq 0x2180
movq 0x5138(%rip), %rdi      # 0x7ff0
leaq 0x217f(%rip), %rsi      # 0x503e
movl $0x1, %edx
callq 0x2180
movq 0x5120(%rip), %rdi      # 0x7ff0
movl $0x16, %esi
callq 0x2260
movq %rax, %rbx
leaq 0x217c(%rip), %rsi      # 0x5060
movl $0x2, %edx
movq %rax, %rdi
callq 0x2180
leaq 0x2178(%rip), %rsi      # 0x5070
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x2180
testq %r14, %r14
je 0x313f
movq %r14, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x3158
movq %r12, 0x48(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x1, %r12d
leaq 0x10(%rsp), %r13
leaq 0x50(%rsp), %rbp
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x2290
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
setne %r14b
jne 0x3121
movq 0x10(%rsp), %rdi
cmpb $0x23, (%rdi)
je 0x3119
cmpq $0x0, 0x18(%rsp)
je 0x3119
movw $0x0, 0xe(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x30(%rsp), %rsi
leaq 0xe(%rsp), %rdx
movq %rbx, %r15
movq %rbx, %rcx
callq 0x493c
movl %eax, %r13d
testb %al, %al
je 0x3021
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x3e34
movzwl 0xe(%rsp), %eax
movw %ax, 0x68(%rsp)
movq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x4348
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x30f0
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x30f0
movl $0x2, 0x50(%rsp)
movl $0x4, %edx
movq 0x4fbb(%rip), %rdi      # 0x7ff0
leaq 0x1fff(%rip), %rsi      # 0x503b
callq 0x2180
movl $0x5, %edx
movq 0x4fa3(%rip), %rdi      # 0x7ff0
leaq 0x1fec(%rip), %rsi      # 0x5040
callq 0x2180
movl $0x3, %edx
movq 0x4f8b(%rip), %rdi      # 0x7ff0
leaq 0x1fda(%rip), %rsi      # 0x5046
callq 0x2180
movl $0xa, %edx
movq 0x4f73(%rip), %rdi      # 0x7ff0
leaq 0x20c6(%rip), %rsi      # 0x514a
callq 0x2180
movl $0x1, %edx
movq 0x4f5b(%rip), %rdi      # 0x7ff0
leaq 0x1fa2(%rip), %rsi      # 0x503e
callq 0x2180
movq 0x4f48(%rip), %rdi      # 0x7ff0
movl $0x23, %esi
callq 0x2260
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1f9c(%rip), %rsi      # 0x5060
callq 0x2180
movl $0xe, %edx
movq %rbx, %rdi
leaq 0x207d(%rip), %rsi      # 0x5155
callq 0x2180
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2100
movq %rbp, %rdi
callq 0x2ad8
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3107
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
testb %r13b, %r13b
movq %r15, %rbx
leaq 0x10(%rsp), %r13
leaq 0x70(%rsp), %r15
je 0x3121
incq %r12
jmp 0x2f52
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3165
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2170
jmp 0x3165
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq %rbx, %rdi
addq %rax, %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x2240
leaq 0x10(%rsp), %rdi
callq 0x2ad8
xorl %r14d, %r14d
leaq 0x70(%rsp), %rdi
callq 0x2080
movl %r14d, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x31c8
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x31c8
jmp 0x31a2
movq %rax, %rbx
jmp 0x31c8
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2ad8
jmp 0x31fb
movq %rax, %rbx
jmp 0x31df
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2ad8
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x31df
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x31fb
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2170
leaq 0x70(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2270
nop