// File: /workspace/github_cpp_makefile_star2_O1/kylegranger[P]ImageScaling/linear16.cpp
// Function: CLinear16::ReadSimpleScanline(unsigned short*, color_t*, ESimpleFormat)
void CLinear16::ReadSimpleScanline(uint16_t *src, color_t *dst, 
	ESimpleFormat format)
{
	switch (format)
	{
	case ESimpleFormatRgba:
		for (int i = 0; i < mWidth; i++)
		{
			dst->r = *src++;
			dst->g = *src++;
			dst->b = *src++;
			dst->a = *src++;
			dst++;
		}
		break;
	case ESimpleFormatBgra:
		for (int i = 0; i < mWidth; i++)
		{
			dst->b = *src++;
			dst->g = *src++;
			dst->r = *src++;
			dst->a = *src++;
			dst++;
		}
		break;
	case ESimpleFormatRgb:
		for (int i = 0; i < mWidth; i++)
		{
			dst->r = *src++;
			dst->g = *src++;
			dst->b = *src++;
			dst->a = 0xffff;
			dst++;
		}
		break;
	case ESimpleFormatBgr:
		for (int i = 0; i < mWidth; i++)
		{
			dst->b = *src++;
			dst->g = *src++;
			dst->r = *src++;
			dst->a = 0xffff;
			dst++;
		}
		break;
	case ESimpleFormatL:
		for (int i = 0; i < mWidth; i++)
		{
			dst->b = *src;
			dst->g = *src;
			dst->r = *src++;
			dst->a = 0xffff;
			dst++;
		}
		break;
	case ESimpleFormatLa:
		for (int i = 0; i < mWidth; i++)
		{
			dst->b = *src;
			dst->g = *src;
			dst->r = *src++;
			dst->a = *src++;
			dst++;
		}
		break;
	}
}

// Assembly:
addl $0xfffff3c5, %ecx       # imm = 0xFFFFF3C5
cmpl $0x5, %ecx
ja 0x8525
leaq 0x16df6(%rip), %rax     # 0x1f1bc
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl (%rdi), %eax
testl %eax, %eax
jle 0x8525
xorl %ecx, %ecx
movzwl (%rsi,%rcx,8), %edi
movw %di, 0x4(%rdx,%rcx,8)
movzwl 0x2(%rsi,%rcx,8), %edi
movw %di, 0x2(%rdx,%rcx,8)
movzwl 0x4(%rsi,%rcx,8), %edi
movw %di, (%rdx,%rcx,8)
movzwl 0x6(%rsi,%rcx,8), %edi
movw %di, 0x6(%rdx,%rcx,8)
incq %rcx
cmpl %ecx, %eax
jne 0x83db
jmp 0x8525
movl (%rdi), %eax
testl %eax, %eax
jle 0x8525
xorl %ecx, %ecx
movzwl (%rsi,%rcx,2), %edi
movw %di, (%rdx,%rcx,8)
movzwl (%rsi,%rcx,2), %edi
movw %di, 0x2(%rdx,%rcx,8)
movzwl (%rsi,%rcx,2), %edi
movw %di, 0x4(%rdx,%rcx,8)
movw $0xffff, 0x6(%rdx,%rcx,8) # imm = 0xFFFF
incq %rcx
cmpl %ecx, %eax
jne 0x8419
jmp 0x8525
movl (%rdi), %eax
testl %eax, %eax
jle 0x8525
xorl %ecx, %ecx
movzwl (%rsi), %edi
movw %di, 0x4(%rdx,%rcx,8)
movzwl 0x2(%rsi), %edi
movw %di, 0x2(%rdx,%rcx,8)
movzwl 0x4(%rsi), %edi
movw %di, (%rdx,%rcx,8)
movw $0xffff, 0x6(%rdx,%rcx,8) # imm = 0xFFFF
incq %rcx
addq $0x6, %rsi
cmpl %ecx, %eax
jne 0x8452
jmp 0x8525
movl (%rdi), %eax
testl %eax, %eax
jle 0x8525
xorl %ecx, %ecx
movzwl (%rsi), %edi
movw %di, (%rdx,%rcx,8)
movzwl 0x2(%rsi), %edi
movw %di, 0x2(%rdx,%rcx,8)
movzwl 0x4(%rsi), %edi
movw %di, 0x4(%rdx,%rcx,8)
movw $0xffff, 0x6(%rdx,%rcx,8) # imm = 0xFFFF
incq %rcx
addq $0x6, %rsi
cmpl %ecx, %eax
jne 0x848e
jmp 0x8525
movl (%rdi), %eax
testl %eax, %eax
jle 0x8525
xorl %ecx, %ecx
movzwl (%rsi,%rcx,8), %edi
movw %di, (%rdx,%rcx,8)
movzwl 0x2(%rsi,%rcx,8), %edi
movw %di, 0x2(%rdx,%rcx,8)
movzwl 0x4(%rsi,%rcx,8), %edi
movw %di, 0x4(%rdx,%rcx,8)
movzwl 0x6(%rsi,%rcx,8), %edi
movw %di, 0x6(%rdx,%rcx,8)
incq %rcx
cmpl %ecx, %eax
jne 0x84c3
jmp 0x8525
movl (%rdi), %eax
testl %eax, %eax
jle 0x8525
xorl %ecx, %ecx
movzwl (%rsi,%rcx,4), %edi
movw %di, (%rdx,%rcx,8)
movzwl (%rsi,%rcx,4), %edi
movw %di, 0x2(%rdx,%rcx,8)
movzwl (%rsi,%rcx,4), %edi
movw %di, 0x4(%rdx,%rcx,8)
movzwl 0x2(%rsi,%rcx,4), %edi
movw %di, 0x6(%rdx,%rcx,8)
incq %rcx
cmpl %ecx, %eax
jne 0x84fa
retq