// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/libraries/libwebp/src/dsp/dec_sse2.c
// Function: HFilter16i_SSE2
static void HFilter16i_SSE2(uint8_t* p, int stride,
                            int thresh, int ithresh, int hev_thresh) {
  int k;
  __m128i p3, p2, p1, p0;   // loop invariants

  Load16x4_SSE2(p, p + 8 * stride, stride, &p3, &p2, &p1, &p0);  // prologue

  for (k = 3; k > 0; --k) {
    __m128i mask, tmp1, tmp2;
    uint8_t* const b = p + 2;   // beginning of p1

    p += 4;  // beginning of q0 (and next span)

    MAX_DIFF1(p3, p2, p1, p0, mask);   // compute partial mask
    Load16x4_SSE2(p, p + 8 * stride, stride, &p3, &p2, &tmp1, &tmp2);
    MAX_DIFF2(p3, p2, tmp1, tmp2, mask);

    ComplexMask_SSE2(&p1, &p0, &p3, &p2, thresh, ithresh, &mask);
    DoFilter4_SSE2(&p1, &p0, &p3, &p2, &mask, hev_thresh);

    Store16x4_SSE2(&p1, &p0, &p3, &p2, b, b + 8 * stride, stride);

    // rotate samples
    p1 = tmp1;
    p0 = tmp2;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movslq %esi, %rax
leaq (,%rax,8), %rsi
leaq (%rdi,%rax,8), %r15
leaq (%rax,%rax), %r9
leaq (%r9,%r9,2), %r9
leaq (,%rax,4), %r10
movd (%rdi,%rax,2), %xmm0
movd (%rdi,%r9), %xmm1
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movd (%rdi,%rax,4), %xmm1
movd (%rdi), %xmm2
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movq %rsi, %r11
subq %rax, %r11
leaq (%rax,%rax,2), %rbx
leaq (%rax,%rax,4), %r14
movd (%rdi,%rbx), %xmm1
movd (%rdi,%r11), %xmm3
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
punpcklbw %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
movd (%rdi,%rax), %xmm1
movd (%rdi,%r14), %xmm3
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
punpcklbw %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7]
movdqa %xmm2, %xmm1
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
punpckhwd %xmm0, %xmm2    # xmm2 = xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
movdqa %xmm1, %xmm11
punpckldq %xmm2, %xmm11   # xmm11 = xmm11[0],xmm2[0],xmm11[1],xmm2[1]
punpckhdq %xmm2, %xmm1    # xmm1 = xmm1[2],xmm2[2],xmm1[3],xmm2[3]
movd (%r15,%rax,2), %xmm0
movd (%r15,%r9), %xmm2
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movd (%rdi,%rax,8), %xmm2
movd (%r15,%rax,4), %xmm3
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
movd (%r11,%r15), %xmm3
movd (%r15,%rbx), %xmm4
punpckldq %xmm3, %xmm4    # xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1]
punpcklbw %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1],xmm0[2],xmm4[2],xmm0[3],xmm4[3],xmm0[4],xmm4[4],xmm0[5],xmm4[5],xmm0[6],xmm4[6],xmm0[7],xmm4[7]
movd (%r15,%r14), %xmm3
movd (%rax,%r15), %xmm4
punpckldq %xmm3, %xmm4    # xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1]
punpcklbw %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1],xmm2[2],xmm4[2],xmm2[3],xmm4[3],xmm2[4],xmm4[4],xmm2[5],xmm4[5],xmm2[6],xmm4[6],xmm2[7],xmm4[7]
movdqa %xmm2, %xmm3
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
punpckhwd %xmm0, %xmm2    # xmm2 = xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
movdqa %xmm3, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpckhdq %xmm2, %xmm3    # xmm3 = xmm3[2],xmm2[2],xmm3[3],xmm2[3]
movdqa %xmm11, %xmm10
punpcklqdq %xmm0, %xmm10   # xmm10 = xmm10[0],xmm0[0]
punpckhqdq %xmm0, %xmm11   # xmm11 = xmm11[1],xmm0[1]
movdqa %xmm1, %xmm12
punpcklqdq %xmm3, %xmm12   # xmm12 = xmm12[0],xmm3[0]
punpckhqdq %xmm3, %xmm1    # xmm1 = xmm1[1],xmm3[1]
movd %ecx, %xmm0
punpcklbw %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movd %edx, %xmm2
punpcklbw %xmm2, %xmm2    # xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
movd %r8d, %xmm3
punpcklbw %xmm3, %xmm3    # xmm3 = xmm3[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0]
movl $0x3, %ecx
movdqa 0x462a2(%rip), %xmm5    # 0x12b4b0
movdqa %xmm12, %xmm13
movdqa %xmm1, %xmm14
psubusb %xmm12, %xmm1
movdqa %xmm12, %xmm4
psubusb %xmm14, %xmm4
por %xmm1, %xmm4
movdqa %xmm11, %xmm1
psubusb %xmm10, %xmm1
psubusb %xmm11, %xmm10
por %xmm1, %xmm10
pmaxub %xmm4, %xmm10
movdqa %xmm12, %xmm1
psubusb %xmm11, %xmm1
psubusb %xmm12, %xmm11
por %xmm1, %xmm11
pmaxub %xmm10, %xmm11
leaq 0x4(%rdi,%rsi), %rdx
movd 0x4(%rdi,%r9), %xmm1
movd 0x4(%rdi,%rax,2), %xmm6
punpckldq %xmm1, %xmm6    # xmm6 = xmm6[0],xmm1[0],xmm6[1],xmm1[1]
movd 0x4(%rdi,%r10), %xmm1
movd 0x4(%rdi), %xmm7
punpckldq %xmm1, %xmm7    # xmm7 = xmm7[0],xmm1[0],xmm7[1],xmm1[1]
movd 0x4(%rdi,%r11), %xmm1
movd 0x4(%rdi,%rbx), %xmm8
punpckldq %xmm1, %xmm8    # xmm8 = xmm8[0],xmm1[0],xmm8[1],xmm1[1]
punpcklbw %xmm8, %xmm6    # xmm6 = xmm6[0],xmm8[0],xmm6[1],xmm8[1],xmm6[2],xmm8[2],xmm6[3],xmm8[3],xmm6[4],xmm8[4],xmm6[5],xmm8[5],xmm6[6],xmm8[6],xmm6[7],xmm8[7]
movd 0x4(%rdi,%r14), %xmm1
movd 0x4(%rdi,%rax), %xmm8
punpckldq %xmm1, %xmm8    # xmm8 = xmm8[0],xmm1[0],xmm8[1],xmm1[1]
punpcklbw %xmm8, %xmm7    # xmm7 = xmm7[0],xmm8[0],xmm7[1],xmm8[1],xmm7[2],xmm8[2],xmm7[3],xmm8[3],xmm7[4],xmm8[4],xmm7[5],xmm8[5],xmm7[6],xmm8[6],xmm7[7],xmm8[7]
movdqa %xmm7, %xmm1
punpcklwd %xmm6, %xmm1    # xmm1 = xmm1[0],xmm6[0],xmm1[1],xmm6[1],xmm1[2],xmm6[2],xmm1[3],xmm6[3]
punpckhwd %xmm6, %xmm7    # xmm7 = xmm7[4],xmm6[4],xmm7[5],xmm6[5],xmm7[6],xmm6[6],xmm7[7],xmm6[7]
movdqa %xmm1, %xmm15
punpckldq %xmm7, %xmm15   # xmm15 = xmm15[0],xmm7[0],xmm15[1],xmm7[1]
punpckhdq %xmm7, %xmm1    # xmm1 = xmm1[2],xmm7[2],xmm1[3],xmm7[3]
movd (%r9,%rdx), %xmm6
movd (%rdx,%rax,2), %xmm7
punpckldq %xmm6, %xmm7    # xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1]
movd 0x4(%rdi,%rsi), %xmm6
movd (%r10,%rdx), %xmm8
punpckldq %xmm8, %xmm6    # xmm6 = xmm6[0],xmm8[0],xmm6[1],xmm8[1]
movd (%r11,%rdx), %xmm8
movd (%rbx,%rdx), %xmm10
punpckldq %xmm8, %xmm10   # xmm10 = xmm10[0],xmm8[0],xmm10[1],xmm8[1]
punpcklbw %xmm10, %xmm7   # xmm7 = xmm7[0],xmm10[0],xmm7[1],xmm10[1],xmm7[2],xmm10[2],xmm7[3],xmm10[3],xmm7[4],xmm10[4],xmm7[5],xmm10[5],xmm7[6],xmm10[6],xmm7[7],xmm10[7]
movd (%r14,%rdx), %xmm8
movd (%rax,%rdx), %xmm10
punpckldq %xmm8, %xmm10   # xmm10 = xmm10[0],xmm8[0],xmm10[1],xmm8[1]
punpcklbw %xmm10, %xmm6   # xmm6 = xmm6[0],xmm10[0],xmm6[1],xmm10[1],xmm6[2],xmm10[2],xmm6[3],xmm10[3],xmm6[4],xmm10[4],xmm6[5],xmm10[5],xmm6[6],xmm10[6],xmm6[7],xmm10[7]
movdqa %xmm6, %xmm8
punpcklwd %xmm7, %xmm8    # xmm8 = xmm8[0],xmm7[0],xmm8[1],xmm7[1],xmm8[2],xmm7[2],xmm8[3],xmm7[3]
punpckhwd %xmm7, %xmm6    # xmm6 = xmm6[4],xmm7[4],xmm6[5],xmm7[5],xmm6[6],xmm7[6],xmm6[7],xmm7[7]
movdqa %xmm8, %xmm7
punpckldq %xmm6, %xmm7    # xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1]
punpckhdq %xmm6, %xmm8    # xmm8 = xmm8[2],xmm6[2],xmm8[3],xmm6[3]
movdqa %xmm15, %xmm10
punpcklqdq %xmm7, %xmm10   # xmm10 = xmm10[0],xmm7[0]
punpckhqdq %xmm7, %xmm15   # xmm15 = xmm15[1],xmm7[1]
movdqa %xmm1, %xmm12
punpcklqdq %xmm8, %xmm12   # xmm12 = xmm12[0],xmm8[0]
punpckhqdq %xmm8, %xmm1    # xmm1 = xmm1[1],xmm8[1]
movdqa %xmm1, %xmm6
psubusb %xmm12, %xmm6
movdqa %xmm12, %xmm7
psubusb %xmm1, %xmm7
por %xmm6, %xmm7
pmaxub %xmm11, %xmm7
movdqa %xmm15, %xmm6
psubusb %xmm10, %xmm6
movdqa %xmm10, %xmm11
psubusb %xmm15, %xmm11
por %xmm6, %xmm11
movdqa %xmm12, %xmm6
psubusb %xmm15, %xmm6
movdqa %xmm15, %xmm8
psubusb %xmm12, %xmm8
por %xmm6, %xmm8
pmaxub %xmm11, %xmm8
pmaxub %xmm7, %xmm8
movdqa %xmm8, %xmm6
pminub %xmm0, %xmm6
pcmpeqb %xmm8, %xmm6
movdqa %xmm15, %xmm7
psubusb %xmm13, %xmm7
movdqa %xmm13, %xmm9
psubusb %xmm15, %xmm9
por %xmm7, %xmm9
movdqa %xmm10, %xmm7
psubusb %xmm14, %xmm7
movdqa %xmm14, %xmm8
psubusb %xmm10, %xmm8
por %xmm7, %xmm8
psrlw $0x1, %xmm9
pand 0x44887(%rip), %xmm9    # 0x129c80
paddusb %xmm8, %xmm8
paddusb %xmm9, %xmm8
movdqa %xmm8, %xmm9
pminub %xmm2, %xmm9
pcmpeqb %xmm8, %xmm9
pmaxub %xmm4, %xmm11
movdqa %xmm11, %xmm7
pminub %xmm3, %xmm7
pcmpeqb %xmm11, %xmm7
pxor %xmm5, %xmm13
pxor %xmm5, %xmm15
movdqa %xmm13, %xmm4
psubsb %xmm15, %xmm4
pxor %xmm5, %xmm10
pxor %xmm5, %xmm14
movdqa %xmm7, %xmm11
pandn %xmm4, %xmm11
movdqa %xmm10, %xmm4
psubsb %xmm14, %xmm4
paddsb %xmm4, %xmm11
paddsb %xmm4, %xmm11
paddsb %xmm4, %xmm11
leaq 0x2(%rdi), %rdx
leaq 0x4(%rdi), %rdi
pand %xmm6, %xmm11
pand %xmm9, %xmm11
movdqa %xmm11, %xmm4
paddsb 0x4862b(%rip), %xmm4    # 0x12dab0
paddsb 0x48632(%rip), %xmm11   # 0x12dac0
punpcklbw %xmm4, %xmm8    # xmm8 = xmm8[0],xmm4[0],xmm8[1],xmm4[1],xmm8[2],xmm4[2],xmm8[3],xmm4[3],xmm8[4],xmm4[4],xmm8[5],xmm4[5],xmm8[6],xmm4[6],xmm8[7],xmm4[7]
punpckhbw %xmm4, %xmm4    # xmm4 = xmm4[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
psraw $0xb, %xmm8
psraw $0xb, %xmm4
packsswb %xmm4, %xmm8
punpcklbw %xmm11, %xmm4   # xmm4 = xmm4[0],xmm11[0],xmm4[1],xmm11[1],xmm4[2],xmm11[2],xmm4[3],xmm11[3],xmm4[4],xmm11[4],xmm4[5],xmm11[5],xmm4[6],xmm11[6],xmm4[7],xmm11[7]
punpckhbw %xmm11, %xmm6   # xmm6 = xmm6[8],xmm11[8],xmm6[9],xmm11[9],xmm6[10],xmm11[10],xmm6[11],xmm11[11],xmm6[12],xmm11[12],xmm6[13],xmm11[13],xmm6[14],xmm11[14],xmm6[15],xmm11[15]
psraw $0xb, %xmm4
psraw $0xb, %xmm6
packsswb %xmm6, %xmm4
paddsb %xmm14, %xmm8
psubsb %xmm4, %xmm10
pxor %xmm5, %xmm10
pxor %xmm5, %xmm4
pavgb 0xebf6(%rip), %xmm4     # 0xf40d0
paddb 0x4860e(%rip), %xmm4    # 0x12daf0
pand %xmm7, %xmm4
psubsb %xmm4, %xmm15
paddsb %xmm13, %xmm4
movdqa %xmm15, %xmm11
pxor %xmm5, %xmm11
pxor %xmm5, %xmm8
pxor %xmm5, %xmm4
movdqa %xmm4, %xmm6
punpcklbw %xmm8, %xmm6    # xmm6 = xmm6[0],xmm8[0],xmm6[1],xmm8[1],xmm6[2],xmm8[2],xmm6[3],xmm8[3],xmm6[4],xmm8[4],xmm6[5],xmm8[5],xmm6[6],xmm8[6],xmm6[7],xmm8[7]
punpckhbw %xmm8, %xmm4    # xmm4 = xmm4[8],xmm8[8],xmm4[9],xmm8[9],xmm4[10],xmm8[10],xmm4[11],xmm8[11],xmm4[12],xmm8[12],xmm4[13],xmm8[13],xmm4[14],xmm8[14],xmm4[15],xmm8[15]
movdqa %xmm10, %xmm7
punpcklbw %xmm11, %xmm7   # xmm7 = xmm7[0],xmm11[0],xmm7[1],xmm11[1],xmm7[2],xmm11[2],xmm7[3],xmm11[3],xmm7[4],xmm11[4],xmm7[5],xmm11[5],xmm7[6],xmm11[6],xmm7[7],xmm11[7]
movdqa %xmm10, %xmm13
punpckhbw %xmm11, %xmm13  # xmm13 = xmm13[8],xmm11[8],xmm13[9],xmm11[9],xmm13[10],xmm11[10],xmm13[11],xmm11[11],xmm13[12],xmm11[12],xmm13[13],xmm11[13],xmm13[14],xmm11[14],xmm13[15],xmm11[15]
movdqa %xmm6, %xmm8
punpcklwd %xmm7, %xmm8    # xmm8 = xmm8[0],xmm7[0],xmm8[1],xmm7[1],xmm8[2],xmm7[2],xmm8[3],xmm7[3]
movdqa %xmm4, %xmm14
punpcklwd %xmm13, %xmm14  # xmm14 = xmm14[0],xmm13[0],xmm14[1],xmm13[1],xmm14[2],xmm13[2],xmm14[3],xmm13[3]
movl $0x4, %r8d
movq %rdx, %r15
movd %xmm8, (%r15)
psrldq $0x4, %xmm8             # xmm8 = xmm8[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
addq %rax, %r15
decl %r8d
jne 0xe5542
punpckhwd %xmm7, %xmm6    # xmm6 = xmm6[4],xmm7[4],xmm6[5],xmm7[5],xmm6[6],xmm7[6],xmm6[7],xmm7[7]
leaq (%rdx,%r10), %r8
movl $0x4, %ebp
movd %xmm6, (%r8)
psrldq $0x4, %xmm6             # xmm6 = xmm6[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
addq %rax, %r8
decl %ebp
jne 0xe5562
addq %rsi, %rdx
movl $0x4, %r8d
movq %rdx, %r15
movd %xmm14, (%r15)
psrldq $0x4, %xmm14            # xmm14 = xmm14[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
addq %rax, %r15
decl %r8d
jne 0xe557f
punpckhwd %xmm13, %xmm4   # xmm4 = xmm4[4],xmm13[4],xmm4[5],xmm13[5],xmm4[6],xmm13[6],xmm4[7],xmm13[7]
addq %r10, %rdx
movl $0x4, %r8d
movd %xmm4, (%rdx)
psrldq $0x4, %xmm4             # xmm4 = xmm4[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
addq %rax, %rdx
decl %r8d
jne 0xe55a0
leal -0x1(%rcx), %edx
cmpl $0x1, %ecx
movl %edx, %ecx
ja 0xe520e
popq %rbx
popq %r14
popq %r15
popq %rbp
retq