// File: /workspace/github_cpp_makefile_star2_O1/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 0xc(%rdi), %eax
leal (%rax,%rax,2), %eax
movzwl 0xc(%rsi), %r9d
leal (%r9,%r9,8), %r9d
addl %r9d, %eax
addl $0x6, %eax
imulq $0x15555556, %rax, %rax # imm = 0x15555556
shrq $0x20, %rax
movw %ax, 0xc(%rcx)
movzwl 0x4(%rdx), %eax
movzwl 0xc(%rdx), %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(%r8)
movzwl 0xc(%rdx), %eax
leal (%rax,%rax,2), %eax
movzwl 0xc(%rsi), %r9d
leal (%r9,%r9,8), %r9d
addl %r9d, %eax
addl $0x6, %eax
imulq $0x15555556, %rax, %rax # imm = 0x15555556
shrq $0x20, %rax
movw %ax, 0xc(%r8)
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 0xa(%rdi), %eax
leal (%rax,%rax,2), %eax
movzwl 0xa(%rsi), %r9d
leal (%r9,%r9,8), %r9d
addl %r9d, %eax
addl $0x6, %eax
imulq $0x15555556, %rax, %rax # imm = 0x15555556
shrq $0x20, %rax
movw %ax, 0xa(%rcx)
movzwl 0x2(%rdx), %eax
movzwl 0xa(%rdx), %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(%r8)
movzwl 0xa(%rdx), %eax
leal (%rax,%rax,2), %eax
movzwl 0xa(%rsi), %r9d
leal (%r9,%r9,8), %r9d
addl %r9d, %eax
addl $0x6, %eax
imulq $0x15555556, %rax, %rax # imm = 0x15555556
shrq $0x20, %rax
movw %ax, 0xa(%r8)
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 0x8(%rdi), %eax
leal (%rax,%rax,2), %eax
movzwl 0x8(%rsi), %r9d
leal (%r9,%r9,8), %r9d
addl %r9d, %eax
addl $0x6, %eax
imulq $0x15555556, %rax, %rax # imm = 0x15555556
shrq $0x20, %rax
movw %ax, 0x8(%rcx)
movzwl (%rdx), %eax
movzwl 0x8(%rdx), %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, (%r8)
movzwl 0x8(%rdx), %eax
leal (%rax,%rax,2), %eax
movzwl 0x8(%rsi), %r9d
leal (%r9,%r9,8), %r9d
addl %r9d, %eax
addl $0x6, %eax
imulq $0x15555556, %rax, %rax # imm = 0x15555556
shrq $0x20, %rax
movw %ax, 0x8(%r8)
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 0xe(%rdi), %eax
leal (%rax,%rax,2), %eax
movzwl 0xe(%rsi), %edi
leal (%rdi,%rdi,8), %edi
addl %edi, %eax
addl $0x6, %eax
imulq $0x15555556, %rax, %rax # imm = 0x15555556
shrq $0x20, %rax
movw %ax, 0xe(%rcx)
movzwl 0x6(%rdx), %eax
movzwl 0xe(%rdx), %ecx
movzwl 0x6(%rsi), %edi
addl %ecx, %edi
leal (%rdi,%rdi,2), %ecx
addl %eax, %ecx
movzwl 0xe(%rsi), %eax
leal (%rax,%rax,8), %eax
addl %ecx, %eax
addl $0x8, %eax
shrl $0x4, %eax
movw %ax, 0x6(%r8)
movzwl 0xe(%rdx), %eax
leal (%rax,%rax,2), %eax
movzwl 0xe(%rsi), %ecx
leal (%rcx,%rcx,8), %ecx
addl %ecx, %eax
addl $0x6, %eax
imulq $0x15555556, %rax, %rax # imm = 0x15555556
shrq $0x20, %rax
movw %ax, 0xe(%r8)
retq
nop