// File: /workspace/github_c_makefile_star2_O1/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, %ebx
movl %r8d, %r12d
movl %esi, %r15d
movq %rdi, %r14
movq %rdx, %rdi
movl %ecx, %edx
callq 0x29752
movq %rax, 0x80(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x30(%r14)
movl %r15d, 0x8(%r14)
movslq %r15d, %rbp
movl $0x8, %esi
movq %rbp, %rdi
callq 0x3260
movq %rax, %r13
movq %rax, 0x10(%r14)
movl %r12d, 0x38(%rsp)
movl %r12d, %eax
movl %ebx, 0x3c(%rsp)
imull %ebx, %eax
leal (%rax,%rax,2), %eax
movl %eax, 0xc(%r14)
movl 0x130(%rsp), %eax
leal (%rax,%rax,4), %esi
movl %ebp, %edi
callq 0x2f52e
movq %rax, 0x18(%r14)
movq %r14, 0xd8(%rsp)
movq %rdx, 0x20(%r14)
testl %ebp, %ebp
jle 0x2d208
movq %rdx, %rbx
xorps %xmm0, %xmm0
cvtsi2ssl 0x3c(%rsp), %xmm0
movaps %xmm0, 0xc0(%rsp)
xorps %xmm0, %xmm0
cvtsi2ssl 0x38(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movl %r15d, %r14d
xorl %r12d, %r12d
movq 0x80(%rsp), %rax
movq (%rax,%r12,8), %r15
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x160b6
movl 0x90(%rsp), %ecx
leaq 0x68(%rsp), %rdi
movl 0x38(%rsp), %esi
movl 0x3c(%rsp), %edx
callq 0x1529e
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
movss 0x2628d(%rip), %xmm0    # 0x53234
callq 0x18a00
xorps %xmm1, %xmm1
cvtsi2ssl 0x88(%rsp), %xmm1
movss %xmm1, 0x40(%rsp)
xorps %xmm2, %xmm2
cvtsi2ssl 0x8c(%rsp), %xmm2
movss 0x58(%rsp), %xmm0
mulss %xmm0, %xmm1
mulss %xmm0, %xmm2
movaps %xmm2, 0xb0(%rsp)
movaps %xmm1, %xmm0
movaps 0x26166(%rip), %xmm2    # 0x53150
xorps %xmm2, %xmm0
callq 0xf201
xorps %xmm1, %xmm1
cvtsi2ssl 0x8c(%rsp), %xmm1
movss %xmm1, 0xa0(%rsp)
addss 0x40(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movaps 0xb0(%rsp), %xmm1
movaps %xmm1, %xmm0
xorps 0x2612c(%rip), %xmm0    # 0x53150
callq 0xf201
movaps 0x40(%rsp), %xmm1
addss 0xa0(%rsp), %xmm0
divss %xmm0, %xmm1
movss 0x25fc5(%rip), %xmm0    # 0x53008
ucomiss %xmm1, %xmm0
ja 0x2d05b
movss 0x34(%rsp), %xmm3
movaps %xmm3, %xmm4
movaps 0xc0(%rsp), %xmm2
jmp 0x2d070
movaps %xmm1, %xmm4
movaps 0xc0(%rsp), %xmm2
mulss %xmm2, %xmm4
movss 0x34(%rsp), %xmm3
movss %xmm4, 0xb0(%rsp)
movaps %xmm3, %xmm0
divss %xmm1, %xmm0
cmpltss 0x25f7f(%rip), %xmm1    # 0x53008
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 0xf201
movaps %xmm0, 0xa0(%rsp)
movaps 0xc0(%rsp), %xmm1
subss 0x40(%rsp), %xmm1
xorps %xmm0, %xmm0
callq 0xf201
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 0x17de8
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 0x1a8a2
callq 0x34f0
movl %eax, %ebp
shrl $0x1f, %eax
addl %ebp, %eax
andl $-0x2, %eax
subl %eax, %ebp
je 0x2d172
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x16f91
movq 0x78(%rsp), %rax
movq %rax, (%r13,%r12,8)
movq (%rbx,%r12,8), %rdx
movaps 0x25fc9(%rip), %xmm0    # 0x53150
movaps 0xa0(%rsp), %xmm4
xorps %xmm0, %xmm4
movss 0x34(%rsp), %xmm3
divss %xmm3, %xmm4
movaps 0xe0(%rsp), %xmm1
xorps %xmm0, %xmm1
movaps 0xc0(%rsp), %xmm0
divss %xmm0, %xmm1
movss 0xb0(%rsp), %xmm2
divss %xmm3, %xmm2
movaps 0x40(%rsp), %xmm3
divss %xmm0, %xmm3
movq %r15, %rdi
movl 0x130(%rsp), %esi
movl %ebp, %r8d
movaps %xmm4, %xmm0
callq 0x2adaa
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x88(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
incq %r12
cmpq %r12, %r14
jne 0x2cf53
movq 0x80(%rsp), %rdi
callq 0x3040
movq 0xd8(%rsp), %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq