// File: /workspace/github_cpp_makefile_star2_O3/kebwi[P]Trifid/src/DebayerProcs.cpp
// Function: hue_constructVerticalRedOrBlueAtGreen(ImageReal&, Image3ChnlReal&, ImageReal&, int, int)
void hue_constructVerticalRedOrBlueAtGreen(
	ImageReal &grayImage, Image3ChnlReal &rgbImage,
	ImageReal &rgbImageRorB, int x, int y)
{
	assert(determineBayerColor(x, y) == G);
	if (&rgbImageRorB == rgbImage[0] && y > 0)
		assert(determineBayerColor(x, y - 1) == R);
	else if (&rgbImageRorB == rgbImage[2] && y > 0)
		assert(determineBayerColor(x, y - 1) == B);
	
	int width = grayImage.width();
	
	Float_t color1L = rgbImage(G, x, y);
	Float_t color2L = 0;
	int divisor = 0;
	
	if (x > 0)
	{
		color2L += (Float_t)grayImage(x, y - 1) /
					(Float_t)rgbImage(G, x, y - 1);
		divisor++;
	}
	if (x < width - 1)
	{
		color2L += (Float_t)grayImage(x, y + 1) /
					(Float_t)rgbImage(G, x, y + 1);
		divisor++;
	}
	
	assert(divisor > 0);
	color1L = ((Float_t)color1L / (Float_t)divisor) * color2L;
	if (color1L > pow(2, sBitDepth) - 1)
		color1L = pow(2, sBitDepth) - 1;
	
	rgbImageRorB(x, y) = color1L;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %ebx
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl %ecx, %edi
movl %r8d, %esi
callq 0x23198
cmpl $0x1, %eax
jne 0x105c3
movq 0x38(%r15), %rax
testl %ebx, %ebx
jle 0x10476
cmpq %r14, (%rax)
jne 0x10476
leal -0x1(%rbx), %esi
movl %ebp, %edi
callq 0x23198
testl %eax, %eax
je 0x10493
leaq 0x1b38c(%rip), %rdi     # 0x2b7ea
leaq 0x1b04b(%rip), %rsi     # 0x2b4b0
leaq 0x1b31d(%rip), %rcx     # 0x2b789
movl $0x1ff, %edx            # imm = 0x1FF
callq 0x31c0
testl %ebx, %ebx
jle 0x10493
cmpq %r14, 0x10(%rax)
jne 0x10493
leal -0x1(%rbx), %esi
movl %ebp, %edi
callq 0x23198
cmpl $0x2, %eax
jne 0x10601
movl 0x28(%r12), %r13d
movq %r15, %rdi
movl $0x1, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0xe49a
movsd (%rax), %xmm0
testl %ebp, %ebp
movsd %xmm0, 0x20(%rsp)
jle 0x10517
leal -0x1(%rbx), %ecx
movq 0x38(%r12), %rax
movl 0x28(%r12), %edx
imull %ecx, %edx
addl %ebp, %edx
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movl $0x1, %esi
movl %ebp, %edx
callq 0xe49a
movsd 0x8(%rsp), %xmm1
divsd (%rax), %xmm1
xorpd %xmm0, %xmm0
addsd %xmm1, %xmm0
decl %r13d
cmpl %ebp, %r13d
jle 0x10582
movsd 0x1af5f(%rip), %xmm1    # 0x2b468
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
jmp 0x1053a
decl %r13d
cmpl %ebp, %r13d
jle 0x105e2
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x19b24(%rip), %xmm0    # 0x2a058
movsd %xmm0, 0x8(%rsp)
leal 0x1(%rbx), %ecx
movq 0x38(%r12), %rax
movl 0x28(%r12), %edx
imull %ecx, %edx
addl %ebp, %edx
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r15, %rdi
movl $0x1, %esi
movl %ebp, %edx
callq 0xe49a
movsd 0x18(%rsp), %xmm1
divsd (%rax), %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd 0x8(%rsp), %xmm2
jmp 0x1058a
movsd 0x19ace(%rip), %xmm2    # 0x2a058
movsd 0x20(%rsp), %xmm1
divsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
movsd 0x1aa30(%rip), %xmm0    # 0x2afd0
minsd %xmm1, %xmm0
movq 0x38(%r14), %rax
imull 0x28(%r14), %ebx
addl %ebp, %ebx
movsd %xmm0, (%rax,%rbx,8)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b0f7(%rip), %rdi     # 0x2b6c1
leaq 0x1aedf(%rip), %rsi     # 0x2b4b0
leaq 0x1b1b1(%rip), %rcx     # 0x2b789
movl $0x1fd, %edx            # imm = 0x1FD
callq 0x31c0
leaq 0x1af16(%rip), %rdi     # 0x2b4ff
leaq 0x1aec0(%rip), %rsi     # 0x2b4b0
leaq 0x1b192(%rip), %rcx     # 0x2b789
movl $0x216, %edx            # imm = 0x216
callq 0x31c0
leaq 0x1b205(%rip), %rdi     # 0x2b80d
leaq 0x1aea1(%rip), %rsi     # 0x2b4b0
leaq 0x1b173(%rip), %rcx     # 0x2b789
movl $0x201, %edx            # imm = 0x201
callq 0x31c0