// File: /workspace/github_c_makefile_star2_O1/akumrao[P]videoAnalyzer/core/pixel.c
// Function: pixel_satd_wxh(unsigned char*, int, unsigned char*, int, int, int)
static int pixel_satd_wxh( uint8_t *pix1, int i_pix1, uint8_t *pix2, int i_pix2, int i_width, int i_height )
{
    int16_t tmp[4][4];
    int16_t diff[4][4];
    int x, y;
    int i_satd = 0;

    for( y = 0; y < i_height; y += 4 )
    {
        for( x = 0; x < i_width; x += 4 )
        {
            int d;

            pixel_sub_4x4( diff, &pix1[x], i_pix1, &pix2[x], i_pix2 );

            for( d = 0; d < 4; d++ )
            {
                int s01, s23;
                int d01, d23;

                s01 = diff[d][0] + diff[d][1]; s23 = diff[d][2] + diff[d][3];
                d01 = diff[d][0] - diff[d][1]; d23 = diff[d][2] - diff[d][3];

                tmp[d][0] = s01 + s23;
                tmp[d][1] = s01 - s23;
                tmp[d][2] = d01 - d23;
                tmp[d][3] = d01 + d23;
            }
            for( d = 0; d < 4; d++ )
            {
                int s01, s23;
                int d01, d23;

                s01 = tmp[0][d] + tmp[1][d]; s23 = tmp[2][d] + tmp[3][d];
                d01 = tmp[0][d] - tmp[1][d]; d23 = tmp[2][d] - tmp[3][d];

                i_satd += abs( s01 + s23 ) + abs( s01 - s23 ) + abs( d01 - d23 ) + abs( d01 + d23 );
            }

        }
        pix1 += 4 * i_pix1;
        pix2 += 4 * i_pix2;
    }

    return i_satd / 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %r9d, -0x30(%rbp)
testl %r9d, %r9d
jle 0xaa87
movslq %esi, %rax
movslq %ecx, %rcx
leal (,%rax,4), %esi
movslq %esi, %rsi
movq %rsi, -0x60(%rbp)
leal (,%rcx,4), %esi
movslq %esi, %rsi
movq %rsi, -0x58(%rbp)
movslq %r8d, %r11
xorl %esi, %esi
xorl %r15d, %r15d
movl %r8d, -0x2c(%rbp)
movq %rsi, -0x68(%rbp)
testl %r8d, %r8d
jle 0xaa5e
xorl %r12d, %r12d
leaq (%rdi,%r12), %r13
leaq (%rdx,%r12), %rsi
leaq -0x90(%rbp), %r14
xorl %r8d, %r8d
xorl %r9d, %r9d
movzbl (%r13,%r9), %ebx
movzbl (%rsi,%r9), %r10d
subl %r10d, %ebx
movw %bx, (%r14,%r9,2)
incq %r9
cmpq $0x4, %r9
jne 0xa948
addq %rax, %r13
addq %rcx, %rsi
incq %r8
addq $0x8, %r14
cmpq $0x4, %r8
jne 0xa945
xorl %esi, %esi
movzwl -0x90(%rbp,%rsi,8), %r8d
movzwl -0x8e(%rbp,%rsi,8), %r9d
leal (%r9,%r8), %r10d
movzwl -0x8c(%rbp,%rsi,8), %ebx
movzwl -0x8a(%rbp,%rsi,8), %r14d
leal (%r14,%rbx), %r13d
subl %r9d, %r8d
subl %r14d, %ebx
leal (%r10,%r13), %r9d
movw %r9w, -0x50(%rbp,%rsi,8)
subl %r13d, %r10d
movw %r10w, -0x4e(%rbp,%rsi,8)
movl %r8d, %r9d
subl %ebx, %r9d
movw %r9w, -0x4c(%rbp,%rsi,8)
addl %r8d, %ebx
movw %bx, -0x4a(%rbp,%rsi,8)
incq %rsi
cmpq $0x4, %rsi
jne 0xa979
movq $-0x4, %r13
movswl -0x48(%rbp,%r13,2), %esi
movswl -0x40(%rbp,%r13,2), %r9d
leal (%r9,%rsi), %r10d
movswl -0x38(%rbp,%r13,2), %r8d
movswl -0x30(%rbp,%r13,2), %ebx
leal (%rbx,%r8), %r14d
subl %r9d, %esi
subl %ebx, %r8d
leal (%r14,%r10), %r9d
movl %r9d, %ebx
negl %ebx
cmovsl %r9d, %ebx
subl %r14d, %r10d
movl %r10d, %r9d
negl %r9d
cmovsl %r10d, %r9d
movl %esi, %r10d
subl %r8d, %r10d
movl %r10d, %r14d
negl %r14d
cmovsl %r10d, %r14d
addl %esi, %r8d
movl %r8d, %esi
negl %esi
cmovsl %r8d, %esi
addl %r15d, %r9d
addl %ebx, %r14d
addl %r9d, %r14d
movl %r14d, %r15d
addl %esi, %r15d
incq %r13
jne 0xa9e1
addq $0x4, %r12
cmpq %r11, %r12
jl 0xa933
addq -0x60(%rbp), %rdi
addq -0x58(%rbp), %rdx
movq -0x68(%rbp), %rsi
addl $0x4, %esi
cmpl -0x30(%rbp), %esi
movl -0x2c(%rbp), %r8d
jl 0xa923
movl %r15d, %eax
shrl $0x1f, %eax
addl %r15d, %eax
sarl %eax
jmp 0xaa89
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq