// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/libraries/libwebp/src/dsp/yuv_sse2.c
// Function: YuvToBgraRow_SSE2
static void YuvToBgraRow_SSE2(const uint8_t* y,
                              const uint8_t* u, const uint8_t* v,
                              uint8_t* dst, int len) {
  const __m128i kAlpha = _mm_set1_epi16(255);
  int n;
  for (n = 0; n + 8 <= len; n += 8, dst += 32) {
    __m128i R, G, B;
    YUV420ToRGB_SSE2(y, u, v, &R, &G, &B);
    PackAndStore4_SSE2(&B, &G, &R, &kAlpha, dst);
    y += 8;
    u += 4;
    v += 4;
  }
  for (; n < len; ++n) {   // Finish off
    VP8YuvToBgra(y[0], u[0], v[0], dst);
    dst += 4;
    y += 1;
    u += (n & 1);
    v += (n & 1);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %eax, %eax
cmpl $0x8, %r8d
jl 0xee929
movl %r8d, %eax
andl $0x7ffffff8, %eax       # imm = 0x7FFFFFF8
movl $0x8, %r9d
pxor %xmm0, %xmm0
movdqa 0x3e4b6(%rip), %xmm1    # 0x12cc50
movdqa 0x3ef1e(%rip), %xmm2    # 0x12d6c0
movdqa 0x3ef26(%rip), %xmm3    # 0x12d6d0
movdqa 0x3ef2e(%rip), %xmm4    # 0x12d6e0
movdqa 0x3ef36(%rip), %xmm5    # 0x12d6f0
movdqa 0x3ef3e(%rip), %xmm6    # 0x12d700
movdqa 0x3ef46(%rip), %xmm7    # 0x12d710
movdqa 0x3ef4d(%rip), %xmm8    # 0x12d720
movdqa 0x3ef54(%rip), %xmm9    # 0x12d730
movdqa 0x3e6bb(%rip), %xmm10   # 0x12cea0
movq (%rdi), %xmm11
pxor %xmm12, %xmm12
punpcklbw %xmm11, %xmm12  # xmm12 = xmm12[0],xmm11[0],xmm12[1],xmm11[1],xmm12[2],xmm11[2],xmm12[3],xmm11[3],xmm12[4],xmm11[4],xmm12[5],xmm11[5],xmm12[6],xmm11[6],xmm12[7],xmm11[7]
movdqa %xmm12, %xmm11
punpckhbw %xmm0, %xmm11   # xmm11 = xmm11[8],xmm0[8],xmm11[9],xmm0[9],xmm11[10],xmm0[10],xmm11[11],xmm0[11],xmm11[12],xmm0[12],xmm11[13],xmm0[13],xmm11[14],xmm0[14],xmm11[15],xmm0[15]
punpcklbw %xmm0, %xmm12   # xmm12 = xmm12[0],xmm0[0],xmm12[1],xmm0[1],xmm12[2],xmm0[2],xmm12[3],xmm0[3],xmm12[4],xmm0[4],xmm12[5],xmm0[5],xmm12[6],xmm0[6],xmm12[7],xmm0[7]
pshufd $0x6c, %xmm12, %xmm12   # xmm12 = xmm12[0,3,2,1]
pshufhw $0xc4, %xmm12, %xmm12   # xmm12 = xmm12[0,1,2,3,4,5,4,7]
pshufd $0x6c, %xmm12, %xmm12   # xmm12 = xmm12[0,3,2,1]
pand %xmm1, %xmm12
packuswb %xmm11, %xmm12
pmulhuw %xmm2, %xmm12
movd (%rsi), %xmm11
pxor %xmm13, %xmm13
punpcklbw %xmm11, %xmm13  # xmm13 = xmm13[0],xmm11[0],xmm13[1],xmm11[1],xmm13[2],xmm11[2],xmm13[3],xmm11[3],xmm13[4],xmm11[4],xmm13[5],xmm11[5],xmm13[6],xmm11[6],xmm13[7],xmm11[7]
punpcklbw %xmm0, %xmm13   # xmm13 = xmm13[0],xmm0[0],xmm13[1],xmm0[1],xmm13[2],xmm0[2],xmm13[3],xmm0[3],xmm13[4],xmm0[4],xmm13[5],xmm0[5],xmm13[6],xmm0[6],xmm13[7],xmm0[7]
pshufd $0xfa, %xmm13, %xmm14   # xmm14 = xmm13[2,2,3,3]
pshufd $0x68, %xmm13, %xmm11   # xmm11 = xmm13[0,2,2,1]
pshuflw $0x64, %xmm11, %xmm11   # xmm11 = xmm11[0,1,2,1,4,5,6,7]
pshufhw $0xcc, %xmm11, %xmm11   # xmm11 = xmm11[0,1,2,3,4,7,4,7]
packuswb %xmm14, %xmm11
movd (%rdx), %xmm13
pxor %xmm14, %xmm14
punpcklbw %xmm13, %xmm14  # xmm14 = xmm14[0],xmm13[0],xmm14[1],xmm13[1],xmm14[2],xmm13[2],xmm14[3],xmm13[3],xmm14[4],xmm13[4],xmm14[5],xmm13[5],xmm14[6],xmm13[6],xmm14[7],xmm13[7]
punpcklbw %xmm0, %xmm14   # xmm14 = xmm14[0],xmm0[0],xmm14[1],xmm0[1],xmm14[2],xmm0[2],xmm14[3],xmm0[3],xmm14[4],xmm0[4],xmm14[5],xmm0[5],xmm14[6],xmm0[6],xmm14[7],xmm0[7]
pshufd $0xfa, %xmm14, %xmm13   # xmm13 = xmm14[2,2,3,3]
pshufd $0x68, %xmm14, %xmm14   # xmm14 = xmm14[0,2,2,1]
pshuflw $0x64, %xmm14, %xmm14   # xmm14 = xmm14[0,1,2,1,4,5,6,7]
pshufhw $0xcc, %xmm14, %xmm14   # xmm14 = xmm14[0,1,2,3,4,7,4,7]
packuswb %xmm13, %xmm14
movdqa %xmm14, %xmm13
pmulhuw %xmm3, %xmm13
paddw %xmm12, %xmm13
paddw %xmm4, %xmm13
movdqa %xmm11, %xmm15
pmulhuw %xmm5, %xmm15
pmulhuw %xmm6, %xmm14
paddw %xmm15, %xmm14
pmulhuw %xmm8, %xmm11
paddusw %xmm12, %xmm11
psubw %xmm14, %xmm12
paddw %xmm7, %xmm12
psubusw %xmm9, %xmm11
psraw $0x6, %xmm13
psraw $0x6, %xmm12
packuswb %xmm10, %xmm12
psrlw $0x6, %xmm11
packuswb %xmm13, %xmm11
movdqa %xmm11, %xmm13
punpcklbw %xmm12, %xmm13  # xmm13 = xmm13[0],xmm12[0],xmm13[1],xmm12[1],xmm13[2],xmm12[2],xmm13[3],xmm12[3],xmm13[4],xmm12[4],xmm13[5],xmm12[5],xmm13[6],xmm12[6],xmm13[7],xmm12[7]
punpckhbw %xmm12, %xmm11  # xmm11 = xmm11[8],xmm12[8],xmm11[9],xmm12[9],xmm11[10],xmm12[10],xmm11[11],xmm12[11],xmm11[12],xmm12[12],xmm11[13],xmm12[13],xmm11[14],xmm12[14],xmm11[15],xmm12[15]
movdqa %xmm13, %xmm12
punpcklwd %xmm11, %xmm12  # xmm12 = xmm12[0],xmm11[0],xmm12[1],xmm11[1],xmm12[2],xmm11[2],xmm12[3],xmm11[3]
punpckhwd %xmm11, %xmm13  # xmm13 = xmm13[4],xmm11[4],xmm13[5],xmm11[5],xmm13[6],xmm11[6],xmm13[7],xmm11[7]
movdqu %xmm12, (%rcx)
movdqu %xmm13, 0x10(%rcx)
addq $0x8, %rdi
addq $0x4, %rsi
addq $0x4, %rdx
addq $0x20, %rcx
addl $0x8, %r9d
cmpl %r8d, %r9d
jle 0xee7e5
subl %eax, %r8d
jle 0xeea27
movl %eax, %eax
movl $0x4000, %r9d           # imm = 0x4000
xorl %r10d, %r10d
leal (%rax,%r10), %r11d
movzbl (%rdi,%r10), %ebx
movzbl (%rsi), %r14d
movzbl (%rdx), %ebp
imull $0x4a85, %ebx, %ebx     # imm = 0x4A85
shrl $0x8, %ebx
imull $0x811a, %r14d, %r15d   # imm = 0x811A
shrl $0x8, %r15d
addl %ebx, %r15d
subl $0x4515, %r15d          # imm = 0x4515
movl $0x0, %r12d
adcb $-0x1, %r12b
movl %r15d, %r13d
shrl $0x6, %r13d
cmpl %r9d, %r15d
movzbl %r12b, %r15d
cmovbl %r13d, %r15d
movb %r15b, (%rcx,%r10,4)
imull $0x1913, %r14d, %r14d   # imm = 0x1913
shrl $0x8, %r14d
imull $0x3408, %ebp, %r15d    # imm = 0x3408
shrl $0x8, %r15d
addl %r14d, %r15d
movl %ebx, %r14d
subl %r15d, %r14d
negl %r15d
addl %ebx, %r15d
addl $0x2204, %r15d          # imm = 0x2204
movl %r15d, %r12d
shrl $0x6, %r12d
cmpl $0xffffddfc, %r14d      # imm = 0xFFFFDDFC
setge %r14b
negb %r14b
cmpl %r9d, %r15d
movzbl %r14b, %r14d
cmovbl %r12d, %r14d
imull $0x6625, %ebp, %ebp     # imm = 0x6625
shrl $0x8, %ebp
addl %ebx, %ebp
subl $0x379a, %ebp           # imm = 0x379A
movl $0x0, %ebx
adcb $-0x1, %bl
movl %ebp, %r15d
shrl $0x6, %r15d
cmpl %r9d, %ebp
movzbl %bl, %ebx
cmovbl %r15d, %ebx
movb %r14b, 0x1(%rcx,%r10,4)
movb %bl, 0x2(%rcx,%r10,4)
movb $-0x1, 0x3(%rcx,%r10,4)
andl $0x1, %r11d
addq %r11, %rsi
addq %r11, %rdx
incq %r10
cmpl %r10d, %r8d
jne 0xee93d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq