// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/normalization_layer.c
// Function: forward_normalization_layer
void forward_normalization_layer(const layer layer, network net)
{
    int k,b;
    int w = layer.w;
    int h = layer.h;
    int c = layer.c;
    scal_cpu(w*h*c*layer.batch, 0, layer.squared, 1);

    for(b = 0; b < layer.batch; ++b){
        float *squared = layer.squared + w*h*c*b;
        float *norms   = layer.norms + w*h*c*b;
        float *input   = net.input + w*h*c*b;
        pow_cpu(w*h*c, 2, input, 1, squared, 1);

        const_cpu(w*h, layer.kappa, norms, 1);
        for(k = 0; k < layer.size/2; ++k){
            axpy_cpu(w*h, layer.alpha, squared + w*h*k, 1, norms, 1);
        }

        for(k = 1; k < layer.c; ++k){
            copy_cpu(w*h, norms + w*h*(k-1), 1, norms + w*h*k, 1);
            int prev = k - ((layer.size-1)/2) - 1;
            int next = k + (layer.size/2);
            if(prev >= 0)      axpy_cpu(w*h, -layer.alpha, squared + w*h*prev, 1, norms + w*h*k, 1);
            if(next < layer.c) axpy_cpu(w*h,  layer.alpha, squared + w*h*next, 1, norms + w*h*k, 1);
        }
    }
    pow_cpu(w*h*c*layer.batch, -layer.beta, layer.norms, 1, layer.output, 1);
    mul_cpu(w*h*c*layer.batch, net.input, 1, layer.output, 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
leaq 0x4b0(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movl 0x70(%rax), %ecx
movl %ecx, -0xc(%rbp)
movl 0x6c(%rax), %ecx
movl %ecx, -0x10(%rbp)
movl 0x74(%rax), %ecx
movl %ecx, -0x14(%rbp)
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
imull -0x14(%rbp), %edi
imull 0x48(%rax), %edi
movq 0x278(%rax), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f6f0
movl $0x0, -0x8(%rbp)
movq -0x40(%rbp), %rcx
movl -0x8(%rbp), %eax
cmpl 0x48(%rcx), %eax
jge 0x468fb
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq 0x278(%rcx), %rdx
movl -0xc(%rbp), %esi
imull -0x10(%rbp), %esi
imull -0x14(%rbp), %esi
imull -0x8(%rbp), %esi
movslq %esi, %rsi
shlq $0x2, %rsi
addq %rsi, %rdx
movq %rdx, -0x20(%rbp)
movq 0x280(%rcx), %rcx
movl -0xc(%rbp), %edx
imull -0x10(%rbp), %edx
imull -0x14(%rbp), %edx
imull -0x8(%rbp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, -0x28(%rbp)
movq 0xd8(%rax), %rax
movl -0xc(%rbp), %ecx
imull -0x10(%rbp), %ecx
imull -0x14(%rbp), %ecx
imull -0x8(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
imull -0x14(%rbp), %edi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rcx
movss 0x2ab3a(%rip), %xmm0    # 0x71210
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f600
movq -0x40(%rbp), %rax
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
movss 0x13c(%rax), %xmm0
movq -0x28(%rbp), %rsi
movl $0x1, %edx
callq 0x2f550
movl $0x0, -0x4(%rbp)
movq -0x40(%rbp), %rax
movl -0x4(%rbp), %ecx
movl %ecx, -0x4c(%rbp)
movl 0x90(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x4c(%rbp), %eax
cmpl %ecx, %eax
jge 0x46775
movq -0x40(%rbp), %rax
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
movss 0x134(%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
imull -0x4(%rbp), %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x4670c
movl $0x1, -0x4(%rbp)
movq -0x40(%rbp), %rcx
movl -0x4(%rbp), %eax
cmpl 0x74(%rcx), %eax
jge 0x468eb
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
movq -0x28(%rbp), %rsi
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
imull %ecx, %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rcx
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
imull -0x4(%rbp), %eax
cltq
shlq $0x2, %rax
addq %rax, %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
movq -0x40(%rbp), %rax
movl -0x4(%rbp), %ecx
movl 0x90(%rax), %eax
subl $0x1, %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movq -0x40(%rbp), %rax
subl %edx, %ecx
subl $0x1, %ecx
movl %ecx, -0x34(%rbp)
movl -0x4(%rbp), %ecx
movl %ecx, -0x50(%rbp)
movl 0x90(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x50(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x34(%rbp)
jl 0x4687e
movq -0x40(%rbp), %rax
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
movss 0x134(%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x20(%rbp), %rsi
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
imull -0x34(%rbp), %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rcx
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
imull -0x4(%rbp), %eax
cltq
shlq $0x2, %rax
addq %rax, %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0x40(%rbp), %rcx
movl -0x38(%rbp), %eax
cmpl 0x74(%rcx), %eax
jge 0x468db
movq -0x40(%rbp), %rax
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
movss 0x134(%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
imull -0x38(%rbp), %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rcx
movl -0xc(%rbp), %eax
imull -0x10(%rbp), %eax
imull -0x4(%rbp), %eax
cltq
shlq $0x2, %rax
addq %rax, %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
jmp 0x468dd
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x4677c
jmp 0x468ed
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x46637
movq -0x40(%rbp), %rax
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
imull -0x14(%rbp), %edi
imull 0x48(%rax), %edi
movss 0x138(%rax), %xmm0
movd %xmm0, %ecx
xorl $0x80000000, %ecx       # imm = 0x80000000
movd %ecx, %xmm0
movq 0x280(%rax), %rsi
movq 0x268(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f600
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
movl -0xc(%rbp), %edi
imull -0x10(%rbp), %edi
imull -0x14(%rbp), %edi
imull 0x48(%rax), %edi
movq 0xd8(%rcx), %rsi
movq 0x268(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f5a0
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)