// File: /workspace/github_c_makefile_star2_O3/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 $0xd38, %rsp            # imm = 0xD38
movq %rdi, %r13
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 0x311ee
movq %rax, %r14
movq %rdx, %r12
movq %rax, %rbp
shrq $0x20, %rbp
movl $0xc350, %edi           # imm = 0xC350
movl $0xa, %esi
callq 0x311ee
movq %rdx, %r15
movq %r14, 0x8(%rsp)
movq %r14, 0x8(%r13)
movq %r12, %rbx
movq %r12, 0x10(%r13)
movq %rax, 0x18(%r13)
movq %r13, 0x20(%rsp)
movq %rdx, 0x20(%r13)
movq %rax, 0x18(%rsp)
shrq $0x20, %rax
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
leaq 0x1(%r12), %rdx
leaq 0x30(%rsp), %r14
movq %r14, %rdi
leaq 0x283f2(%rip), %rsi     # 0x58b01
movq %rdx, 0x28(%rsp)
xorl %eax, %eax
callq 0x3420
movq %r14, %rdi
leaq 0x249b3(%rip), %rsi     # 0x550d8
callq 0x3390
movq %rax, %r14
testq %rax, %rax
jne 0x3073c
leaq 0x30(%rsp), %rdi
callq 0xe925
imulq $0x2710, %r12, %r12     # imm = 0x2710
xorl %r13d, %r13d
movl $0x1, %esi
movl $0xc01, %edx            # imm = 0xC01
leaq 0x130(%rsp), %rdi
movq %r14, %rcx
callq 0x30d0
leaq (%r12,%r13), %rax
movzbl 0x130(%rsp), %ecx
movq (%r15,%rax,8), %rdx
movl $0x3f800000, (%rdx,%rcx,4) # imm = 0x3F800000
testl %ebp, %ebp
jle 0x307a1
movq (%rbx,%rax,8), %rax
xorl %ecx, %ecx
movzbl 0x131(%rsp,%rcx), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, (%rax,%rcx,4)
leaq 0x1(%rcx), %rdx
movq %rdx, %rcx
cmpq %rdx, %rbp
jne 0x30781
incq %r13
cmpq $0x2710, %r13           # imm = 0x2710
jne 0x30746
movq %r14, %rdi
callq 0x3130
movq 0x28(%rsp), %rax
movq %rax, %r12
cmpq $0x5, %rax
jne 0x306fb
movq 0x8(%rsp), %r14
testl %r14d, %r14d
jle 0x307f8
movq %rbx, %r12
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
movq (%r12,%rbx,8), %rdi
movl %ebp, %esi
movss 0x281bd(%rip), %xmm0    # 0x589a8
callq 0xf95e
incq %rbx
cmpq %rbx, %r14
jne 0x307dd
movq 0x18(%rsp), %rsi
testl %esi, %esi
movq 0x10(%rsp), %rdi
jle 0x30864
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
movsd 0x2493b(%rip), %xmm1    # 0x55150
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %eax, %eax
movss 0x2817c(%rip), %xmm1    # 0x589ac
mulss 0x24a60(%rip), %xmm0    # 0x55298
testl %edi, %edi
jle 0x3085c
movq (%r15,%rax,8), %rcx
xorl %edx, %edx
movss (%rcx,%rdx,4), %xmm2
mulss %xmm1, %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rdi
jne 0x30842
incq %rax
cmpq %rsi, %rax
jne 0x30838
movq 0x20(%rsp), %rax
addq $0xd38, %rsp            # imm = 0xD38
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq