// File: /workspace/github_cpp_makefile_star2_O3/lipiji[P]PG_DEEP/deep.cpp
// Function: Dataset::Dataset(Conf)
Dataset::Dataset(Conf conf)
{

    N = 0;
    n_f = 0;
    batch_index = 0;

    if(conf.batch_size >= 0)
    {
        int Nx = 0;
        int Ny = 0;
        int Nf = 0; // dim of x

        //read the label file
        ifstream fin_y(conf.f_train_y.c_str());
        if(!fin_y) 
        {   
            cout << "Error opening " << conf.f_train_y << " for input" << endl;
            exit(-1);
        }
        else
        {
            string s;
            while(getline(fin_y, s))
            {	
                Y.push_back(atof(s.c_str()));
                if(conf.batch_size > 0 && Ny >= conf.batch_size)
                    break;
                ++Ny;
            }
        }
        fin_y.close();

        // read the x file
        ifstream fin_x(conf.f_train_x.c_str());
        if(!fin_x) 
        {   
            cout << "Error opening " << conf.f_train_x << " for input" << endl;
            exit(-1);
        }
        else
        {
            string s;
            while(getline(fin_x, s))
            {	
                Nf = 0;
                vector<double> x;
                const char *split = " \t";

                char *line=new char[s.size()+1];
                strcpy(line, s.c_str());
                char *p = strtok(line, split);
                x.push_back(atof(p));

                Nf = 1;
                while(1)
                {
                    p = strtok(NULL, split);
                    if(p == NULL || *p == '\n')
                        break;
                    x.push_back(atof(p));
                    ++Nf;
                }
                X.push_back(x);
                n_f = Nf;

                vector<double>().swap(x);
                if(conf.batch_size > 0 && Nx >= conf.batch_size)
                    break;
                ++Nx;
            }
        }
        fin_x.close();

        if(Nx == Ny)
        {
            N = Nx;
            n_f = Nf;
        }
        else
        {
            cout << "Dataset error: size(x) != size(y)." << endl;
            exit(-1);
        }

        cout << "Data loaded: size=" << N <<", dim=" << n_f << endl;
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x478, %rsp            # imm = 0x478
xorps %xmm0, %xmm0
movups %xmm0, 0x2c(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
cmpl $0x0, 0x84(%rsi)
js 0x3c1f
movq %rsi, %r14
movq %rdi, %r12
leaq 0x8(%rdi), %rax
movq %rax, 0x30(%rsp)
leaq 0x20(%rdi), %rbp
movq 0x20(%rsi), %rsi
leaq 0x270(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
movq %r12, 0x28(%rsp)
movq %rbp, 0x60(%rsp)
callq 0x22e0
movq %r14, 0x8(%rsp)
movq 0x270(%rsp), %rax
movq -0x18(%rax), %rcx
testb $0x5, 0x290(%rsp,%rcx)
jne 0x3c31
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
movl $0x0, 0x4(%rsp)
leaq 0x68(%rsp), %r15
leaq 0x40(%rsp), %r13
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
movq 0x68(%rsp), %rdi
jne 0x393e
callq 0x2200
movsd %xmm0, 0x40(%rsp)
movq 0x28(%r12), %rsi
cmpq 0x30(%r12), %rsi
je 0x38fe
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%r12)
jmp 0x3909
movq %rbp, %rdi
movq %r13, %rdx
callq 0x653e
movq 0x8(%rsp), %rax
movl 0x84(%rax), %eax
testl %eax, %eax
setle %cl
movl 0x4(%rsp), %edx
cmpl %eax, %edx
setl %al
orb %cl, %al
je 0x3939
incl %edx
movl %edx, 0x4(%rsp)
movq 0x270(%rsp), %rax
jmp 0x38a6
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x3950
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x270(%rsp), %rdi
callq 0x2060
movq 0x8(%rsp), %rax
movq (%rax), %rsi
leaq 0x68(%rsp), %rdi
movl $0x8, %edx
callq 0x22e0
movq 0x68(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x88(%rsp,%rax)
jne 0x3c83
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r13d, %r13d
leaq 0x37a1(%rip), %r15      # 0x714a
leaq 0x10(%rsp), %rbx
xorl %r14d, %r14d
movq 0x68(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0x68(%rsp), %rbp
addq %rbp, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %edx
movq %rbp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x22f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3b56
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x48(%rsp), %rdi
incq %rdi
callq 0x2030
movq %rax, %r13
movq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x2190
movq %r13, %rdi
movq %r15, %rsi
callq 0x2260
movq %rax, %rdi
callq 0x2200
movsd %xmm0, 0x38(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
leaq 0x38(%rsp), %rbp
je 0x3a55
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3a60
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x653e
xorl %edi, %edi
movq %r15, %rsi
callq 0x2260
movl $0x1, %r13d
testq %rax, %rax
je 0x3abd
cmpb $0xa, (%rax)
je 0x3abd
movq %rax, %rdi
callq 0x2200
movsd %xmm0, 0x38(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3aa3
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3aae
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x653e
incl %r13d
xorl %edi, %edi
movq %r15, %rsi
callq 0x2260
jmp 0x3a70
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x6512
movl %r13d, 0x4(%r12)
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x3b34
subq %rdi, %rsi
callq 0x21c0
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rax
movl 0x84(%rax), %eax
testl %eax, %eax
setle %cl
cmpl %eax, %r14d
setl %r12b
orb %cl, %r12b
testq %rdi, %rdi
je 0x3b28
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
testb %r12b, %r12b
movq 0x28(%rsp), %r12
jne 0x3b4e
jmp 0x3b56
movq 0x8(%rsp), %rax
movl 0x84(%rax), %eax
testl %eax, %eax
setle %cl
cmpl %eax, %r14d
setl %al
orb %cl, %al
je 0x3b56
incl %r14d
jmp 0x39b1
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3b72
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x68(%rsp), %rdi
callq 0x2060
movl 0x4(%rsp), %eax
cmpl %r14d, %eax
jne 0x3cd4
movl %eax, (%r12)
movl %r13d, 0x4(%r12)
movq 0x643f(%rip), %rdi      # 0x9fd8
leaq 0x35d0(%rip), %rsi      # 0x7170
movl $0x12, %edx
callq 0x21e0
movl (%r12), %esi
movq 0x6423(%rip), %rdi      # 0x9fd8
callq 0x22a0
movq %rax, %rbx
leaq 0x35bf(%rip), %rsi      # 0x7183
movl $0x6, %edx
movq %rax, %rdi
callq 0x21e0
movl 0x4(%r12), %esi
movq %rbx, %rdi
callq 0x22a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2110
leaq 0x68(%rsp), %rdi
callq 0x2070
leaq 0x270(%rsp), %rdi
callq 0x2070
addq $0x478, %rsp            # imm = 0x478
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x63a0(%rip), %rdi      # 0x9fd8
leaq 0x34f1(%rip), %rsi      # 0x7130
movl $0xe, %edx
callq 0x21e0
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq 0x637b(%rip), %rdi      # 0x9fd8
callq 0x21e0
movq %rax, %rbx
leaq 0x34d3(%rip), %rsi      # 0x713f
movl $0xa, %edx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
callq 0x20d0
jmp 0x3cf8
movq 0x634e(%rip), %rdi      # 0x9fd8
leaq 0x349f(%rip), %rsi      # 0x7130
movl $0xe, %edx
callq 0x21e0
movq 0x8(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x632a(%rip), %rdi      # 0x9fd8
callq 0x21e0
movq %rax, %rbx
leaq 0x3482(%rip), %rsi      # 0x713f
movl $0xa, %edx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
callq 0x20d0
jmp 0x3cf8
movq 0x62fd(%rip), %rdi      # 0x9fd8
leaq 0x346b(%rip), %rsi      # 0x714d
movl $0x22, %edx
callq 0x21e0
movq 0x62e5(%rip), %rdi      # 0x9fd8
callq 0x20d0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
jmp 0x3d0c
movq %rax, %rbx
jmp 0x3d8c
movq %rax, %rbx
jmp 0x3d7f
jmp 0x3d3f
jmp 0x3d23
movq %rax, %rbx
jmp 0x3d75
jmp 0x3d1e
jmp 0x3d3f
movq %rax, %rbx
jmp 0x3d59
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x3d7f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3d7f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3d59
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x3d75
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x68(%rsp), %rdi
callq 0x2070
leaq 0x270(%rsp), %rdi
callq 0x2070
movq 0x60(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3daa
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rsi
subq %rdi, %rsi
callq 0x21c0
movq 0x30(%rsp), %rdi
callq 0x3198
movq %rbx, %rdi
callq 0x22b0