// File: /workspace/github_c_makefile_star2_O3/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
movaps %xmm3, 0x10(%rsp)
movaps %xmm2, (%rsp)
testl %esi, %esi
jle 0x2b7ab
movl %edx, %ebx
movaps %xmm1, %xmm2
movq %rdi, %r14
movaps 0x29a98(%rip), %xmm3    # 0x55090
movl %esi, %eax
movaps (%rsp), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movaps %xmm1, (%rsp)
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
xorps %xmm3, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps 0x10(%rsp), %xmm1
shufps $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movaps %xmm1, 0x10(%rsp)
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
xorps %xmm3, %xmm2
movaps %xmm2, 0x30(%rsp)
shlq $0x2, %rax
leaq (%rax,%rax,8), %r15
xorl %r12d, %r12d
xorps %xmm1, %xmm1
movss 0x4(%r14,%r12), %xmm0
ucomiss %xmm1, %xmm0
jne 0x2b668
jp 0x2b668
movss 0x8(%r14,%r12), %xmm0
ucomiss %xmm1, %xmm0
jne 0x2b668
jp 0x2b668
movaps 0x2d363(%rip), %xmm0    # 0x589c0
movups %xmm0, 0x4(%r14,%r12)
jmp 0x2b79e
movsd 0x14(%r14,%r12), %xmm2
mulps (%rsp), %xmm2
addps 0x20(%rsp), %xmm2
movsd 0x1c(%r14,%r12), %xmm0
mulps 0x10(%rsp), %xmm0
addps 0x30(%rsp), %xmm0
movaps %xmm2, %xmm1
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movups %xmm1, 0x14(%r14,%r12)
testl %ebx, %ebx
je 0x2b6b7
movaps 0x29c50(%rip), %xmm0    # 0x552f0
subps %xmm2, %xmm0
movaps %xmm0, %xmm1
shufps $0xe1, %xmm0, %xmm1     # xmm1 = xmm1[1,0],xmm0[2,3]
movlps %xmm1, 0x14(%r14,%r12)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm0, %xmm2
xorps %xmm0, %xmm0
movss 0x29946(%rip), %xmm1    # 0x55008
callq 0xf814
movss %xmm0, 0x14(%r14,%r12)
movss 0x18(%r14,%r12), %xmm2
xorps %xmm0, %xmm0
movss 0x29928(%rip), %xmm1    # 0x55008
callq 0xf814
movss %xmm0, 0x18(%r14,%r12)
movss 0x1c(%r14,%r12), %xmm2
xorps %xmm0, %xmm0
movss 0x2990a(%rip), %xmm1    # 0x55008
callq 0xf814
movss %xmm0, 0x1c(%r14,%r12)
movss 0x20(%r14,%r12), %xmm2
xorps %xmm0, %xmm0
movss 0x298ec(%rip), %xmm1    # 0x55008
callq 0xf814
movss %xmm0, 0x20(%r14,%r12)
movss 0x14(%r14,%r12), %xmm1
movsd 0x18(%r14,%r12), %xmm3
movaps %xmm3, %xmm2
subss %xmm1, %xmm2
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
addps %xmm3, %xmm1
mulps 0x2d266(%rip), %xmm1    # 0x589b0
movlps %xmm1, 0x4(%r14,%r12)
movss %xmm2, 0xc(%r14,%r12)
shufps $0x55, %xmm3, %xmm3     # xmm3 = xmm3[1,1,1,1]
subss %xmm3, %xmm0
movss %xmm0, 0x10(%r14,%r12)
xorps %xmm0, %xmm0
movss 0x29897(%rip), %xmm1    # 0x55008
callq 0xf814
movss %xmm0, 0xc(%r14,%r12)
movss 0x10(%r14,%r12), %xmm2
xorps %xmm0, %xmm0
movss 0x29879(%rip), %xmm1    # 0x55008
callq 0xf814
movss %xmm0, 0x10(%r14,%r12)
xorps %xmm1, %xmm1
addq $0x24, %r12
cmpq %r12, %r15
jne 0x2b63a
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq