// File: /workspace/github_cpp_makefile_star2_O2/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::TransferValueFromOriginalToActive_WB()
void ConstructLayer::TestBatchNormalization_UpdateZ()
{
    // print each matrix, see if batch normalization Z works as expected

    // print Z matrix before normalization
    std::cout<<"Z image before batch normalization: "<<std::endl;
    int id = 0;
    for(auto &i: __imageZ)
    {
        std::cout<<"sample id: "<<id++<<std::endl;
        std::cout<<i<<std::endl;
    }

    /*
       cout<<"average mu_N: "<<endl;
       for(auto &i: __imageAverage_BN)
       cout<<i<<endl;

       cout<<"sigma squared: "<<endl;
       for(auto &i: __imageVariance_BN)
       cout<<i<<endl;

       cout<<"image z after normlization: "<<endl;
       for(auto &i: __imageZ_BN)
       cout<<i<<endl;
       */
    std::cout<<"image y after normalization: "<<std::endl;
    for(auto &i: __imageY_BN)
        std::cout<<i<<std::endl;

    std::cout<<"enter to continue..."<<std::endl;
    getchar();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq 0x60(%rdi), %r15
movq 0x68(%rdi), %rcx
subq %r15, %rcx
pushq $0x18
popq %rsi
movq %rcx, %rax
cqto
idivq %rsi
movq %rax, 0x10(%rsp)
movq 0x80(%rdi), %rax
subq 0x78(%rdi), %rax
cmpq %rax, %rcx
jne 0xd04c
movl 0xc(%rdi), %eax
leal -0x1(%rax), %edx
cmpl $0x1, %edx
ja 0xcbea
movq 0x110(%rdi), %rsi
subq 0x108(%rdi), %rsi
cmpq %rsi, %rcx
jne 0xd06b
leaq 0x78(%rdi), %rcx
movq %rcx, 0x38(%rsp)
cmpl $0x2, %edx
movq %rdi, 0x8(%rsp)
jb 0xce56
testl %eax, %eax
je 0xcc0e
cmpl $0x4, %eax
jne 0xcf8c
movq 0x8(%rsp), %rax
movq 0x108(%rax), %rbx
movq %r15, %rdi
callq 0x17a6a
movq %rax, %r14
movq %rdx, 0x28(%rsp)
movq %rbx, %rdi
callq 0x1145e
movq %r14, 0x30(%rsp)
cmpq %rax, %r14
jne 0xd08a
movq %rbx, %rdi
callq 0x1145e
cmpq $0x1, %rdx
jne 0xd0a9
movq 0x8(%rsp), %rcx
movq 0x80(%rcx), %rax
subq 0x78(%rcx), %rax
cmpq $0x18, %rax
jne 0xd0c8
leaq 0xd8(%rcx), %rax
movq %rax, 0x18(%rsp)
leaq 0xf0(%rcx), %rax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
leaq 0x40(%rsp), %rbp
movq %rbx, 0x20(%rsp)
cmpq 0x30(%rsp), %r14
je 0xcf8c
imulq $0x28, %r14, %rdi
addq (%rbx), %rdi
xorl %esi, %esi
callq 0x11440
testq %rdx, (%rax)
je 0xce4e
andq $0x0, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0x28(%rsp), %rbx
xorl %r12d, %r12d
xorl %r13d, %r13d
subq $0x1, %rbx
jb 0xcd51
movq 0x8(%rsp), %rax
movq 0x3f0(%rax), %rdi
testq %rdi, %rdi
je 0xcd2b
movq (%rdi), %rax
callq *0x250(%rax)
testl %eax, %eax
jne 0xcd2b
movq 0x8(%rsp), %rax
movq 0x3f0(%rax), %rdi
movq (%rdi), %rax
callq *0x268(%rax)
movq (%rax), %rcx
movq 0x8(%rax), %rax
subq %rcx, %rax
cmpq $0x18, %rax
jne 0xd00e
movq (%rcx), %rdi
addq %r13, %rdi
xorl %esi, %esi
callq 0x11440
testq %rdx, (%rax)
je 0xcd44
movq %r15, %rdi
movq %r14, %rsi
callq 0x17c46
movq (%rax), %rsi
addq %r12, %rsi
movq %rbp, %rdi
callq 0x11d08
addq $0x28, %r13
addq $0x8, %r12
jmp 0xcccc
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
andq $0x0, 0x90(%rsp)
leaq 0x80(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x11d32
leaq 0xb8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x17906
movq 0x20(%rsp), %rbx
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0x1139c
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x17c46
leaq 0x60(%rsp), %r13
movq (%rax), %rsi
movq %r13, %rdi
callq 0x11d08
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
andq $0x0, 0xb0(%rsp)
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x11d32
leaq 0xd0(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x17906
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x1139c
movq %r13, %rdi
callq 0x17a9a
movq %r12, %rdi
callq 0x11d5e
leaq 0x60(%rsp), %rdi
callq 0x127dc
leaq 0xb8(%rsp), %rdi
callq 0x17a9a
leaq 0x80(%rsp), %rdi
callq 0x11d5e
movq %rbp, %rdi
callq 0x127dc
incq %r14
jmp 0xcc91
leaq 0xd8(%rdi), %rax
movq %rax, 0x58(%rsp)
xorl %eax, %eax
leaq 0x40(%rsp), %rbx
movq %rdi, %rcx
cmpq 0x10(%rsp), %rax
je 0xcf7b
movq %rax, 0x18(%rsp)
imulq $0x18, %rax, %r13
movq 0x60(%rcx), %rdi
addq %r13, %rdi
addq 0x108(%rcx), %r13
movq %rdi, 0x28(%rsp)
callq 0x17a6a
movq %rax, %r14
movq %rdx, %r15
movq %r13, %rdi
callq 0x1145e
movq %rdx, %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x175e8
testb %al, %al
je 0xd02d
movq %rbx, %rbp
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1776a
xorl %ebx, %ebx
movq %r14, 0x20(%rsp)
cmpq %r14, %rbx
je 0xcf51
imulq $0x28, %rbx, %r12
xorl %r14d, %r14d
cmpq %r14, %r15
je 0xcf47
movq (%r13), %rdi
addq %r12, %rdi
movq %r14, %rsi
callq 0x11440
testq %rdx, (%rax)
je 0xcf2b
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0x17c46
movq (%rax), %rax
movsd (%rax,%r14,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x17c46
movsd 0x30(%rsp), %xmm0
jmp 0xcf39
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x17c46
xorps %xmm0, %xmm0
movq (%rax), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
jmp 0xcee3
incq %rbx
movq 0x20(%rsp), %r14
jmp 0xced7
movq 0x58(%rsp), %rdi
movq %rbp, %rbx
movq %rbp, %rsi
callq 0x1139c
movq %rbx, %rdi
callq 0x17a9a
movq 0x18(%rsp), %rax
incq %rax
movq 0x8(%rsp), %rcx
jmp 0xce6c
leaq 0xf0(%rcx), %rdi
movq 0x38(%rsp), %rsi
callq 0x11a9e
movq 0x8(%rsp), %rsi
movl 0xc(%rsi), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0xcfe0
testl %eax, %eax
je 0xcfa5
cmpl $0x4, %eax
jne 0xcffc
movups 0x398(%rsi), %xmm0
movups %xmm0, 0x3b0(%rsi)
movq 0x3a8(%rsi), %rax
movq %rax, 0x3c0(%rsi)
movq 0xe0(%rsi), %rax
subq 0xd8(%rsi), %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
movq %rax, 0x3b0(%rsi)
jmp 0xcffc
movq 0x3a8(%rsi), %rax
movq %rax, 0x3c0(%rsi)
movups 0x398(%rsi), %xmm0
movups %xmm0, 0x3b0(%rsi)
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16954(%rip), %rdi     # 0x23969
leaq 0x146be(%rip), %rsi     # 0x216da
leaq 0x1686d(%rip), %rcx     # 0x23890
movl $0xb84, %edx            # imm = 0xB84
callq 0x4180
leaq 0x16840(%rip), %rdi     # 0x23874
leaq 0x1469f(%rip), %rsi     # 0x216da
leaq 0x1684e(%rip), %rcx     # 0x23890
movl $0xb59, %edx            # imm = 0xB59
callq 0x4180
leaq 0x155a9(%rip), %rdi     # 0x225fc
leaq 0x14680(%rip), %rsi     # 0x216da
leaq 0x155ba(%rip), %rcx     # 0x2261b
movl $0xb51, %edx            # imm = 0xB51
callq 0x4180
leaq 0x155ed(%rip), %rdi     # 0x2265f
leaq 0x14661(%rip), %rsi     # 0x216da
leaq 0x1559b(%rip), %rcx     # 0x2261b
movl $0xb53, %edx            # imm = 0xB53
callq 0x4180
leaq 0x16876(%rip), %rdi     # 0x23907
leaq 0x14642(%rip), %rsi     # 0x216da
leaq 0x167f1(%rip), %rcx     # 0x23890
movl $0xb73, %edx            # imm = 0xB73
callq 0x4180
leaq 0x1687f(%rip), %rdi     # 0x2392f
leaq 0x14623(%rip), %rsi     # 0x216da
leaq 0x167d2(%rip), %rcx     # 0x23890
movl $0xb74, %edx            # imm = 0xB74
callq 0x4180
leaq 0x16881(%rip), %rdi     # 0x23950
leaq 0x14604(%rip), %rsi     # 0x216da
leaq 0x167b3(%rip), %rcx     # 0x23890
movl $0xb75, %edx            # imm = 0xB75
callq 0x4180
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x17a9a
jmp 0xd10a
jmp 0xd0fb
movq %rax, %rbx
jmp 0xd135
jmp 0xd107
movq %rax, %rbx
jmp 0xd128
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x11d5e
jmp 0xd11e
jmp 0xd159
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x127dc
leaq 0xb8(%rsp), %rdi
callq 0x17a9a
leaq 0x80(%rsp), %rdi
callq 0x11d5e
jmp 0xd14b
jmp 0xd148
jmp 0xd148
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x127dc
jmp 0xd166
jmp 0xd159
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x17a9a
movq %rbx, %rdi
callq 0x43b0