// File: /workspace/github_cpp_makefile_star2_O3/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), %r9d
cmpl (%rsi), %r9d
jne 0x7900
movl 0x4(%rsi), %edx
leal (%rdx,%rdx), %eax
cmpl %eax, 0x4(%rdi)
jne 0x791f
testl %edx, %edx
jle 0x78f1
movslq %r9d, %r11
movq 0x18(%rsi), %r8
movq 0x18(%rdi), %r10
movq %r11, %rcx
shlq $0x4, %rcx
addq %r10, %rcx
leaq (%r10,%r11,8), %rax
shlq $0x3, %r11
movq %r10, %r15
subq %r11, %r15
xorl %r11d, %r11d
movq %rsi, (%rsp)
movq %rdi, 0x10(%rsp)
testl %r11d, %r11d
movl %r11d, 0xc(%rsp)
je 0x781b
decl %edx
cmpl %edx, %r11d
jne 0x7867
testl %r9d, %r9d
jle 0x78af
xorl %ebx, %ebx
movq %rcx, %r12
movq %r15, %rdx
leaq 0x8(%r10), %r13
leaq 0x8(%rax), %r14
leaq 0x8(%rdx), %r15
leaq 0x8(%r8), %rbp
movq %r10, %rdi
movq %rax, %rsi
movq %r8, %rcx
callq 0x5821
movq (%rsp), %rsi
addq $0x8, %r12
incl %ebx
movl (%rsi), %r9d
movq %rbp, %r8
movq %r14, %rax
movq %r13, %r10
movq %r15, %rdx
cmpl %r9d, %ebx
jl 0x77da
jmp 0x78bb
testl %r9d, %r9d
jle 0x78af
xorl %ebx, %ebx
leaq 0x8(%r10), %r13
leaq 0x8(%rax), %r14
leaq 0x8(%rcx), %r12
leaq 0x8(%r8), %rbp
movq %r10, %rdi
movq %rax, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x5821
movq (%rsp), %rsi
addq $0x8, %r15
incl %ebx
movl (%rsi), %r9d
movq %rbp, %r8
movq %r12, %rcx
movq %r14, %rax
movq %r13, %r10
cmpl %r9d, %ebx
jl 0x7826
jmp 0x78bb
testl %r9d, %r9d
jle 0x78af
xorl %ebx, %ebx
movq %r15, %rdi
leaq 0x8(%rdi), %r15
leaq 0x8(%r10), %r13
leaq 0x8(%rax), %r14
leaq 0x8(%rcx), %r12
leaq 0x8(%r8), %rbp
movq %r10, %rsi
movq %rax, %rdx
callq 0x57c3
movq (%rsp), %rsi
incl %ebx
movl (%rsi), %r9d
movq %rbp, %r8
movq %r12, %rcx
movq %r14, %rax
movq %r13, %r10
movq %r15, %rdi
cmpl %r9d, %ebx
jl 0x7871
jmp 0x78bb
movq %r10, %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), %r10
addq %r13, %r10
leaq (%r14,%rcx,8), %rax
leaq (%r12,%rcx,8), %rcx
movl 0xc(%rsp), %r11d
incl %r11d
movl 0x4(%rsi), %edx
movq %rbp, %r8
cmpl %edx, %r11d
jl 0x77b4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16aeb(%rip), %rdi     # 0x1e3f2
leaq 0x169b2(%rip), %rsi     # 0x1e2c0
leaq 0x16af3(%rip), %rcx     # 0x1e408
movl $0x212, %edx            # imm = 0x212
callq 0x4100
leaq 0x16b0b(%rip), %rdi     # 0x1e431
leaq 0x16993(%rip), %rsi     # 0x1e2c0
leaq 0x16ad4(%rip), %rcx     # 0x1e408
movl $0x213, %edx            # imm = 0x213
callq 0x4100