// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: load_data_detection
data load_data_detection(int n, char **paths, int m, int w, int h, int boxes, int classes, float jitter, float hue, float saturation, float exposure)
{
    char **random_paths = get_random_paths(paths, n, m);
    int i;
    data d = {0};
    d.shallow = 0;

    d.X.rows = n;
    d.X.vals = calloc(d.X.rows, sizeof(float*));
    d.X.cols = h*w*3;

    d.y = make_matrix(n, 5*boxes);
    for(i = 0; i < n; ++i){
        image orig = load_image_color(random_paths[i], 0, 0);
        image sized = make_image(w, h, orig.c);
        fill_image(sized, .5);

        float dw = jitter * orig.w;
        float dh = jitter * orig.h;

        float new_ar = (orig.w + rand_uniform(-dw, dw)) / (orig.h + rand_uniform(-dh, dh));
        //float scale = rand_uniform(.25, 2);
        float scale = 1;

        float nw, nh;

        if(new_ar < 1){
            nh = scale * h;
            nw = nh * new_ar;
        } else {
            nw = scale * w;
            nh = nw / new_ar;
        }

        float dx = rand_uniform(0, w - nw);
        float dy = rand_uniform(0, h - nh);

        place_image(orig, nw, nh, dx, dy, sized);

        random_distort_image(sized, hue, saturation, exposure);

        int flip = rand()%2;
        if(flip) flip_image(sized);
        d.X.vals[i] = sized.data;


        fill_truth_detection(random_paths[i], boxes, d.y.vals[i], classes, flip, -dx/w, -dy/h, nw/w, nh/h);

        free_image(orig);
    }
    free(random_paths);
    return d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movss %xmm3, 0x64(%rsp)
movss %xmm2, 0x60(%rsp)
movss %xmm1, 0x5c(%rsp)
movss %xmm0, 0x58(%rsp)
movl %r9d, %ebp
movl %r8d, %r12d
movl %esi, %ebx
movq %rdi, %r14
movl 0x130(%rsp), %r15d
movq %rdx, %rdi
movl %ecx, %edx
callq 0x1c922
movq %rax, 0x80(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x30(%r14)
movl %ebx, 0x8(%r14)
movslq %ebx, %r13
pushq $0x8
popq %rsi
movq %r13, %rdi
callq 0x3250
movq %rax, 0xd8(%rsp)
movq %rax, 0x10(%r14)
movl %r12d, %eax
imull %ebp, %eax
leal (%rax,%rax,2), %eax
movl %eax, 0xc(%r14)
leal (%r15,%r15,4), %esi
movl %r13d, %edi
callq 0x221e3
movl %ebp, 0x54(%rsp)
cvtsi2ss %ebp, %xmm0
movaps %xmm0, 0xc0(%rsp)
movq %rdx, %r15
movl %r12d, %ebx
cvtsi2ss %r12d, %xmm0
movss %xmm0, 0x3c(%rsp)
movq %rax, 0x18(%r14)
movq %r14, 0xd0(%rsp)
movq %rdx, 0x20(%r14)
xorl %r12d, %r12d
testl %r13d, %r13d
cmovlel %r12d, %r13d
cmpq %r12, %r13
je 0x200b1
movq 0x80(%rsp), %rax
movq (%rax,%r12,8), %rbp
leaq 0x88(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xbf36
movl 0x90(%rsp), %ecx
leaq 0x68(%rsp), %rdi
movl %ebx, %esi
movl 0x54(%rsp), %edx
callq 0xb45a
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
movss 0x2c3da(%rip), %xmm0    # 0x4c234
callq 0xe178
cvtsi2ssl 0x88(%rsp), %xmm1
movss %xmm1, 0x40(%rsp)
cvtsi2ssl 0x8c(%rsp), %xmm2
movss 0x58(%rsp), %xmm0
mulss %xmm0, %xmm1
mulss %xmm0, %xmm2
movaps %xmm2, 0xb0(%rsp)
movaps %xmm1, %xmm0
movaps 0x2c2b9(%rip), %xmm2    # 0x4c150
xorps %xmm2, %xmm0
callq 0x4c09
cvtsi2ssl 0x8c(%rsp), %xmm1
movss %xmm1, 0xa0(%rsp)
addss 0x40(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movaps 0xb0(%rsp), %xmm1
movaps %xmm1, %xmm0
xorps 0x2c282(%rip), %xmm0    # 0x4c150
callq 0x4c09
movaps 0x40(%rsp), %xmm1
addss 0xa0(%rsp), %xmm0
divss %xmm0, %xmm1
movss 0x2c11b(%rip), %xmm0    # 0x4c008
ucomiss %xmm1, %xmm0
ja 0x1ff05
movss 0x3c(%rsp), %xmm3
movaps %xmm3, %xmm4
movaps 0xc0(%rsp), %xmm2
jmp 0x1ff1a
movaps %xmm1, %xmm4
movaps 0xc0(%rsp), %xmm2
mulss %xmm2, %xmm4
movss 0x3c(%rsp), %xmm3
movss %xmm4, 0xb0(%rsp)
movaps %xmm3, %xmm0
divss %xmm1, %xmm0
cmpltss 0x2c0d5(%rip), %xmm1    # 0x4c008
movaps %xmm1, %xmm5
andnps %xmm0, %xmm1
andps %xmm2, %xmm5
orps %xmm1, %xmm5
movaps %xmm5, 0x40(%rsp)
movaps %xmm3, %xmm1
subss %xmm4, %xmm1
xorps %xmm0, %xmm0
callq 0x4c09
movaps %xmm0, 0xa0(%rsp)
movaps 0xc0(%rsp), %xmm1
subss 0x40(%rsp), %xmm1
xorps %xmm0, %xmm0
callq 0x4c09
cvttss2si 0xb0(%rsp), %edi
cvttss2si 0x40(%rsp), %esi
cvttss2si 0xa0(%rsp), %edx
movaps %xmm0, 0xe0(%rsp)
cvttss2si %xmm0, %ecx
movq 0x78(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x88(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xd842
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
movss 0x5c(%rsp), %xmm0
movss 0x60(%rsp), %xmm1
movss 0x64(%rsp), %xmm2
callq 0xfd21
callq 0x34e0
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %edx, %r14d
testl %edx, %edx
je 0x2001b
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xcb93
movq 0x78(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq %rax, (%rcx,%r12,8)
movq (%r15,%r12,8), %rdx
movaps 0x2c119(%rip), %xmm2    # 0x4c150
movaps 0xa0(%rsp), %xmm0
xorps %xmm2, %xmm0
movss 0x3c(%rsp), %xmm3
divss %xmm3, %xmm0
movaps 0xe0(%rsp), %xmm1
xorps %xmm2, %xmm1
movaps 0xc0(%rsp), %xmm4
divss %xmm4, %xmm1
movss 0xb0(%rsp), %xmm2
divss %xmm3, %xmm2
movaps 0x40(%rsp), %xmm3
divss %xmm4, %xmm3
movq %rbp, %rdi
movl 0x130(%rsp), %esi
movl %r14d, %r8d
callq 0x1dda1
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x88(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
incq %r12
jmp 0x1fdff
movq 0x80(%rsp), %rdi
callq 0x3040
movq 0xd0(%rsp), %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq