// File: /workspace/github_cpp_makefile_star2_O2/kebwi[P]Trifid/src/DebayerProcs.cpp
// Function: hue_constructHorizontalRedOrBlueAtGreen(ImageReal&, Image3ChnlReal&, ImageReal&, int, int)
void hue_constructHorizontalRedOrBlueAtGreen(
	ImageReal &grayImage, Image3ChnlReal &rgbImage,
	ImageReal &rgbImageRorB, int x, int y)
{
	assert(determineBayerColor(x, y) == G);
	if (&rgbImageRorB == rgbImage[0] && x > 0)
		assert(determineBayerColor(x - 1, y) == R);
	else if (&rgbImageRorB == rgbImage[2] && x > 0)
		assert(determineBayerColor(x - 1, y) == 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 - 1, y) /
					(Float_t)rgbImage(G, x - 1, y);
		divisor++;
	}
	if (x < width - 1)
	{
		color2L += (Float_t)grayImage(x + 1, y) /
					(Float_t)rgbImage(G, x + 1, y);
		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, %r14d
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movl %ecx, %edi
movl %r8d, %esi
callq 0x1c294
cmpl $0x1, %eax
jne 0xd517
movq 0x38(%r12), %rax
testl %r14d, %r14d
jle 0xd3ca
cmpq %r15, (%rax)
jne 0xd3ca
leal -0x1(%r14), %edi
movl %ebx, %esi
callq 0x1c294
testl %eax, %eax
je 0xd3e9
leaq 0x16381(%rip), %rdi     # 0x23733
leaq 0x160e7(%rip), %rsi     # 0x234a0
leaq 0x16310(%rip), %rcx     # 0x236d0
movl $0x1da, %edx            # imm = 0x1DA
callq 0x31a0
testl %r14d, %r14d
jle 0xd3e9
cmpq %r15, 0x10(%rax)
jne 0xd3e9
leal -0x1(%r14), %edi
movl %ebx, %esi
callq 0x1c294
cmpl $0x2, %eax
jne 0xd555
movl 0x28(%r13), %ebp
pushq $0x1
popq %rsi
movq %r12, %rdi
movl %r14d, %edx
movl %ebx, %ecx
callq 0xb868
movsd (%rax), %xmm0
testl %r14d, %r14d
movsd %xmm0, 0x20(%rsp)
jle 0xd46b
leal -0x1(%r14), %edx
movq 0x38(%r13), %rax
movl 0x28(%r13), %ecx
imull %ebx, %ecx
addl %r14d, %ecx
decl %ecx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
pushq $0x1
popq %rsi
movq %r12, %rdi
movl %ebx, %ecx
callq 0xb868
movsd 0x8(%rsp), %xmm1
divsd (%rax), %xmm1
xorpd %xmm0, %xmm0
addsd %xmm1, %xmm0
decl %ebp
cmpl %r14d, %ebp
jle 0xd4d5
movsd 0x15ffb(%rip), %xmm1    # 0x23458
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
jmp 0xd48d
decl %ebp
cmpl %r14d, %ebp
jle 0xd536
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x14bd1(%rip), %xmm0    # 0x22058
movsd %xmm0, 0x8(%rsp)
leal 0x1(%r14), %edx
movq 0x38(%r13), %rax
movl 0x28(%r13), %ecx
imull %ebx, %ecx
addl %r14d, %ecx
incl %ecx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x18(%rsp)
pushq $0x1
popq %rsi
movq %r12, %rdi
movl %ebx, %ecx
callq 0xb868
movsd 0x18(%rsp), %xmm1
divsd (%rax), %xmm1
movsd 0x10(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd 0x8(%rsp), %xmm2
jmp 0xd4dd
movsd 0x14b7b(%rip), %xmm2    # 0x22058
movsd 0x20(%rsp), %xmm1
divsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
movsd 0x15acd(%rip), %xmm0    # 0x22fc0
minsd %xmm1, %xmm0
movq 0x38(%r15), %rax
imull 0x28(%r15), %ebx
addl %r14d, %ebx
movsd %xmm0, (%rax,%rbx,8)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16193(%rip), %rdi     # 0x236b1
leaq 0x15f7b(%rip), %rsi     # 0x234a0
leaq 0x161a4(%rip), %rcx     # 0x236d0
movl $0x1d8, %edx            # imm = 0x1D8
callq 0x31a0
leaq 0x15fb2(%rip), %rdi     # 0x234ef
leaq 0x15f5c(%rip), %rsi     # 0x234a0
leaq 0x16185(%rip), %rcx     # 0x236d0
movl $0x1f1, %edx            # imm = 0x1F1
callq 0x31a0
leaq 0x161fa(%rip), %rdi     # 0x23756
leaq 0x15f3d(%rip), %rsi     # 0x234a0
leaq 0x16166(%rip), %rcx     # 0x236d0
movl $0x1dc, %edx            # imm = 0x1DC
callq 0x31a0