// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/libraries/libwebp/src/dsp/dec_sse2.c
// Function: VFilter8i_SSE2
static void VFilter8i_SSE2(uint8_t* u, uint8_t* v, int stride,
                           int thresh, int ithresh, int hev_thresh) {
  __m128i mask;
  __m128i t1, t2, p1, p0, q0, q1;

  // Load p3, p2, p1, p0
  LOADUV_H_EDGES4(u, v, stride, t2, t1, p1, p0);
  MAX_DIFF1(t2, t1, p1, p0, mask);

  u += 4 * stride;
  v += 4 * stride;

  // Load q0, q1, q2, q3
  LOADUV_H_EDGES4(u, v, stride, q0, q1, t1, t2);
  MAX_DIFF2(t2, t1, q1, q0, mask);

  ComplexMask_SSE2(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
  DoFilter4_SSE2(&p1, &p0, &q0, &q1, &mask, hev_thresh);

  // Store
  STOREUV(p1, u, v, -2 * stride);
  STOREUV(p0, u, v, -1 * stride);
  STOREUV(q0, u, v, 0 * stride);
  STOREUV(q1, u, v, 1 * stride);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r9d, 0x14(%rsp)
movl %r8d, %r9d
movl %ecx, %r8d
movq (%rsi), %xmm0
movq (%rdi), %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movslq %edx, %r12
movq (%rsi,%r12), %xmm2
movq (%rdi,%r12), %xmm0
punpcklqdq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0]
leaq (%r12,%r12), %rax
movq %rax, 0x28(%rsp)
movq (%rsi,%r12,2), %xmm2
movq (%rdi,%r12,2), %xmm3
punpcklqdq %xmm2, %xmm3    # xmm3 = xmm3[0],xmm2[0]
leaq 0x70(%rsp), %rbx
movdqa %xmm3, (%rbx)
leaq (%r12,%r12,2), %rax
movq (%rsi,%rax), %xmm2
movq (%rdi,%rax), %xmm4
punpcklqdq %xmm2, %xmm4    # xmm4 = xmm4[0],xmm2[0]
leaq 0x60(%rsp), %r15
movdqa %xmm4, (%r15)
movdqa %xmm3, %xmm2
psubusb %xmm4, %xmm2
psubusb %xmm3, %xmm4
por %xmm2, %xmm4
movdqa %xmm0, %xmm2
psubusb %xmm1, %xmm2
psubusb %xmm0, %xmm1
por %xmm2, %xmm1
movdqa %xmm3, %xmm2
psubusb %xmm0, %xmm2
psubusb %xmm3, %xmm0
por %xmm2, %xmm0
pmaxub %xmm1, %xmm0
pmaxub %xmm4, %xmm0
movq %rdi, 0x18(%rsp)
leaq (%rdi,%r12,4), %rbp
movq %rsi, 0x20(%rsp)
leaq (%rsi,%r12,4), %r13
movq (%rsi,%r12,4), %xmm1
movq (%rdi,%r12,4), %xmm2
punpcklqdq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0]
leaq 0x50(%rsp), %r14
movdqa %xmm2, (%r14)
movq (%r12,%r13), %xmm1
movq (%r12,%rbp), %xmm3
punpcklqdq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0]
leaq 0x30(%rsp), %rsi
movdqa %xmm3, (%rsi)
movq %rsi, %r11
movq (%r13,%r12,2), %xmm1
movq (%rbp,%r12,2), %xmm4
punpcklqdq %xmm1, %xmm4    # xmm4 = xmm4[0],xmm1[0]
movq (%r13,%rax), %xmm1
movq (%rbp,%rax), %xmm5
punpcklqdq %xmm1, %xmm5    # xmm5 = xmm5[0],xmm1[0]
movdqa %xmm3, %xmm1
psubusb %xmm2, %xmm1
psubusb %xmm3, %xmm2
por %xmm1, %xmm2
movdqa %xmm4, %xmm1
psubusb %xmm5, %xmm1
psubusb %xmm4, %xmm5
por %xmm1, %xmm5
pmaxub %xmm2, %xmm5
pmaxub %xmm0, %xmm5
movdqa %xmm3, %xmm0
psubusb %xmm4, %xmm0
psubusb %xmm3, %xmm4
por %xmm0, %xmm4
pmaxub %xmm5, %xmm4
leaq 0x40(%rsp), %rax
movdqa %xmm4, (%rax)
movq %rax, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r11, %rcx
callq 0xd8554
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
leaq 0x30(%rsp), %rcx
leaq 0x40(%rsp), %r8
movl 0x14(%rsp), %r9d
callq 0xd8b11
movq %rbp, %rax
movq 0x28(%rsp), %rcx
subq %rcx, %rax
movdqa (%rbx), %xmm0
movq %xmm0, (%rax)
movq %r13, %rax
subq %rcx, %rax
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, (%rax)
movq %rbp, %rax
subq %r12, %rax
movdqa (%r15), %xmm0
movq %xmm0, (%rax)
movq %r13, %rax
subq %r12, %rax
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, (%rax)
movdqa (%r14), %xmm0
movq 0x18(%rsp), %rax
movq %xmm0, (%rax,%r12,4)
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq 0x20(%rsp), %rax
movq %xmm0, (%rax,%r12,4)
leaq 0x30(%rsp), %rax
movdqa (%rax), %xmm0
movq %xmm0, (%r12,%rbp)
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movq %xmm0, (%r12,%r13)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq