// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: load_all_cifar10
data load_all_cifar10()
{
    data d = {0};
    d.shallow = 0;
    int i,j,b;
    matrix X = make_matrix(50000, 3072);
    matrix y = make_matrix(50000, 10);
    d.X = X;
    d.y = y;


    for(b = 0; b < 5; ++b){
        char buff[256];
        sprintf(buff, "data/cifar/cifar-10-batches-bin/data_batch_%d.bin", b+1);
        FILE *fp = fopen(buff, "rb");
        if(!fp) file_error(buff);
        for(i = 0; i < 10000; ++i){
            unsigned char bytes[3073];
            fread(bytes, 1, 3073, fp);
            int class = bytes[0];
            y.vals[i+b*10000][class] = 1;
            for(j = 0; j < X.cols; ++j){
                X.vals[i+b*10000][j] = (double)bytes[j+1];
            }
        }
        fclose(fp);
    }
    //normalize_data_rows(d);
    scale_data_rows(d, 1./255);
    smooth_data(d);
    return d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd18, %rsp            # imm = 0xD18
movq %rdi, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movl $0xc350, %edi           # imm = 0xC350
movl $0xc00, %esi            # imm = 0xC00
callq 0x2f52e
movq %rax, %r12
movq %rdx, %rbp
movq %rax, %rbx
shrq $0x20, %rbx
movl $0xc350, %edi           # imm = 0xC350
movl $0xa, %esi
callq 0x2f52e
movq %rdx, %r14
movq %r12, 0x8(%r15)
movq %rbp, %r13
movq %rbp, 0x10(%r15)
movq %rax, 0x18(%r15)
movq %r15, (%rsp)
movq %rdx, 0x20(%r15)
xorl %r15d, %r15d
leaq 0x1(%r15), %rdx
leaq 0x10(%rsp), %r12
movq %r12, %rdi
leaq 0x27fd1(%rip), %rsi     # 0x56a01
movq %rdx, 0x8(%rsp)
xorl %eax, %eax
callq 0x3430
movq %r12, %rdi
leaq 0x2466a(%rip), %rsi     # 0x530b0
callq 0x33a0
movq %rax, %rbp
testq %rax, %rax
jne 0x2ea5d
leaq 0x10(%rsp), %rdi
callq 0xe142
imulq $0x2710, %r15, %r12     # imm = 0x2710
xorl %r15d, %r15d
movl $0x1, %esi
movl $0xc01, %edx            # imm = 0xC01
leaq 0x110(%rsp), %rdi
movq %rbp, %rcx
callq 0x30e0
leaq (%r15,%r12), %rax
movzbl 0x110(%rsp), %ecx
movq (%r14,%rax,8), %rdx
movl $0x3f800000, (%rdx,%rcx,4) # imm = 0x3F800000
testl %ebx, %ebx
jle 0x2eac3
movq (%r13,%rax,8), %rax
xorl %ecx, %ecx
movzbl 0x111(%rsp,%rcx), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, (%rax,%rcx,4)
leaq 0x1(%rcx), %rdx
movq %rdx, %rcx
cmpq %rdx, %rbx
jne 0x2eaa3
incq %r15
cmpq $0x2710, %r15           # imm = 0x2710
jne 0x2ea67
movq %rbp, %rdi
callq 0x3140
movq 0x8(%rsp), %rax
movq %rax, %r15
cmpq $0x5, %rax
jne 0x2ea1d
movq (%rsp), %rbp
movslq 0x8(%rbp), %r15
testq %r15, %r15
jle 0x2eb18
movl 0xc(%rbp), %ebx
xorl %r12d, %r12d
movq (%r13,%r12,8), %rdi
movl %ebx, %esi
movss 0x27dcd(%rip), %xmm0    # 0x568d8
callq 0xf152
incq %r12
cmpq %r12, %r15
jne 0x2eafc
movslq 0x18(%rbp), %rax
testq %rax, %rax
jle 0x2eb7c
movl 0x1c(%rbp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd 0x245f5(%rip), %xmm1    # 0x53128
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
xorl %edx, %edx
movss 0x27d94(%rip), %xmm1    # 0x568dc
mulss 0x2471c(%rip), %xmm0    # 0x5326c
testl %ecx, %ecx
jle 0x2eb74
movq (%r14,%rdx,8), %rsi
xorl %edi, %edi
movss (%rsi,%rdi,4), %xmm2
mulss %xmm1, %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rsi,%rdi,4)
incq %rdi
cmpq %rdi, %rcx
jne 0x2eb5a
incq %rdx
cmpq %rax, %rdx
jne 0x2eb50
movq %rbp, %rax
addq $0xd18, %rsp            # imm = 0xD18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq