// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/box.c
// Function: do_nms_sort
void do_nms_sort(detection *dets, int total, int classes, float thresh)
{
    int i, j, k;
    k = total-1;
    for(i = 0; i <= k; ++i){
        if(dets[i].objectness == 0){
            detection swap = dets[i];
            dets[i] = dets[k];
            dets[k] = swap;
            --k;
            --i;
        }
    }
    total = k+1;

    for(k = 0; k < classes; ++k){
        for(i = 0; i < total; ++i){
            dets[i].sort_class = k;
        }
        qsort(dets, total, sizeof(detection), nms_comparator);
        for(i = 0; i < total; ++i){
            if(dets[i].prob[k] == 0) continue;
            box a = dets[i].bbox;
            for(j = i+1; j < total; ++j){
                box b = dets[j].bbox;
                if (box_iou(a, b) > thresh){
                    dets[j].prob[k] = 0;
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movss %xmm0, -0x14(%rbp)
movl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x44e15
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movss 0x28(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x44e05
jp 0x44e05
movq -0x8(%rbp), %rsi
movslq -0x18(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
leaq -0x50(%rbp), %rdi
movl $0x30, %edx
callq 0x3280
movq -0x8(%rbp), %rdi
movslq -0x18(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movq -0x8(%rbp), %rsi
movslq -0x20(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
movl $0x30, %edx
callq 0x3280
movq -0x8(%rbp), %rdi
movslq -0x20(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
leaq -0x50(%rbp), %rsi
movl $0x30, %edx
callq 0x3280
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x44e07
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x44d67
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x44f69
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x44e60
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x2c(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x44e38
movq -0x8(%rbp), %rdi
movslq -0xc(%rbp), %rsi
movl $0x30, %edx
leaq -0x4d4(%rip), %rcx      # 0x449a0
callq 0x3090
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x44f59
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movslq -0x20(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x44eb7
jp 0x44eb7
jmp 0x44f4b
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x60(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x44f49
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movups (%rax,%rcx), %xmm0
movaps %xmm0, -0x70(%rbp)
movsd -0x60(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x70(%rbp), %xmm2
movsd -0x68(%rbp), %xmm3
callq 0x44cd0
ucomiss -0x14(%rbp), %xmm0
jbe 0x44f3c
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movslq -0x20(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
jmp 0x44f3e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x44ede
jmp 0x44f4b
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x44e80
jmp 0x44f5b
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x44e25
addq $0x70, %rsp
popq %rbp
retq
nop