// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xda0, %rsp            # imm = 0xDA0
movq %rdi, -0xd50(%rbp)
movq %rdi, %rax
movq %rax, -0xd58(%rbp)
xorl %esi, %esi
movl $0x40, %edx
callq 0x3190
movq -0xd50(%rbp), %rdi
movl $0x0, 0x28(%rdi)
movl $0xc350, %edi           # imm = 0xC350
movl $0xc00, %esi            # imm = 0xC00
callq 0x39450
movq %rax, -0x20(%rbp)
movq %rdx, -0x18(%rbp)
movl $0xc350, %edi           # imm = 0xC350
movl $0xa, %esi
callq 0x39450
movq -0xd50(%rbp), %rdi
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, 0x8(%rdi)
movq -0x18(%rbp), %rax
movq %rax, 0x10(%rdi)
movq -0x30(%rbp), %rax
movq %rax, 0x18(%rdi)
movq -0x28(%rbp), %rax
movq %rax, 0x20(%rdi)
movl $0x0, -0xc(%rbp)
cmpl $0x5, -0xc(%rbp)
jge 0x386cc
leaq -0x130(%rbp), %rdi
movl -0xc(%rbp), %edx
addl $0x1, %edx
leaq 0x3be44(%rip), %rsi     # 0x743f4
movb $0x0, %al
callq 0x33f0
leaq -0x130(%rbp), %rdi
leaq 0x38af7(%rip), %rsi     # 0x710bc
callq 0x3360
movq %rax, -0x138(%rbp)
cmpq $0x0, -0x138(%rbp)
jne 0x385e7
leaq -0x130(%rbp), %rdi
callq 0x4110
movl $0x0, -0x4(%rbp)
cmpl $0x2710, -0x4(%rbp)     # imm = 0x2710
jge 0x386b2
leaq -0xd40(%rbp), %rdi
movq -0x138(%rbp), %rcx
movl $0x1, %esi
movl $0xc01, %edx            # imm = 0xC01
callq 0x30a0
movzbl -0xd40(%rbp), %eax
movl %eax, -0xd44(%rbp)
movq -0x28(%rbp), %rax
movl -0x4(%rbp), %ecx
imull $0x2710, -0xc(%rbp), %edx # imm = 0x2710
addl %edx, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0xd44(%rbp), %rcx
movss 0x389c1(%rip), %xmm0    # 0x7100c
movss %xmm0, (%rax,%rcx,4)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x386a2
movslq -0x8(%rbp), %rax
leaq -0xd40(%rbp), %rcx
movzbl 0x1(%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x18(%rbp), %rax
movl -0x4(%rbp), %ecx
imull $0x2710, -0xc(%rbp), %edx # imm = 0x2710
addl %edx, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x8(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x38657
jmp 0x386a4
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x385ee
movq -0x138(%rbp), %rdi
callq 0x3100
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x38592
movq -0xd50(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movq %rsp, %rax
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movss 0x3bc24(%rip), %xmm0    # 0x74320
callq 0x38250
movq -0xd50(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movq %rsp, %rax
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x38430
movq -0xd58(%rbp), %rax
addq $0xda0, %rsp            # imm = 0xDA0
popq %rbp
retq
nop