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

    fill_cpu(l.outputs*l.batch, 0, l.output, 1);

    if(l.xnor){
        binarize_weights(l.weights, l.n, l.c/l.groups*l.size*l.size, l.binary_weights);
        swap_binary(&l);
        binarize_cpu(net.input, l.c*l.h*l.w*l.batch, l.binary_input);
        net.input = l.binary_input;
    }

    int m = l.n/l.groups;
    int k = l.size*l.size*l.c/l.groups;
    int n = l.out_w*l.out_h;
    for(i = 0; i < l.batch; ++i){
        for(j = 0; j < l.groups; ++j){
            float *a = l.weights + j*l.nweights/l.groups;
            float *b = net.workspace;
            float *c = l.output + (i*l.groups + j)*n*m;
            float *im =  net.input + (i*l.groups + j)*l.c/l.groups*l.h*l.w;

            if (l.size == 1) {
                b = im;
            } else {
                im2col_cpu(im, l.c/l.groups, l.h, l.w, l.size, l.stride, l.pad, b);
            }
            gemm(0,0,m,n,k,1,a,k,b,n,1,c,n);
        }
    }

    if(l.batch_normalize){
        forward_batchnorm_layer(l, net);
    } else {
        add_bias(l.output, l.biases, l.batch, l.n, l.out_h*l.out_w);
    }

    activate_array(l.output, l.outputs*l.batch, l.activation);
    if(l.binary || l.xnor) swap_binary(&l);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x600, %rsp            # imm = 0x600
leaq 0x4b0(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq 0x268(%rax), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0x50(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0x7c81
movq -0x50(%rbp), %rcx
movq 0x250(%rcx), %rdi
movl 0x84(%rcx), %esi
movl 0x74(%rcx), %eax
cltd
idivl 0x8c(%rcx)
movl %eax, %edx
movq -0x50(%rbp), %rax
imull 0x90(%rax), %edx
imull 0x90(%rax), %edx
movq 0x228(%rax), %rcx
callq 0x71e0
movq -0x50(%rbp), %rdi
callq 0x71a0
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rcx
movq 0xd8(%rcx), %rdi
movl 0x74(%rax), %esi
imull 0x6c(%rax), %esi
imull 0x70(%rax), %esi
imull 0x48(%rax), %esi
movq 0x388(%rax), %rdx
callq 0x7300
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
movq 0x388(%rcx), %rcx
movq %rcx, 0xd8(%rax)
movq -0x50(%rbp), %rcx
movl 0x84(%rcx), %eax
cltd
idivl 0x8c(%rcx)
movl %eax, -0x1c(%rbp)
movl 0x90(%rcx), %eax
imull 0x90(%rcx), %eax
imull 0x74(%rcx), %eax
cltd
idivl 0x8c(%rcx)
movl %eax, -0x20(%rbp)
movl 0x7c(%rcx), %eax
imull 0x78(%rcx), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x50(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x48(%rcx), %eax
jge 0x7e4a
movl $0x0, -0x18(%rbp)
movq -0x50(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x8c(%rcx), %eax
jge 0x7e3a
movq -0x50(%rbp), %rsi
movq 0x250(%rsi), %rcx
movl -0x18(%rbp), %eax
imull 0x5c(%rsi), %eax
cltd
idivl 0x8c(%rsi)
movl %eax, %edx
movq -0x58(%rbp), %rax
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, -0x30(%rbp)
movq 0xf0(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x268(%rsi), %rcx
movl -0x14(%rbp), %edx
imull 0x8c(%rsi), %edx
addl -0x18(%rbp), %edx
imull -0x24(%rbp), %edx
imull -0x1c(%rbp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, -0x40(%rbp)
movq 0xd8(%rax), %rcx
movl -0x14(%rbp), %eax
imull 0x8c(%rsi), %eax
addl -0x18(%rbp), %eax
imull 0x74(%rsi), %eax
cltd
idivl 0x8c(%rsi)
movl %eax, %edx
movq -0x50(%rbp), %rax
imull 0x6c(%rax), %edx
imull 0x70(%rax), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, -0x48(%rbp)
cmpl $0x1, 0x90(%rax)
jne 0x7d9b
movq -0x48(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x7de0
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rdi
movl 0x74(%rcx), %eax
cltd
idivl 0x8c(%rcx)
movl %eax, %esi
movq -0x50(%rbp), %rax
movl 0x6c(%rax), %edx
movl 0x70(%rax), %ecx
movl 0x90(%rax), %r8d
movl 0x98(%rax), %r9d
movl 0xa8(%rax), %r10d
movq -0x38(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2e650
movl -0x1c(%rbp), %edx
movl -0x24(%rbp), %ecx
movl -0x20(%rbp), %r8d
movq -0x30(%rbp), %r9
movl -0x20(%rbp), %r14d
movq -0x38(%rbp), %rbx
movl -0x24(%rbp), %r11d
movq -0x40(%rbp), %r10
movl -0x24(%rbp), %eax
xorl %esi, %esi
movss 0x69201(%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 0x3aa0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7cd8
jmp 0x7e3c
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7cc1
movq -0x50(%rbp), %rax
cmpl $0x0, 0x40(%rax)
je 0x7e85
movq -0x50(%rbp), %rsi
movq %rsp, %rdi
movq %rdi, -0x60(%rbp)
movl $0x94, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
rep  movsq (%rsi), %es:(%rdi)
callq 0x4b2d0
jmp 0x7eae
movq -0x50(%rbp), %rax
movq 0x268(%rax), %rdi
movq 0x230(%rax), %rsi
movl 0x48(%rax), %edx
movl 0x84(%rax), %ecx
movl 0x78(%rax), %r8d
imull 0x7c(%rax), %r8d
callq 0x8840
movq -0x50(%rbp), %rax
movq 0x268(%rax), %rdi
movl 0x58(%rax), %esi
imull 0x48(%rax), %esi
movl 0x4(%rax), %edx
callq 0x2dfa0
movq -0x50(%rbp), %rax
cmpl $0x0, 0xb8(%rax)
jne 0x7ee2
movq -0x50(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0x7eeb
movq -0x50(%rbp), %rdi
callq 0x71a0
addq $0x600, %rsp            # imm = 0x600
popq %rbx
popq %r14
popq %rbp
retq
nopw (%rax,%rax)