// File: /workspace/github_cpp_makefile_star2_O2/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:
movq %rdx, %r9
movzwl 0x4(%rdi), %eax
movzwl 0xc(%rdi), %edx
movzwl 0x4(%rsi), %r10d
addl %edx, %r10d
leal (%r10,%r10,2), %edx
addl %eax, %edx
movzwl 0xc(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %edx, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, 0x4(%rcx)
movzwl 0x2(%rdi), %eax
movzwl 0xa(%rdi), %edx
movzwl 0x2(%rsi), %r10d
addl %edx, %r10d
leal (%r10,%r10,2), %edx
addl %eax, %edx
movzwl 0xa(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %edx, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, 0x2(%rcx)
movzwl (%rdi), %eax
movzwl 0x8(%rdi), %edx
movzwl (%rsi), %r10d
addl %edx, %r10d
leal (%r10,%r10,2), %edx
addl %eax, %edx
movzwl 0x8(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %edx, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, (%rcx)
movzwl 0x6(%rdi), %eax
movzwl 0xe(%rdi), %edx
movzwl 0x6(%rsi), %r10d
addl %edx, %r10d
leal (%r10,%r10,2), %edx
addl %eax, %edx
movzwl 0xe(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %edx, %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, %xmm3
paddd %xmm1, %xmm3
paddd %xmm1, %xmm3
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, %xmm2
pslld $0x3, %xmm2
paddd %xmm1, %xmm2
paddd %xmm3, %xmm2
movdqa 0x17efc(%rip), %xmm1    # 0x1e220
paddd %xmm1, %xmm2
pshufd $0xff, %xmm2, %xmm3     # xmm3 = xmm2[3,3,3,3]
movd %xmm3, %eax
pushq $0xc
popq %rdi
xorl %edx, %edx
divl %edi
movd %eax, %xmm3
pshufd $0xee, %xmm2, %xmm4     # xmm4 = xmm2[2,3,2,3]
movd %xmm4, %eax
xorl %edx, %edx
divl %edi
movd %eax, %xmm4
punpckldq %xmm3, %xmm4    # xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1]
movd %xmm2, %eax
xorl %edx, %edx
divl %edi
movd %eax, %xmm3
pshufd $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
movd %xmm2, %eax
xorl %edx, %edx
divl %edi
movd %eax, %xmm2
punpckldq %xmm2, %xmm3    # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
punpcklqdq %xmm4, %xmm3    # xmm3 = xmm3[0],xmm4[0]
pshuflw $0xe8, %xmm3, %xmm2     # xmm2 = xmm3[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3]
movq %xmm2, 0x8(%rcx)
movq (%r9), %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movq 0x8(%r9), %xmm3
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
movq (%rsi), %xmm4
punpcklwd %xmm0, %xmm4    # xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1],xmm4[2],xmm0[2],xmm4[3],xmm0[3]
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, %xmm5
pslld $0x3, %xmm5
paddd %xmm3, %xmm5
paddd %xmm4, %xmm2
paddd %xmm4, %xmm4
paddd %xmm2, %xmm4
paddd %xmm5, %xmm4
paddd 0x17e39(%rip), %xmm4    # 0x1e210
psrld $0x4, %xmm4
pshuflw $0xe8, %xmm4, %xmm2     # xmm2 = xmm4[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3]
movq %xmm2, (%r8)
movq 0x8(%r9), %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movdqa %xmm2, %xmm3
paddd %xmm2, %xmm3
paddd %xmm2, %xmm3
movq 0x8(%rsi), %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movdqa %xmm2, %xmm0
pslld $0x3, %xmm0
paddd %xmm2, %xmm0
paddd %xmm3, %xmm0
paddd %xmm1, %xmm0
pshufd $0xff, %xmm0, %xmm1     # xmm1 = xmm0[3,3,3,3]
movd %xmm1, %eax
xorl %edx, %edx
divl %edi
movd %eax, %xmm1
pshufd $0xee, %xmm0, %xmm2     # xmm2 = xmm0[2,3,2,3]
movd %xmm2, %eax
xorl %edx, %edx
divl %edi
movd %eax, %xmm2
punpckldq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movd %xmm0, %eax
xorl %edx, %edx
divl %edi
movd %eax, %xmm1
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, %eax
xorl %edx, %edx
divl %edi
movd %eax, %xmm0
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
punpcklqdq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0]
pshuflw $0xe8, %xmm1, %xmm0     # xmm0 = xmm1[0,2,2,3,4,5,6,7]
pshufhw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,1,2,3,4,6,6,7]
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
movq %xmm0, 0x8(%r8)
retq
nopl (%rax)