// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/region_layer.c
// Function: correct_region_boxes
void correct_region_boxes(detection *dets, int n, int w, int h, int netw, int neth, int relative)
{
    int i;
    int new_w=0;
    int new_h=0;
    if (((float)netw/w) < ((float)neth/h)) {
        new_w = netw;
        new_h = (h * netw)/w;
    } else {
        new_h = neth;
        new_w = (w * neth)/h;
    }
    for (i = 0; i < n; ++i){
        box b = dets[i].bbox;
        b.x =  (b.x - (netw - new_w)/2./netw) / ((float)new_w/netw); 
        b.y =  (b.y - (neth - new_h)/2./neth) / ((float)new_h/neth); 
        b.w *= (float)netw/new_w;
        b.h *= (float)neth/new_h;
        if(!relative){
            b.x *= w;
            b.w *= w;
            b.y *= h;
            b.h *= h;
        }
        dets[i].bbox = b;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
cvtsi2ssl -0x18(%rbp), %xmm1
cvtsi2ssl -0x10(%rbp), %xmm0
divss %xmm0, %xmm1
cvtsi2ssl -0x1c(%rbp), %xmm0
cvtsi2ssl -0x14(%rbp), %xmm2
divss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x4dc01
movl -0x18(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x14(%rbp), %eax
imull -0x18(%rbp), %eax
cltd
idivl -0x10(%rbp)
movl %eax, -0x28(%rbp)
jmp 0x4dc15
movl -0x1c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x10(%rbp), %eax
imull -0x1c(%rbp), %eax
cltd
idivl -0x14(%rbp)
movl %eax, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x4dd7a
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movss -0x38(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movl -0x18(%rbp), %eax
subl -0x24(%rbp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x233f7(%rip), %xmm2    # 0x71058
divsd %xmm2, %xmm1
cvtsi2sdl -0x18(%rbp), %xmm2
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
cvtsi2ssl -0x24(%rbp), %xmm1
cvtsi2ssl -0x18(%rbp), %xmm2
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x34(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movl -0x1c(%rbp), %eax
subl -0x28(%rbp), %eax
cvtsi2sd %eax, %xmm1
movsd 0x233ac(%rip), %xmm2    # 0x71058
divsd %xmm2, %xmm1
cvtsi2sdl -0x1c(%rbp), %xmm2
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
cvtsi2ssl -0x28(%rbp), %xmm1
cvtsi2ssl -0x1c(%rbp), %xmm2
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
cvtsi2ssl -0x18(%rbp), %xmm0
cvtsi2ssl -0x24(%rbp), %xmm1
divss %xmm1, %xmm0
mulss -0x30(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
cvtsi2ssl -0x1c(%rbp), %xmm0
cvtsi2ssl -0x28(%rbp), %xmm1
divss %xmm1, %xmm0
mulss -0x2c(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
cmpl $0x0, 0x10(%rbp)
jne 0x4dd4e
cvtsi2ssl -0x10(%rbp), %xmm0
mulss -0x38(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
cvtsi2ssl -0x10(%rbp), %xmm0
mulss -0x30(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
cvtsi2ssl -0x14(%rbp), %xmm0
mulss -0x34(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
cvtsi2ssl -0x14(%rbp), %xmm0
mulss -0x2c(%rbp), %xmm0
movss %xmm0, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x4dc1c
popq %rbp
retq
nopl (%rax)