// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/crop_layer.c
// Function: forward_crop_layer
void forward_crop_layer(const crop_layer l, network net)
{
    int i,j,c,b,row,col;
    int index;
    int count = 0;
    int flip = (l.flip && rand()%2);
    int dh = rand()%(l.h - l.out_h + 1);
    int dw = rand()%(l.w - l.out_w + 1);
    float scale = 2;
    float trans = -1;
    if(l.noadjust){
        scale = 1;
        trans = 0;
    }
    if(!net.train){
        flip = 0;
        dh = (l.h - l.out_h)/2;
        dw = (l.w - l.out_w)/2;
    }
    for(b = 0; b < l.batch; ++b){
        for(c = 0; c < l.c; ++c){
            for(i = 0; i < l.out_h; ++i){
                for(j = 0; j < l.out_w; ++j){
                    if(flip){
                        col = l.w - dw - j - 1;    
                    }else{
                        col = j + dw;
                    }
                    row = i + dh;
                    index = col+l.w*(row+l.h*(c + l.c*b)); 
                    l.output[count++] = net.input[index]*scale + trans;
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x70(%rsp), %r13
cmpl $0x0, 0xb0(%r13)
je 0x1bceb
callq 0x34e0
movl %eax, %ebx
andl $0x1, %ebx
jmp 0x1bced
xorl %ebx, %ebx
leaq 0x510(%rsp), %r15
callq 0x34e0
movl 0x6c(%r13), %ecx
movl 0x78(%r13), %edx
movl %ecx, 0x18(%rsp)
movl %ecx, %r14d
movl %edx, %ebp
subl %edx, %r14d
leal 0x1(%r14), %ecx
cltd
idivl %ecx
movl %edx, 0x8(%rsp)
callq 0x34e0
movl 0x70(%r13), %ecx
movl 0x7c(%r13), %edi
movl %ecx, 0xc(%rsp)
subl %edi, %ecx
leal 0x1(%rcx), %r8d
cltd
idivl %r8d
movl %edx, %eax
xorl %r8d, %r8d
cmpl $0x0, 0x114(%r13)
sete %r8b
je 0x1bd4c
xorps %xmm0, %xmm0
jmp 0x1bd54
movss 0x30510(%rip), %xmm0    # 0x4c264
leaq 0x33a71(%rip), %r9      # 0x4f7cc
cmpl $0x0, 0xf8(%r15)
jne 0x1bd7c
pushq $0x2
popq %r10
movl %r14d, %eax
cltd
idivl %r10d
movl %eax, 0x8(%rsp)
movl %ecx, %eax
cltd
idivl %r10d
xorl %ebx, %ebx
movss (%r9,%r8,4), %xmm1
movl 0x48(%r13), %ecx
movl 0x74(%r13), %edx
xorl %r8d, %r8d
testl %edi, %edi
cmovlel %r8d, %edi
movq 0xd8(%r15), %r9
movl %ebp, %esi
testl %ebp, %ebp
cmovlel %r8d, %esi
testl %edx, %edx
movl $0x0, %r10d
movl %edx, 0x10(%rsp)
cmovgl %edx, %r10d
movl %r10d, 0x1c(%rsp)
movq 0x268(%r13), %r11
testl %ecx, %ecx
cmovlel %r8d, %ecx
movl %ecx, 0x14(%rsp)
movl %eax, %r14d
notl %eax
addl 0xc(%rsp), %eax
xorl %r13d, %r13d
cmpl 0x14(%rsp), %r8d
je 0x1be80
movl 0x10(%rsp), %ecx
imull %r8d, %ecx
movq %rcx, 0x20(%rsp)
xorl %edx, %edx
movq %r8, 0x28(%rsp)
cmpl 0x1c(%rsp), %edx
je 0x1be78
movq 0x20(%rsp), %rcx
movq %rdx, 0x30(%rsp)
leal (%rcx,%rdx), %r8d
imull 0x18(%rsp), %r8d
addl 0x8(%rsp), %r8d
xorl %r15d, %r15d
cmpl %esi, %r15d
je 0x1be67
leal (%r8,%r15), %ebp
imull 0xc(%rsp), %ebp
movslq %r13d, %rcx
leaq (%r11,%rcx,4), %rcx
movl %eax, %edx
xorl %r10d, %r10d
cmpl %r10d, %edi
je 0x1be5f
leal (%r14,%r10), %r12d
testl %ebx, %ebx
cmovnel %edx, %r12d
addl %ebp, %r12d
movslq %r12d, %r12
movss (%r9,%r12,4), %xmm2
mulss %xmm1, %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rcx,%r10,4)
incq %r10
decl %edx
jmp 0x1be2f
addl %r10d, %r13d
incl %r15d
jmp 0x1be15
movq 0x30(%rsp), %rdx
incl %edx
movq 0x28(%rsp), %r8
jmp 0x1bdf3
incl %r8d
jmp 0x1bdd4
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq