// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
movq %rax, %rdx
subq %r15, %rdx
movq 0x80(%rdi), %rcx
subq 0x78(%rdi), %rcx
cmpq %rcx, %rdx
jne 0xe4b6
movq %rdx, %r8
movl 0xc(%rdi), %ecx
leal -0x1(%rcx), %edx
cmpl $0x1, %edx
ja 0xdf14
movq 0x110(%rdi), %rsi
subq 0x108(%rdi), %rsi
cmpq %rsi, %r8
jne 0xe4f4
leaq 0x78(%rdi), %rsi
movq %rsi, 0x68(%rsp)
cmpl $0x2, %edx
movq %rdi, (%rsp)
jb 0xdf75
testl %ecx, %ecx
je 0xdf33
cmpl $0x4, %ecx
jne 0xe3ed
movq (%rsp), %rbx
movq 0x108(%rbx), %r14
movq %r15, %rdi
callq 0x1ac7c
movq %rdx, 0x8(%rsp)
movq (%r14), %rdi
movq 0x8(%r14), %rcx
movq %rcx, %rsi
subq %rdi, %rsi
je 0xe159
sarq $0x3, %rsi
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rsi, %rdx
jmp 0xe15b
cmpq %r15, %rax
je 0xe143
sarq $0x3, %r8
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r8
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
leaq 0xd8(%rdi), %rcx
movq %rcx, 0x78(%rsp)
cmpq $0x1, %r8
adcq $0x0, %r8
movq %r8, 0x70(%rsp)
xorl %ecx, %ecx
leaq 0x30(%rsp), %r15
addq $0x3f, %rax
movq %rax, 0x28(%rsp)
movq %rcx, 0x10(%rsp)
leaq (,%rcx,8), %rax
leaq (%rax,%rax,2), %r14
movq 0x60(%rdi), %rax
addq %r14, %rax
movq 0x108(%rdi), %rbx
movq %rax, 0x20(%rsp)
movq %rax, %rdi
callq 0x1ac7c
movq %rax, %r12
movq %rdx, %rbp
movq (%rbx,%r14), %rax
movq 0x8(%rbx,%r14), %rdx
subq %rax, %rdx
je 0xe025
sarq $0x3, %rdx
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rdx
movq 0x10(%rax), %rcx
movl 0x18(%rax), %esi
subq (%rax), %rcx
leaq (%rsi,%rcx,8), %rcx
jmp 0xe029
xorl %edx, %edx
xorl %ecx, %ecx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1a680
testb %al, %al
je 0xe497
movq %r15, %r13
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x1a8c0
testq %r12, %r12
je 0xe114
addq %r14, %rbx
xorl %r14d, %r14d
movq %r12, 0x18(%rsp)
testq %rbp, %rbp
je 0xe103
leaq (%r14,%r14,4), %r15
xorl %r12d, %r12d
movq (%rbx), %rax
leaq 0x3f(%r12), %rcx
testq %r12, %r12
cmovnsq %r12, %rcx
sarq $0x6, %rcx
shlq $0x3, %rcx
addq (%rax,%r15,8), %rcx
movq %r12, %rax
andq 0x28(%rsp), %rax
xorl %edx, %edx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
cmpq %rsi, %rax
setbe %dl
movq -0x8(%rcx,%rdx,8), %rax
btq %r12, %rax
jae 0xe0e0
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x1ae76
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x1ae76
movsd 0x8(%rsp), %xmm0
jmp 0xe0ee
movq %r13, %rdi
movq %r14, %rsi
callq 0x1ae76
xorps %xmm0, %xmm0
movq (%rax), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
cmpq %r12, %rbp
jne 0xe071
incq %r14
movq 0x18(%rsp), %r12
cmpq %r12, %r14
jne 0xe061
movq 0x78(%rsp), %rdi
movq %r13, %r15
movq %r13, %rsi
callq 0x13a14
movq %r15, %rdi
callq 0x1acb6
movq 0x10(%rsp), %rcx
incq %rcx
cmpq 0x70(%rsp), %rcx
movq (%rsp), %rdi
jne 0xdfc3
addq $0xf0, %rdi
movq 0x68(%rsp), %rsi
callq 0x1429e
jmp 0xe3ed
xorl %edx, %edx
cmpq %rdx, %rax
jne 0xe513
cmpq %rdi, %rcx
je 0xe4d5
movq 0x10(%rdi), %rcx
movl 0x18(%rdi), %edx
subq (%rdi), %rcx
leaq (%rdx,%rcx,8), %rcx
cmpq $0x1, %rcx
jne 0xe4d5
movq 0x80(%rbx), %rcx
subq 0x78(%rbx), %rcx
cmpq $0x18, %rcx
jne 0xe532
testq %rax, %rax
je 0xe3ed
movq (%rsp), %rcx
leaq 0xd8(%rcx), %rdx
movq %rdx, 0x28(%rsp)
addq $0xf0, %rcx
movq %rcx, 0x18(%rsp)
xorl %ebp, %ebp
leaq 0xa0(%rsp), %rbx
movq %r14, 0x20(%rsp)
movq %rax, 0x10(%rsp)
movq (%r14), %rdx
leaq (,%rbp,4), %rcx
addq %rbp, %rcx
movq (%rdx,%rcx,8), %rcx
testb $0x1, (%rcx)
je 0xe3e1
movq %rbx, %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0xe2b4
xorl %ebx, %ebx
movq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq (%rsp), %rax
movq 0x3f0(%rax), %rdi
testq %rdi, %rdi
je 0xe269
movq (%rdi), %rax
callq *0x250(%rax)
testl %eax, %eax
jne 0xe269
movq (%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 0xe478
movq (%rcx), %rax
movq (%rax,%r12), %rax
testb $0x1, (%rax)
je 0xe2a3
movq %r15, %rdi
movq %rbp, %rsi
callq 0x1ae76
movq (%rax), %rdx
addq %rbx, %rdx
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0xe299
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0xe2a3
leaq 0x30(%rsp), %rdi
callq 0x17770
addq $0x28, %r12
addq $0x8, %rbx
decq %r14
jne 0xe218
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
movq %r13, %rbx
movq %r13, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1468c
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1aa86
leaq 0x80(%rsp), %r13
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x13a14
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
movq %rbp, %rsi
callq 0x1ae76
movq 0x20(%rsp), %r14
movq (%rax), %rdx
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0xe34b
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x58(%rsp)
jmp 0xe355
leaq 0x50(%rsp), %rdi
callq 0x17770
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x1468c
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x1aa86
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x13a14
movq %r12, %rdi
callq 0x1acb6
movq %r13, %rdi
callq 0x146b8
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xe3b8
callq 0x4230
leaq 0xb8(%rsp), %rdi
callq 0x1acb6
movq %rbx, %rdi
callq 0x146b8
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xe3dc
callq 0x4230
movq 0x10(%rsp), %rax
incq %rbp
cmpq %rax, %rbp
jne 0xe1d3
movq (%rsp), %rdx
movl 0xc(%rdx), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0xe44a
testl %eax, %eax
je 0xe405
cmpl $0x4, %eax
jne 0xe466
movups 0x398(%rdx), %xmm0
movups %xmm0, 0x3b0(%rdx)
movq 0x3a8(%rdx), %rax
movq %rax, 0x3c0(%rdx)
movq 0xe0(%rdx), %rax
subq 0xd8(%rdx), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movq %rax, 0x3b0(%rdx)
jmp 0xe466
movq 0x3a8(%rdx), %rax
movq %rax, 0x3c0(%rdx)
movups 0x398(%rdx), %xmm0
movups %xmm0, 0x3b0(%rdx)
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b591(%rip), %rdi     # 0x29a10
leaq 0x192c4(%rip), %rsi     # 0x2774a
leaq 0x1b4aa(%rip), %rcx     # 0x29937
movl $0xb84, %edx            # imm = 0xB84
callq 0x4160
leaq 0x1b47d(%rip), %rdi     # 0x2991b
leaq 0x192a5(%rip), %rsi     # 0x2774a
leaq 0x1b48b(%rip), %rcx     # 0x29937
movl $0xb59, %edx            # imm = 0xB59
callq 0x4160
leaq 0x1a1ee(%rip), %rdi     # 0x286ab
leaq 0x19286(%rip), %rsi     # 0x2774a
leaq 0x1a1ff(%rip), %rcx     # 0x286ca
movl $0xb51, %edx            # imm = 0xB51
callq 0x4160
leaq 0x1b4fa(%rip), %rdi     # 0x299d6
leaq 0x19267(%rip), %rsi     # 0x2774a
leaq 0x1b44d(%rip), %rcx     # 0x29937
movl $0xb74, %edx            # imm = 0xB74
callq 0x4160
leaq 0x1a213(%rip), %rdi     # 0x2870e
leaq 0x19248(%rip), %rsi     # 0x2774a
leaq 0x1a1c1(%rip), %rcx     # 0x286ca
movl $0xb53, %edx            # imm = 0xB53
callq 0x4160
leaq 0x1b494(%rip), %rdi     # 0x299ae
leaq 0x19229(%rip), %rsi     # 0x2774a
leaq 0x1b40f(%rip), %rcx     # 0x29937
movl $0xb73, %edx            # imm = 0xB73
callq 0x4160
leaq 0x1b4be(%rip), %rdi     # 0x299f7
leaq 0x1920a(%rip), %rsi     # 0x2774a
leaq 0x1b3f0(%rip), %rcx     # 0x29937
movl $0xb75, %edx            # imm = 0xB75
callq 0x4160
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x1acb6
jmp 0xe56f
jmp 0xe56c
movq %rax, %rbx
jmp 0xe595
jmp 0xe57e
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x146b8
jmp 0xe586
movq %rax, %rbx
jmp 0xe5a2
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xe595
callq 0x4230
leaq 0xb8(%rsp), %rdi
callq 0x1acb6
leaq 0xa0(%rsp), %rdi
callq 0x146b8
jmp 0xe5b8
jmp 0xe5c9
jmp 0xe5b5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xe5d6
callq 0x4230
jmp 0xe5d6
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x1acb6
movq %rbx, %rdi
callq 0x43e0