// File: kebwi[P]Trifid/src/DebayerProcs.cpp
// Function: bilinear_procOnePixel(ImageReal&, Image3ChnlReal&, int, int)
void bilinear_procOnePixel(
	ImageReal &grayImage, Image3ChnlReal &rgbImage,
	int x, int y)
{
	Color color = determineBayerColor(x, y);
	
	Float_t color1 = 0, color2 = 0;
	bilinear_calcMissingColors(grayImage, rgbImage, x, y, color1, color2);
	
	//Fill in the output
	Float_t bayerValue = grayImage(x, y);
	switch (color)
	{
		case R:
			rgbImage(R, x, y) = bayerValue;
			rgbImage(G, x, y) = color1;
			rgbImage(B, x, y) = color2;
			break;
		case G:
			rgbImage(R, x, y) = color1;
			rgbImage(G, x, y) = bayerValue;
			rgbImage(B, x, y) = color2;
			break;
		case B:
			rgbImage(R, x, y) = color1;
			rgbImage(G, x, y) = color2;
			rgbImage(B, x, y) = bayerValue;
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x380a0
movl %eax, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq -0x28(%rbp), %r8
leaq -0x30(%rbp), %r9
callq 0x19be0
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x16fd0
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x3c(%rbp)
testl %eax, %eax
je 0x1a4b5
jmp 0x1a496
movl -0x3c(%rbp), %eax
subl $0x1, %eax
je 0x1a52c
jmp 0x1a4a4
movl -0x3c(%rbp), %eax
subl $0x2, %eax
je 0x1a5a0
jmp 0x1a618
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
xorl %esi, %esi
callq 0x17990
movsd -0x58(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x1, %esi
callq 0x17990
movsd -0x50(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x2, %esi
callq 0x17990
movsd -0x48(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x1a618
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
xorl %esi, %esi
callq 0x17990
movsd -0x70(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x1, %esi
callq 0x17990
movsd -0x68(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x2, %esi
callq 0x17990
movsd -0x60(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x1a618
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
xorl %esi, %esi
callq 0x17990
movsd -0x88(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x1, %esi
callq 0x17990
movsd -0x80(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x2, %esi
callq 0x17990
movsd -0x78(%rbp), %xmm0
movsd %xmm0, (%rax)
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)