// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/data.c
// Function: correct_boxes
void correct_boxes(box_label *boxes, int n, float dx, float dy, float sx, float sy, int flip)
{
    int i;
    for(i = 0; i < n; ++i){
        if(boxes[i].x == 0 && boxes[i].y == 0) {
            boxes[i].x = 999999;
            boxes[i].y = 999999;
            boxes[i].w = 999999;
            boxes[i].h = 999999;
            continue;
        }
        boxes[i].left   = boxes[i].left  * sx - dx;
        boxes[i].right  = boxes[i].right * sx - dx;
        boxes[i].top    = boxes[i].top   * sy - dy;
        boxes[i].bottom = boxes[i].bottom* sy - dy;

        if(flip){
            float swap = boxes[i].left;
            boxes[i].left = 1. - boxes[i].right;
            boxes[i].right = 1. - swap;
        }

        boxes[i].left =  constrain(0, 1, boxes[i].left);
        boxes[i].right = constrain(0, 1, boxes[i].right);
        boxes[i].top =   constrain(0, 1, boxes[i].top);
        boxes[i].bottom =   constrain(0, 1, boxes[i].bottom);

        boxes[i].x = (boxes[i].left+boxes[i].right)/2;
        boxes[i].y = (boxes[i].top+boxes[i].bottom)/2;
        boxes[i].w = (boxes[i].right - boxes[i].left);
        boxes[i].h = (boxes[i].bottom - boxes[i].top);

        boxes[i].w = constrain(0, 1, boxes[i].w);
        boxes[i].h = constrain(0, 1, boxes[i].h);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebx
movq %rdi, %r14
movaps 0x2f21c(%rip), %xmm4    # 0x4c150
xorl %r15d, %r15d
testl %esi, %esi
cmovlel %r15d, %esi
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
movaps %xmm2, 0x20(%rsp)
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
xorps %xmm4, %xmm0
movaps %xmm0, (%rsp)
shufps $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0]
movaps %xmm3, 0x30(%rsp)
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
xorps %xmm4, %xmm1
movaps %xmm1, 0x10(%rsp)
imulq $0x24, %rsi, %r12
xorps %xmm1, %xmm1
cmpq %r15, %r12
je 0x1d0e3
movss 0x4(%r14,%r15), %xmm0
ucomiss %xmm1, %xmm0
jne 0x1cfa4
jp 0x1cfa4
movss 0x8(%r14,%r15), %xmm0
ucomiss %xmm1, %xmm0
jne 0x1cfa4
jp 0x1cfa4
movaps 0x32977(%rip), %xmm0    # 0x4f910
movups %xmm0, 0x4(%r14,%r15)
jmp 0x1d0da
movsd 0x14(%r14,%r15), %xmm2
mulps 0x20(%rsp), %xmm2
addps (%rsp), %xmm2
movsd 0x1c(%r14,%r15), %xmm0
mulps 0x30(%rsp), %xmm0
addps 0x10(%rsp), %xmm0
movaps %xmm2, %xmm1
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movups %xmm1, 0x14(%r14,%r15)
testl %ebx, %ebx
je 0x1cff3
movaps 0x2f2d4(%rip), %xmm0    # 0x4c2b0
subps %xmm2, %xmm0
movaps %xmm0, %xmm1
shufps $0xe1, %xmm0, %xmm1     # xmm1 = xmm1[1,0],xmm0[2,3]
movlps %xmm1, 0x14(%r14,%r15)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm0, %xmm2
xorps %xmm0, %xmm0
movss 0x2f00a(%rip), %xmm1    # 0x4c008
callq 0x4a48
movss %xmm0, 0x14(%r14,%r15)
movss 0x18(%r14,%r15), %xmm2
xorps %xmm0, %xmm0
movss 0x2efec(%rip), %xmm1    # 0x4c008
callq 0x4a48
movss %xmm0, 0x18(%r14,%r15)
movss 0x1c(%r14,%r15), %xmm2
xorps %xmm0, %xmm0
movss 0x2efce(%rip), %xmm1    # 0x4c008
callq 0x4a48
movss %xmm0, 0x1c(%r14,%r15)
movss 0x20(%r14,%r15), %xmm2
xorps %xmm0, %xmm0
movss 0x2efb0(%rip), %xmm1    # 0x4c008
callq 0x4a48
movss %xmm0, 0x20(%r14,%r15)
movss 0x14(%r14,%r15), %xmm1
movsd 0x18(%r14,%r15), %xmm3
movaps %xmm3, %xmm2
subss %xmm1, %xmm2
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
addps %xmm3, %xmm1
mulps 0x3287a(%rip), %xmm1    # 0x4f900
movlps %xmm1, 0x4(%r14,%r15)
movss %xmm2, 0xc(%r14,%r15)
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
subss %xmm3, %xmm0
movss %xmm0, 0x10(%r14,%r15)
xorps %xmm0, %xmm0
movss 0x2ef5b(%rip), %xmm1    # 0x4c008
callq 0x4a48
movss %xmm0, 0xc(%r14,%r15)
movss 0x10(%r14,%r15), %xmm2
xorps %xmm0, %xmm0
movss 0x2ef3d(%rip), %xmm1    # 0x4c008
callq 0x4a48
movss %xmm0, 0x10(%r14,%r15)
xorps %xmm1, %xmm1
addq $0x24, %r15
jmp 0x1cf6d
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq