// File: 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
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x230(%rbp), %rdi
movl $0x8, %edx
callq 0x22c0
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x230(%rbp,%rax), %rdi
callq 0x20e0
movb %al, -0x2b9(%rbp)
jmp 0x4300
movb -0x2b9(%rbp), %al
testb $0x1, %al
jne 0x430f
jmp 0x4495
leaq -0x240(%rbp), %rdi
movl $0x2, %esi
callq 0x2e30
jmp 0x4322
callq 0x2e60
movq %rax, -0x2c8(%rbp)
jmp 0x4330
movq -0x2c8(%rbp), %rdi
leaq 0x6ced(%rip), %rsi      # 0xb02b
callq 0x2150
movq %rax, -0x2d0(%rbp)
jmp 0x434c
movq -0x2d0(%rbp), %rdi
leaq 0x6cd6(%rip), %rsi      # 0xb030
callq 0x2150
movq %rax, -0x2d8(%rbp)
jmp 0x4368
movq -0x2d8(%rbp), %rdi
leaq 0x6cc0(%rip), %rsi      # 0xb036
callq 0x2150
movq %rax, -0x2e0(%rbp)
jmp 0x4384
movq -0x2e0(%rbp), %rdi
leaq 0x6d82(%rip), %rsi      # 0xb114
callq 0x2150
movq %rax, -0x2e8(%rbp)
jmp 0x43a0
movq -0x2e8(%rbp), %rdi
leaq 0x6c80(%rip), %rsi      # 0xb02e
callq 0x2150
movq %rax, -0x2f0(%rbp)
jmp 0x43bc
movq -0x2f0(%rbp), %rdi
movl $0x16, %esi
callq 0x22a0
movq %rax, -0x2f8(%rbp)
jmp 0x43d6
movq -0x2f8(%rbp), %rdi
leaq 0x6c6c(%rip), %rsi      # 0xb050
callq 0x2150
movq %rax, -0x300(%rbp)
jmp 0x43f2
movq -0x300(%rbp), %rdi
leaq 0x6c60(%rip), %rsi      # 0xb060
callq 0x2150
movq %rax, -0x308(%rbp)
jmp 0x440e
movq -0x308(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2150
movq %rax, -0x310(%rbp)
jmp 0x4427
movq -0x310(%rbp), %rsi
leaq -0x240(%rbp), %rdi
callq 0x2e50
jmp 0x443c
leaq -0x240(%rbp), %rdi
callq 0x2e70
movb $0x0, -0x1(%rbp)
movl $0x1, -0x244(%rbp)
jmp 0x4804
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x481e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x2e70
jmp 0x481e
leaq -0x268(%rbp), %rdi
callq 0x21f0
movq $0x0, -0x270(%rbp)
leaq -0x230(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x2060
movq %rax, -0x318(%rbp)
jmp 0x44c8
movq -0x318(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x21c0
movb %al, -0x319(%rbp)
jmp 0x44e6
movb -0x319(%rbp), %al
testb $0x1, %al
jne 0x44f5
jmp 0x47da
movq -0x270(%rbp), %rax
incq %rax
movq %rax, -0x270(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x268(%rbp), %rdi
callq 0x22d0
movq %rax, -0x328(%rbp)
jmp 0x451f
movq -0x328(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
je 0x4540
leaq -0x268(%rbp), %rdi
callq 0x2280
testb $0x1, %al
jne 0x4540
jmp 0x455c
jmp 0x44ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x47f6
movw $0x0, -0x272(%rbp)
leaq -0x290(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x2ec0
leaq -0x268(%rbp), %rdi
callq 0x20d0
movq -0x338(%rbp), %rsi
movq %rax, %rdi
movq -0x28(%rbp), %rcx
leaq -0x272(%rbp), %rdx
callq 0xa340
movb %al, -0x329(%rbp)
jmp 0x45a6
movb -0x329(%rbp), %al
testb $0x1, %al
jne 0x473f
jmp 0x45b6
leaq -0x294(%rbp), %rdi
movl $0x2, %esi
callq 0x2e30
jmp 0x45c9
callq 0x2e60
movq %rax, -0x340(%rbp)
jmp 0x45d7
movq -0x340(%rbp), %rdi
leaq 0x6a46(%rip), %rsi      # 0xb02b
callq 0x2150
movq %rax, -0x348(%rbp)
jmp 0x45f3
movq -0x348(%rbp), %rdi
leaq 0x6a2f(%rip), %rsi      # 0xb030
callq 0x2150
movq %rax, -0x350(%rbp)
jmp 0x460f
movq -0x350(%rbp), %rdi
leaq 0x6a19(%rip), %rsi      # 0xb036
callq 0x2150
movq %rax, -0x358(%rbp)
jmp 0x462b
movq -0x358(%rbp), %rdi
leaq 0x6adb(%rip), %rsi      # 0xb114
callq 0x2150
movq %rax, -0x360(%rbp)
jmp 0x4647
movq -0x360(%rbp), %rdi
leaq 0x69d9(%rip), %rsi      # 0xb02e
callq 0x2150
movq %rax, -0x368(%rbp)
jmp 0x4663
movq -0x368(%rbp), %rdi
movl $0x23, %esi
callq 0x22a0
movq %rax, -0x370(%rbp)
jmp 0x467d
movq -0x370(%rbp), %rdi
leaq 0x69c5(%rip), %rsi      # 0xb050
callq 0x2150
movq %rax, -0x378(%rbp)
jmp 0x4699
movq -0x378(%rbp), %rdi
leaq 0x6a78(%rip), %rsi      # 0xb11f
callq 0x2150
movq %rax, -0x380(%rbp)
jmp 0x46b5
movq -0x380(%rbp), %rdi
movq -0x270(%rbp), %rsi
callq 0x2080
movq %rax, -0x388(%rbp)
jmp 0x46d1
movq -0x388(%rbp), %rsi
leaq -0x294(%rbp), %rdi
callq 0x2e50
jmp 0x46e6
leaq -0x294(%rbp), %rdi
callq 0x2e70
movb $0x0, -0x1(%rbp)
movl $0x1, -0x244(%rbp)
jmp 0x4791
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x47cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x294(%rbp), %rdi
callq 0x2e70
jmp 0x47cc
movq -0x20(%rbp), %rax
movq %rax, -0x390(%rbp)
leaq -0x2b8(%rbp), %rdi
leaq -0x290(%rbp), %rsi
leaq -0x272(%rbp), %rdx
callq 0x5a00
jmp 0x4766
movq -0x390(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x59d0
jmp 0x477b
leaq -0x2b8(%rbp), %rdi
callq 0x5a40
movl $0x0, -0x244(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x2f30
movl -0x244(%rbp), %eax
testl %eax, %eax
jne 0x47e8
jmp 0x47a9
jmp 0x44ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x5a40
leaq -0x290(%rbp), %rdi
callq 0x2f30
jmp 0x47f6
movb $0x1, -0x1(%rbp)
movl $0x1, -0x244(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x2110
jmp 0x4804
leaq -0x268(%rbp), %rdi
callq 0x2110
jmp 0x481e
leaq -0x230(%rbp), %rdi
callq 0x2090
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
leaq -0x230(%rbp), %rdi
callq 0x2090
movq -0x238(%rbp), %rdi
callq 0x22b0
nopw %cs:(%rax,%rax)