// File: /workspace/github_cpp_makefile_star2_O1/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 %ebp, %ebp
movl $0x0, %r14d
testq %rcx, %rcx
je 0x2523
movl (%rbx), %eax
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0x2442
cvtsi2sd %ecx, %xmm0
movsd 0x38(%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rbx)
leal -0x1(%rax), %edx
cmpl $0x1, %edx
ja 0x245c
cvtsi2sd %ecx, %xmm0
movsd 0x40(%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rbx)
xorl %ebp, %ebp
testl %ecx, %ecx
jle 0x24c6
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, %eax       # imm = 0xFFFFFFFD
jne 0x249d
movsd (%rsi,%r8,8), %xmm2
subsd %xmm0, %xmm2
cvtsi2sd %ebp, %xmm3
mulsd %xmm2, %xmm2
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %ebp
cmpl $0x1, %edx
ja 0x24be
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 0x247c
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0x24f1
decl %ecx
movl %ebp, %eax
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x24e8
sqrtsd %xmm0, %xmm0
jmp 0x24ed
callq 0x20e0
cvttsd2si %xmm0, %ebp
movl (%rbx), %eax
decl %eax
cmpl $0x1, %eax
ja 0x2523
movl 0x50(%rbx), %ecx
decl %ecx
movl %r14d, %eax
cltd
idivl %ecx
cvtsi2sd %eax, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x2519
sqrtsd %xmm0, %xmm0
jmp 0x251e
callq 0x20e0
cvttsd2si %xmm0, %r14d
movq 0x3ab6(%rip), %rax      # 0x5fe0
movq (%rax), %r15
movl 0x50(%rbx), %r12d
callq 0x2030
subq 0x48(%rbx), %rax
movl $0xf4240, %ecx          # imm = 0xF4240
cqto
idivq %rcx
movsd 0x38(%rbx), %xmm0
movsd 0x40(%rbx), %xmm1
leaq 0x1d03(%rip), %rsi      # 0x4258
movq %r15, %rdi
movl %r12d, %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