// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dsp/lossless_sse2.c
// Function: ConvertBGRAToRGBA_SSE2
static void ConvertBGRAToRGBA_SSE2(const uint32_t* src,
                                   int num_pixels, uint8_t* dst) {
  const __m128i red_blue_mask = _mm_set1_epi32(0x00ff00ff);
  const __m128i* in = (const __m128i*)src;
  __m128i* out = (__m128i*)dst;
  while (num_pixels >= 8) {
    const __m128i A1 = _mm_loadu_si128(in++);
    const __m128i A2 = _mm_loadu_si128(in++);
    const __m128i B1 = _mm_and_si128(A1, red_blue_mask);     // R 0 B 0
    const __m128i B2 = _mm_and_si128(A2, red_blue_mask);     // R 0 B 0
    const __m128i C1 = _mm_andnot_si128(red_blue_mask, A1);  // 0 G 0 A
    const __m128i C2 = _mm_andnot_si128(red_blue_mask, A2);  // 0 G 0 A
    const __m128i D1 = _mm_shufflelo_epi16(B1, _MM_SHUFFLE(2, 3, 0, 1));
    const __m128i D2 = _mm_shufflelo_epi16(B2, _MM_SHUFFLE(2, 3, 0, 1));
    const __m128i E1 = _mm_shufflehi_epi16(D1, _MM_SHUFFLE(2, 3, 0, 1));
    const __m128i E2 = _mm_shufflehi_epi16(D2, _MM_SHUFFLE(2, 3, 0, 1));
    const __m128i F1 = _mm_or_si128(E1, C1);
    const __m128i F2 = _mm_or_si128(E2, C2);
    _mm_storeu_si128(out++, F1);
    _mm_storeu_si128(out++, F2);
    num_pixels -= 8;
  }
  // left-overs
  if (num_pixels > 0) {
    VP8LConvertBGRAToRGBA_C((const uint32_t*)in, num_pixels, (uint8_t*)out);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x138(%rbp)
movl %esi, -0x13c(%rbp)
movq %rdx, -0x148(%rbp)
movl $0xff00ff, -0x74(%rbp)  # imm = 0xFF00FF
movl -0x74(%rbp), %eax
movl %eax, -0x44(%rbp)
movl %eax, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl %eax, -0x50(%rbp)
movd -0x44(%rbp), %xmm0
movd -0x48(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movd -0x4c(%rbp), %xmm2
movd -0x50(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa %xmm0, -0x60(%rbp)
movdqa -0x60(%rbp), %xmm0
movdqa %xmm0, -0x160(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x148(%rbp), %rax
movq %rax, -0x170(%rbp)
cmpl $0x8, -0x13c(%rbp)
jl 0x168683
movq -0x168(%rbp), %rax
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x168(%rbp)
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movups (%rax), %xmm0
movaps %xmm0, -0x180(%rbp)
movq -0x168(%rbp), %rax
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x168(%rbp)
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movups (%rax), %xmm0
movaps %xmm0, -0x190(%rbp)
movaps -0x180(%rbp), %xmm1
movaps -0x160(%rbp), %xmm0
movaps %xmm1, -0x100(%rbp)
movaps %xmm0, -0x110(%rbp)
movaps -0x100(%rbp), %xmm0
movaps -0x110(%rbp), %xmm1
pand %xmm1, %xmm0
movaps %xmm0, -0x1a0(%rbp)
movaps -0x190(%rbp), %xmm1
movaps -0x160(%rbp), %xmm0
movaps %xmm1, -0x120(%rbp)
movaps %xmm0, -0x130(%rbp)
movaps -0x120(%rbp), %xmm0
movaps -0x130(%rbp), %xmm1
pand %xmm1, %xmm0
movaps %xmm0, -0x1b0(%rbp)
movaps -0x160(%rbp), %xmm1
movaps -0x180(%rbp), %xmm0
movaps %xmm1, -0x10(%rbp)
movaps %xmm0, -0x20(%rbp)
movaps -0x10(%rbp), %xmm0
movaps -0x20(%rbp), %xmm1
pandn %xmm1, %xmm0
movaps %xmm0, -0x1c0(%rbp)
movaps -0x160(%rbp), %xmm1
movaps -0x190(%rbp), %xmm0
movaps %xmm1, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movaps -0x30(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
pandn %xmm1, %xmm0
movaps %xmm0, -0x1d0(%rbp)
movaps -0x1a0(%rbp), %xmm0
pshuflw $0xb1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,3,2,4,5,6,7]
movaps %xmm0, -0x1e0(%rbp)
movaps -0x1b0(%rbp), %xmm0
pshuflw $0xb1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,3,2,4,5,6,7]
movaps %xmm0, -0x1f0(%rbp)
movaps -0x1e0(%rbp), %xmm0
pshufhw $0xb1, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,5,4,7,6]
movaps %xmm0, -0x200(%rbp)
movaps -0x1f0(%rbp), %xmm0
pshufhw $0xb1, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,5,4,7,6]
movdqa %xmm0, -0x210(%rbp)
movdqa -0x200(%rbp), %xmm1
movdqa -0x1c0(%rbp), %xmm0
movdqa %xmm1, -0xc0(%rbp)
movdqa %xmm0, -0xd0(%rbp)
movdqa -0xc0(%rbp), %xmm0
por -0xd0(%rbp), %xmm0
movdqa %xmm0, -0x220(%rbp)
movdqa -0x210(%rbp), %xmm1
movdqa -0x1d0(%rbp), %xmm0
movdqa %xmm1, -0xe0(%rbp)
movdqa %xmm0, -0xf0(%rbp)
movdqa -0xe0(%rbp), %xmm0
por -0xf0(%rbp), %xmm0
movdqa %xmm0, -0x230(%rbp)
movq -0x170(%rbp), %rax
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x170(%rbp)
movdqa -0x220(%rbp), %xmm0
movq %rax, -0x80(%rbp)
movdqa %xmm0, -0x90(%rbp)
movdqa -0x90(%rbp), %xmm0
movq -0x80(%rbp), %rax
movdqu %xmm0, (%rax)
movq -0x170(%rbp), %rax
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x170(%rbp)
movdqa -0x230(%rbp), %xmm0
movq %rax, -0x98(%rbp)
movdqa %xmm0, -0xb0(%rbp)
movdqa -0xb0(%rbp), %xmm0
movq -0x98(%rbp), %rax
movdqu %xmm0, (%rax)
movl -0x13c(%rbp), %eax
subl $0x8, %eax
movl %eax, -0x13c(%rbp)
jmp 0x168423
cmpl $0x0, -0x13c(%rbp)
jle 0x1686a5
movq -0x168(%rbp), %rdi
movl -0x13c(%rbp), %esi
movq -0x170(%rbp), %rdx
callq 0x14f200
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nop