// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: fill_truth_iseg
void fill_truth_iseg(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;
    int j;
    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);

        image mask = resize_image(sized, mw, mh);
        truth[i*(mw*mh+1)] = id;
        for(j = 0; j < mw*mh; ++j){
            truth[i*(mw*mh + 1) + 1 + j] = mask.data[j];
        }
        ++i;

        free_image(mask);
        free_image(sized);
        free(rle);
    }
    if(i < num_boxes) truth[i*(mw*mh+1)] = -1;
    fclose(file);
    free_image(part);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x90b8, %rsp           # imm = 0x90B8
movl %r9d, %r14d
movl %r8d, %r12d
movq %rdx, 0x20(%rsp)
movl %esi, %r15d
leaq 0x2ca61(%rip), %rsi     # 0x58a4f
leaq 0x2ca7e(%rip), %rbp     # 0x58a73
leaq 0xa0(%rsp), %r13
movq %rbp, %rdx
movq %r13, %rcx
callq 0xf02d
leaq 0x2ca4e(%rip), %rsi     # 0x58a5d
movq %r13, %rdi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xf02d
leaq 0x2b808(%rip), %rsi     # 0x5782c
leaq 0x2e8e6(%rip), %rbp     # 0x5a911
movq %r13, %rdi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xf02d
leaq 0x2ca28(%rip), %rsi     # 0x58a68
movq %r13, %rdi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xf02d
leaq 0x2ca18(%rip), %rsi     # 0x58a6d
movq %r13, %rdi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xf02d
leaq 0x2edbf(%rip), %rsi     # 0x5ae29
movq %r13, %rdi
callq 0x3390
movq %rax, %rbx
testq %rax, %rax
jne 0x2c087
leaq 0xa0(%rsp), %rdi
callq 0xe925
movl 0x9120(%rsp), %r13d
leaq 0x68(%rsp), %rdi
movl $0x1, %ebp
movl %r12d, %esi
movl %r14d, %edx
movl $0x1, %ecx
callq 0x15d43
leaq 0x2c9c8(%rip), %rsi     # 0x58a78
xorl %r12d, %r12d
leaq 0x1c(%rsp), %rdx
leaq 0x10a0(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x30a0
cmpl $0x2, %eax
setne %al
testl %r15d, %r15d
setle %cl
orb %al, %cl
jne 0x2c2f1
movq %rbx, 0x48(%rsp)
leaq 0x90f0(%rsp), %rax
movss 0xc(%rax), %xmm0
movss %xmm0, 0x44(%rsp)
movss 0x8(%rax), %xmm0
movss %xmm0, 0x40(%rsp)
movl (%rax), %ecx
movl %ecx, 0x3c(%rsp)
movl 0x4(%rax), %ecx
movl %ecx, 0x38(%rsp)
movss 0x10(%rax), %xmm0
movss %xmm0, 0x34(%rsp)
movss 0x14(%rax), %xmm0
movss %xmm0, 0x30(%rsp)
movss 0x18(%rax), %xmm0
movss %xmm0, 0x2c(%rsp)
movl %r13d, %ebx
imull 0x9118(%rsp), %ebx
leal 0x1(%rbx), %eax
movl %eax, 0x28(%rsp)
cltq
movq %rax, 0x80(%rsp)
movl %r15d, %r13d
leaq 0x10a0(%rsp), %r15
xorl %r12d, %r12d
movl $0x0, 0x18(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0xe7d7
movq %rax, %r14
movl 0x18(%rsp), %esi
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x2bb35
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x50(%rsp), %rdi
movss 0x44(%rsp), %xmm0
movss 0x40(%rsp), %xmm1
movl 0x3c(%rsp), %esi
movl 0x38(%rsp), %edx
movss 0x34(%rsp), %xmm2
movss 0x30(%rsp), %xmm3
movss 0x2c(%rsp), %xmm4
callq 0x18c21
cmpl $0x0, 0x9110(%rsp)
je 0x2c1f7
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1786a
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x88(%rsp), %rdi
movl 0x9118(%rsp), %esi
movl 0x9120(%rsp), %edx
callq 0x170fa
xorps %xmm0, %xmm0
cvtsi2ssl 0x1c(%rsp), %xmm0
movq %r12, %rax
imulq 0x80(%rsp), %rax
movq 0x20(%rsp), %rcx
movss %xmm0, (%rcx,%rax,4)
testl %ebx, %ebx
jle 0x2c26f
movl %ebp, %eax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq 0x98(%rsp), %rcx
xorl %edx, %edx
movss (%rcx,%rdx,4), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rbx
jne 0x2c25d
incq %r12
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x88(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq %r14, %rdi
callq 0x3040
movq 0x48(%rsp), %rdi
leaq 0x2c7bc(%rip), %rsi     # 0x58a78
leaq 0x1c(%rsp), %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x30a0
cmpl $0x2, %eax
jne 0x2c2dd
addl 0x28(%rsp), %ebp
cmpq %r13, %r12
jb 0x2c159
cmpq %r13, %r12
movq 0x48(%rsp), %rbx
movl 0x9120(%rsp), %r13d
jb 0x2c2f6
jmp 0x2c315
testl %r15d, %r15d
jle 0x2c315
imull 0x9118(%rsp), %r13d
incl %r13d
imull %r12d, %r13d
movslq %r13d, %rax
movq 0x20(%rsp), %rcx
movl $0xbf800000, (%rcx,%rax,4) # imm = 0xBF800000
movq %rbx, %rdi
callq 0x3130
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
addq $0x90b8, %rsp           # imm = 0x90B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq