// File: /workspace/github_cpp_makefile_star2_O3/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 0x3621(%rip), %rdi      # 0x5120
leaq 0x16e1(%rip), %rsi      # 0x31e7
callq 0x10f0
testq %rax, %rax
je 0x1de1
movq %rax, %rbx
movl $0x0, 0x35d7(%rip)      # 0x50f8
leaq -0x160(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
movq %rax, %rdx
callq 0x1160
testq %rax, %rax
je 0x1c8c
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 0x1a0f
movq %rax, %r15
movslq -0x2c(%rbp), %r14
leal -0x2(%r14), %eax
movl %eax, 0x357e(%rip)      # 0x50fc
movq 0x3603(%rip), %rsi      # 0x5188
cmpq 0x3604(%rip), %rsi      # 0x5190
je 0x1b9e
movq (%r15), %rax
movq %rax, (%rsi)
addq $0x8, 0x35ec(%rip)      # 0x5188
jmp 0x1bad
leaq 0x35db(%rip), %rdi      # 0x5180
movq %r15, %rdx
callq 0x2208
cmpl $0x3, %r14d
jl 0x1bf7
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 0x1be3
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x1bef
movq %r13, %rdi
leaq -0x58(%rbp), %rdx
callq 0x2348
incq %r12
cmpq %r12, %rbx
jne 0x1bbd
leaq 0x353a(%rip), %rdi      # 0x5138
movq %r13, %rsi
callq 0x21be
movq -0x8(%r15,%r14,8), %rdi
callq 0x1100
movsd %xmm0, -0x58(%rbp)
movq 0x3554(%rip), %rsi      # 0x5170
cmpq 0x3555(%rip), %rsi      # 0x5178
movq -0x60(%rbp), %rbx
je 0x1c41
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x3538(%rip)      # 0x5170
leaq -0x160(%rbp), %r14
jmp 0x1c58
leaq 0x3520(%rip), %rdi      # 0x5168
leaq -0x58(%rbp), %rdx
callq 0x2348
leaq -0x160(%rbp), %r14
incl 0x349a(%rip)            # 0x50f8
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1c73
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x1160
testq %rax, %rax
jne 0x1b4d
movq %rbx, %rdi
callq 0x10b0
movq 0x348d(%rip), %rdi      # 0x5128
leaq 0x1545(%rip), %rsi      # 0x31e7
callq 0x10f0
testq %rax, %rax
je 0x1de8
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
movq %rax, %rdx
callq 0x1160
testq %rax, %rax
je 0x1dc5
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 0x1a0f
movq %rax, %r15
movq 0x3493(%rip), %rsi      # 0x51a0
cmpq 0x3494(%rip), %rsi      # 0x51a8
je 0x1d26
movq (%r15), %rax
movq %rax, (%rsi)
addq $0x8, 0x347c(%rip)      # 0x51a0
jmp 0x1d35
leaq 0x346b(%rip), %rdi      # 0x5198
movq %r15, %rdx
callq 0x2208
movslq -0x2c(%rbp), %r14
cmpq $0x2, %r14
jl 0x1d7d
movl $0x1, %ebx
movq (%r15,%rbx,8), %rdi
callq 0x1100
movsd %xmm0, -0x58(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x1d6a
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x1d75
movq %r13, %rdi
movq %r12, %rdx
callq 0x2348
incq %rbx
cmpq %rbx, %r14
jne 0x1d44
leaq 0x33cc(%rip), %rdi      # 0x5150
movq %r13, %rsi
callq 0x21be
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
movq -0x60(%rbp), %rbx
leaq -0x160(%rbp), %r14
je 0x1dac
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x1160
testq %rax, %rax
jne 0x1ce3
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 0x12f6
jmp 0x1ded
callq 0x12d4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1dcf
jmp 0x1dfc
jmp 0x1dfc
jmp 0x1dfc
jmp 0x1dfc
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x1e14
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x10d0
movq %rbx, %rdi
callq 0x1190