// File: tetsuok[P]kernel-pa/tokenizer.cc
// Function: kernel::Tokenize(char const*, std::vector<std::pair<unsigned int, float>, std::allocator<std::pair<unsigned int, float>>>*, short*, unsigned long*)
bool Tokenize(const char *line, fv *fv, short *y, std::size_t *maxid) {
  *y = static_cast<short>(atoi(line));
  if (*y != 1 && *y != -1) {
    LOG(ERROR) << "Invalid label. A label must be +1 or -1.";
    return false;
  }

  while (!isspace(*line) && *line) line++;
  while (isspace(*line) && *line) line++;
  while (1) {
    const char *begin = line;
    unsigned int index = std::atol(begin);
    while (*line != ':' && *line) line++;
    float val = std::atof(++line);

    while (*line != ' ' && *line) line++;
    fv->push_back(std::make_pair(index, val));
    if (index > *maxid) *maxid = index;
    if (*line++ == 0) break;
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2250
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, (%rax)
movq -0x20(%rbp), %rax
movswl (%rax), %eax
cmpl $0x1, %eax
je 0xa4a8
movq -0x20(%rbp), %rax
movswl (%rax), %eax
cmpl $-0x1, %eax
je 0xa4a8
leaq -0x2c(%rbp), %rdi
movl $0x2, %esi
callq 0x2e30
callq 0x2e60
movq %rax, -0x60(%rbp)
jmp 0xa3a7
movq -0x60(%rbp), %rdi
leaq 0xc79(%rip), %rsi       # 0xb02b
callq 0x2150
movq %rax, -0x68(%rbp)
jmp 0xa3bd
movq -0x68(%rbp), %rdi
leaq 0xc68(%rip), %rsi       # 0xb030
callq 0x2150
movq %rax, -0x70(%rbp)
jmp 0xa3d3
movq -0x70(%rbp), %rdi
leaq 0xc58(%rip), %rsi       # 0xb036
callq 0x2150
movq %rax, -0x78(%rbp)
jmp 0xa3e9
movq -0x78(%rbp), %rdi
leaq 0xe14(%rip), %rsi       # 0xb208
callq 0x2150
movq %rax, -0x80(%rbp)
jmp 0xa3ff
movq -0x80(%rbp), %rdi
leaq 0xc24(%rip), %rsi       # 0xb02e
callq 0x2150
movq %rax, -0x88(%rbp)
jmp 0xa418
movq -0x88(%rbp), %rdi
movl $0xd, %esi
callq 0x22a0
movq %rax, -0x90(%rbp)
jmp 0xa432
movq -0x90(%rbp), %rdi
leaq 0xc10(%rip), %rsi       # 0xb050
callq 0x2150
movq %rax, -0x98(%rbp)
jmp 0xa44e
movq -0x98(%rbp), %rdi
leaq 0xdb9(%rip), %rsi       # 0xb215
callq 0x2150
movq %rax, -0xa0(%rbp)
jmp 0xa46a
movq -0xa0(%rbp), %rsi
leaq -0x2c(%rbp), %rdi
callq 0x2e50
jmp 0xa47c
leaq -0x2c(%rbp), %rdi
callq 0x2e70
movb $0x0, -0x1(%rbp)
jmp 0xa648
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2c(%rbp), %rdi
callq 0x2e70
jmp 0xa656
jmp 0xa4aa
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0x2050
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xa1(%rbp)
jne 0xa4d5
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
setne %al
movb %al, -0xa1(%rbp)
movb -0xa1(%rbp), %al
testb $0x1, %al
jne 0xa4e1
jmp 0xa4ef
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xa4aa
jmp 0xa4f1
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0x2050
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xa2(%rbp)
je 0xa51c
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
setne %al
movb %al, -0xa2(%rbp)
movb -0xa2(%rbp), %al
testb $0x1, %al
jne 0xa528
jmp 0xa536
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xa4f1
jmp 0xa538
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x2190
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x3a, %ecx
movb %al, -0xa3(%rbp)
je 0xa570
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
setne %al
movb %al, -0xa3(%rbp)
movb -0xa3(%rbp), %al
testb $0x1, %al
jne 0xa57c
jmp 0xa58a
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xa54c
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movq %rdi, -0x10(%rbp)
callq 0x21b0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0xa4(%rbp)
je 0xa5c8
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
setne %al
movb %al, -0xa4(%rbp)
movb -0xa4(%rbp), %al
testb $0x1, %al
jne 0xa5d4
jmp 0xa5e2
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xa5a4
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x4c(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xa660
movq -0xb0(%rbp), %rdi
movq %rax, -0x58(%rbp)
leaq -0x58(%rbp), %rsi
callq 0x6be0
movl -0x4c(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpq (%rcx), %rax
jbe 0xa626
movl -0x4c(%rbp), %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xa63f
jmp 0xa644
jmp 0xa538
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x22b0
nop