// File: /workspace/github_cpp_makefile_star2_O3/zhangk145[P]video_envalue/Envaluer.cpp
// Function: Envaluer::ssim_4x4x2_core(unsigned char const*, int, unsigned char const*, int, int (*) [4])
void Envaluer::ssim_4x4x2_core(const uint8_t *pix1, int stride1,
                               const uint8_t *pix2, int stride2,
                               int sums[2][4])
{
    int x, y, z;
    for(z=0; z<2; z++)
    {
        uint32_t s1=0, s2=0, ss=0, s12=0;
        for(y=0; y<4; y++)
            for(x=0; x<4; x++)
            {
                int a = pix1[x+y*stride1];
                int b = pix2[x+y*stride2];
                s1  += a;
                s2  += b;
                ss  += a*a;
                ss  += b*b;
                s12 += a*b;
            }
        sums[z][0] = s1;
        sums[z][1] = s2;
        sums[z][2] = ss;
        sums[z][3] = s12;
        pix1 += 4;
        pix2 += 4;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movslq %edx, %rax
movslq %r8d, %rdx
movb $0x1, %dil
xorl %r8d, %r8d
pxor %xmm0, %xmm0
movl $0x4, %r10d
movq %rsi, %r11
movq %rcx, %rbx
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %r12d, %r12d
movd %ebp, %xmm4
movd %r14d, %xmm5
movd %r15d, %xmm2
movd %r12d, %xmm6
movd (%rbx), %xmm3
punpcklbw %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7]
movdqa %xmm3, %xmm1
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
paddd %xmm2, %xmm1
movd (%r11), %xmm7
punpcklbw %xmm0, %xmm7    # xmm7 = xmm7[0],xmm0[0],xmm7[1],xmm0[1],xmm7[2],xmm0[2],xmm7[3],xmm0[3],xmm7[4],xmm0[4],xmm7[5],xmm0[5],xmm7[6],xmm0[6],xmm7[7],xmm0[7]
movdqa %xmm7, %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
paddd %xmm6, %xmm2
movdqa %xmm3, %xmm6
pmullw %xmm7, %xmm6
punpcklwd %xmm0, %xmm6    # xmm6 = xmm6[0],xmm0[0],xmm6[1],xmm0[1],xmm6[2],xmm0[2],xmm6[3],xmm0[3]
paddd %xmm4, %xmm6
pmullw %xmm7, %xmm7
punpcklwd %xmm0, %xmm7    # xmm7 = xmm7[0],xmm0[0],xmm7[1],xmm0[1],xmm7[2],xmm0[2],xmm7[3],xmm0[3]
paddd %xmm5, %xmm7
pmullw %xmm3, %xmm3
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
paddd %xmm7, %xmm3
pshufd $0xee, %xmm6, %xmm4     # xmm4 = xmm6[2,3,2,3]
paddd %xmm6, %xmm4
pshufd $0x55, %xmm4, %xmm5     # xmm5 = xmm4[1,1,1,1]
paddd %xmm4, %xmm5
movd %xmm5, %ebp
pshufd $0xee, %xmm3, %xmm4     # xmm4 = xmm3[2,3,2,3]
paddd %xmm3, %xmm4
pshufd $0x55, %xmm4, %xmm3     # xmm3 = xmm4[1,1,1,1]
paddd %xmm4, %xmm3
movd %xmm3, %r14d
pshufd $0xee, %xmm1, %xmm3     # xmm3 = xmm1[2,3,2,3]
paddd %xmm1, %xmm3
pshufd $0x55, %xmm3, %xmm1     # xmm1 = xmm3[1,1,1,1]
paddd %xmm3, %xmm1
movd %xmm1, %r15d
pshufd $0xee, %xmm2, %xmm1     # xmm1 = xmm2[2,3,2,3]
paddd %xmm2, %xmm1
pshufd $0x55, %xmm1, %xmm2     # xmm2 = xmm1[1,1,1,1]
paddd %xmm1, %xmm2
movd %xmm2, %r12d
addq %rdx, %rbx
addq %rax, %r11
decq %r10
jne 0x2bb3
shlq $0x4, %r8
movl %r12d, (%r9,%r8)
movl %r15d, 0x4(%r9,%r8)
movl %r14d, 0x8(%r9,%r8)
movl %ebp, 0xc(%r9,%r8)
addq $0x4, %rsi
addq $0x4, %rcx
movl $0x1, %r8d
testb $0x1, %dil
movl $0x0, %edi
jne 0x2b9c
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq