// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: fill_truth_region
void fill_truth_region(char *path, float *truth, int classes, int num_boxes, int flip, float dx, float dy, float sx, float sy)
{
    char labelpath[4096];
    find_replace(path, "images", "labels", labelpath);
    find_replace(labelpath, "JPEGImages", "labels", labelpath);

    find_replace(labelpath, ".jpg", ".txt", labelpath);
    find_replace(labelpath, ".png", ".txt", labelpath);
    find_replace(labelpath, ".JPG", ".txt", labelpath);
    find_replace(labelpath, ".JPEG", ".txt", labelpath);
    int count = 0;
    box_label *boxes = read_boxes(labelpath, &count);
    randomize_boxes(boxes, count);
    correct_boxes(boxes, count, dx, dy, sx, sy, flip);
    float x,y,w,h;
    int id;
    int i;

    for (i = 0; i < count; ++i) {
        x =  boxes[i].x;
        y =  boxes[i].y;
        w =  boxes[i].w;
        h =  boxes[i].h;
        id = boxes[i].id;

        if (w < .005 || h < .005) continue;

        int col = (int)(x*num_boxes);
        int row = (int)(y*num_boxes);

        x = x*num_boxes - col;
        y = y*num_boxes - row;

        int index = (col+row*num_boxes)*(5+classes);
        if (truth[index]) continue;
        truth[index++] = 1;

        if (id < classes) truth[index+id] = 1;
        index += classes;

        truth[index++] = x;
        truth[index++] = y;
        truth[index++] = w;
        truth[index++] = h;
    }
    free(boxes);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movss %xmm3, 0x18(%rsp)
movss %xmm2, 0x14(%rsp)
movss %xmm1, 0x10(%rsp)
movss %xmm0, 0xc(%rsp)
movl %r8d, %ebp
movl %ecx, %ebx
movl %edx, %r14d
movq %rsi, %r15
leaq 0x2d0d9(%rip), %rsi     # 0x58a4f
leaq 0x2d0d9(%rip), %r13     # 0x58a56
leaq 0x20(%rsp), %r12
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2d0c9(%rip), %rsi     # 0x58a5d
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2be83(%rip), %rsi     # 0x5782c
leaq 0x2ef61(%rip), %r13     # 0x5a911
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2bdb9(%rip), %rsi     # 0x5777e
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2d08e(%rip), %rsi     # 0x58a68
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x2d07e(%rip), %rsi     # 0x58a6d
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xf02d
leaq 0x1c(%rsp), %r13
movl $0x0, (%r13)
movq %r12, %rdi
movq %r13, %rsi
callq 0x2b377
movq %rax, %r12
movslq (%r13), %r13
movq %rax, %rdi
movl %r13d, %esi
callq 0x2b52a
movq %r12, %rdi
movl %r13d, %esi
movss 0xc(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
movss 0x14(%rsp), %xmm2
movss 0x18(%rsp), %xmm3
movl %ebp, %edx
callq 0x2b5cd
testq %r13, %r13
jle 0x2bb1b
xorps %xmm0, %xmm0
cvtsi2ss %ebx, %xmm0
leal 0x5(%r14), %eax
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
shlq $0x2, %r13
leaq (,%r13,8), %rcx
addq %r13, %rcx
xorl %edx, %edx
movsd 0x2cf73(%rip), %xmm1    # 0x589f0
xorps %xmm2, %xmm2
movsd 0xc(%r12,%rdx), %xmm3
xorps %xmm4, %xmm4
cvtss2sd %xmm3, %xmm4
ucomisd %xmm4, %xmm1
ja 0x2bb0e
movaps %xmm3, %xmm4
shufps $0x55, %xmm3, %xmm4     # xmm4 = xmm4[1,1],xmm3[1,1]
cvtss2sd %xmm4, %xmm4
ucomisd %xmm4, %xmm1
ja 0x2bb0e
movsd 0x4(%r12,%rdx), %xmm4
mulps %xmm0, %xmm4
cvttps2dq %xmm4, %xmm5
pshufd $0x55, %xmm5, %xmm6     # xmm6 = xmm5[1,1,1,1]
movd %xmm6, %esi
imull %ebx, %esi
movd %xmm5, %edi
addl %esi, %edi
imull %eax, %edi
movslq %edi, %r8
movss (%r15,%r8,4), %xmm6
ucomiss %xmm2, %xmm6
jne 0x2bb0e
jp 0x2bb0e
movl (%r12,%rdx), %edi
leal 0x1(%r8), %esi
movl $0x3f800000, (%r15,%r8,4) # imm = 0x3F800000
cmpl %r14d, %edi
jge 0x2bafa
addl %esi, %edi
movslq %edi, %rdi
movl $0x3f800000, (%r15,%rdi,4) # imm = 0x3F800000
cvtdq2ps %xmm5, %xmm5
subps %xmm5, %xmm4
addl %r14d, %esi
movslq %esi, %rsi
movlhps %xmm3, %xmm4            # xmm4 = xmm4[0],xmm3[0]
movups %xmm4, (%r15,%rsi,4)
addq $0x24, %rdx
cmpq %rdx, %rcx
jne 0x2ba80
movq %r12, %rdi
callq 0x3040
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq