// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/deconvolutional_layer.c
// Function: backward_deconvolutional_layer
void backward_deconvolutional_layer(layer l, network net)
{
    int i;

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

    if(l.batch_normalize){
        backward_batchnorm_layer(l, net);
    } else {
        backward_bias(l.bias_updates, l.delta, l.batch, l.n, l.out_w*l.out_h);
    }

    //if(net.delta) memset(net.delta, 0, l.batch*l.h*l.w*l.c*sizeof(float));

    for(i = 0; i < l.batch; ++i){
        int m = l.c;
        int n = l.size*l.size*l.n;
        int k = l.h*l.w;

        float *a = net.input + i*m*k;
        float *b = net.workspace;
        float *c = l.weight_updates;

        im2col_cpu(l.delta + i*l.outputs, l.out_c, l.out_h, l.out_w, 
                l.size, l.stride, l.pad, b);
        gemm_cpu(0,1,m,n,k,1,a,k,b,k,1,c,n);

        if(net.delta){
            int m = l.c;
            int n = l.h*l.w;
            int k = l.size*l.size*l.n;

            float *a = l.weights;
            float *b = net.workspace;
            float *c = net.delta + i*n*m;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x620, %rsp            # imm = 0x620
leaq 0x4b0(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq 0x268(%rax), %rdi
movl 0x58(%rax), %esi
imull 0x48(%rax), %esi
movl 0x4(%rax), %edx
movq 0x260(%rax), %rcx
callq 0x2e560
movq -0x68(%rbp), %rax
cmpl $0x0, 0x40(%rax)
je 0x6a29
movq -0x68(%rbp), %rsi
movq %rsp, %rdi
movq %rdi, -0x78(%rbp)
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x70(%rbp), %rsi
movq -0x78(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
rep  movsq (%rsi), %es:(%rdi)
callq 0x4b530
jmp 0x6a52
movq -0x68(%rbp), %rax
movq 0x238(%rax), %rdi
movq 0x260(%rax), %rsi
movl 0x48(%rax), %edx
movl 0x84(%rax), %ecx
movl 0x7c(%rax), %r8d
imull 0x78(%rax), %r8d
callq 0x8980
movl $0x0, -0x14(%rbp)
movq -0x68(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x48(%rcx), %eax
jge 0x6c3b
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %rax
movl 0x74(%rax), %edx
movl %edx, -0x18(%rbp)
movl 0x90(%rax), %edx
imull 0x90(%rax), %edx
imull 0x84(%rax), %edx
movl %edx, -0x1c(%rbp)
movl 0x6c(%rax), %edx
imull 0x70(%rax), %edx
movl %edx, -0x20(%rbp)
movq 0xd8(%rcx), %rdx
movl -0x14(%rbp), %esi
imull -0x18(%rbp), %esi
imull -0x20(%rbp), %esi
movslq %esi, %rsi
shlq $0x2, %rsi
addq %rsi, %rdx
movq %rdx, -0x28(%rbp)
movq 0xf0(%rcx), %rcx
movq %rcx, -0x30(%rbp)
movq 0x258(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x260(%rax), %rdi
movl -0x14(%rbp), %ecx
imull 0x58(%rax), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rdi
movl 0x80(%rax), %esi
movl 0x78(%rax), %edx
movl 0x7c(%rax), %ecx
movl 0x90(%rax), %r8d
movl 0x98(%rax), %r9d
movl 0xa8(%rax), %r10d
movq -0x30(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2e650
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
movq -0x28(%rbp), %r9
movl -0x20(%rbp), %r14d
movq -0x30(%rbp), %rbx
movl -0x20(%rbp), %r11d
movq -0x38(%rbp), %r10
movl -0x1c(%rbp), %eax
xorl %edi, %edi
movl $0x1, %esi
movss 0x6a4c3(%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 0x3900
movq -0x70(%rbp), %rax
cmpq $0x0, 0xe8(%rax)
je 0x6c2b
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movl 0x74(%rcx), %edx
movl %edx, -0x3c(%rbp)
movl 0x6c(%rcx), %edx
imull 0x70(%rcx), %edx
movl %edx, -0x40(%rbp)
movl 0x90(%rcx), %edx
imull 0x90(%rcx), %edx
imull 0x84(%rcx), %edx
movl %edx, -0x44(%rbp)
movq 0x250(%rcx), %rcx
movq %rcx, -0x50(%rbp)
movq 0xf0(%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0xe8(%rax), %rax
movl -0x14(%rbp), %ecx
imull -0x40(%rbp), %ecx
imull -0x3c(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
movl -0x44(%rbp), %r8d
movq -0x50(%rbp), %r9
movl -0x44(%rbp), %r14d
movq -0x58(%rbp), %rbx
movl -0x40(%rbp), %r11d
movq -0x60(%rbp), %r10
movl -0x40(%rbp), %eax
xorl %esi, %esi
movss 0x6a402(%rip), %xmm1    # 0x7100c
movl %esi, %edi
movaps %xmm1, %xmm0
movl %r14d, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
callq 0x3900
jmp 0x6c2d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6a59
addq $0x620, %rsp            # imm = 0x620
popq %rbx
popq %r14
popq %rbp
retq
nopw (%rax,%rax)