// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/region_layer.c
// Function: get_region_detections
void get_region_detections(layer l, int w, int h, int netw, int neth, float thresh, int *map, float tree_thresh, int relative, detection *dets)
{
    int i,j,n,z;
    float *predictions = l.output;
    if (l.batch == 2) {
        float *flip = l.output + l.outputs;
        for (j = 0; j < l.h; ++j) {
            for (i = 0; i < l.w/2; ++i) {
                for (n = 0; n < l.n; ++n) {
                    for(z = 0; z < l.classes + l.coords + 1; ++z){
                        int i1 = z*l.w*l.h*l.n + n*l.w*l.h + j*l.w + i;
                        int i2 = z*l.w*l.h*l.n + n*l.w*l.h + j*l.w + (l.w - i - 1);
                        float swap = flip[i1];
                        flip[i1] = flip[i2];
                        flip[i2] = swap;
                        if(z == 0){
                            flip[i1] = -flip[i1];
                            flip[i2] = -flip[i2];
                        }
                    }
                }
            }
        }
        for(i = 0; i < l.outputs; ++i){
            l.output[i] = (l.output[i] + flip[i])/2.;
        }
    }
    for (i = 0; i < l.w*l.h; ++i){
        int row = i / l.w;
        int col = i % l.w;
        for(n = 0; n < l.n; ++n){
            int index = n*l.w*l.h + i;
            for(j = 0; j < l.classes; ++j){
                dets[index].prob[j] = 0;
            }
            int obj_index  = entry_index(l, 0, n*l.w*l.h + i, l.coords);
            int box_index  = entry_index(l, 0, n*l.w*l.h + i, 0);
            int mask_index = entry_index(l, 0, n*l.w*l.h + i, 4);
            float scale = l.background ? 1 : predictions[obj_index];
            dets[index].bbox = get_region_box(predictions, l.biases, n, box_index, col, row, l.w, l.h, l.w*l.h);
            dets[index].objectness = scale > thresh ? scale : 0;
            if(dets[index].mask){
                for(j = 0; j < l.coords - 4; ++j){
                    dets[index].mask[j] = l.output[mask_index + j*l.w*l.h];
                }
            }

            int class_index = entry_index(l, 0, n*l.w*l.h + i, l.coords + !l.background);
            if(l.softmax_tree){

                hierarchy_predictions(predictions + class_index, l.classes, l.softmax_tree, 0, l.w*l.h);
                if(map){
                    for(j = 0; j < 200; ++j){
                        int class_index = entry_index(l, 0, n*l.w*l.h + i, l.coords + 1 + map[j]);
                        float prob = scale*predictions[class_index];
                        dets[index].prob[j] = (prob > thresh) ? prob : 0;
                    }
                } else {
                    int j =  hierarchy_top_prediction(predictions + class_index, l.softmax_tree, tree_thresh, l.w*l.h);
                    dets[index].prob[j] = (scale > thresh) ? scale : 0;
                }
            } else {
                if(dets[index].objectness){
                    for(j = 0; j < l.classes; ++j){
                        int class_index = entry_index(l, 0, n*l.w*l.h + i, l.coords + 1 + j);
                        float prob = scale*predictions[class_index];
                        dets[index].prob[j] = (prob > thresh) ? prob : 0;
                    }
                }
            }
        }
    }
    correct_region_boxes(dets, l.w*l.h*l.n, w, h, netw, neth, relative);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x588, %rsp            # imm = 0x588
movq 0x4b0(%rbp), %rax
leaq 0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movss %xmm0, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movss %xmm1, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
movq 0x268(%rax), %rcx
movq %rcx, -0x48(%rbp)
cmpl $0x2, 0x48(%rax)
jne 0x4e027
movq -0xa8(%rbp), %rcx
movq 0x268(%rcx), %rax
movslq 0x58(%rcx), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x38(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0x6c(%rcx), %eax
jge 0x4dfbc
movl $0x0, -0x34(%rbp)
movq -0xa8(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, -0xac(%rbp)
movl 0x70(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xac(%rbp), %eax
cmpl %ecx, %eax
jge 0x4dfac
movl $0x0, -0x3c(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x3c(%rbp), %eax
cmpl 0x84(%rcx), %eax
jge 0x4df9c
movl $0x0, -0x40(%rbp)
movq -0xa8(%rbp), %rdx
movl -0x40(%rbp), %eax
movl 0xfc(%rdx), %ecx
addl 0x100(%rdx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x4df8c
movq -0xa8(%rbp), %rcx
movl -0x40(%rbp), %eax
imull 0x70(%rcx), %eax
imull 0x6c(%rcx), %eax
imull 0x84(%rcx), %eax
movl -0x3c(%rbp), %edx
imull 0x70(%rcx), %edx
imull 0x6c(%rcx), %edx
addl %edx, %eax
movl -0x38(%rbp), %edx
imull 0x70(%rcx), %edx
addl %edx, %eax
addl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x40(%rbp), %eax
imull 0x70(%rcx), %eax
imull 0x6c(%rcx), %eax
imull 0x84(%rcx), %eax
movl -0x3c(%rbp), %edx
imull 0x70(%rcx), %edx
imull 0x6c(%rcx), %edx
addl %edx, %eax
movl -0x38(%rbp), %edx
imull 0x70(%rcx), %edx
addl %edx, %eax
movl 0x70(%rcx), %ecx
subl -0x34(%rbp), %ecx
subl $0x1, %ecx
addl %ecx, %eax
movl %eax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movslq -0x54(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x5c(%rbp)
movq -0x50(%rbp), %rax
movslq -0x58(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x50(%rbp), %rax
movslq -0x54(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movss -0x5c(%rbp), %xmm0
movq -0x50(%rbp), %rax
movslq -0x58(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
cmpl $0x0, -0x40(%rbp)
jne 0x4df7c
movq -0x50(%rbp), %rax
movslq -0x54(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x50(%rbp), %rax
movslq -0x54(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x50(%rbp), %rax
movslq -0x58(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x50(%rbp), %rax
movslq -0x58(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
jmp 0x4df7e
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x4de5e
jmp 0x4df8e
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x4de41
jmp 0x4df9e
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4de0f
jmp 0x4dfae
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4ddf5
movl $0x0, -0x34(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl 0x58(%rcx), %eax
jge 0x4e025
movq -0xa8(%rbp), %rax
movq 0x268(%rax), %rcx
movslq -0x34(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm0
movq -0x50(%rbp), %rcx
movslq -0x34(%rbp), %rdx
addss (%rcx,%rdx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x23056(%rip), %xmm1    # 0x71058
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x268(%rax), %rax
movslq -0x34(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4dfc3
jmp 0x4e027
movl $0x0, -0x34(%rbp)
movq -0xa8(%rbp), %rdx
movl -0x34(%rbp), %eax
movl 0x70(%rdx), %ecx
imull 0x6c(%rdx), %ecx
cmpl %ecx, %eax
jge 0x4e678
movq -0xa8(%rbp), %rcx
movl -0x34(%rbp), %eax
cltd
idivl 0x70(%rcx)
movl %eax, -0x60(%rbp)
movl -0x34(%rbp), %eax
cltd
idivl 0x70(%rcx)
movl %edx, -0x64(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x3c(%rbp), %eax
cmpl 0x84(%rcx), %eax
jge 0x4e668
movq -0xa8(%rbp), %rcx
movl -0x3c(%rbp), %eax
imull 0x70(%rcx), %eax
imull 0x6c(%rcx), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x68(%rbp)
movl $0x0, -0x38(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0xfc(%rcx), %eax
jge 0x4e0dd
movq 0x4b0(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movslq -0x38(%rbp), %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4e09e
movq -0xa8(%rbp), %rsi
movl -0x3c(%rbp), %eax
imull 0x70(%rsi), %eax
imull 0x6c(%rsi), %eax
addl -0x34(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl 0x100(%rsi), %edx
xorl %eax, %eax
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movl -0xb8(%rbp), %esi
xorl %edi, %edi
callq 0x4db20
movq -0xa8(%rbp), %rsi
movl %eax, -0x6c(%rbp)
movl -0x3c(%rbp), %eax
imull 0x70(%rsi), %eax
imull 0x6c(%rsi), %eax
addl -0x34(%rbp), %eax
movl %eax, -0xb4(%rbp)
xorl %eax, %eax
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movl -0xb4(%rbp), %esi
xorl %edx, %edx
movl %edx, %edi
callq 0x4db20
movq -0xa8(%rbp), %rsi
movl %eax, -0x70(%rbp)
movl -0x3c(%rbp), %eax
imull 0x70(%rsi), %eax
imull 0x6c(%rsi), %eax
addl -0x34(%rbp), %eax
movl %eax, -0xb0(%rbp)
xorl %eax, %eax
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movl -0xb0(%rbp), %esi
xorl %edi, %edi
movl $0x4, %edx
callq 0x4db20
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movl %ecx, -0x74(%rbp)
cmpl $0x0, 0x104(%rax)
je 0x4e1b6
movss 0x22e60(%rip), %xmm0    # 0x7100c
movss %xmm0, -0xbc(%rbp)
jmp 0x4e1cb
movq -0x48(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0xbc(%rbp)
movq -0xa8(%rbp), %rax
movss -0xbc(%rbp), %xmm0
movss %xmm0, -0x78(%rbp)
movq 0x4b0(%rbp), %rcx
movslq -0x68(%rbp), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq %rcx, -0xc8(%rbp)
movq -0x48(%rbp), %rdi
movq 0x230(%rax), %rsi
movl -0x3c(%rbp), %edx
movl -0x70(%rbp), %ecx
movl -0x64(%rbp), %r8d
movl -0x60(%rbp), %r9d
movl 0x6c(%rax), %r11d
movl 0x70(%rax), %r10d
movl %r10d, %ebx
imull %r11d, %ebx
movq %rsp, %rax
movl %ebx, 0x10(%rax)
movl %r11d, 0x8(%rax)
movl %r10d, (%rax)
callq 0x4d440
movq -0xc8(%rbp), %rax
movlpd %xmm0, -0x88(%rbp)
movlpd %xmm1, -0x80(%rbp)
movq -0x88(%rbp), %rcx
movq %rcx, (%rax)
movq -0x80(%rbp), %rcx
movq %rcx, 0x8(%rax)
movss -0x78(%rbp), %xmm0
ucomiss -0x1c(%rbp), %xmm0
jbe 0x4e276
movss -0x78(%rbp), %xmm0
movss %xmm0, -0xcc(%rbp)
jmp 0x4e283
xorps %xmm0, %xmm0
movss %xmm0, -0xcc(%rbp)
jmp 0x4e283
movss -0xcc(%rbp), %xmm0
movq 0x4b0(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movss %xmm0, 0x28(%rax)
movq 0x4b0(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x20(%rax)
je 0x4e32b
movl $0x0, -0x38(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x38(%rbp), %eax
movl 0x100(%rcx), %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
jge 0x4e329
movq -0xa8(%rbp), %rsi
movq 0x268(%rsi), %rax
movl -0x74(%rbp), %ecx
movl -0x38(%rbp), %edx
imull 0x70(%rsi), %edx
imull 0x6c(%rsi), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x4b0(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movslq -0x38(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4e2c2
jmp 0x4e32b
movq -0xa8(%rbp), %rsi
movl -0x3c(%rbp), %eax
imull 0x70(%rsi), %eax
imull 0x6c(%rsi), %eax
addl -0x34(%rbp), %eax
movl %eax, -0xd0(%rbp)
movl 0x100(%rsi), %edx
cmpl $0x0, 0x104(%rsi)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addl %eax, %edx
xorl %eax, %eax
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movl -0xd0(%rbp), %esi
xorl %edi, %edi
callq 0x4db20
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movl %ecx, -0x8c(%rbp)
cmpq $0x0, 0x490(%rax)
je 0x4e54b
movq -0xa8(%rbp), %rax
movq -0x48(%rbp), %rdi
movslq -0x8c(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rdi
movl 0xfc(%rax), %esi
movq 0x490(%rax), %rdx
movl 0x70(%rax), %r8d
imull 0x6c(%rax), %r8d
xorl %ecx, %ecx
callq 0x4efb0
cmpq $0x0, -0x28(%rbp)
je 0x4e4be
movl $0x0, -0x38(%rbp)
cmpl $0xc8, -0x38(%rbp)
jge 0x4e4b9
movq -0xa8(%rbp), %rsi
movl -0x3c(%rbp), %eax
imull 0x70(%rsi), %eax
imull 0x6c(%rsi), %eax
addl -0x34(%rbp), %eax
movl %eax, -0xd4(%rbp)
movl 0x100(%rsi), %edx
addl $0x1, %edx
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
addl (%rax,%rcx,4), %edx
xorl %eax, %eax
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movl -0xd4(%rbp), %esi
xorl %edi, %edi
callq 0x4db20
movl %eax, -0x90(%rbp)
movss -0x78(%rbp), %xmm0
movq -0x48(%rbp), %rax
movslq -0x90(%rbp), %rcx
mulss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x94(%rbp)
movss -0x94(%rbp), %xmm0
ucomiss -0x1c(%rbp), %xmm0
jbe 0x4e477
movss -0x94(%rbp), %xmm0
movss %xmm0, -0xd8(%rbp)
jmp 0x4e484
xorps %xmm0, %xmm0
movss %xmm0, -0xd8(%rbp)
jmp 0x4e484
movss -0xd8(%rbp), %xmm0
movq 0x4b0(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movslq -0x38(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4e3de
jmp 0x4e546
movq -0xa8(%rbp), %rax
movq -0x48(%rbp), %rdi
movslq -0x8c(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rdi
movq 0x490(%rax), %rsi
movss -0x2c(%rbp), %xmm0
movl 0x70(%rax), %edx
imull 0x6c(%rax), %edx
callq 0x4f080
movl %eax, -0x98(%rbp)
movss -0x78(%rbp), %xmm0
ucomiss -0x1c(%rbp), %xmm0
jbe 0x4e50f
movss -0x78(%rbp), %xmm0
movss %xmm0, -0xdc(%rbp)
jmp 0x4e51c
xorps %xmm0, %xmm0
movss %xmm0, -0xdc(%rbp)
jmp 0x4e51c
movss -0xdc(%rbp), %xmm0
movq 0x4b0(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movslq -0x98(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
jmp 0x4e658
movq 0x4b0(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movss 0x28(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4e571
jp 0x4e571
jmp 0x4e656
movl $0x0, -0x38(%rbp)
movq -0xa8(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0xfc(%rcx), %eax
jge 0x4e654
movq -0xa8(%rbp), %rsi
movl -0x3c(%rbp), %eax
imull 0x70(%rsi), %eax
imull 0x6c(%rsi), %eax
addl -0x34(%rbp), %eax
movl %eax, -0xe0(%rbp)
movl 0x100(%rsi), %edx
addl $0x1, %edx
addl -0x38(%rbp), %edx
xorl %eax, %eax
movq %rsp, %rdi
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movl -0xe0(%rbp), %esi
xorl %edi, %edi
callq 0x4db20
movl %eax, -0x9c(%rbp)
movss -0x78(%rbp), %xmm0
movq -0x48(%rbp), %rax
movslq -0x9c(%rbp), %rcx
mulss (%rax,%rcx,4), %xmm0
movss %xmm0, -0xa0(%rbp)
movss -0xa0(%rbp), %xmm0
ucomiss -0x1c(%rbp), %xmm0
jbe 0x4e612
movss -0xa0(%rbp), %xmm0
movss %xmm0, -0xe4(%rbp)
jmp 0x4e61f
xorps %xmm0, %xmm0
movss %xmm0, -0xe4(%rbp)
jmp 0x4e61f
movss -0xe4(%rbp), %xmm0
movq 0x4b0(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movslq -0x38(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4e578
jmp 0x4e656
jmp 0x4e658
jmp 0x4e65a
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x4e069
jmp 0x4e66a
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4e02e
movq -0xa8(%rbp), %rax
movq 0x4b0(%rbp), %rdi
movl 0x70(%rax), %esi
imull 0x6c(%rax), %esi
imull 0x84(%rax), %esi
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
movl -0x14(%rbp), %r8d
movl -0x18(%rbp), %r9d
movl -0x30(%rbp), %eax
movl %eax, (%rsp)
callq 0x4dba0
addq $0x588, %rsp            # imm = 0x588
popq %rbx
popq %rbp
retq
nopw (%rax,%rax)