// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/filter16.cpp
// Function: Upfilter(color_t*, color_t*, color_t*, color_t*, color_t*)
void Upfilter(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 = ((src1[2].r + 3 * (src1[1].r + src2[2].r) + src2[1].r * 9 + 8) >> 4);
	dst2[0].r = ((src3[0].r + 3 * (src3[1].r + src2[0].r) + src2[1].r * 9 + 8) >> 4);
	dst2[1].r = ((src3[2].r + 3 * (src3[1].r + src2[2].r) + src2[1].r * 9 + 8) >> 4);

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

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

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

// 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 0x14(%rdi), %eax
movzwl 0xc(%rdi), %r9d
movzwl 0x14(%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, 0xc(%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 0x12(%rdi), %eax
movzwl 0xa(%rdi), %r9d
movzwl 0x12(%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, 0xa(%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 0x10(%rdi), %eax
movzwl 0x8(%rdi), %r9d
movzwl 0x10(%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, 0x8(%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)
movzwl 0x16(%rdi), %eax
movzwl 0xe(%rdi), %edi
movzwl 0x16(%rsi), %r9d
addl %edi, %r9d
leal (%r9,%r9,2), %edi
addl %eax, %edi
movzwl 0xe(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %edi, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, 0xe(%rcx)
movq (%rdx), %xmm1
pxor %xmm0, %xmm0
punpcklwd %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
movq 0x8(%rdx), %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movq (%rsi), %xmm3
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
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, %xmm4
pslld $0x3, %xmm4
paddd %xmm2, %xmm4
paddd %xmm3, %xmm1
paddd %xmm3, %xmm3
paddd %xmm1, %xmm3
movdqa 0x18234(%rip), %xmm1    # 0x1e210
paddd %xmm1, %xmm4
paddd %xmm3, %xmm4
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 0x10(%rdx), %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movq 0x8(%rdx), %xmm3
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
movq 0x10(%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, %xmm0
pslld $0x3, %xmm0
paddd %xmm3, %xmm0
paddd %xmm4, %xmm2
paddd %xmm4, %xmm4
paddd %xmm2, %xmm4
paddd %xmm1, %xmm0
paddd %xmm4, %xmm0
psrld $0x4, %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[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