// File: /workspace/github_cpp_makefile_star2_O1/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 0x3bee
movq %rsi, %rbp
movq %rdi, %r12
leaq 0x8(%rdi), %rax
movq %rax, 0x40(%rsp)
leaq 0x20(%rdi), %rax
movq %rax, 0x38(%rsp)
movq 0x20(%rsi), %rsi
leaq 0x270(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x22e0
movq 0x270(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x290(%rsp,%rax)
jne 0x3c00
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
movl $0x0, 0x8(%rsp)
leaq 0x68(%rsp), %r15
leaq 0x48(%rsp), %r13
movq 0x270(%rsp), %rax
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)
jne 0x390c
movq 0x68(%rsp), %rdi
callq 0x2200
movsd %xmm0, 0x48(%rsp)
movq 0x28(%r12), %rsi
cmpq 0x30(%r12), %rsi
je 0x38e0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%r12)
jmp 0x38ed
movq 0x38(%rsp), %rdi
movq %r13, %rdx
callq 0x64b0
movl 0x84(%rbp), %eax
testl %eax, %eax
setle %cl
cmpl %eax, 0x8(%rsp)
setl %al
orb %cl, %al
je 0x390c
incl 0x8(%rsp)
jmp 0x3880
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x3923
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x270(%rsp), %rdi
callq 0x2060
movq (%rbp), %rsi
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x22e0
movq 0x68(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x88(%rsp,%rax)
jne 0x3c4d
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r13d, %r13d
leaq 0x37cf(%rip), %r14      # 0x714a
leaq 0x10(%rsp), %r15
movl $0x0, 0xc(%rsp)
movq 0x68(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x48(%rsp), %rsi
callq 0x22f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3b24
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x50(%rsp), %rdi
incq %rdi
callq 0x2030
movq %rax, %r13
movq 0x48(%rsp), %rsi
movq %rax, %rdi
callq 0x2190
movq %r13, %rdi
movq %r14, %rsi
callq 0x2260
movq %rax, %rdi
callq 0x2200
movsd %xmm0, 0x30(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3a22
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3a2f
movq %r15, %rdi
leaq 0x30(%rsp), %rdx
callq 0x64b0
xorl %edi, %edi
movq %r14, %rsi
callq 0x2260
movl $0x1, %r13d
testq %rax, %rax
je 0x3a8e
cmpb $0xa, (%rax)
je 0x3a8e
movq %rax, %rdi
callq 0x2200
movsd %xmm0, 0x30(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3a72
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3a7f
movq %r15, %rdi
leaq 0x30(%rsp), %rdx
callq 0x64b0
incl %r13d
xorl %edi, %edi
movq %r14, %rsi
callq 0x2260
jmp 0x3a3f
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x6484
movq %rbx, %r14
movq %r12, %rbx
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 0x3ace
subq %rdi, %rsi
callq 0x21c0
movq %rbp, %r15
movl 0x84(%rbp), %eax
testl %eax, %eax
setle %r12b
cmpl %eax, 0xc(%rsp)
setl %bpl
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3afc
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
orb %bpl, %r12b
movzbl %r12b, %eax
addl %eax, 0xc(%rsp)
testb %al, %al
movq %rbx, %r12
movq %r15, %rbp
movq %r14, %rbx
leaq 0x3631(%rip), %r14      # 0x714a
leaq 0x10(%rsp), %r15
jne 0x3988
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x3b40
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x68(%rsp), %rdi
callq 0x2060
movl 0xc(%rsp), %eax
cmpl 0x8(%rsp), %eax
jne 0x3c9a
movl %eax, (%r12)
movl %r13d, 0x4(%r12)
movq 0x6470(%rip), %rdi      # 0x9fd8
leaq 0x3601(%rip), %rsi      # 0x7170
movl $0x12, %edx
callq 0x21e0
movl (%r12), %esi
movq 0x6454(%rip), %rdi      # 0x9fd8
callq 0x22a0
movq %rax, %rbx
leaq 0x35f0(%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 0x63d1(%rip), %rdi      # 0x9fd8
leaq 0x3522(%rip), %rsi      # 0x7130
movl $0xe, %edx
callq 0x21e0
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %rdx
movq 0x63b1(%rip), %rdi      # 0x9fd8
callq 0x21e0
movq %rax, %rbx
leaq 0x3509(%rip), %rsi      # 0x713f
movl $0xa, %edx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
callq 0x20d0
jmp 0x3cbe
movq 0x6384(%rip), %rdi      # 0x9fd8
leaq 0x34d5(%rip), %rsi      # 0x7130
movl $0xe, %edx
callq 0x21e0
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq 0x6364(%rip), %rdi      # 0x9fd8
callq 0x21e0
movq %rax, %rbx
leaq 0x34bc(%rip), %rsi      # 0x713f
movl $0xa, %edx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
callq 0x20d0
jmp 0x3cbe
movq 0x6337(%rip), %rdi      # 0x9fd8
leaq 0x34a5(%rip), %rsi      # 0x714d
movl $0x22, %edx
callq 0x21e0
movq 0x631f(%rip), %rdi      # 0x9fd8
callq 0x20d0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21f0
jmp 0x3cd2
movq %rax, %rbx
jmp 0x3d52
movq %rax, %rbx
jmp 0x3d45
jmp 0x3d05
jmp 0x3ce9
movq %rax, %rbx
jmp 0x3d3b
jmp 0x3d05
jmp 0x3d05
movq %rax, %rbx
jmp 0x3d1f
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x3d45
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x3d45
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3d1f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x3d3b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x68(%rsp), %rdi
callq 0x2070
leaq 0x270(%rsp), %rdi
callq 0x2070
movq 0x38(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3d6c
movq 0x30(%r12), %rsi
subq %rdi, %rsi
callq 0x21c0
movq 0x40(%rsp), %rdi
callq 0x318e
movq %rbx, %rdi
callq 0x22b0