// File: /workspace/github_cpp_makefile_star2_O3/zhangk145[P]video_envalue/Envaluer.cpp
// Function: Envaluer::end()
void Envaluer::end() {
    double diff = 0;
    int psnr_stdv = 0;
    int ssim_stdv = 0;
    int i = 0;

    if (mCount) {
        if (mMode == EVL_PSNR || mMode == EVL_BOTH) {
            mPMean /= mCount;
        }
        if (mMode == EVL_SSIM || mMode == EVL_BOTH) {
            mSMean /= mCount;
        }
        for (psnr_stdv = 0, ssim_stdv = 0, i = 0; i < mCount; i++) {
            if (mMode == EVL_PSNR || mMode == EVL_BOTH) {
                diff = mYPsnr[i] - mPMean;
                psnr_stdv += diff * diff;
            }
            if (mMode == EVL_SSIM || mMode == EVL_BOTH) {
                diff = mYSsim[i] - mSMean;
                ssim_stdv += diff * diff;
            }
        }
        if (mMode == EVL_PSNR || mMode == EVL_BOTH) {
            psnr_stdv = sqrt(psnr_stdv / (mCount - 1));
        }
        if (mMode == EVL_SSIM || mMode == EVL_BOTH) {
            ssim_stdv = sqrt(ssim_stdv / (mCount - 1));
        }
    }

    fprintf(stderr, "%d frames (CPU: %lu s) psnr mean: %.2f ssim mean:%.2f psnr stdv: %.2f ssim stdv: %.2f\n",
            mCount, (unsigned long) ((clock() - mStartClock) / CLOCKS_PER_SEC), mPMean, mSMean, psnr_stdv, ssim_stdv);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0x50(%rdi), %ecx
xorl %r15d, %r15d
movl $0x0, %ebp
movl $0x0, %r14d
testq %rcx, %rcx
je 0x2531
movl (%rbx), %edx
cvtsi2sd %ecx, %xmm0
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0x2449
movsd 0x38(%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rbx)
leal -0x1(%rdx), %eax
cmpl $0x1, %eax
ja 0x245f
movsd 0x40(%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rbx)
xorl %ebp, %ebp
testl %ecx, %ecx
jle 0x24ca
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdi
movsd 0x38(%rbx), %xmm0
movsd 0x40(%rbx), %xmm1
xorl %r8d, %r8d
xorl %r14d, %r14d
xorl %ebp, %ebp
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0x24a1
movsd (%rsi,%r8,8), %xmm2
subsd %xmm0, %xmm2
cvtsi2sd %ebp, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %ebp
cmpl $0x1, %eax
ja 0x24c2
movsd (%rdi,%r8,8), %xmm2
subsd %xmm1, %xmm2
cvtsi2sd %r14d, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %r14d
incq %r8
cmpq %r8, %rcx
jne 0x247f
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0x24fd
decl %ecx
movl %ebp, %eax
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x24ed
sqrtsd %xmm0, %xmm0
jmp 0x24f2
callq 0x20e0
cvttsd2si %xmm0, %ebp
movl (%rbx), %eax
movl 0x50(%rbx), %ecx
decl %eax
cmpl $0x1, %eax
ja 0x251e
decl %ecx
movl %r14d, %eax
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x2523
sqrtsd %xmm0, %xmm0
jmp 0x2528
movl %ecx, %r15d
jmp 0x2531
callq 0x20e0
cvttsd2si %xmm0, %r14d
movl 0x50(%rbx), %r15d
movq 0x3aa8(%rip), %rax      # 0x5fe0
movq (%rax), %r12
callq 0x2030
subq 0x48(%rbx), %rax
movl $0xf4240, %ecx          # imm = 0xF4240
cqto
idivq %rcx
movsd 0x38(%rbx), %xmm0
movsd 0x40(%rbx), %xmm1
leaq 0x1cf9(%rip), %rsi      # 0x4258
movq %r12, %rdi
movl %r15d, %edx
movq %rax, %rcx
movl %ebp, %r8d
movl %r14d, %r9d
movb $0x2, %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2080