// File: /workspace/github_cpp_makefile_star2_O2/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
movl (%rdi), %eax
cmpl (%rsi), %eax
jne 0x7537
movl 0x4(%rsi), %ecx
leal (%rcx,%rcx), %edx
cmpl %edx, 0x4(%rdi)
jne 0x7556
movslq %eax, %r10
movq 0x18(%rdi), %r9
leaq (,%r10,8), %rdx
movq %r9, %r11
subq %rdx, %r11
leaq (%r9,%r10,8), %rdx
shlq $0x4, %r10
addq %r9, %r10
movq 0x18(%rsi), %r8
xorl %ebp, %ebp
movq %rdi, 0x10(%rsp)
movq %rsi, (%rsp)
cmpl %ecx, %ebp
jge 0x7528
testl %ebp, %ebp
movl %ebp, 0xc(%rsp)
je 0x746b
decl %ecx
cmpl %ecx, %ebp
jne 0x74b7
movq %r10, %rbx
xorl %r13d, %r13d
cmpl %eax, %r13d
jge 0x74fb
leaq 0x8(%r9), %r14
leaq 0x8(%rdx), %r15
leaq 0x8(%r11), %r12
leaq 0x8(%r8), %rbp
movq %r9, %rdi
movq %rdx, %rsi
movq %r11, %rdx
movq %r8, %rcx
callq 0x55c3
addq $0x8, %rbx
incl %r13d
movq (%rsp), %rax
movl (%rax), %eax
movq %r12, %r11
movq %r14, %r9
movq %r15, %rdx
movq %rbp, %r8
jmp 0x7426
movq %r11, %rbx
xorl %r13d, %r13d
cmpl %eax, %r13d
jge 0x74b2
leaq 0x8(%r9), %r14
leaq 0x8(%rdx), %rbp
leaq 0x8(%r10), %r15
leaq 0x8(%r8), %r12
movq %r9, %rdi
movq %rdx, %rsi
movq %r10, %rdx
movq %r8, %rcx
callq 0x55c3
addq $0x8, %rbx
incl %r13d
movq (%rsp), %rax
movl (%rax), %eax
movq %r14, %r9
movq %rbp, %rdx
movq %r15, %r10
movq %r12, %r8
jmp 0x7471
movq %rbx, %r11
jmp 0x74fe
xorl %r13d, %r13d
cmpl %eax, %r13d
jge 0x74fe
leaq 0x8(%r11), %r14
leaq 0x8(%r9), %r15
leaq 0x8(%rdx), %r12
leaq 0x8(%r10), %rbp
leaq 0x8(%r8), %rbx
movq %r11, %rdi
movq %r9, %rsi
movq %r10, %rcx
callq 0x5565
incl %r13d
movq (%rsp), %rax
movl (%rax), %eax
movq %r14, %r11
movq %r15, %r9
movq %r12, %rdx
movq %rbp, %r10
movq %rbx, %r8
jmp 0x74ba
movq %rbx, %r10
movq (%rsp), %rsi
movq 0x10(%rsp), %rcx
movslq (%rcx), %rcx
leaq (%r11,%rcx,8), %r11
leaq (%r9,%rcx,8), %r9
leaq (%rdx,%rcx,8), %rdx
leaq (%r10,%rcx,8), %r10
movl 0xc(%rsp), %ebp
incl %ebp
movl 0x4(%rsi), %ecx
jmp 0x7406
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16e84(%rip), %rdi     # 0x1e3c2
leaq 0x16d4b(%rip), %rsi     # 0x1e290
leaq 0x16e8c(%rip), %rcx     # 0x1e3d8
movl $0x212, %edx            # imm = 0x212
callq 0x4100
leaq 0x16ea4(%rip), %rdi     # 0x1e401
leaq 0x16d2c(%rip), %rsi     # 0x1e290
leaq 0x16e6d(%rip), %rcx     # 0x1e3d8
movl $0x213, %edx            # imm = 0x213
callq 0x4100
nop