// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
leaq 0xb0(%rsp), %r15
movl 0x48(%r15), %ebp
movl 0x58(%r15), %edi
imull %ebp, %edi
movq 0x268(%r15), %rsi
xorps %xmm0, %xmm0
movl %edi, 0x38(%rsp)
movq %rsi, 0x18(%rsp)
movl $0x1, %edx
callq 0x29d83
cmpl $0x0, 0xbc(%r15)
je 0x1098f
movq 0x250(%r15), %rbx
movl 0x74(%r15), %r13d
movl 0x84(%r15), %r12d
movl 0x8c(%r15), %ecx
movl %r13d, %eax
cltd
movl %ecx, 0x28(%rsp)
idivl %ecx
movl 0x90(%r15), %edx
movl %edx, 0x10(%rsp)
imull %edx, %edx
imull %eax, %edx
movq 0x228(%r15), %r14
movq %rbx, %rdi
movl %r12d, %esi
movq %r14, %rcx
callq 0x1068d
movl %r13d, %r9d
movq %r14, 0x250(%r15)
movq %rbx, 0x228(%r15)
movl 0x6c(%r15), %edx
imull %r13d, %edx
imull 0x70(%r15), %edx
imull %ebp, %edx
movq 0x388(%r15), %rax
testl %edx, %edx
jle 0x10975
leaq 0x550(%rsp), %rcx
movq 0xd8(%rcx), %rcx
movl %edx, %edx
xorl %esi, %esi
xorps %xmm0, %xmm0
leaq 0x4487d(%rip), %rdi     # 0x551d0
movss (%rcx,%rsi,4), %xmm1
xorl %r8d, %r8d
ucomiss %xmm0, %xmm1
seta %r8b
movss (%rdi,%r8,4), %xmm1
movss %xmm1, (%rax,%rsi,4)
incq %rsi
cmpq %rsi, %rdx
jne 0x10953
leaq 0x550(%rsp), %rcx
movq %rax, 0xd8(%rcx)
movl 0x28(%rsp), %esi
movl 0x10(%rsp), %r8d
jmp 0x109a8
movl 0x74(%r15), %r9d
movl 0x84(%r15), %r12d
movl 0x8c(%r15), %esi
movl 0x90(%r15), %r8d
movl %r12d, 0x34(%rsp)
movl %r12d, %eax
cltd
idivl %esi
movl %eax, 0x14(%rsp)
movl %r8d, %eax
imull %r8d, %eax
imull %r9d, %eax
cltd
idivl %esi
movq %rax, 0x68(%rsp)
movl 0x7c(%r15), %eax
imull 0x78(%r15), %eax
movq %rax, 0x20(%rsp)
testl %ebp, %ebp
jle 0x10b97
movl 0x14(%rsp), %eax
imull 0x20(%rsp), %eax
movl %eax, 0x5c(%rsp)
imull %esi, %eax
movl %eax, 0x40(%rsp)
movl %esi, %eax
imull %r9d, %eax
movl %eax, 0x3c(%rsp)
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
xorl %ecx, %ecx
movl %r8d, 0x10(%rsp)
movl %ebp, 0x44(%rsp)
movl %r9d, 0x4c(%rsp)
movl %ecx, 0x48(%rsp)
testl %esi, %esi
jle 0x10b6d
leaq 0xb0(%rsp), %rax
movq 0x250(%rax), %rcx
movq %rcx, 0x28(%rsp)
movl 0x5c(%rax), %ecx
movl %ecx, 0x64(%rsp)
movl 0x6c(%rax), %edx
leaq 0x550(%rsp), %rcx
movq 0xd8(%rcx), %rcx
movq %rcx, 0x70(%rsp)
movl 0x70(%rax), %eax
movl %edx, 0x54(%rsp)
movl %eax, 0x50(%rsp)
imull %eax, %edx
movl %edx, 0x60(%rsp)
xorl %r14d, %r14d
movl 0xc(%rsp), %r12d
movl 0x8(%rsp), %eax
movl %eax, %ebx
xorl %ebp, %ebp
movl %r14d, %eax
cltd
idivl %esi
movl %eax, %edi
movl %r12d, %eax
cltd
idivl %esi
imull 0x60(%rsp), %eax
cltq
movq 0x70(%rsp), %rcx
leaq (%rcx,%rax,4), %r10
cmpl $0x1, %r8d
jne 0x10aaa
movl %r9d, %r13d
movl %esi, %r15d
jmp 0x10b02
leaq 0x550(%rsp), %rax
movq 0xf0(%rax), %r13
movl %r9d, %eax
cltd
idivl %esi
leaq 0xb0(%rsp), %rcx
movl 0x98(%rcx), %r9d
movl 0xa8(%rcx), %r11d
movl %edi, 0x58(%rsp)
movq %r10, %rdi
movl %esi, %r15d
movl %eax, %esi
movl 0x54(%rsp), %edx
movl 0x50(%rsp), %ecx
pushq %r13
pushq %r11
callq 0x28f73
movl 0x68(%rsp), %edi
addq $0x10, %rsp
movq %r13, %r10
movl 0x4c(%rsp), %r13d
movq 0x18(%rsp), %rcx
movslq %edi, %rax
movq 0x28(%rsp), %rdx
leaq (%rdx,%rax,4), %r9
movslq %ebx, %rbx
leaq (%rcx,%rbx,4), %rax
subq $0x8, %rsp
xorl %edi, %edi
xorl %esi, %esi
movl 0x1c(%rsp), %edx
movq 0x28(%rsp), %rcx
movq 0x70(%rsp), %r8
movss 0x444d0(%rip), %xmm0    # 0x55008
movaps %xmm0, %xmm1
pushq %rcx
pushq %rax
pushq %rcx
pushq %r10
pushq %r8
callq 0xe50d
addq $0x30, %rsp
incl %ebp
addl 0x5c(%rsp), %ebx
addl %r13d, %r12d
addl 0x64(%rsp), %r14d
cmpl %r15d, %ebp
movl %r13d, %r9d
movl %r15d, %esi
movl 0x10(%rsp), %r8d
jl 0x10a7e
movl 0x48(%rsp), %ecx
incl %ecx
movl 0x8(%rsp), %eax
addl 0x40(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %eax
addl 0x3c(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x44(%rsp), %ebp
cmpl %ebp, %ecx
jl 0x10a1e
leaq 0xb0(%rsp), %rbx
cmpl $0x0, 0x40(%rbx)
je 0x10bee
subq $0x5b0, %rsp            # imm = 0x5B0
movl $0x94, %ecx
movq %rsp, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
movl $0x22, %ecx
leaq 0xb00(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c630
addq $0x5b0, %rsp            # imm = 0x5B0
movq 0x268(%rbx), %rdi
movl 0x48(%rbx), %esi
imull 0x58(%rbx), %esi
jmp 0x10c14
movq 0x230(%rbx), %rsi
movq 0x18(%rsp), %r14
movq %r14, %rdi
movl %ebp, %edx
movl 0x34(%rsp), %ecx
movq 0x20(%rsp), %r8
callq 0x1131e
movq %r14, %rdi
movl 0x38(%rsp), %esi
movl 0x4(%rbx), %edx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x28c99