// File: /workspace/github_c_makefile_star2_O2/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:
movd -0x4(%rcx), %xmm7
movslq %edx, %r8
xorl %eax, %eax
pxor %xmm0, %xmm0
xorl %r10d, %r10d
leaq 0x4(%r10), %r9
cmpq %r8, %r9
jg 0xd9fd1
movdqu -0x4(%rsi,%rax), %xmm1
movdqu (%rsi,%rax), %xmm3
movdqu (%rdi,%rax), %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, %xmm7
psrldq $0x4, %xmm7             # xmm7 = xmm7[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
pshufd $0xe9, %xmm1, %xmm9     # xmm9 = 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 %xmm7, %xmm11   # xmm11 = xmm11[0],xmm7[0],xmm11[1],xmm7[1]
punpckldq %xmm7, %xmm9    # xmm9 = xmm9[0],xmm7[0],xmm9[1],xmm7[1]
psadbw %xmm11, %xmm9
pcmpgtd %xmm8, %xmm9
movdqa %xmm4, %xmm8
pand %xmm9, %xmm8
pandn %xmm7, %xmm9
por %xmm8, %xmm9
paddb %xmm10, %xmm9
punpckldq %xmm9, %xmm4    # xmm4 = xmm4[0],xmm9[0],xmm4[1],xmm9[1]
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, %xmm10
psrldq $0x8, %xmm10            # xmm10 = xmm10[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
packssdw %xmm0, %xmm5
movdqa %xmm9, %xmm7
punpckldq %xmm8, %xmm7    # xmm7 = xmm7[0],xmm8[0],xmm7[1],xmm8[1]
psadbw %xmm6, %xmm7
pcmpgtd %xmm5, %xmm7
pand %xmm7, %xmm9
pandn %xmm8, %xmm7
por %xmm9, %xmm7
paddb %xmm10, %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,%rax)
addq $0x10, %rax
movq %r9, %r10
movdqa %xmm1, %xmm7
jmp 0xd9e77
cmpl %r10d, %edx
jne 0xd9fd7
retq
leaq 0x97732(%rip), %r8      # 0x171710
movq 0x58(%r8), %r8
addq %rax, %rdi
addq %rax, %rsi
subl %r10d, %edx
addq %rax, %rcx
jmpq *%r8