// File: /workspace/github_cpp_makefile_star2_O2/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
testl %ecx, %ecx
je 0x2ab0
movl (%rbx), %edx
cvtsi2sd %ecx, %xmm1
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0x29be
movsd 0x38(%rbx), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rbx)
leal -0x1(%rdx), %eax
cmpl $0x2, %eax
jae 0x29d6
movsd 0x40(%rbx), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rbx)
jmp 0x29db
movsd 0x40(%rbx), %xmm0
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdi
movsd 0x38(%rbx), %xmm1
xorl %r8d, %r8d
testl %ecx, %ecx
movl $0x0, %r9d
cmovgl %ecx, %r9d
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpq %r8, %r9
je 0x2a49
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0x2a23
movsd (%rsi,%r8,8), %xmm2
subsd %xmm1, %xmm2
cvtsi2sd %ebp, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %ebp
cmpl $0x1, %eax
ja 0x2a44
movsd (%rdi,%r8,8), %xmm2
subsd %xmm0, %xmm2
cvtsi2sd %r14d, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %r14d
incq %r8
jmp 0x29fc
testl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
jne 0x2a7c
decl %ecx
movl %ebp, %eax
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x2a6c
sqrtsd %xmm0, %xmm0
jmp 0x2a71
callq 0x20e0
cvttsd2si %xmm0, %ebp
movl (%rbx), %eax
movl 0x50(%rbx), %ecx
decl %eax
cmpl $0x1, %eax
ja 0x2a9d
decl %ecx
movl %r14d, %eax
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x2aa2
sqrtsd %xmm0, %xmm0
jmp 0x2aa7
movl %ecx, %r15d
jmp 0x2ab0
callq 0x20e0
cvttsd2si %xmm0, %r14d
movl 0x50(%rbx), %r15d
movq 0x3529(%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 0x177a(%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