// File: /workspace/github_c_makefile_star2_O2/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 $0xd68, %rsp            # imm = 0xD68
movq %rdi, %rbx
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 0x221e3
movq %rax, %r15
movq %rdx, %r14
movq %rax, %r12
shrq $0x20, %r12
pushq $0xa
popq %rsi
movl $0xc350, %edi           # imm = 0xC350
callq 0x221e3
movq %rdx, %r13
movq %r15, 0x40(%rsp)
movq %r15, 0x8(%rbx)
movq %r14, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq %rbx, 0x50(%rsp)
movq %rdx, 0x20(%rbx)
testl %r12d, %r12d
movl $0x0, %r15d
movq %r12, 0x48(%rsp)
cmovgl %r12d, %r15d
xorl %ebx, %ebx
cmpq $0x5, %rbx
je 0x2188d
leaq 0x1(%rbx), %rdx
leaq 0x60(%rsp), %r12
movq %r12, %rdi
leaq 0x2e26b(%rip), %rsi     # 0x4fa51
movq %rdx, 0x58(%rsp)
xorl %eax, %eax
callq 0x3420
movq %r12, %rdi
leaq 0x2a8b4(%rip), %rsi     # 0x4c0b0
callq 0x3390
movq %rax, %r12
testq %rax, %rax
jne 0x21813
leaq 0x60(%rsp), %rdi
callq 0x3d0f
imulq $0x2710, %rbx, %rbp     # imm = 0x2710
xorl %ebx, %ebx
cmpq $0x2710, %rbx           # imm = 0x2710
je 0x2187b
movl $0xc01, %edx            # imm = 0xC01
leaq 0x160(%rsp), %rdi
pushq $0x1
popq %rsi
movq %r12, %rcx
callq 0x30d0
movzbl 0x160(%rsp), %ecx
leaq (%rbx,%rbp), %rax
movq (%r13,%rax,8), %rdx
movl $0x3f800000, (%rdx,%rcx,4) # imm = 0x3F800000
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x21876
movzbl 0x161(%rsp,%rcx), %edx
cvtsi2ss %edx, %xmm0
movq (%r14,%rax,8), %rdx
movss %xmm0, (%rdx,%rcx,4)
incq %rcx
jmp 0x21857
incq %rbx
jmp 0x2181c
movq %r12, %rdi
callq 0x3130
movq 0x58(%rsp), %rbx
jmp 0x217c9
movslq 0x40(%rsp), %rbx
xorl %r15d, %r15d
testq %rbx, %rbx
cmovleq %r15, %rbx
movq 0x48(%rsp), %r12
cmpq %r15, %rbx
je 0x218bf
movq (%r14,%r15,8), %rdi
movl %r12d, %esi
movss 0x2e043(%rip), %xmm0    # 0x4f8f8
callq 0x4b7e
incq %r15
jmp 0x218a1
movq 0x50(%rsp), %rbx
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups 0x30(%rbx), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x216dd
movq %rbx, %rax
addq $0xd68, %rsp            # imm = 0xD68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq