// File: /workspace/github_cpp_makefile_star2_O3/kylegranger[P]ImageScaling/filter16.cpp
// Function: UpfilterRight(color_t*, color_t*, color_t*, color_t*, color_t*)
void UpfilterRight(color_t *src1, color_t *src2, color_t *src3, color_t *dst1, color_t *dst2)
{
	dst1[0].r = ((src1[0].r + 3 * (src1[1].r + src2[0].r) + src2[1].r * 9 + 8) >> 4);
	dst1[1].r = (3 * src1[1].r + src2[1].r * 9 + 6) / 12;
	dst2[0].r = ((src3[0].r + 3 * (src3[1].r + src2[0].r) + src2[1].r * 9 + 8) >> 4);
	dst2[1].r = (3 * src3[1].r + src2[1].r * 9 + 6) / 12;

	dst1[0].g = ((src1[0].g + 3 * (src1[1].g + src2[0].g) + src2[1].g * 9 + 8) >> 4);
	dst1[1].g = (3 * src1[1].g + src2[1].g * 9 + 6) / 12;
	dst2[0].g = ((src3[0].g + 3 * (src3[1].g + src2[0].g) + src2[1].g * 9 + 8) >> 4);
	dst2[1].g = (3 * src3[1].g + src2[1].g * 9 + 6) / 12;

	dst1[0].b = ((src1[0].b + 3 * (src1[1].b + src2[0].b) + src2[1].b * 9 + 8) >> 4);
	dst1[1].b = (3 * src1[1].b + src2[1].b * 9 + 6) / 12;
	dst2[0].b = ((src3[0].b + 3 * (src3[1].b + src2[0].b) + src2[1].b * 9 + 8) >> 4);
	dst2[1].b = (3 * src3[1].b + src2[1].b * 9 + 6) / 12;

	dst1[0].a = ((src1[0].a + 3 * (src1[1].a + src2[0].a) + src2[1].a * 9 + 8) >> 4);
	dst1[1].a = (3 * src1[1].a + src2[1].a * 9 + 6) / 12;
	dst2[0].a = ((src3[0].a + 3 * (src3[1].a + src2[0].a) + src2[1].a * 9 + 8) >> 4);
	dst2[1].a = (3 * src3[1].a + src2[1].a * 9 + 6) / 12;
}

// Assembly:
movzwl 0x4(%rdi), %eax
movzwl 0xc(%rdi), %r9d
movzwl 0x4(%rsi), %r10d
addl %r9d, %r10d
leal (%r10,%r10,2), %r9d
addl %eax, %r9d
movzwl 0xc(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %r9d, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, 0x4(%rcx)
movzwl 0x2(%rdi), %eax
movzwl 0xa(%rdi), %r9d
movzwl 0x2(%rsi), %r10d
addl %r9d, %r10d
leal (%r10,%r10,2), %r9d
addl %eax, %r9d
movzwl 0xa(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %r9d, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, 0x2(%rcx)
movzwl (%rdi), %eax
movzwl 0x8(%rdi), %r9d
movzwl (%rsi), %r10d
addl %r9d, %r10d
leal (%r10,%r10,2), %r9d
addl %eax, %r9d
movzwl 0x8(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %r9d, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, (%rcx)
movzwl 0x6(%rdi), %eax
movzwl 0xe(%rdi), %r9d
movzwl 0x6(%rsi), %r10d
addl %r9d, %r10d
leal (%r10,%r10,2), %r9d
addl %eax, %r9d
movzwl 0xe(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %r9d, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, 0x6(%rcx)
movq 0x8(%rdi), %xmm1
pxor %xmm0, %xmm0
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
movdqa %xmm1, %xmm2
paddd %xmm1, %xmm2
paddd %xmm1, %xmm2
movq 0x8(%rsi), %xmm1
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
movdqa %xmm1, %xmm3
pslld $0x3, %xmm3
paddd %xmm1, %xmm3
paddd %xmm2, %xmm3
movdqa 0x17de1(%rip), %xmm2    # 0x1e240
paddd %xmm2, %xmm3
movdqa 0x17de5(%rip), %xmm1    # 0x1e250
pshufd $0xf5, %xmm3, %xmm4     # xmm4 = xmm3[1,1,3,3]
pmuludq %xmm1, %xmm3
pshufd $0xed, %xmm3, %xmm3     # xmm3 = xmm3[1,3,2,3]
pmuludq %xmm1, %xmm4
pshufd $0xed, %xmm4, %xmm4     # xmm4 = xmm4[1,3,2,3]
punpcklwd %xmm4, %xmm3    # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1],xmm3[2],xmm4[2],xmm3[3],xmm4[3]
pshufd $0xe8, %xmm3, %xmm3     # xmm3 = xmm3[0,2,2,3]
movq %xmm3, 0x8(%rcx)
movq (%rdx), %xmm3
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
movq 0x8(%rdx), %xmm4
punpcklwd %xmm0, %xmm4    # xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1],xmm4[2],xmm0[2],xmm4[3],xmm0[3]
movq (%rsi), %xmm5
punpcklwd %xmm0, %xmm5    # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1],xmm5[2],xmm0[2],xmm5[3],xmm0[3]
paddd %xmm4, %xmm5
movq 0x8(%rsi), %xmm4
punpcklwd %xmm0, %xmm4    # xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1],xmm4[2],xmm0[2],xmm4[3],xmm0[3]
movdqa %xmm4, %xmm6
pslld $0x3, %xmm6
paddd %xmm4, %xmm6
paddd %xmm5, %xmm3
paddd %xmm5, %xmm5
paddd %xmm3, %xmm5
paddd %xmm6, %xmm5
paddd 0x17d55(%rip), %xmm5    # 0x1e230
psrld $0x4, %xmm5
pshuflw $0xe8, %xmm5, %xmm3     # xmm3 = xmm5[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm3, %xmm3     # xmm3 = xmm3[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm3, %xmm3     # xmm3 = xmm3[0,2,2,3]
movq %xmm3, (%r8)
movq 0x8(%rdx), %xmm3
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
movdqa %xmm3, %xmm4
paddd %xmm3, %xmm4
paddd %xmm3, %xmm4
movq 0x8(%rsi), %xmm3
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
movdqa %xmm3, %xmm0
pslld $0x3, %xmm0
paddd %xmm3, %xmm0
paddd %xmm4, %xmm0
paddd %xmm2, %xmm0
pshufd $0xf5, %xmm0, %xmm2     # xmm2 = xmm0[1,1,3,3]
pmuludq %xmm1, %xmm0
pshufd $0xed, %xmm0, %xmm0     # xmm0 = xmm0[1,3,2,3]
pmuludq %xmm1, %xmm2
pshufd $0xed, %xmm2, %xmm1     # xmm1 = xmm2[1,3,2,3]
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
movq %xmm0, 0x8(%r8)
retq
nop