// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: load_data_iseg
data load_data_iseg(int n, char **paths, int m, int w, int h, int classes, int boxes, int div, int min, int max, float angle, float aspect, 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, (((w/div)*(h/div))+1)*boxes);

    for(i = 0; i < n; ++i){
        image orig = load_image_color(random_paths[i], 0, 0);
        augment_args a = random_augment_args(orig, angle, aspect, min, max, w, h);
        image sized = rotate_crop_image(orig, a.rad, a.scale, a.w, a.h, a.dx, a.dy, a.aspect);

        int flip = rand()%2;
        if(flip) flip_image(sized);
        random_distort_image(sized, hue, saturation, exposure);
        d.X.vals[i] = sized.data;
        //show_image(sized, "image");

        fill_truth_iseg(random_paths[i], boxes, d.y.vals[i], classes, orig.w, orig.h, a, flip, w/div, h/div);

        free_image(orig);

        /*
           image rgb = mask_to_rgb(sized_m, classes);
           show_image(rgb, "part");
           show_image(sized, "orig");
           cvWaitKey(0);
           free_image(rgb);
         */
    }
    free(random_paths);
    return d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movss %xmm4, 0x5c(%rsp)
movss %xmm3, 0x58(%rsp)
movss %xmm2, 0x54(%rsp)
movss %xmm1, 0x50(%rsp)
movss %xmm0, 0x4c(%rsp)
movl %r9d, %ebp
movl %r8d, %r15d
movl %esi, %r14d
movq %rdi, %r13
movl 0x110(%rsp), %ebx
movq %rdx, %rdi
movl %ecx, %edx
callq 0x29752
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
movups %xmm0, 0x10(%r13)
movups %xmm0, 0x20(%r13)
movups %xmm0, 0x30(%r13)
movl %r14d, 0x8(%r13)
movslq %r14d, %r12
movl $0x8, %esi
movq %r12, %rdi
callq 0x3260
movq %rax, 0xa8(%rsp)
movq %rax, 0x10(%r13)
movl %r15d, %eax
imull %ebp, %eax
leal (%rax,%rax,2), %eax
movl %eax, 0xc(%r13)
movl %r15d, 0x44(%rsp)
movl %r15d, %eax
cltd
idivl %ebx
movl %eax, %ecx
movl %ebp, 0x48(%rsp)
movl %ebp, %eax
cltd
idivl %ebx
movl %eax, %r15d
movl %eax, %esi
movl %ecx, 0x40(%rsp)
imull %ecx, %esi
incl %esi
imull 0x108(%rsp), %esi
movl %r12d, %edi
callq 0x2f52e
movq %rax, 0x18(%r13)
movq %r13, 0xa0(%rsp)
movq %rdx, 0x20(%r13)
testl %r12d, %r12d
jle 0x2c12d
movq %rdx, %rbp
movl %r14d, %r13d
xorl %ebx, %ebx
movq 0x60(%rsp), %rax
movq (%rax,%rbx,8), %r14
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x160b6
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x80(%rsp), %rdi
movss 0x4c(%rsp), %xmm0
movss 0x50(%rsp), %xmm1
movl 0x118(%rsp), %esi
movl 0x120(%rsp), %edx
movl 0x44(%rsp), %ecx
movl 0x48(%rsp), %r8d
callq 0x192e2
movss 0x8c(%rsp), %xmm0
movss 0x88(%rsp), %xmm1
movl 0x80(%rsp), %esi
movl 0x84(%rsp), %edx
movss 0x90(%rsp), %xmm2
movss 0x94(%rsp), %xmm3
movss 0x98(%rsp), %xmm4
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm5
movups %xmm5, (%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x183d8
callq 0x34f0
movl %eax, %r12d
shrl $0x1f, %eax
addl %r12d, %eax
andl $-0x2, %eax
subl %eax, %r12d
je 0x2c07c
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xb0(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x16f91
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xb0(%rsp), %xmm0
movups %xmm0, (%rsp)
movss 0x54(%rsp), %xmm0
movss 0x58(%rsp), %xmm1
movss 0x5c(%rsp), %xmm2
callq 0x1a8a2
movq 0xc0(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq %rax, (%rcx,%rbx,8)
movq (%rbp,%rbx,8), %rdx
movl 0x68(%rsp), %r8d
movl 0x6c(%rsp), %r9d
movups 0x80(%rsp), %xmm0
movups 0x8c(%rsp), %xmm1
movups %xmm1, 0xc(%rsp)
movups %xmm0, (%rsp)
movl %r15d, 0x30(%rsp)
movl 0x40(%rsp), %eax
movl %eax, 0x28(%rsp)
movl %r12d, 0x20(%rsp)
movq %r14, %rdi
movl 0x108(%rsp), %esi
callq 0x2a5a7
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
incq %rbx
cmpq %rbx, %r13
jne 0x2bf90
movq 0x60(%rsp), %rdi
callq 0x3040
movq 0xa0(%rsp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq