// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/alpha_processing_sse2.c
// Function: AlphaReplace_SSE2
static void AlphaReplace_SSE2(uint32_t* src, int length, uint32_t color) {
  const __m128i m_color = _mm_set1_epi32((int)color);
  const __m128i zero = _mm_setzero_si128();
  int i = 0;
  for (; i + 8 <= length; i += 8) {
    const __m128i a0 = _mm_loadu_si128((const __m128i*)(src + i + 0));
    const __m128i a1 = _mm_loadu_si128((const __m128i*)(src + i + 4));
    const __m128i b0 = _mm_srai_epi32(a0, 24);
    const __m128i b1 = _mm_srai_epi32(a1, 24);
    const __m128i c0 = _mm_cmpeq_epi32(b0, zero);
    const __m128i c1 = _mm_cmpeq_epi32(b1, zero);
    const __m128i d0 = _mm_and_si128(c0, m_color);
    const __m128i d1 = _mm_and_si128(c1, m_color);
    const __m128i e0 = _mm_andnot_si128(c0, a0);
    const __m128i e1 = _mm_andnot_si128(c1, a1);
    _mm_storeu_si128((__m128i*)(src + i + 0), _mm_or_si128(d0, e0));
    _mm_storeu_si128((__m128i*)(src + i + 4), _mm_or_si128(d1, e1));
  }
  for (; i < length; ++i) if ((src[i] >> 24) == 0) src[i] = color;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x1c8(%rbp)
movl %esi, -0x1cc(%rbp)
movl %edx, -0x1d0(%rbp)
movl -0x1d0(%rbp), %eax
movl %eax, -0x124(%rbp)
movl -0x124(%rbp), %eax
movl %eax, -0x104(%rbp)
movl %eax, -0x108(%rbp)
movl %eax, -0x10c(%rbp)
movl %eax, -0x110(%rbp)
movd -0x104(%rbp), %xmm0
movd -0x108(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movd -0x10c(%rbp), %xmm2
movd -0x110(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movaps %xmm0, -0x120(%rbp)
movaps -0x120(%rbp), %xmm0
movaps %xmm0, -0x1e0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x1c0(%rbp)
movdqa -0x1c0(%rbp), %xmm0
movdqa %xmm0, -0x1f0(%rbp)
movl $0x0, -0x1f4(%rbp)
movl -0x1f4(%rbp), %eax
addl $0x8, %eax
cmpl -0x1cc(%rbp), %eax
jg 0x1580d5
movq -0x1c8(%rbp), %rax
movslq -0x1f4(%rbp), %rcx
leaq (%rax,%rcx,4), %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movups (%rax), %xmm0
movaps %xmm0, -0x210(%rbp)
movq -0x1c8(%rbp), %rax
movslq -0x1f4(%rbp), %rcx
leaq 0x10(%rax,%rcx,4), %rax
movq %rax, -0x170(%rbp)
movq -0x170(%rbp), %rax
movups (%rax), %xmm0
movaps %xmm0, -0x220(%rbp)
movaps -0x210(%rbp), %xmm0
movaps %xmm0, -0x90(%rbp)
movl $0x18, -0x94(%rbp)
movaps -0x90(%rbp), %xmm0
movd -0x94(%rbp), %xmm1
psrad %xmm1, %xmm0
movaps %xmm0, -0x230(%rbp)
movaps -0x220(%rbp), %xmm0
movaps %xmm0, -0xb0(%rbp)
movl $0x18, -0xb4(%rbp)
movaps -0xb0(%rbp), %xmm0
movd -0xb4(%rbp), %xmm1
psrad %xmm1, %xmm0
movaps %xmm0, -0x240(%rbp)
movaps -0x230(%rbp), %xmm1
movaps -0x1f0(%rbp), %xmm0
movaps %xmm1, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps -0x50(%rbp), %xmm0
movaps -0x60(%rbp), %xmm1
pcmpeqd %xmm1, %xmm0
movaps %xmm0, -0x250(%rbp)
movaps -0x240(%rbp), %xmm1
movaps -0x1f0(%rbp), %xmm0
movaps %xmm1, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps -0x70(%rbp), %xmm0
movaps -0x80(%rbp), %xmm1
pcmpeqd %xmm1, %xmm0
movaps %xmm0, -0x260(%rbp)
movaps -0x250(%rbp), %xmm1
movaps -0x1e0(%rbp), %xmm0
movaps %xmm1, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movaps -0xd0(%rbp), %xmm0
movaps -0xe0(%rbp), %xmm1
pand %xmm1, %xmm0
movaps %xmm0, -0x270(%rbp)
movaps -0x260(%rbp), %xmm1
movaps -0x1e0(%rbp), %xmm0
movaps %xmm1, -0xf0(%rbp)
movaps %xmm0, -0x100(%rbp)
movaps -0xf0(%rbp), %xmm0
movaps -0x100(%rbp), %xmm1
pand %xmm1, %xmm0
movaps %xmm0, -0x280(%rbp)
movaps -0x250(%rbp), %xmm1
movaps -0x210(%rbp), %xmm0
movaps %xmm1, -0x10(%rbp)
movaps %xmm0, -0x20(%rbp)
movaps -0x10(%rbp), %xmm0
pcmpeqd %xmm1, %xmm1
movaps -0x20(%rbp), %xmm2
pandn %xmm2, %xmm0
movaps %xmm0, -0x290(%rbp)
movaps -0x260(%rbp), %xmm2
movaps -0x220(%rbp), %xmm0
movaps %xmm2, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movaps -0x30(%rbp), %xmm0
pxor %xmm1, %xmm0
pand -0x40(%rbp), %xmm0
movdqa %xmm0, -0x2a0(%rbp)
movq -0x1c8(%rbp), %rax
movslq -0x1f4(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movdqa -0x270(%rbp), %xmm1
movdqa -0x290(%rbp), %xmm0
movdqa %xmm1, -0x180(%rbp)
movdqa %xmm0, -0x190(%rbp)
movdqa -0x180(%rbp), %xmm0
por -0x190(%rbp), %xmm0
movq %rax, -0x130(%rbp)
movdqa %xmm0, -0x140(%rbp)
movdqa -0x140(%rbp), %xmm0
movq -0x130(%rbp), %rax
movdqu %xmm0, (%rax)
movq -0x1c8(%rbp), %rax
movslq -0x1f4(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $0x10, %rax
movdqa -0x280(%rbp), %xmm1
movdqa -0x2a0(%rbp), %xmm0
movdqa %xmm1, -0x1a0(%rbp)
movdqa %xmm0, -0x1b0(%rbp)
movdqa -0x1a0(%rbp), %xmm0
por -0x1b0(%rbp), %xmm0
movq %rax, -0x148(%rbp)
movdqa %xmm0, -0x160(%rbp)
movdqa -0x160(%rbp), %xmm0
movq -0x148(%rbp), %rax
movdqu %xmm0, (%rax)
movl -0x1f4(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x1f4(%rbp)
jmp 0x157e0d
jmp 0x1580d7
movl -0x1f4(%rbp), %eax
cmpl -0x1cc(%rbp), %eax
jge 0x158128
movq -0x1c8(%rbp), %rax
movslq -0x1f4(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shrl $0x18, %eax
cmpl $0x0, %eax
jne 0x158115
movl -0x1d0(%rbp), %edx
movq -0x1c8(%rbp), %rax
movslq -0x1f4(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x158117
movl -0x1f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f4(%rbp)
jmp 0x1580d7
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)