// File: /workspace/github_cpp_makefile_star2_O1/shuimu[P]logistic-regression/lr.cpp
// Function: load_data()
int load_data() {
    FILE * tfp, * pfp;
    int line = 0, sz = 0; 
    char buffer[LINE_LEN];
    char ** str_array = NULL;
 
    // load train file
    if((tfp = fopen(train_file, "r")) == NULL) {
        fprintf(stderr, "train file is not valid\n");
        return -1;
    }
    M = 0;
    while(fgets(buffer, LINE_LEN, tfp) != NULL) {
        vector<double> tmp;
        str_array = split(buffer, '\t', &sz);
        D = sz - 2;
        train_instances.push_back(str_array[0]);
        for(int i = 1; i < sz-1; i++) {
            tmp.push_back(atof(str_array[i]));
        }
        train_features.push_back(tmp);
        labels.push_back(atof(str_array[sz-1]));
        M++;
    }
    fclose(tfp);

    // load predict data
    if((pfp = fopen(predict_file, "r")) == NULL) {
        fprintf(stderr, "load predict file failed");
        return -1;
    }
    while(fgets(buffer, LINE_LEN, pfp) != NULL) {
        vector<double> tmp;
        str_array = split(buffer, '\t', &sz);
        predict_instances.push_back(str_array[0]);
        for(int i = 1; i < sz; i++) {
            tmp.push_back(atof(str_array[i]));
        }
        predict_features.push_back(tmp);
    }
    fclose(pfp);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movl $0x0, -0x2c(%rbp)
movq 0x360f(%rip), %rdi      # 0x5128
leaq 0x16d9(%rip), %rsi      # 0x31f9
callq 0x10f0
testq %rax, %rax
je 0x1dfb
movq %rax, %rbx
movl $0x0, 0x35c5(%rip)      # 0x5100
leaq -0x160(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
movq %rax, %rdx
callq 0x1170
testq %rax, %rax
je 0x1ca6
leaq -0x160(%rbp), %r14
leaq -0x50(%rbp), %r13
movq %rbx, -0x60(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq %r14, %rdi
movl $0x9, %esi
leaq -0x2c(%rbp), %rdx
callq 0x1a29
movq %rax, %r15
movslq -0x2c(%rbp), %r14
leal -0x2(%r14), %eax
movl %eax, 0x356c(%rip)      # 0x5104
movq 0x35f1(%rip), %rsi      # 0x5190
cmpq 0x35f2(%rip), %rsi      # 0x5198
je 0x1bb8
movq (%r15), %rax
movq %rax, (%rsi)
addq $0x8, 0x35da(%rip)      # 0x5190
jmp 0x1bc7
leaq 0x35c9(%rip), %rdi      # 0x5188
movq %r15, %rdx
callq 0x221c
cmpl $0x3, %r14d
jl 0x1c11
leal -0x1(%r14), %ebx
movl $0x1, %r12d
movq (%r15,%r12,8), %rdi
callq 0x1100
movsd %xmm0, -0x58(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1bfd
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x1c09
movq %r13, %rdi
leaq -0x58(%rbp), %rdx
callq 0x235c
incq %r12
cmpq %r12, %rbx
jne 0x1bd7
leaq 0x3528(%rip), %rdi      # 0x5140
movq %r13, %rsi
callq 0x21d2
movq -0x8(%r15,%r14,8), %rdi
callq 0x1100
movsd %xmm0, -0x58(%rbp)
movq 0x3542(%rip), %rsi      # 0x5178
cmpq 0x3543(%rip), %rsi      # 0x5180
movq -0x60(%rbp), %rbx
je 0x1c5b
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x3526(%rip)      # 0x5178
leaq -0x160(%rbp), %r14
jmp 0x1c72
leaq 0x350e(%rip), %rdi      # 0x5170
leaq -0x58(%rbp), %rdx
callq 0x235c
leaq -0x160(%rbp), %r14
incl 0x3488(%rip)            # 0x5100
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1c8d
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x1170
testq %rax, %rax
jne 0x1b67
movq %rbx, %rdi
callq 0x10b0
movq 0x347b(%rip), %rdi      # 0x5130
leaq 0x153d(%rip), %rsi      # 0x31f9
callq 0x10f0
testq %rax, %rax
je 0x1e02
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
movq %rax, %rdx
callq 0x1170
testq %rax, %rax
je 0x1ddf
leaq -0x160(%rbp), %r14
leaq -0x50(%rbp), %r13
leaq -0x58(%rbp), %r12
movq %rbx, -0x60(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq %r14, %rdi
movl $0x9, %esi
leaq -0x2c(%rbp), %rdx
callq 0x1a29
movq %rax, %r15
movq 0x3481(%rip), %rsi      # 0x51a8
cmpq 0x3482(%rip), %rsi      # 0x51b0
je 0x1d40
movq (%r15), %rax
movq %rax, (%rsi)
addq $0x8, 0x346a(%rip)      # 0x51a8
jmp 0x1d4f
leaq 0x3459(%rip), %rdi      # 0x51a0
movq %r15, %rdx
callq 0x221c
movslq -0x2c(%rbp), %r14
cmpq $0x2, %r14
jl 0x1d97
movl $0x1, %ebx
movq (%r15,%rbx,8), %rdi
callq 0x1100
movsd %xmm0, -0x58(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1d84
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x1d8f
movq %r13, %rdi
movq %r12, %rdx
callq 0x235c
incq %rbx
cmpq %rbx, %r14
jne 0x1d5e
leaq 0x33ba(%rip), %rdi      # 0x5158
movq %r13, %rsi
callq 0x21d2
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
movq -0x60(%rbp), %rbx
leaq -0x160(%rbp), %r14
je 0x1dc6
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x1170
testq %rax, %rax
jne 0x1cfd
movq %rbx, %rdi
callq 0x10b0
xorl %eax, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1306
jmp 0x1e07
callq 0x12e4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1de9
jmp 0x1e16
jmp 0x1e16
jmp 0x1e16
jmp 0x1e16
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1e2e
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %rbx, %rdi
callq 0x11a0