// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/filters_sse2.c
// Function: GradientPredictDirect_SSE2
static void GradientPredictDirect_SSE2(const uint8_t* const row,
                                       const uint8_t* const top,
                                       uint8_t* const out, int length) {
  const int max_pos = length & ~7;
  int i;
  const __m128i zero = _mm_setzero_si128();
  for (i = 0; i < max_pos; i += 8) {
    const __m128i A0 = _mm_loadl_epi64((const __m128i*)&row[i - 1]);
    const __m128i B0 = _mm_loadl_epi64((const __m128i*)&top[i]);
    const __m128i C0 = _mm_loadl_epi64((const __m128i*)&top[i - 1]);
    const __m128i D = _mm_loadl_epi64((const __m128i*)&row[i]);
    const __m128i A1 = _mm_unpacklo_epi8(A0, zero);
    const __m128i B1 = _mm_unpacklo_epi8(B0, zero);
    const __m128i C1 = _mm_unpacklo_epi8(C0, zero);
    const __m128i E = _mm_add_epi16(A1, B1);
    const __m128i F = _mm_sub_epi16(E, C1);
    const __m128i G = _mm_packus_epi16(F, zero);
    const __m128i H = _mm_sub_epi8(D, G);
    _mm_storel_epi64((__m128i*)(out + i), H);
  }
  for (; i < length; ++i) {
    const int delta = GradientPredictor_SSE2(row[i - 1], top[i], top[i - 1]);
    out[i] = (uint8_t)(row[i] - delta);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movq %rdi, -0x198(%rbp)
movq %rsi, -0x1a0(%rbp)
movq %rdx, -0x1a8(%rbp)
movl %ecx, -0x1ac(%rbp)
movl -0x1ac(%rbp), %eax
andl $-0x8, %eax
movl %eax, -0x1b0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xf0(%rbp)
movdqa -0xf0(%rbp), %xmm0
movdqa %xmm0, -0x1d0(%rbp)
movl $0x0, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
cmpl -0x1b0(%rbp), %eax
jge 0x1650d1
movq -0x198(%rbp), %rax
movl -0x1b4(%rbp), %ecx
decl %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq (%rax), %xmm0
movaps %xmm0, -0x130(%rbp)
movaps -0x130(%rbp), %xmm0
movaps %xmm0, -0x1e0(%rbp)
movq -0x1a0(%rbp), %rax
movslq -0x1b4(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
movq (%rax), %xmm0
movaps %xmm0, -0x150(%rbp)
movaps -0x150(%rbp), %xmm0
movaps %xmm0, -0x1f0(%rbp)
movq -0x1a0(%rbp), %rax
movl -0x1b4(%rbp), %ecx
decl %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rax
movq (%rax), %xmm0
movaps %xmm0, -0x170(%rbp)
movaps -0x170(%rbp), %xmm0
movaps %xmm0, -0x200(%rbp)
movq -0x198(%rbp), %rax
movslq -0x1b4(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rax
movq (%rax), %xmm0
movaps %xmm0, -0x190(%rbp)
movaps -0x190(%rbp), %xmm0
movaps %xmm0, -0x210(%rbp)
movaps -0x1e0(%rbp), %xmm1
movaps -0x1d0(%rbp), %xmm0
movaps %xmm1, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movaps -0x90(%rbp), %xmm0
movaps -0xa0(%rbp), %xmm1
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]
movaps %xmm0, -0x220(%rbp)
movaps -0x1f0(%rbp), %xmm1
movaps -0x1d0(%rbp), %xmm0
movaps %xmm1, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps -0xb0(%rbp), %xmm0
movaps -0xc0(%rbp), %xmm1
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]
movaps %xmm0, -0x230(%rbp)
movaps -0x200(%rbp), %xmm1
movaps -0x1d0(%rbp), %xmm0
movaps %xmm1, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movaps -0xd0(%rbp), %xmm0
movaps -0xe0(%rbp), %xmm1
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]
movaps %xmm0, -0x240(%rbp)
movaps -0x220(%rbp), %xmm1
movaps -0x230(%rbp), %xmm0
movaps %xmm1, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps -0x50(%rbp), %xmm0
movaps -0x60(%rbp), %xmm1
paddw %xmm1, %xmm0
movaps %xmm0, -0x250(%rbp)
movaps -0x250(%rbp), %xmm1
movaps -0x240(%rbp), %xmm0
movaps %xmm1, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps -0x70(%rbp), %xmm0
movaps -0x80(%rbp), %xmm1
psubw %xmm1, %xmm0
movaps %xmm0, -0x260(%rbp)
movaps -0x260(%rbp), %xmm1
movaps -0x1d0(%rbp), %xmm0
movaps %xmm1, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movaps -0x30(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
packuswb %xmm1, %xmm0
movaps %xmm0, -0x270(%rbp)
movaps -0x210(%rbp), %xmm1
movaps -0x270(%rbp), %xmm0
movaps %xmm1, -0x10(%rbp)
movaps %xmm0, -0x20(%rbp)
movaps -0x10(%rbp), %xmm0
movaps -0x20(%rbp), %xmm1
psubb %xmm1, %xmm0
movaps %xmm0, -0x280(%rbp)
movq -0x1a8(%rbp), %rax
movslq -0x1b4(%rbp), %rcx
addq %rcx, %rax
movaps -0x280(%rbp), %xmm0
movq %rax, -0xf8(%rbp)
movaps %xmm0, -0x110(%rbp)
movq -0x110(%rbp), %rcx
movq -0xf8(%rbp), %rax
movq %rcx, (%rax)
movl -0x1b4(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x164e49
jmp 0x1650d3
movl -0x1b4(%rbp), %eax
cmpl -0x1ac(%rbp), %eax
jge 0x165175
movq -0x198(%rbp), %rax
movl -0x1b4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %sil
movq -0x1a0(%rbp), %rax
movslq -0x1b4(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x1a0(%rbp), %rax
movl -0x1b4(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl %sil, %edi
movzbl %dl, %esi
movzbl (%rax,%rcx), %edx
callq 0x164230
movl %eax, -0x284(%rbp)
movq -0x198(%rbp), %rax
movslq -0x1b4(%rbp), %rcx
movzbl (%rax,%rcx), %eax
subl -0x284(%rbp), %eax
movb %al, %dl
movq -0x1a8(%rbp), %rax
movslq -0x1b4(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x1650d3
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
nop