// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/local_layer.c
// Function: forward_local_layer
void forward_local_layer(const local_layer l, network net)
{
    int out_h = local_out_height(l);
    int out_w = local_out_width(l);
    int i, j;
    int locations = out_h * out_w;

    for(i = 0; i < l.batch; ++i){
        copy_cpu(l.outputs, l.biases, 1, l.output + i*l.outputs, 1);
    }

    for(i = 0; i < l.batch; ++i){
        float *input = net.input + i*l.w*l.h*l.c;
        im2col_cpu(input, l.c, l.h, l.w, 
                l.size, l.stride, l.pad, net.workspace);
        float *output = l.output + i*l.outputs;
        for(j = 0; j < locations; ++j){
            float *a = l.weights + j*l.size*l.size*l.c*l.n;
            float *b = net.workspace + j;
            float *c = output + j;

            int m = l.n;
            int n = 1;
            int k = l.size*l.size*l.c;

            gemm(0,0,m,n,k,1,a,k,b,locations,1,c,locations);
        }
    }
    activate_array(l.output, l.outputs*l.batch, l.activation);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
leaq 0xc0(%rsp), %rsi
movl 0x48(%rsi), %edi
movl 0x6c(%rsi), %edx
movl 0xa8(%rsi), %ecx
movl 0x90(%rsi), %eax
movl %eax, 0xc(%rsp)
negl %eax
xorl %r12d, %r12d
movq %rcx, 0x60(%rsp)
negl %ecx
movl $0x0, %ecx
sbbl %ecx, %ecx
orl %eax, %ecx
movq %rdx, 0x38(%rsp)
leal (%rcx,%rdx), %eax
movl 0x98(%rsi), %r8d
cltd
idivl %r8d
movl %eax, %ebx
movl 0x70(%rsi), %eax
movl %eax, 0x8(%rsp)
addl %eax, %ecx
movl %ecx, %eax
cltd
movl %r8d, 0x1c(%rsp)
idivl %r8d
movl %eax, %r13d
incl %r13d
movslq 0x58(%rsi), %rax
movq 0x230(%rsi), %r14
movq 0x268(%rsi), %r15
testl %edi, %edi
movl %edi, 0x10(%rsp)
cmovgl %edi, %r12d
movq %rax, 0x30(%rsp)
leaq (,%rax,4), %rax
movq %rax, 0x40(%rsp)
pushq $0x1
popq %rbp
movq %r15, 0x28(%rsp)
movq %r12, 0x68(%rsp)
subq $0x1, %r12
jb 0x2cb69
movq 0x30(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r15, %rcx
movl %ebp, %r8d
callq 0x1b5a3
addq 0x40(%rsp), %r15
jmp 0x2cb47
incl %ebx
imull %ebx, %r13d
movl 0xc(%rsp), %eax
movl %eax, %ebx
imull %ebx, %ebx
leaq 0x560(%rsp), %rcx
movq 0xd8(%rcx), %rax
movq %rax, 0x58(%rsp)
movq 0xf0(%rcx), %rax
movq %rax, 0x50(%rsp)
leaq 0xc0(%rsp), %rax
movl 0x74(%rax), %ecx
movl 0x84(%rax), %edx
movl 0x8(%rsp), %esi
imull 0x38(%rsp), %esi
imull %ecx, %esi
movl %esi, 0x14(%rsp)
movl %ecx, 0x18(%rsp)
imull %ecx, %ebx
movq 0x250(%rax), %rax
movq %rax, 0x80(%rsp)
xorl %ecx, %ecx
testl %r13d, %r13d
movl $0x0, %eax
cmovgl %r13d, %eax
movq %rax, 0x48(%rsp)
movl %ebx, %eax
movl %edx, 0x24(%rsp)
imull %edx, %eax
movl %eax, 0x20(%rsp)
movq 0x28(%rsp), %r12
cmpq 0x68(%rsp), %rcx
je 0x2ccb6
movl 0x14(%rsp), %eax
movq %rcx, 0x78(%rsp)
imull %ecx, %eax
cltq
movq 0x58(%rsp), %rcx
leaq (%rcx,%rax,4), %rdi
movl 0x18(%rsp), %esi
movq 0x38(%rsp), %rdx
movl 0x8(%rsp), %ecx
movl 0xc(%rsp), %r8d
movl 0x1c(%rsp), %r9d
movq 0x50(%rsp), %r14
pushq %r14
pushq 0x68(%rsp)
callq 0x1a7d7
popq %rax
popq %rcx
xorl %r15d, %r15d
movq %r12, 0x70(%rsp)
movq 0x48(%rsp), %rbp
subq $0x1, %rbp
jb 0x2cc9f
movslq %r15d, %r15
movq 0x80(%rsp), %rax
leaq (%rax,%r15,4), %r9
subq $0x8, %rsp
xorl %edi, %edi
xorl %esi, %esi
movl 0x2c(%rsp), %edx
pushq $0x1
popq %rcx
movl %ebx, %r8d
movss 0x1f38d(%rip), %xmm0    # 0x4c008
movaps %xmm0, %xmm1
pushq %r13
pushq %r12
pushq %r13
pushq %r14
pushq %rbx
callq 0x3954
addq $0x30, %rsp
addl 0x20(%rsp), %r15d
addq $0x4, %r12
addq $0x4, %r14
jmp 0x2cc4c
movq 0x78(%rsp), %rcx
incq %rcx
movq 0x70(%rsp), %r12
addq 0x40(%rsp), %r12
jmp 0x2cbf4
movq 0x30(%rsp), %rsi
imull 0x10(%rsp), %esi
leaq 0xc0(%rsp), %rax
movl 0x4(%rax), %edx
movq 0x28(%rsp), %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1a4f8