// File: /workspace/github_cpp_makefile_star2_O2/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::Upsample(CLinear16*)
void CLinear16::Upsample(CLinear16 *bmp)
{
	color_t *src1 = mData - 1 - mWidth;
	color_t *src2 = mData - 1;
	color_t *src3 = mData - 1 + mWidth;
	color_t *dst1 = bmp->mData;
	color_t *dst2 = bmp->mData + bmp->mWidth;
	for (int y = 0; y < mHeight; y++)
	{
		if (y == 0)
		{
			UpfilterLeft(src2, src2, src3, dst1, dst2);
			src1++; src2++; src3++;
			dst1 += 2;
			dst2 += 2;
			for (int x = 1; x < mWidth-1; x++)
			{
				Upfilter(src2, src2, src3, dst1, dst2);
				dst1 += 2;
				dst2 += 2;
				src1++; src2++; src3++;
			}
			UpfilterRight(src1, src2, src2, dst1, dst2);
			src1++; src2++; src3++;
			dst1 += 2;
			dst2 += 2;
		}
		else if (y == mHeight - 1)
		{
			UpfilterLeft(src1, src2, src2, dst1, dst2);
			src1++; src2++; src3++;
			dst1 += 2;
			dst2 += 2;
			for (int x = 1; x < mWidth-1; x++)
			{
				Upfilter(src1, src2, src2, dst1, dst2);
				src1++; src2++; src3++;
				dst1 += 2;
				dst2 += 2;
			}
			UpfilterRight(src1, src2, src2, dst1, dst2);
			src1++; src2++; src3++;
			dst1 += 2;
			dst2 += 2;
		}
		else
		{
			UpfilterLeft(src1++, src2++, src3++, dst1, dst2);
			dst1 += 2;
			dst2 += 2;
			for (int x = 1; x < mWidth-1; x++)
			{
				Upfilter(src1++, src2++, src3++, dst1, dst2);
				dst1 += 2;
				dst2 += 2;
			}
			UpfilterRight(src1++, src2++, src3++, dst1, dst2);
			dst1 += 2;
			dst2 += 2;
		}
		dst1 += bmp->mWidth;
		dst2 += bmp->mWidth;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rax
leaq -0x8(%rax), %r15
movslq (%rdi), %rcx
leaq (,%rcx,8), %rdx
negq %rdx
addq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x8(%rsp)
leaq -0x8(%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsi), %rbp
movq %rsi, 0x18(%rsp)
movslq (%rsi), %rax
leaq (,%rax,8), %rbx
addq %rbp, %rbx
xorl %ecx, %ecx
movl 0x4(%r14), %eax
cmpl %eax, %ecx
jge 0x6cd7
testl %ecx, %ecx
movq %rcx, 0x20(%rsp)
je 0x6b5c
decl %eax
cmpl %eax, %ecx
jne 0x6be5
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movq %rbx, %r8
callq 0x6061
xorl %r12d, %r12d
pushq $0x1
popq %r13
leaq (%r15,%r12), %rdx
addq $0x8, %rdx
movq 0x8(%rsp), %rax
leaq (%rax,%r12), %rdi
addq $0x8, %rdi
movl (%r14), %eax
decl %eax
cmpl %eax, %r13d
jge 0x6c49
addq $0x10, %rbx
addq $0x10, %rbp
movq %rdx, %rsi
movq %rbp, %rcx
movq %rbx, %r8
callq 0x5e37
incl %r13d
addq $0x8, %r12
jmp 0x6b1a
movq %r15, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
movq %rbp, %rcx
movq %rbx, %r8
callq 0x6061
xorl %r12d, %r12d
pushq $0x1
popq %r13
leaq (%r15,%r12), %rsi
addq $0x8, %rsi
movl (%r14), %eax
decl %eax
cmpl %eax, %r13d
jge 0x6bb7
addq $0x10, %rbx
addq $0x10, %rbp
movq 0x10(%rsp), %rax
leaq (%r12,%rax), %rdx
addq $0x8, %rdx
movq %rsi, %rdi
movq %rbp, %rcx
movq %rbx, %r8
callq 0x5e37
incl %r13d
addq $0x8, %r12
jmp 0x6b79
movq 0x8(%rsp), %r13
leaq (%r12,%r13), %rdi
addq $0x8, %rdi
leaq 0x10(%rbp), %rcx
leaq 0x10(%rbx), %r8
movq %rsi, %rdx
callq 0x6245
addq %r12, %r13
addq $0x10, %r13
movq %r13, 0x8(%rsp)
jmp 0x6c6a
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
movq %rbp, %rcx
movq %rbx, %r8
callq 0x6061
xorl %r12d, %r12d
pushq $0x1
popq %r13
movq 0x10(%rsp), %rax
leaq (%rax,%r12), %rdx
addq $0x8, %rdx
leaq 0x8(%r15,%r12), %rsi
movq 0x8(%rsp), %rax
leaq (%rax,%r12), %rdi
addq $0x8, %rdi
movl (%r14), %eax
decl %eax
cmpl %eax, %r13d
jge 0x6c84
addq $0x10, %rbx
addq $0x10, %rbp
movq %rbp, %rcx
movq %rbx, %r8
callq 0x5e37
incl %r13d
addq $0x8, %r12
jmp 0x6c04
leaq 0x10(%rbp), %rcx
leaq 0x10(%rbx), %r8
movq %rdx, %rsi
callq 0x6245
movq 0x8(%rsp), %rax
addq %r12, %rax
addq $0x10, %rax
movq %rax, 0x8(%rsp)
addq %r12, %r15
addq $0x10, %r15
movq 0x10(%rsp), %rax
addq %r12, %rax
addq $0x10, %rax
movq %rax, 0x10(%rsp)
jmp 0x6cb6
movq 0x8(%rsp), %rax
addq %r12, %rax
addq $0x10, %rax
movq %rax, 0x8(%rsp)
leaq 0x10(%r15,%r12), %r15
movq 0x10(%rsp), %rax
leaq 0x10(%rax,%r12), %rax
movq %rax, 0x10(%rsp)
leaq 0x10(%rbp), %rcx
leaq 0x10(%rbx), %r8
callq 0x6245
movq 0x18(%rsp), %rax
movslq (%rax), %rax
leaq 0x20(%rbp,%rax,8), %rbp
leaq (%rbx,%rax,8), %rbx
addq $0x20, %rbx
movq 0x20(%rsp), %rcx
incl %ecx
jmp 0x6ade
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq