// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/libraries/libwebp/src/dsp/lossless_sse2.c
// Function: PredictorAdd11_SSE2
static void PredictorAdd11_SSE2(const uint32_t* in, const uint32_t* upper,
                                int num_pixels, uint32_t* out) {
  int i;
  __m128i pa;
  __m128i L = _mm_cvtsi32_si128((int)out[-1]);
  for (i = 0; i + 4 <= num_pixels; i += 4) {
    __m128i T = _mm_loadu_si128((const __m128i*)&upper[i]);
    __m128i TL = _mm_loadu_si128((const __m128i*)&upper[i - 1]);
    __m128i src = _mm_loadu_si128((const __m128i*)&in[i]);
    {
      // We can unpack with any value on the upper 32 bits, provided it's the
      // same on both operands (so that their sum of abs diff is zero). Here we
      // use T.
      const __m128i T_lo = _mm_unpacklo_epi32(T, T);
      const __m128i TL_lo = _mm_unpacklo_epi32(TL, T);
      const __m128i T_hi = _mm_unpackhi_epi32(T, T);
      const __m128i TL_hi = _mm_unpackhi_epi32(TL, T);
      const __m128i s_lo = _mm_sad_epu8(T_lo, TL_lo);
      const __m128i s_hi = _mm_sad_epu8(T_hi, TL_hi);
      pa = _mm_packs_epi32(s_lo, s_hi);  // pa = sum |T-TL|
    }
    DO_PRED11(0);
    DO_PRED11_SHIFT;
    DO_PRED11(1);
    DO_PRED11_SHIFT;
    DO_PRED11(2);
    DO_PRED11_SHIFT;
    DO_PRED11(3);
  }
  if (i != num_pixels) {
    VP8LPredictorsAdd_C[11](in + i, upper + i, num_pixels - i, out + i);
  }
}

// Assembly:
xorl %r9d, %r9d
cmpl $0x4, %edx
jl 0xe7a74
movd -0x4(%rcx), %xmm7
movl %edx, %eax
xorl %r9d, %r9d
pxor %xmm0, %xmm0
movq %r9, %r8
movdqu -0x4(%rsi,%r9,4), %xmm1
movdqu (%rsi,%r9,4), %xmm3
movdqu (%rdi,%r9,4), %xmm2
pshufd $0x50, %xmm3, %xmm8     # xmm8 = xmm3[0,0,1,1]
movdqa %xmm1, %xmm9
punpckldq %xmm3, %xmm9    # xmm9 = xmm9[0],xmm3[0],xmm9[1],xmm3[1]
pshufd $0xfa, %xmm3, %xmm5     # xmm5 = xmm3[2,2,3,3]
movdqa %xmm1, %xmm6
punpckhdq %xmm3, %xmm6    # xmm6 = xmm6[2],xmm3[2],xmm6[3],xmm3[3]
psadbw %xmm9, %xmm8
psadbw %xmm6, %xmm5
packssdw %xmm5, %xmm8
movdqa %xmm7, %xmm4
punpckldq %xmm3, %xmm4    # xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1]
psadbw %xmm9, %xmm4
pcmpgtd %xmm8, %xmm4
pand %xmm4, %xmm7
pandn %xmm3, %xmm4
por %xmm7, %xmm4
paddb %xmm2, %xmm4
movdqa %xmm3, %xmm9
psrldq $0x4, %xmm9             # xmm9 = xmm9[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
pshufd $0xe9, %xmm1, %xmm7     # xmm7 = xmm1[1,2,2,3]
movdqa %xmm2, %xmm10
psrldq $0x4, %xmm10            # xmm10 = xmm10[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
psrldq $0x4, %xmm8             # xmm8 = xmm8[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
movdqa %xmm4, %xmm11
punpckldq %xmm9, %xmm11   # xmm11 = xmm11[0],xmm9[0],xmm11[1],xmm9[1]
punpckldq %xmm9, %xmm7    # xmm7 = xmm7[0],xmm9[0],xmm7[1],xmm9[1]
psadbw %xmm11, %xmm7
pcmpgtd %xmm8, %xmm7
movdqa %xmm4, %xmm8
pand %xmm7, %xmm8
pandn %xmm9, %xmm7
por %xmm8, %xmm7
paddb %xmm10, %xmm7
movdqa %xmm3, %xmm8
psrldq $0x8, %xmm8             # xmm8 = xmm8[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
movdqa %xmm2, %xmm9
psrldq $0x8, %xmm9             # xmm9 = xmm9[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
packssdw %xmm0, %xmm5
movdqa %xmm7, %xmm10
punpckldq %xmm7, %xmm4    # xmm4 = xmm4[0],xmm7[0],xmm4[1],xmm7[1]
punpckldq %xmm8, %xmm7    # xmm7 = xmm7[0],xmm8[0],xmm7[1],xmm8[1]
psadbw %xmm6, %xmm7
pcmpgtd %xmm5, %xmm7
pand %xmm7, %xmm10
pandn %xmm8, %xmm7
por %xmm10, %xmm7
paddb %xmm9, %xmm7
psrldq $0xc, %xmm3             # xmm3 = xmm3[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
psrldq $0xc, %xmm2             # xmm2 = xmm2[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
psrldq $0x4, %xmm5             # xmm5 = xmm5[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
movdqa %xmm7, %xmm6
punpckldq %xmm3, %xmm6    # xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
psrldq $0xc, %xmm1             # xmm1 = xmm1[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
psadbw %xmm6, %xmm1
pcmpgtd %xmm5, %xmm1
movdqa %xmm7, %xmm5
pand %xmm1, %xmm5
pandn %xmm3, %xmm1
por %xmm5, %xmm1
paddb %xmm2, %xmm1
punpckldq %xmm1, %xmm7    # xmm7 = xmm7[0],xmm1[0],xmm7[1],xmm1[1]
punpcklqdq %xmm7, %xmm4    # xmm4 = xmm4[0],xmm7[0]
movdqu %xmm4, (%rcx,%r9,4)
addq $0x4, %r9
addq $0x8, %r8
movdqa %xmm1, %xmm7
cmpq %rax, %r8
jbe 0xe791b
subl %r9d, %edx
jne 0xe7a7a
retq
leaq 0x94acf(%rip), %rax     # 0x17c550
movq 0x58(%rax), %rax
movl %r9d, %r8d
leaq (%rdi,%r8,4), %rdi
leaq (%rsi,%r8,4), %rsi
leaq (%rcx,%r8,4), %rcx
jmpq *%rax