// File: /workspace/github_cpp_makefile_star2_O3/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 0xe419
movq %rdx, %r8
movl 0xc(%rdi), %ecx
leal -0x1(%rcx), %edx
cmpl $0x1, %edx
ja 0xde88
movq 0x110(%rdi), %rsi
subq 0x108(%rdi), %rsi
cmpq %rsi, %r8
jne 0xe438
leaq 0x78(%rdi), %rsi
movq %rsi, 0x68(%rsp)
cmpl $0x2, %edx
movq %rdi, (%rsp)
jb 0xe173
testl %ecx, %ecx
je 0xdeab
cmpl $0x4, %ecx
jne 0xe350
movq (%rsp), %rbx
movq 0x108(%rbx), %r14
movq %r15, %rdi
callq 0x1abb8
movq %rdx, 0x8(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rcx
subq %rsi, %rcx
je 0xe457
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rdx
cmpq %rdx, %rax
jne 0xe47b
movq 0x10(%rsi), %rcx
movl 0x18(%rsi), %edx
subq (%rsi), %rcx
leaq (%rdx,%rcx,8), %rcx
cmpq $0x1, %rcx
jne 0xe45c
movq 0x80(%rbx), %rcx
subq 0x78(%rbx), %rcx
cmpq $0x18, %rcx
jne 0xe49a
testq %rax, %rax
je 0xe350
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 0xe162
movq %rbx, %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0xe035
xorl %ebx, %ebx
movq 0x8(%rsp), %r14
xorl %r12d, %r12d
movq (%rsp), %rax
movq 0x3f0(%rax), %rdi
testq %rdi, %rdi
je 0xdfea
movq (%rdi), %rax
callq *0x250(%rax)
testl %eax, %eax
jne 0xdfea
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 0xe3db
movq (%rcx), %rax
movq (%rax,%r12), %rax
testb $0x1, (%rax)
je 0xe024
movq %r15, %rdi
movq %rbp, %rsi
callq 0x1adb2
movq (%rax), %rdx
addq %rbx, %rdx
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0xe01a
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0xe024
leaq 0x30(%rsp), %rdi
callq 0x17694
addq $0x28, %r12
addq $0x8, %rbx
decq %r14
jne 0xdf99
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
movq %r13, %rbx
movq %r13, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1454c
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1a9c6
leaq 0x80(%rsp), %r13
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x138a4
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
movq %rbp, %rsi
callq 0x1adb2
movq 0x20(%rsp), %r14
movq (%rax), %rdx
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0xe0cc
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x58(%rsp)
jmp 0xe0d6
leaq 0x50(%rsp), %rdi
callq 0x17694
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x1454c
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x1a9c6
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x138a4
movq %r12, %rdi
callq 0x1abf2
movq %r13, %rdi
callq 0x14578
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xe139
callq 0x4230
leaq 0xb8(%rsp), %rdi
callq 0x1abf2
movq %rbx, %rdi
callq 0x14578
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xe15d
callq 0x4230
movq 0x10(%rsp), %rax
incq %rbp
cmpq %rax, %rbp
jne 0xdf54
jmp 0xe350
cmpq %r15, %rax
je 0xe33f
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 0x1abb8
movq %rax, %r12
movq %rdx, %rbp
movq (%rbx,%r14), %rax
movq 0x8(%rbx,%r14), %rdx
subq %rax, %rdx
je 0xe211
movq 0x10(%rax), %rcx
movl 0x18(%rax), %esi
subq (%rax), %rcx
leaq (%rsi,%rcx,8), %rcx
jmp 0xe213
xorl %ecx, %ecx
sarq $0x3, %rdx
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rdx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1a5e0
testb %al, %al
je 0xe3fa
movq %r15, %r13
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x1a800
testq %r12, %r12
je 0xe310
addq %r14, %rbx
xorl %r14d, %r14d
movq %r12, 0x18(%rsp)
testq %rbp, %rbp
je 0xe2ff
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 0xe2dc
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x1adb2
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x1adb2
movsd 0x8(%rsp), %xmm0
jmp 0xe2ea
movq %r13, %rdi
movq %r14, %rsi
callq 0x1adb2
xorps %xmm0, %xmm0
movq (%rax), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
cmpq %r12, %rbp
jne 0xe26d
incq %r14
movq 0x18(%rsp), %r12
cmpq %r12, %r14
jne 0xe25d
movq 0x78(%rsp), %rdi
movq %r13, %r15
movq %r13, %rsi
callq 0x138a4
movq %r15, %rdi
callq 0x1abf2
movq 0x10(%rsp), %rcx
incq %rcx
cmpq 0x70(%rsp), %rcx
movq (%rsp), %rdi
jne 0xe1c1
addq $0xf0, %rdi
movq 0x68(%rsp), %rsi
callq 0x14112
movq (%rsp), %rdx
movl 0xc(%rdx), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0xe3ad
testl %eax, %eax
je 0xe368
cmpl $0x4, %eax
jne 0xe3c9
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 0xe3c9
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 0x1b5ef(%rip), %rdi     # 0x299d1
leaq 0x19361(%rip), %rsi     # 0x2774a
leaq 0x1b508(%rip), %rcx     # 0x298f8
movl $0xb84, %edx            # imm = 0xB84
callq 0x4160
leaq 0x1b4db(%rip), %rdi     # 0x298dc
leaq 0x19342(%rip), %rsi     # 0x2774a
leaq 0x1b4e9(%rip), %rcx     # 0x298f8
movl $0xb59, %edx            # imm = 0xB59
callq 0x4160
leaq 0x1a24c(%rip), %rdi     # 0x2866c
leaq 0x19323(%rip), %rsi     # 0x2774a
leaq 0x1a25d(%rip), %rcx     # 0x2868b
movl $0xb51, %edx            # imm = 0xB51
callq 0x4160
leaq 0x1a290(%rip), %rdi     # 0x286cf
leaq 0x19304(%rip), %rsi     # 0x2774a
leaq 0x1a23e(%rip), %rcx     # 0x2868b
movl $0xb53, %edx            # imm = 0xB53
callq 0x4160
testq %rax, %rax
jne 0xe47b
leaq 0x1b534(%rip), %rdi     # 0x29997
leaq 0x192e0(%rip), %rsi     # 0x2774a
leaq 0x1b487(%rip), %rcx     # 0x298f8
movl $0xb74, %edx            # imm = 0xB74
callq 0x4160
leaq 0x1b4ed(%rip), %rdi     # 0x2996f
leaq 0x192c1(%rip), %rsi     # 0x2774a
leaq 0x1b468(%rip), %rcx     # 0x298f8
movl $0xb73, %edx            # imm = 0xB73
callq 0x4160
leaq 0x1b517(%rip), %rdi     # 0x299b8
leaq 0x192a2(%rip), %rsi     # 0x2774a
leaq 0x1b449(%rip), %rcx     # 0x298f8
movl $0xb75, %edx            # imm = 0xB75
callq 0x4160
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x1abf2
jmp 0xe4d7
jmp 0xe4d4
movq %rax, %rbx
jmp 0xe4fd
jmp 0xe4e6
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x14578
jmp 0xe4ee
movq %rax, %rbx
jmp 0xe50a
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xe4fd
callq 0x4230
leaq 0xb8(%rsp), %rdi
callq 0x1abf2
leaq 0xa0(%rsp), %rdi
callq 0x14578
jmp 0xe520
jmp 0xe531
jmp 0xe51d
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xe53e
callq 0x4230
jmp 0xe53e
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x1abf2
movq %rbx, %rdi
callq 0x43e0