// File: /workspace/github_cpp_makefile_star2_O1/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::DownsampleY(CLinear16*)
void CLinear16::DownsampleY(CLinear16 *bmp)
{
	assert(mWidth == bmp->mWidth);
	assert(mHeight == bmp->mHeight*2);
	color_t *src1 = mData - mWidth;
	color_t *src2 = mData;
	color_t *src3 = mData + mWidth;
	color_t *src4 = mData + mWidth * 2;
	color_t *dst = bmp->mData;
	for (int y = 0; y < bmp->mHeight; y++)
	{
		if (y == 0)
		{
			for (int x = 0; x < bmp->mWidth; x++)
			{
				DownfilterY(src2++, src3++, src4++, dst++);
				src1++;
			}
		}
		else if (y == bmp->mHeight - 1)
		{
			for (int x = 0; x < bmp->mWidth; x++)
			{
				DownfilterY(src2++, src3++, src1++, dst++);
				src4++;
			}
		}
		else
		{
			for (int x = 0; x < bmp->mWidth; x++)
			{
				DownfilterY(src1++, src2++, src3++, src4++, dst++);
			}
		}
		src1 += mWidth;
		src2 += mWidth;
		src3 += mWidth;
		src4 += mWidth;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movslq (%rdi), %r10
cmpl (%rsi), %r10d
jne 0x81d9
movl 0x4(%rsi), %eax
addl %eax, %eax
cmpl %eax, 0x4(%rdi)
jne 0x81f8
movl 0x4(%rsi), %edx
testl %edx, %edx
jle 0x81ca
movq 0x18(%rsi), %r8
movq 0x18(%rdi), %r9
movq %r10, %rcx
shlq $0x4, %rcx
addq %r9, %rcx
leaq (%r9,%r10,8), %rax
shlq $0x3, %r10
movq %r9, %r15
subq %r10, %r15
xorl %r10d, %r10d
movq %rsi, (%rsp)
movq %rdi, 0x10(%rsp)
testl %r10d, %r10d
movl %r10d, 0xc(%rsp)
je 0x80fd
decl %edx
movl (%rsi), %edi
cmpl %edx, %r10d
jne 0x8145
testl %edi, %edi
jle 0x8188
xorl %ebx, %ebx
movq %rcx, %r12
movq %r15, %rdx
leaq 0x8(%r9), %r13
leaq 0x8(%rax), %r14
leaq 0x8(%rdx), %r15
leaq 0x8(%r8), %rbp
movq %r9, %rdi
movq %rax, %rsi
movq %r8, %rcx
callq 0x58eb
movq (%rsp), %rsi
addq $0x8, %r12
incl %ebx
movq %rbp, %r8
movq %r14, %rax
movq %r13, %r9
movq %r15, %rdx
cmpl (%rsi), %ebx
jl 0x80c0
jmp 0x8194
cmpl $0x0, (%rsi)
jle 0x8188
xorl %ebx, %ebx
leaq 0x8(%r9), %r13
leaq 0x8(%rax), %r14
leaq 0x8(%rcx), %r12
leaq 0x8(%r8), %rbp
movq %r9, %rdi
movq %rax, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x58eb
movq (%rsp), %rsi
addq $0x8, %r15
incl %ebx
movq %rbp, %r8
movq %r12, %rcx
movq %r14, %rax
movq %r13, %r9
cmpl (%rsi), %ebx
jl 0x8108
jmp 0x8194
testl %edi, %edi
jle 0x8188
xorl %ebx, %ebx
movq %r15, %rdi
leaq 0x8(%rdi), %r15
leaq 0x8(%r9), %r13
leaq 0x8(%rax), %r14
leaq 0x8(%rcx), %r12
leaq 0x8(%r8), %rbp
movq %r9, %rsi
movq %rax, %rdx
callq 0x5846
movq (%rsp), %rsi
incl %ebx
movq %rbp, %r8
movq %r12, %rcx
movq %r14, %rax
movq %r13, %r9
movq %r15, %rdi
cmpl (%rsi), %ebx
jl 0x814e
jmp 0x8194
movq %r9, %r13
movq %rax, %r14
movq %rcx, %r12
movq %r8, %rbp
movq 0x10(%rsp), %rax
movslq (%rax), %rcx
leaq (%r15,%rcx,8), %r15
leaq (,%rcx,8), %r9
addq %r13, %r9
leaq (%r14,%rcx,8), %rax
leaq (%r12,%rcx,8), %rcx
movl 0xc(%rsp), %r10d
incl %r10d
movl 0x4(%rsi), %edx
movq %rbp, %r8
cmpl %edx, %r10d
jl 0x8099
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17156(%rip), %rdi     # 0x1f336
leaq 0x1701d(%rip), %rsi     # 0x1f204
leaq 0x1715e(%rip), %rcx     # 0x1f34c
movl $0x212, %edx            # imm = 0x212
callq 0x4100
leaq 0x17176(%rip), %rdi     # 0x1f375
leaq 0x16ffe(%rip), %rsi     # 0x1f204
leaq 0x1713f(%rip), %rcx     # 0x1f34c
movl $0x213, %edx            # imm = 0x213
callq 0x4100
nop