// File: /workspace/github_c_makefile_star2_O2/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 0x32708(%rip), %rsi     # 0x4f99f
leaq 0x32708(%rip), %r13     # 0x4f9a6
leaq 0x20(%rsp), %r12
movq %r13, %rdx
movq %r12, %rcx
callq 0x42ea
leaq 0x326f8(%rip), %rsi     # 0x4f9ad
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x42ea
leaq 0x31482(%rip), %rsi     # 0x4e74c
leaq 0x344f8(%rip), %r13     # 0x517c9
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x42ea
leaq 0x313b8(%rip), %rsi     # 0x4e69e
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x42ea
leaq 0x326bd(%rip), %rsi     # 0x4f9b8
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x42ea
leaq 0x326ad(%rip), %rsi     # 0x4f9bd
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x42ea
leaq 0x1c(%rsp), %r13
andl $0x0, (%r13)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1cd0d
movq %rax, %r12
movl (%r13), %r13d
movq %rax, %rdi
movl %r13d, %esi
callq 0x1ce7c
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 0x1cf1d
cvtsi2ss %ebx, %xmm0
leal 0x5(%r14), %eax
xorl %ecx, %ecx
testl %r13d, %r13d
cmovlel %ecx, %r13d
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
imulq $0x24, %r13, %rdx
movsd 0x325b5(%rip), %xmm1    # 0x4f940
xorps %xmm2, %xmm2
cmpq %rcx, %rdx
je 0x1d42b
movsd 0xc(%r12,%rcx), %xmm3
cvtss2sd %xmm3, %xmm4
ucomisd %xmm4, %xmm1
ja 0x1d422
movaps %xmm3, %xmm4
shufps $0x55, %xmm3, %xmm4     # xmm4 = xmm4[1,1],xmm3[1,1]
cvtss2sd %xmm4, %xmm4
ucomisd %xmm4, %xmm1
ja 0x1d422
movsd 0x4(%r12,%rcx), %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 0x1d422
jp 0x1d422
movl (%r12,%rcx), %edi
leal 0x1(%r8), %esi
movl $0x3f800000, (%r15,%r8,4) # imm = 0x3F800000
cmpl %r14d, %edi
jge 0x1d40e
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, %rcx
jmp 0x1d38e
movq %r12, %rdi
callq 0x3040
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq