// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: fill_truth_mask
void fill_truth_mask(char *path, int num_boxes, float *truth, int classes, int w, int h, augment_args aug, int flip, int mw, int mh)
{
    char labelpath[4096];
    find_replace(path, "images", "mask", labelpath);
    find_replace(labelpath, "JPEGImages", "mask", labelpath);
    find_replace(labelpath, ".jpg", ".txt", labelpath);
    find_replace(labelpath, ".JPG", ".txt", labelpath);
    find_replace(labelpath, ".JPEG", ".txt", labelpath);
    FILE *file = fopen(labelpath, "r");
    if(!file) file_error(labelpath);
    char buff[32788];
    int id;
    int i = 0;
    image part = make_image(w, h, 1);
    while((fscanf(file, "%d %s", &id, buff) == 2) && i < num_boxes){
        int n = 0;
        int *rle = read_intlist(buff, &n, 0);
        load_rle(part, rle, n);
        image sized = rotate_crop_image(part, aug.rad, aug.scale, aug.w, aug.h, aug.dx, aug.dy, aug.aspect);
        if(flip) flip_image(sized);
        box b = bound_image(sized);
        if(b.w > 0){
            image crop = crop_image(sized, b.x, b.y, b.w, b.h);
            image mask = resize_image(crop, mw, mh);
            truth[i*(4 + mw*mh + 1) + 0] = (b.x + b.w/2.)/sized.w;
            truth[i*(4 + mw*mh + 1) + 1] = (b.y + b.h/2.)/sized.h;
            truth[i*(4 + mw*mh + 1) + 2] = b.w/sized.w;
            truth[i*(4 + mw*mh + 1) + 3] = b.h/sized.h;
            int j;
            for(j = 0; j < mw*mh; ++j){
                truth[i*(4 + mw*mh + 1) + 4 + j] = mask.data[j];
            }
            truth[i*(4 + mw*mh + 1) + 4 + mw*mh] = id;
            free_image(crop);
            free_image(mask);
            ++i;
        }
        free_image(sized);
        free(rle);
    }
    fclose(file);
    free_image(part);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9108, %rsp           # imm = 0x9108
movl %r9d, %ebp
movl %r8d, %r15d
movq %rdx, %rbx
movl %esi, %r13d
leaq 0x2c009(%rip), %rsi     # 0x5694f
leaq 0x2c026(%rip), %r12     # 0x56973
leaq 0xf0(%rsp), %r14
movq %r12, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x2bff6(%rip), %rsi     # 0x5695d
movq %r14, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x2add8(%rip), %rsi     # 0x55754
leaq 0x2de36(%rip), %r12     # 0x587b9
movq %r14, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x2bfd0(%rip), %rsi     # 0x56968
movq %r14, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x2bfc0(%rip), %rsi     # 0x5696d
movq %r14, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0xe842
leaq 0x2e30f(%rip), %rsi     # 0x58cd1
movq %r14, %rdi
callq 0x33a0
movq %rax, %r14
testq %rax, %rax
jne 0x2a9df
leaq 0xf0(%rsp), %rdi
callq 0xe142
leaq 0x60(%rsp), %rdi
movl %r15d, %esi
movl %ebp, %edx
movl $0x1, %ecx
callq 0x1529e
leaq 0x2bf7e(%rip), %rsi     # 0x56978
leaq 0x20(%rsp), %rdx
leaq 0x10f0(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x30b0
cmpl $0x2, %eax
setne %al
movl %r13d, 0x44(%rsp)
testl %r13d, %r13d
setle %cl
orb %al, %cl
jne 0x2ad78
movl 0x9170(%rsp), %ecx
leaq 0x9140(%rsp), %rax
movss 0xc(%rax), %xmm0
movss %xmm0, 0x40(%rsp)
movss 0x8(%rax), %xmm0
movss %xmm0, 0x3c(%rsp)
movl (%rax), %edx
movl %edx, 0x38(%rsp)
movl 0x4(%rax), %edx
movl %edx, 0x34(%rsp)
movss 0x10(%rax), %xmm0
movss %xmm0, 0x30(%rsp)
movss 0x14(%rax), %xmm0
movss %xmm0, 0x2c(%rsp)
movss 0x18(%rax), %xmm0
movss %xmm0, 0x28(%rsp)
movl %ecx, %r13d
imull 0x9168(%rsp), %r13d
leal 0x5(%r13), %eax
movl %eax, 0x24(%rsp)
leaq 0x10(%rbx), %rax
movq %rax, 0x78(%rsp)
leaq 0x10f0(%rsp), %r12
xorl %r15d, %r15d
movl $0x0, 0x1c(%rsp)
movq %r12, %rdi
leaq 0x1c(%rsp), %rsi
xorl %edx, %edx
callq 0xe017
movq %rax, %rbp
movl 0x1c(%rsp), %esi
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbp, %rdi
callq 0x2a37e
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x48(%rsp), %rdi
movss 0x40(%rsp), %xmm0
movss 0x3c(%rsp), %xmm1
movl 0x38(%rsp), %esi
movl 0x34(%rsp), %edx
movss 0x30(%rsp), %xmm2
movss 0x2c(%rsp), %xmm3
movss 0x28(%rsp), %xmm4
callq 0x183d8
cmpl $0x0, 0x9160(%rsp)
je 0x2ab43
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x16f91
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x2a505
ucomiss 0x28516(%rip), %xmm1    # 0x53078
jbe 0x2ad2f
cvttss2si %xmm0, %esi
movaps %xmm0, 0xc0(%rsp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm0, 0xe0(%rsp)
cvttss2si %xmm0, %edx
cvttss2si %xmm1, %ecx
movaps %xmm1, %xmm0
shufps $0x55, %xmm1, %xmm0     # xmm0 = xmm0[1,1],xmm1[1,1]
movaps %xmm0, 0xd0(%rsp)
cvttss2si %xmm0, %r8d
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x80(%rsp), %rdi
movaps %xmm1, 0xb0(%rsp)
callq 0x181f7
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x80(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x98(%rsp), %rdi
movl 0x9168(%rsp), %esi
movl 0x9170(%rsp), %edx
callq 0x1676b
movl %r15d, %eax
xorps %xmm0, %xmm0
cvtss2sd 0xc0(%rsp), %xmm0
movaps 0xb0(%rsp), %xmm4
xorps %xmm1, %xmm1
cvtss2sd %xmm4, %xmm1
movsd 0x28502(%rip), %xmm2    # 0x53120
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movl 0x48(%rsp), %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
imull 0x24(%rsp), %eax
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movslq %eax, %rcx
movss %xmm0, (%rbx,%rcx,4)
xorps %xmm0, %xmm0
cvtss2sd 0xe0(%rsp), %xmm0
movaps 0xd0(%rsp), %xmm3
xorps %xmm1, %xmm1
cvtss2sd %xmm3, %xmm1
mulsd %xmm2, %xmm1
movl 0x4c(%rsp), %esi
xorps %xmm2, %xmm2
cvtsi2sd %esi, %xmm2
addsd %xmm0, %xmm1
divsd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x4(%rbx,%rcx,4)
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movaps %xmm4, %xmm1
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
movss %xmm1, 0x8(%rbx,%rcx,4)
movaps %xmm3, %xmm1
divss %xmm0, %xmm1
movss %xmm1, 0xc(%rbx,%rcx,4)
testl %r13d, %r13d
jle 0x2acda
movq 0xa8(%rsp), %rdx
movq 0x78(%rsp), %rsi
leaq (%rsi,%rcx,4), %rcx
xorl %esi, %esi
movss (%rdx,%rsi,4), %xmm0
movss %xmm0, (%rcx,%rsi,4)
incq %rsi
cmpq %rsi, %r13
jne 0x2acc8
xorps %xmm0, %xmm0
cvtsi2ssl 0x20(%rsp), %xmm0
addl %r13d, %eax
addl $0x4, %eax
cltq
movss %xmm0, (%rbx,%rax,4)
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x80(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x98(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
incl %r15d
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq %rbp, %rdi
callq 0x3040
movq %r14, %rdi
leaq 0x2bc1f(%rip), %rsi     # 0x56978
leaq 0x20(%rsp), %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x30b0
cmpl $0x2, %eax
jne 0x2ad78
cmpl 0x44(%rsp), %r15d
jl 0x2aaa5
movq %r14, %rdi
callq 0x3140
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
addq $0x9108, %rsp           # imm = 0x9108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq