// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/batchnorm_layer.c
// Function: forward_batchnorm_layer
void forward_batchnorm_layer(layer l, network net)
{
    if(l.type == BATCHNORM) copy_cpu(l.outputs*l.batch, net.input, 1, l.output, 1);
    copy_cpu(l.outputs*l.batch, l.output, 1, l.x, 1);
    if(net.train){
        mean_cpu(l.output, l.batch, l.out_c, l.out_h*l.out_w, l.mean);
        variance_cpu(l.output, l.mean, l.batch, l.out_c, l.out_h*l.out_w, l.variance);

        scal_cpu(l.out_c, .99, l.rolling_mean, 1);
        axpy_cpu(l.out_c, .01, l.mean, 1, l.rolling_mean, 1);
        scal_cpu(l.out_c, .99, l.rolling_variance, 1);
        axpy_cpu(l.out_c, .01, l.variance, 1, l.rolling_variance, 1);

        normalize_cpu(l.output, l.mean, l.variance, l.batch, l.out_c, l.out_h*l.out_w);   
        copy_cpu(l.outputs*l.batch, l.output, 1, l.x_norm, 1);
    } else {
        normalize_cpu(l.output, l.rolling_mean, l.rolling_variance, l.batch, l.out_c, l.out_h*l.out_w);
    }
    scale_bias(l.output, l.scales, l.batch, l.out_c, l.out_h*l.out_w);
    add_bias(l.output, l.biases, l.batch, l.out_c, l.out_h*l.out_w);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x4f0(%rsp), %rbx
leaq 0x50(%rsp), %r13
movl 0x48(%r13), %ebp
cmpl $0x13, (%r13)
movl 0x58(%r13), %r15d
jne 0x2fc9d
imull %ebp, %r15d
movq 0xd8(%rbx), %rsi
movq 0x268(%r13), %r14
pushq $0x1
popq %rdx
movl %r15d, %edi
movq %r14, %rcx
movl %edx, %r8d
callq 0x1b5a3
jmp 0x2fca8
movq 0x268(%r13), %r14
imull %ebp, %r15d
movq 0x2c0(%r13), %rcx
pushq $0x1
popq %rdx
movl %r15d, %edi
movq %r14, %rsi
movl %edx, %r8d
callq 0x1b5a3
cmpl $0x0, 0xf8(%rbx)
je 0x2fdd1
movl %r15d, (%rsp)
movl 0x7c(%r13), %r15d
movl 0x80(%r13), %r12d
imull 0x78(%r13), %r15d
movq 0x290(%r13), %rbx
movq %r14, %rdi
movl %ebp, %esi
movl %r12d, %edx
movl %r15d, %ecx
movq %rbx, %r8
callq 0x1afa6
movq 0x298(%r13), %r9
movq %r9, 0x10(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movq %rbx, 0x8(%rsp)
movl %ebp, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq 0x1b042
movl %ebp, 0x4(%rsp)
movq 0x2b0(%r13), %rbp
movss 0x20f52(%rip), %xmm0    # 0x50c84
pushq $0x1
popq %rdx
movl %r12d, %edi
movq %rbp, %rsi
callq 0x1b423
movss 0x1f860(%rip), %xmm0    # 0x4f5a8
movl %r12d, %edi
movq %rbx, %rsi
pushq $0x1
popq %rdx
movq %rbp, %rcx
movl %edx, %r8d
movl %edx, %ebx
callq 0x1b3ed
movq 0x2b8(%r13), %rbp
movl %r12d, %edi
movss 0x20f14(%rip), %xmm0    # 0x50c84
movq %rbp, %rsi
movl %ebx, %edx
callq 0x1b423
movl %r12d, %edi
movss 0x1f823(%rip), %xmm0    # 0x4f5a8
movq 0x10(%rsp), %rbx
movq %rbx, %rsi
pushq $0x1
popq %rdx
movq %rbp, %rcx
movl 0x4(%rsp), %ebp
movl %edx, %r8d
callq 0x1b3ed
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
movl %ebp, %ecx
movl %r12d, %r8d
movl %r15d, %r9d
callq 0x1b21e
movq 0x2c8(%r13), %rcx
movl (%rsp), %edi
movq %r14, %rsi
pushq $0x1
popq %rdx
movl %edx, %r8d
callq 0x1b5a3
jmp 0x2fdff
movq 0x2b0(%r13), %rsi
movq 0x2b8(%r13), %rdx
movl 0x7c(%r13), %r15d
movl 0x80(%r13), %r12d
imull 0x78(%r13), %r15d
movq %r14, %rdi
movl %ebp, %ecx
movl %r12d, %r8d
movl %r15d, %r9d
callq 0x1b21e
movq 0x240(%r13), %rsi
movq %r14, %rdi
movl %ebp, %edx
movl %r12d, %ecx
movl %r15d, %r8d
callq 0x6d49
movq 0x230(%r13), %rsi
movq %r14, %rdi
movl %ebp, %edx
movl %r12d, %ecx
movl %r15d, %r8d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6cd3