// File: /workspace/github_c_makefile_star2_O1/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 0x2c7bd(%rip), %rsi     # 0x5694f
leaq 0x2c7bd(%rip), %r13     # 0x56956
leaq 0x20(%rsp), %r12
movq %r13, %rdx
movq %r12, %rcx
callq 0xe842
leaq 0x2c7ad(%rip), %rsi     # 0x5695d
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xe842
leaq 0x2b58f(%rip), %rsi     # 0x55754
leaq 0x2e5ed(%rip), %r13     # 0x587b9
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xe842
leaq 0x2b4c5(%rip), %rsi     # 0x556a6
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xe842
leaq 0x2c772(%rip), %rsi     # 0x56968
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xe842
leaq 0x2c762(%rip), %rsi     # 0x5696d
movq %r12, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0xe842
leaq 0x1c(%rsp), %r13
movl $0x0, (%r13)
movq %r12, %rdi
movq %r13, %rsi
callq 0x29b2e
movq %rax, %r12
movslq (%r13), %r13
movq %rax, %rdi
movl %r13d, %esi
callq 0x29ce7
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 0x29d8a
testq %r13, %r13
jle 0x2a364
xorps %xmm0, %xmm0
cvtsi2ss %ebx, %xmm0
leal 0x5(%r14), %eax
shlq $0x2, %r13
leaq (,%r13,8), %rcx
addq %r13, %rcx
xorl %edx, %edx
movsd 0x2c65b(%rip), %xmm1    # 0x568f0
xorps %xmm2, %xmm2
movss 0xc(%r12,%rdx), %xmm3
xorps %xmm4, %xmm4
cvtss2sd %xmm3, %xmm4
ucomisd %xmm4, %xmm1
ja 0x2a357
movss 0x10(%r12,%rdx), %xmm4
xorps %xmm5, %xmm5
cvtss2sd %xmm4, %xmm5
ucomisd %xmm5, %xmm1
ja 0x2a357
movss 0x4(%r12,%rdx), %xmm5
mulss %xmm0, %xmm5
cvttss2si %xmm5, %esi
movss 0x8(%r12,%rdx), %xmm6
mulss %xmm0, %xmm6
cvttss2si %xmm6, %edi
imull %ebx, %edi
addl %esi, %edi
imull %eax, %edi
movslq %edi, %r8
movss (%r15,%r8,4), %xmm7
ucomiss %xmm2, %xmm7
jne 0x2a357
jp 0x2a357
movl (%r12,%rdx), %edi
leal 0x1(%r8), %esi
movl $0x3f800000, (%r15,%r8,4) # imm = 0x3F800000
cmpl %r14d, %edi
jge 0x2a320
addl %esi, %edi
movslq %edi, %rdi
movl $0x3f800000, (%r15,%rdi,4) # imm = 0x3F800000
cvttps2dq %xmm5, %xmm7
cvtdq2ps %xmm7, %xmm7
subss %xmm7, %xmm5
cvttps2dq %xmm6, %xmm7
cvtdq2ps %xmm7, %xmm7
subss %xmm7, %xmm6
addl %r14d, %esi
movslq %esi, %rsi
movss %xmm5, (%r15,%rsi,4)
movss %xmm6, 0x4(%r15,%rsi,4)
movss %xmm3, 0x8(%r15,%rsi,4)
movss %xmm4, 0xc(%r15,%rsi,4)
addq $0x24, %rdx
cmpq %rdx, %rcx
jne 0x2a298
movq %r12, %rdi
callq 0x3040
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq