// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
leaq 0x60(%rsp), %r12
cmpl $0x0, 0xb0(%r12)
je 0x28ddb
callq 0x34f0
movl %eax, %ebx
andl $0x1, %ebx
jmp 0x28ddd
xorl %ebx, %ebx
leaq 0x500(%rsp), %r13
callq 0x34f0
movl 0x6c(%r12), %ecx
movl 0x78(%r12), %r15d
movl %ecx, 0x10(%rsp)
movl %ecx, %r14d
subl %r15d, %r14d
leal 0x1(%r14), %ecx
cltd
idivl %ecx
movl %edx, (%rsp)
callq 0x34f0
movl 0x70(%r12), %ecx
movl 0x7c(%r12), %esi
movl %ecx, 0x4(%rsp)
movl %ecx, %r8d
subl %esi, %r8d
leal 0x1(%r8), %ecx
cltd
idivl %ecx
xorl %eax, %eax
cmpl $0x0, 0x114(%r12)
sete %dil
je 0x28e3e
xorps %xmm0, %xmm0
jmp 0x28e46
movss 0x2a422(%rip), %xmm0    # 0x53268
cmpl $0x0, 0xf8(%r13)
jne 0x28e6b
movl %r14d, %ecx
shrl $0x1f, %ecx
addl %r14d, %ecx
sarl %ecx
movl %ecx, (%rsp)
movl %r8d, %edx
shrl $0x1f, %edx
addl %r8d, %edx
sarl %edx
xorl %ebx, %ebx
movl 0x48(%r12), %ecx
movl %ecx, 0x8(%rsp)
testl %ecx, %ecx
jle 0x28f5a
movb %dil, %al
leaq 0x2d926(%rip), %rcx     # 0x567ac
movss (%rcx,%rax,4), %xmm1
movl 0x74(%r12), %ecx
movq 0xd8(%r13), %r8
movq 0x268(%r12), %r9
movl %edx, %eax
movl %edx, %r10d
notl %eax
addl 0x4(%rsp), %eax
xorl %r11d, %r11d
xorl %edx, %edx
movl %ecx, 0x14(%rsp)
testl %ecx, %ecx
movl %edx, 0xc(%rsp)
jle 0x28f4a
movl %ecx, %edi
imull %edx, %edi
movq %rdi, 0x18(%rsp)
xorl %edx, %edx
testl %r15d, %r15d
movq %rdx, 0x20(%rsp)
jle 0x28f3b
movq 0x18(%rsp), %rcx
leal (%rcx,%rdx), %r14d
imull 0x10(%rsp), %r14d
addl (%rsp), %r14d
xorl %r12d, %r12d
testl %esi, %esi
jle 0x28f33
leal (%r14,%r12), %ebp
imull 0x4(%rsp), %ebp
movslq %r11d, %rdx
leaq (%r9,%rdx,4), %rdi
movl %eax, %edx
xorl %r13d, %r13d
leal (%r10,%r13), %ecx
testl %ebx, %ebx
cmovnel %edx, %ecx
addl %ebp, %ecx
movslq %ecx, %rcx
movss (%r8,%rcx,4), %xmm2
mulss %xmm1, %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rdi,%r13,4)
incq %r13
decl %edx
cmpl %r13d, %esi
jne 0x28f04
addl %r13d, %r11d
incl %r12d
cmpl %r15d, %r12d
jne 0x28eeb
movq 0x20(%rsp), %rdx
incl %edx
movl 0x14(%rsp), %ecx
cmpl %ecx, %edx
jne 0x28ecb
movl 0xc(%rsp), %edx
incl %edx
cmpl 0x8(%rsp), %edx
jne 0x28eb3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq