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

    gradient_array(l.output, l.outputs*l.batch, l.activation, l.delta);

    for(i = 0; i < l.batch; ++i){
        axpy_cpu(l.outputs, 1, l.delta + i*l.outputs, 1, l.bias_updates, 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);

        for(j = 0; j < locations; ++j){ 
            float *a = l.delta + i*l.outputs + j;
            float *b = net.workspace + j;
            float *c = l.weight_updates + j*l.size*l.size*l.c*l.n;
            int m = l.n;
            int n = l.size*l.size*l.c;
            int k = 1;

            gemm(0,1,m,n,k,1,a,locations,b,locations,1,c,n);
        }

        if(net.delta){
            for(j = 0; j < locations; ++j){ 
                float *a = l.weights + j*l.size*l.size*l.c*l.n;
                float *b = l.delta + i*l.outputs + j;
                float *c = net.workspace + j;

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

                gemm(1,0,m,n,k,1,a,m,b,locations,0,c,locations);
            }

            col2im_cpu(net.workspace, l.c,  l.h,  l.w,  l.size,  l.stride, l.pad, net.delta+i*l.c*l.h*l.w);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xa0, %rsp
leaq 0x4b0(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movl 0x7c(%rax), %ecx
imull 0x78(%rax), %ecx
movl %ecx, -0x1c(%rbp)
movq 0x268(%rax), %rdi
movl 0x58(%rax), %esi
imull 0x48(%rax), %esi
movl 0x4(%rax), %edx
movq 0x260(%rax), %rcx
callq 0x2e560
movl $0x0, -0x14(%rbp)
movq -0x80(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x48(%rcx), %eax
jge 0x47a95
movq -0x80(%rbp), %rax
movl 0x58(%rax), %edi
movq 0x260(%rax), %rsi
movl -0x14(%rbp), %ecx
imull 0x58(%rax), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rsi
movq 0x238(%rax), %rcx
movss 0x29590(%rip), %xmm0    # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x47a42
movl $0x0, -0x14(%rbp)
movq -0x80(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x48(%rcx), %eax
jge 0x47db9
movq -0x88(%rbp), %rax
movq -0x80(%rbp), %r10
movq 0xd8(%rax), %rcx
movl -0x14(%rbp), %edx
imull 0x70(%r10), %edx
imull 0x6c(%r10), %edx
imull 0x74(%r10), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movl 0x74(%r10), %esi
movl 0x6c(%r10), %edx
movl 0x70(%r10), %ecx
movl 0x90(%r10), %r8d
movl 0x98(%r10), %r9d
movl 0xa8(%r10), %r10d
movq 0xf0(%rax), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2e650
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x47c25
movq -0x80(%rbp), %rcx
movq -0x88(%rbp), %rax
movq 0x260(%rcx), %rdx
movl -0x14(%rbp), %esi
imull 0x58(%rcx), %esi
movslq %esi, %rsi
shlq $0x2, %rsi
addq %rsi, %rdx
movslq -0x18(%rbp), %rsi
shlq $0x2, %rsi
addq %rsi, %rdx
movq %rdx, -0x30(%rbp)
movq 0xf0(%rax), %rax
movslq -0x18(%rbp), %rdx
shlq $0x2, %rdx
addq %rdx, %rax
movq %rax, -0x38(%rbp)
movq 0x258(%rcx), %rax
movl -0x18(%rbp), %edx
imull 0x90(%rcx), %edx
imull 0x90(%rcx), %edx
imull 0x74(%rcx), %edx
imull 0x84(%rcx), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rax
movq %rax, -0x40(%rbp)
movl 0x84(%rcx), %eax
movl %eax, -0x44(%rbp)
movl 0x90(%rcx), %eax
imull 0x90(%rcx), %eax
imull 0x74(%rcx), %eax
movl %eax, -0x48(%rbp)
movl $0x1, -0x4c(%rbp)
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movq -0x30(%rbp), %r9
movl -0x1c(%rbp), %r14d
movq -0x38(%rbp), %rbx
movl -0x1c(%rbp), %r11d
movq -0x40(%rbp), %r10
movl -0x48(%rbp), %eax
xorl %edi, %edi
movl $0x1, %esi
movss 0x29414(%rip), %xmm1    # 0x7100c
movaps %xmm1, %xmm0
movl %r14d, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x3aa0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x47b1f
movq -0x88(%rbp), %rax
cmpq $0x0, 0xe8(%rax)
je 0x47da9
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x47d47
movq -0x80(%rbp), %rax
movq -0x88(%rbp), %rcx
movq 0x250(%rax), %rdx
movl -0x18(%rbp), %esi
imull 0x90(%rax), %esi
imull 0x90(%rax), %esi
imull 0x74(%rax), %esi
imull 0x84(%rax), %esi
movslq %esi, %rsi
shlq $0x2, %rsi
addq %rsi, %rdx
movq %rdx, -0x58(%rbp)
movq 0x260(%rax), %rdx
movl -0x14(%rbp), %esi
imull 0x58(%rax), %esi
movslq %esi, %rsi
shlq $0x2, %rsi
addq %rsi, %rdx
movslq -0x18(%rbp), %rsi
shlq $0x2, %rsi
addq %rsi, %rdx
movq %rdx, -0x60(%rbp)
movq 0xf0(%rcx), %rcx
movslq -0x18(%rbp), %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movl 0x90(%rax), %ecx
imull 0x90(%rax), %ecx
imull 0x74(%rax), %ecx
movl %ecx, -0x6c(%rbp)
movl $0x1, -0x70(%rbp)
movl 0x84(%rax), %eax
movl %eax, -0x74(%rbp)
movl -0x6c(%rbp), %edx
movl -0x70(%rbp), %ecx
movl -0x74(%rbp), %r8d
movq -0x58(%rbp), %r9
movl -0x6c(%rbp), %r14d
movq -0x60(%rbp), %rbx
movl -0x1c(%rbp), %r11d
movq -0x68(%rbp), %r10
movl -0x1c(%rbp), %eax
movl $0x1, %edi
xorl %esi, %esi
movss 0x292f2(%rip), %xmm0    # 0x7100c
xorps %xmm1, %xmm1
movl %r14d, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x3aa0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x47c41
movq -0x80(%rbp), %rbx
movq -0x88(%rbp), %rax
movq 0xf0(%rax), %rdi
movl 0x74(%rbx), %esi
movl 0x6c(%rbx), %edx
movl 0x70(%rbx), %ecx
movl 0x90(%rbx), %r8d
movl 0x98(%rbx), %r9d
movl 0xa8(%rbx), %r10d
movq 0xe8(%rax), %rax
movl -0x14(%rbp), %r11d
imull 0x74(%rbx), %r11d
imull 0x6c(%rbx), %r11d
imull 0x70(%rbx), %r11d
movslq %r11d, %r11
shlq $0x2, %r11
addq %r11, %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2e840
jmp 0x47dab
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x47a9c
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)