// File: /workspace/github_c_makefile_star2_O2/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 $0x90c8, %rsp           # imm = 0x90C8
movl %r9d, %ebx
movl %r8d, %r12d
movq %rdx, %r14
movl %esi, 0x20(%rsp)
leaq 0x9100(%rsp), %rbp
leaq 0x3231f(%rip), %rsi     # 0x4f99f
leaq 0x3233c(%rip), %r13     # 0x4f9c3
leaq 0xb0(%rsp), %r15
movq %r13, %rdx
movq %r15, %rcx
callq 0x42ea
leaq 0x3230c(%rip), %rsi     # 0x4f9ad
movq %r15, %rdi
movq %r13, %rdx
movq %r15, %rcx
callq 0x42ea
leaq 0x31096(%rip), %rsi     # 0x4e74c
leaq 0x3410c(%rip), %r13     # 0x517c9
movq %r15, %rdi
movq %r13, %rdx
movq %r15, %rcx
callq 0x42ea
leaq 0x322e6(%rip), %rsi     # 0x4f9b8
movq %r15, %rdi
movq %r13, %rdx
movq %r15, %rcx
callq 0x42ea
leaq 0x322d6(%rip), %rsi     # 0x4f9bd
movq %r15, %rdi
movq %r13, %rdx
movq %r15, %rcx
callq 0x42ea
leaq 0x345ed(%rip), %rsi     # 0x51ce9
movq %r15, %rdi
callq 0x3390
movq %rax, 0x50(%rsp)
testq %rax, %rax
jne 0x1d71b
leaq 0xb0(%rsp), %rdi
callq 0x3d0f
leaq 0x70(%rsp), %rdi
pushq $0x1
popq %rcx
movl %r12d, %esi
movl %ebx, %edx
callq 0xb45a
movss 0xc(%rbp), %xmm0
movss %xmm0, 0x48(%rsp)
movss 0x8(%rbp), %xmm0
movss %xmm0, 0x44(%rsp)
movl (%rbp), %eax
movl %eax, 0x40(%rsp)
movl 0x4(%rbp), %eax
movl %eax, 0x3c(%rsp)
movss 0x10(%rbp), %xmm0
movss %xmm0, 0x38(%rsp)
movss 0x14(%rbp), %xmm0
movss %xmm0, 0x34(%rsp)
movl 0x9130(%rsp), %eax
movl %eax, %ebx
imull 0x9128(%rsp), %ebx
leal 0x1(%rbx), %ecx
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
movss 0x18(%rbp), %xmm0
movss %xmm0, 0x30(%rsp)
movslq 0x20(%rsp), %r15
movl %ecx, 0x2c(%rsp)
movslq %ecx, %rax
movq %r14, 0x20(%rsp)
leaq 0x4(%r14), %r13
movq %rax, 0x90(%rsp)
leaq (,%rax,4), %rax
movq %rax, 0x88(%rsp)
leaq 0x10b0(%rsp), %rbp
xorl %r12d, %r12d
movq 0x50(%rsp), %rdi
leaq 0x321f7(%rip), %rsi     # 0x4f9c8
leaq 0x4c(%rsp), %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x30a0
cmpl $0x2, %eax
jne 0x1d94b
cmpq %r15, %r12
jge 0x1d94b
andl $0x0, 0x1c(%rsp)
movq %rbp, %rdi
leaq 0x1c(%rsp), %rsi
xorl %edx, %edx
callq 0x3bfb
movq %rax, %r14
movl 0x1c(%rsp), %esi
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x1d445
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x58(%rsp), %rdi
movss 0x48(%rsp), %xmm0
movss 0x44(%rsp), %xmm1
movl 0x40(%rsp), %esi
movl 0x3c(%rsp), %edx
movss 0x38(%rsp), %xmm2
movss 0x34(%rsp), %xmm3
movss 0x30(%rsp), %xmm4
callq 0xdccf
cmpl $0x0, 0x9120(%rsp)
je 0x1d893
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xcb93
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x98(%rsp), %rdi
movl 0x9128(%rsp), %esi
movl 0x9130(%rsp), %edx
callq 0xc3ee
cvtsi2ssl 0x4c(%rsp), %xmm0
movq %r12, %rax
imulq 0x90(%rsp), %rax
movq 0x20(%rsp), %rcx
movss %xmm0, (%rcx,%rax,4)
movq 0xa8(%rsp), %rax
xorl %ecx, %ecx
cmpq %rcx, %rbx
je 0x1d8fd
movss (%rax,%rcx,4), %xmm0
movss %xmm0, (%r13,%rcx,4)
incq %rcx
jmp 0x1d8e7
incq %r12
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x98(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq %r14, %rdi
callq 0x3040
addq 0x88(%rsp), %r13
jmp 0x1d7c5
cmpq %r15, %r12
jge 0x1d966
movl 0x2c(%rsp), %eax
imull %r12d, %eax
cltq
movq 0x20(%rsp), %rcx
movl $0xbf800000, (%rcx,%rax,4) # imm = 0xBF800000
movq 0x50(%rsp), %rdi
callq 0x3130
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
addq $0x90c8, %rsp           # imm = 0x90C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq