// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::UpdateBatch(std::vector<Matrix, std::allocator<Matrix>>&, std::vector<Matrix, std::allocator<Matrix>>&)
void DataInterface::UpdateBatch(vector<Matrix> &data, vector<Matrix> &label)
{
    // clear previous batch
    data.clear();
    label.clear();

    size_t total_elements = __dataDimension.first*__dataDimension.second;
    assert( total_elements > 0); // make sure data dimension has been set

    //---------------------------------------------
    // prepare data
    int batch_size = gBatchSize / 2; // because signal + cosmic = gBatchSize
    int offset = gDataIndex * batch_size;
    assert( (size_t)(offset + batch_size) <= test_training_signal.size() ); // to avoid exceed range issue

    for(int i=0;i<batch_size;i++) // signal data
    {
        // data signal
        Matrix M;	
        if(__gLayerDimension == LayerDimension::_1D)
        {
            // if input layer is 1D, then reshape images into a collum vector
            M = test_training_signal[offset+i].Reshape(total_elements, 1);
        }
        else
        {
            M = test_training_signal[offset+i];
        }
        data.push_back(M);

        // label
        Matrix signal_label_m(2, 1, 0); // signal label
        signal_label_m[0][0] = 1;
        label.push_back(signal_label_m);
    }
    for(int i=0;i<batch_size;i++) // cosmic data
    {
        // data cosmic
        Matrix M;
        if(__gLayerDimension == LayerDimension::_1D)
        {
            M = test_training_cosmic[offset+i].Reshape(total_elements, 1);
        }
        else
        {
            M = test_training_cosmic[offset+i];
        }
        data.push_back(M);

        // label
        Matrix cosmic_label_m(2, 1, 0); // cosmic label
        cosmic_label_m[1][0] = 1;
        label.push_back(cosmic_label_m);
    }

    // get ready for next batch
    gDataIndex++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, (%rsp)
movq %rsi, %r15
movq %rdi, %r14
movq (%rsi), %rbx
movq 0x8(%rsi), %r13
cmpq %rbx, %r13
je 0x1999a
movq %rbx, %r12
movq %r12, %rdi
callq 0x1acb6
addq $0x18, %r12
cmpq %r13, %r12
jne 0x19985
movq %rbx, 0x8(%r15)
movq (%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %r13
cmpq %rbx, %r13
je 0x199c6
movq %rbx, %r12
movq %r12, %rdi
callq 0x1acb6
addq $0x18, %r12
cmpq %r13, %r12
jne 0x199ad
movq (%rsp), %rax
movq %rbx, 0x8(%rax)
movq 0x78(%r14), %rax
imulq 0x70(%r14), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x19c02
movl (%r14), %esi
movl %esi, %ecx
shrl $0x1f, %ecx
addl %esi, %ecx
sarl %ecx
movslq 0x4(%r14), %rax
movslq %ecx, %rdx
imulq %rax, %rdx
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
leal (%rdx,%rcx), %eax
cltq
movq 0x98(%r14), %rcx
subq 0x90(%r14), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %rax, %rdx
jb 0x19c21
movl %esi, 0xc(%rsp)
cmpl $0x2, %esi
jl 0x19b0d
movl 0x18(%rsp), %r12d
movq 0x10(%rsp), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbx
leaq 0x40(%rsp), %r13
leaq 0x28(%rsp), %rbp
movq %r13, %rdi
callq 0x1a792
cmpl $0x0, 0xc0(%r14)
je 0x19a7b
movq 0x90(%r14), %rsi
addq %rbx, %rsi
movq %r13, %rdi
callq 0x14f80
jmp 0x19aaa
movq 0x90(%r14), %rsi
addq %rbx, %rsi
movl $0x1, %ecx
movq %rbp, %rdi
movq 0x20(%rsp), %rdx
callq 0x1c1c4
movq %r13, %rdi
movq %rbp, %rsi
callq 0x14f80
movq %rbp, %rdi
callq 0x1acb6
movq %r15, %rdi
movq %r13, %rsi
callq 0x13a14
movl $0x2, %esi
movl $0x1, %edx
xorps %xmm0, %xmm0
movq %rbp, %rdi
callq 0x1a952
movq %rbp, %rdi
xorl %esi, %esi
callq 0x1ae76
movq (%rax), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, (%rax)
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x13a14
movq %rbp, %rdi
callq 0x1acb6
movq %r13, %rdi
callq 0x1acb6
addq $0x18, %rbx
decq %r12
jne 0x19a55
cmpl $0x2, 0xc(%rsp)
jl 0x19bef
movslq 0x10(%rsp), %rax
movl 0x18(%rsp), %r12d
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbx
leaq 0x40(%rsp), %r13
leaq 0x28(%rsp), %rbp
movq %r13, %rdi
callq 0x1a792
cmpl $0x0, 0xc0(%r14)
je 0x19b5a
movq 0xa8(%r14), %rsi
addq %rbx, %rsi
movq %r13, %rdi
callq 0x14f80
jmp 0x19b89
movq 0xa8(%r14), %rsi
addq %rbx, %rsi
movl $0x1, %ecx
movq %rbp, %rdi
movq 0x20(%rsp), %rdx
callq 0x1c1c4
movq %r13, %rdi
movq %rbp, %rsi
callq 0x14f80
movq %rbp, %rdi
callq 0x1acb6
movq %r15, %rdi
movq %r13, %rsi
callq 0x13a14
movl $0x2, %esi
movl $0x1, %edx
xorps %xmm0, %xmm0
movq %rbp, %rdi
callq 0x1a952
movl $0x1, %esi
movq %rbp, %rdi
callq 0x1ae76
movq (%rax), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, (%rax)
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x13a14
movq %rbp, %rdi
callq 0x1acb6
movq %r13, %rdi
callq 0x1acb6
addq $0x18, %rbx
decq %r12
jne 0x19b34
incl 0x4(%r14)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x100cb(%rip), %rdi     # 0x29cd4
leaq 0xfff8(%rip), %rsi      # 0x29c08
leaq 0x100d0(%rip), %rcx     # 0x29ce7
movl $0x9c, %edx
callq 0x4160
leaq 0x10103(%rip), %rdi     # 0x29d2b
leaq 0xffd9(%rip), %rsi      # 0x29c08
leaq 0x100b1(%rip), %rcx     # 0x29ce7
movl $0xa2, %edx
callq 0x4160
jmp 0x19c55
jmp 0x19c4e
jmp 0x19c55
jmp 0x19c4e
jmp 0x19c4e
jmp 0x19c4e
jmp 0x19c4e
movq %rax, %rbx
jmp 0x19c62
jmp 0x19c55
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x1acb6
leaq 0x40(%rsp), %rdi
callq 0x1acb6
movq %rbx, %rdi
callq 0x43e0