// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/lossless_sse2.c
// Function: ClampedAddSubtractHalf_SSE2
static WEBP_INLINE uint32_t ClampedAddSubtractHalf_SSE2(uint32_t c0,
                                                        uint32_t c1,
                                                        uint32_t c2) {
  const __m128i zero = _mm_setzero_si128();
  const __m128i C0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c0), zero);
  const __m128i C1 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c1), zero);
  const __m128i B0 = _mm_unpacklo_epi8(_mm_cvtsi32_si128((int)c2), zero);
  const __m128i avg = _mm_add_epi16(C1, C0);
  const __m128i A0 = _mm_srli_epi16(avg, 1);
  const __m128i A1 = _mm_sub_epi16(A0, B0);
  const __m128i BgtA = _mm_cmpgt_epi16(B0, A0);
  const __m128i A2 = _mm_sub_epi16(A1, BgtA);
  const __m128i A3 = _mm_srai_epi16(A2, 1);
  const __m128i A4 = _mm_add_epi16(A0, A3);
  const __m128i A5 = _mm_packus_epi16(A4, A4);
  return (uint32_t)_mm_cvtsi128_si32(A5);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movl %edi, -0x1f4(%rbp)
movl %esi, -0x1f8(%rbp)
movl %edx, -0x1fc(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x1f0(%rbp)
movaps -0x1f0(%rbp), %xmm0
movaps %xmm0, -0x210(%rbp)
movl -0x1f4(%rbp), %eax
movl %eax, -0x124(%rbp)
movd -0x124(%rbp), %xmm0
movaps %xmm0, -0x140(%rbp)
movaps -0x140(%rbp), %xmm1
movaps -0x210(%rbp), %xmm0
movaps %xmm1, -0x190(%rbp)
movaps %xmm0, -0x1a0(%rbp)
movaps -0x190(%rbp), %xmm0
movaps -0x1a0(%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)
movl -0x1f8(%rbp), %eax
movl %eax, -0x144(%rbp)
movd -0x144(%rbp), %xmm0
movaps %xmm0, -0x160(%rbp)
movaps -0x160(%rbp), %xmm1
movaps -0x210(%rbp), %xmm0
movaps %xmm1, -0x1b0(%rbp)
movaps %xmm0, -0x1c0(%rbp)
movaps -0x1b0(%rbp), %xmm0
movaps -0x1c0(%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)
movl -0x1fc(%rbp), %eax
movl %eax, -0x164(%rbp)
movd -0x164(%rbp), %xmm0
movaps %xmm0, -0x180(%rbp)
movaps -0x180(%rbp), %xmm1
movaps -0x210(%rbp), %xmm0
movaps %xmm1, -0x1d0(%rbp)
movaps %xmm0, -0x1e0(%rbp)
movaps -0x1d0(%rbp), %xmm0
movaps -0x1e0(%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 -0x230(%rbp), %xmm1
movaps -0x220(%rbp), %xmm0
movaps %xmm1, -0xf0(%rbp)
movaps %xmm0, -0x100(%rbp)
movaps -0xf0(%rbp), %xmm0
movaps -0x100(%rbp), %xmm1
paddw %xmm1, %xmm0
movaps %xmm0, -0x250(%rbp)
movaps -0x250(%rbp), %xmm0
movaps %xmm0, -0xd0(%rbp)
movl $0x1, -0xd4(%rbp)
movaps -0xd0(%rbp), %xmm0
movd -0xd4(%rbp), %xmm1
psrlw %xmm1, %xmm0
movaps %xmm0, -0x260(%rbp)
movaps -0x260(%rbp), %xmm1
movaps -0x240(%rbp), %xmm0
movaps %xmm1, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps -0x50(%rbp), %xmm0
movaps -0x60(%rbp), %xmm1
psubw %xmm1, %xmm0
movaps %xmm0, -0x270(%rbp)
movaps -0x240(%rbp), %xmm1
movaps -0x260(%rbp), %xmm0
movaps %xmm1, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movaps -0x30(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
pcmpgtw %xmm1, %xmm0
movaps %xmm0, -0x280(%rbp)
movaps -0x270(%rbp), %xmm1
movaps -0x280(%rbp), %xmm0
movaps %xmm1, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps -0x70(%rbp), %xmm0
movaps -0x80(%rbp), %xmm1
psubw %xmm1, %xmm0
movaps %xmm0, -0x290(%rbp)
movaps -0x290(%rbp), %xmm0
movaps %xmm0, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movaps -0x10(%rbp), %xmm0
movd -0x14(%rbp), %xmm1
psraw %xmm1, %xmm0
movaps %xmm0, -0x2a0(%rbp)
movaps -0x260(%rbp), %xmm1
movaps -0x2a0(%rbp), %xmm0
movaps %xmm1, -0x110(%rbp)
movaps %xmm0, -0x120(%rbp)
movaps -0x110(%rbp), %xmm0
movaps -0x120(%rbp), %xmm1
paddw %xmm1, %xmm0
movaps %xmm0, -0x2b0(%rbp)
movaps -0x2b0(%rbp), %xmm0
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps -0xb0(%rbp), %xmm0
movaps -0xc0(%rbp), %xmm1
packuswb %xmm1, %xmm0
movaps %xmm0, -0x2c0(%rbp)
movaps -0x2c0(%rbp), %xmm0
movaps %xmm0, -0x90(%rbp)
movaps -0x90(%rbp), %xmm0
movaps %xmm0, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
nopl (%rax,%rax)