// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %r8d, 0x18(%rsp)
movl %ecx, 0x14(%rsp)
movl %edx, 0x10(%rsp)
movl %esi, %edx
movq %rdi, %rbx
leal (,%rdx,8), %eax
movslq %eax, %r14
leaq (%rdi,%r14), %rsi
leaq 0x20(%rsp), %rax
movq %rax, (%rsp)
leaq 0x50(%rsp), %rcx
leaq 0x40(%rsp), %r8
leaq 0x30(%rsp), %r9
movq %rdx, 0x68(%rsp)
callq 0xd8926
leaq (%rbx,%r14), %rdx
addq $0x4, %rdx
addq $0x4, %rbx
pushq $-0x3
popq %rax
testl %eax, %eax
je 0xd7bcc
leaq -0x2(%rbx), %rcx
movq %rcx, 0x70(%rsp)
movdqa 0x20(%rsp), %xmm0
movdqa 0x30(%rsp), %xmm1
movdqa %xmm1, %xmm2
psubusb %xmm0, %xmm2
psubusb %xmm1, %xmm0
por %xmm2, %xmm0
movdqa 0x40(%rsp), %xmm4
movdqa 0x50(%rsp), %xmm2
movdqa %xmm4, %xmm3
psubusb %xmm2, %xmm3
psubusb %xmm4, %xmm2
por %xmm3, %xmm2
pmaxub %xmm0, %xmm2
movdqa %xmm1, %xmm0
psubusb %xmm4, %xmm0
psubusb %xmm1, %xmm4
por %xmm0, %xmm4
pmaxub %xmm2, %xmm4
movdqa %xmm4, 0xb0(%rsp)
movdqa %xmm4, 0xa0(%rsp)
leaq 0x80(%rsp), %rcx
movq %rcx, (%rsp)
movq %rbx, %rdi
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rsi
movq %rbx, 0x78(%rsp)
movq 0x68(%rsp), %rbx
movl %ebx, %edx
leaq 0x50(%rsp), %r14
movq %r14, %rcx
leaq 0x40(%rsp), %r15
movq %r15, %r8
leaq 0x90(%rsp), %r9
movl %eax, 0x1c(%rsp)
callq 0xd8926
movdqa 0x80(%rsp), %xmm0
movdqa 0x90(%rsp), %xmm1
movdqa %xmm1, %xmm2
psubusb %xmm0, %xmm2
psubusb %xmm1, %xmm0
por %xmm2, %xmm0
movdqa 0x40(%rsp), %xmm2
movdqa 0x50(%rsp), %xmm3
movdqa %xmm2, %xmm4
psubusb %xmm3, %xmm4
psubusb %xmm2, %xmm3
por %xmm4, %xmm3
pmaxub %xmm0, %xmm3
movdqa %xmm1, %xmm0
psubusb %xmm2, %xmm0
psubusb %xmm1, %xmm2
por %xmm0, %xmm2
pmaxub %xmm3, %xmm2
pmaxub 0xb0(%rsp), %xmm2
movdqa %xmm2, 0xa0(%rsp)
leaq 0xa0(%rsp), %r13
movq %r13, (%rsp)
leaq 0x30(%rsp), %r12
movq %r12, %rdi
leaq 0x20(%rsp), %rbp
movq %rbp, %rsi
movq %r14, %rdx
movq %r15, %rcx
movl 0x10(%rsp), %r8d
movl 0x14(%rsp), %r9d
callq 0xd8554
movq %r12, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %r13, %r8
movl 0x18(%rsp), %r9d
callq 0xd8b11
movq 0x8(%rsp), %rax
leaq -0x2(%rax), %r9
movl %ebx, (%rsp)
movq 0x78(%rsp), %rbx
movq %r12, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r15, %rcx
movq 0x70(%rsp), %r8
callq 0xd89a3
movq 0x8(%rsp), %rdx
movl 0x1c(%rsp), %eax
movaps 0x90(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movaps 0x80(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
incl %eax
addq $0x4, %rdx
addq $0x4, %rbx
jmp 0xd7a08
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq