// File: /workspace/github_cpp_makefile_star2_O3/mattcha[P]sgd-svm/sgd_svm.cpp
// Function: load_line(char const*, Instance&, unsigned int&)
int load_line(
        const char* line,
        Instance &instance,
        uint32_t &max_feature)
{
    double label;
    uint32_t fea_idx;
    double fea_val;

    stringstream ss(line);
    string field;
    if (getline(ss, field, ' ')) 
        label = atof(field.c_str());    
    else {
        fprintf(stderr, "read label fail [%s]\n",
                field.c_str());
        return -1;
    }
    instance.y_label = label;
    //cout << label << " ";

    while (true) {
        if (getline(ss, field, ':')) {
            fea_idx = atoi(field.c_str());
            //cout << fea_idx << ":";
        }
        else
            break;

        if (fea_idx > max_feature)
            max_feature = fea_idx;

        if (getline(ss, field, ' ')) {
            fea_val = atof(field.c_str());
            //cout << fea_val << " ";
        }
        else
            break;

        Feature fea;
        fea.idx = fea_idx;
        fea.val = fea_val;
        instance.f_vec.push_back(fea);
    }

    //cout << endl;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdx, -0x50(%rbp)
movq %rsi, %r14
movq %rdi, %rsi
leaq -0x48(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x33de
leaq -0x1f0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x18, %edx
callq 0x21a0
leaq -0x38(%rbp), %rbx
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0x3228
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2110
leaq -0x48(%rbp), %rsi
movq %rbx, (%rsi)
movq $0x0, 0x8(%rsi)
movb $0x0, 0x10(%rsi)
leaq -0x1f0(%rbp), %rdi
movl $0x20, %edx
callq 0x21f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3318
leaq -0x48(%rbp), %r15
movq (%r15), %rdi
callq 0x2140
movsd %xmm0, (%r14)
leaq 0x8(%r14), %rax
movq %rax, -0x68(%rbp)
leaq -0x1f0(%rbp), %r13
xorl %r12d, %r12d
movq %r13, %rdi
movq %r15, %rsi
movl $0x3a, %edx
callq 0x21f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3327
movq -0x48(%rbp), %rdi
callq 0x2190
movl %eax, %ebx
movq -0x50(%rbp), %rax
cmpl (%rax), %ebx
jbe 0x32bc
movq -0x50(%rbp), %rax
movl %ebx, (%rax)
movq %r13, %rdi
movq %r15, %rsi
movl $0x20, %edx
callq 0x21f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3327
movq -0x48(%rbp), %rdi
callq 0x2140
movl %ebx, -0x60(%rbp)
movsd %xmm0, -0x58(%rbp)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0x3306
movups -0x60(%rbp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x10(%r14)
jmp 0x3281
movq -0x68(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x34ba
jmp 0x3281
leaq -0x48(%rbp), %rdi
callq 0x2400
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x3340
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2110
movq 0x2c79(%rip), %rsi      # 0x5fc0
leaq -0x1f0(%rbp), %rdi
callq 0x20b0
leaq -0x170(%rbp), %rdi
callq 0x2050
movl %r12d, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x339b
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x33d6
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2110
jmp 0x33d6
movq %rax, %rbx
jmp 0x33d6
jmp 0x339b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x33b7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2110
movq 0x2c02(%rip), %rsi      # 0x5fc0
leaq -0x1f0(%rbp), %rdi
callq 0x20b0
leaq -0x170(%rbp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x21d0