// File: /workspace/github_cpp_makefile_star2_O1/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 0x23404
cmpl $0x1, %eax
jne 0x10421
movq 0x38(%r12), %rax
testl %r14d, %r14d
jle 0x102f0
cmpq %r15, (%rax)
jne 0x102f0
leal -0x1(%r14), %edi
movl %ebx, %esi
callq 0x23404
testl %eax, %eax
je 0x1030f
leaq 0x1c483(%rip), %rdi     # 0x2c75b
leaq 0x1c1e9(%rip), %rsi     # 0x2c4c8
leaq 0x1c412(%rip), %rcx     # 0x2c6f8
movl $0x1da, %edx            # imm = 0x1DA
callq 0x31c0
testl %r14d, %r14d
jle 0x1030f
cmpq %r15, 0x10(%rax)
jne 0x1030f
leal -0x1(%r14), %edi
movl %ebx, %esi
callq 0x23404
cmpl $0x2, %eax
jne 0x1045f
movq %r15, 0x20(%rsp)
movl 0x28(%r13), %r15d
movl $0x1, %ebp
movq %r12, %rdi
movl $0x1, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0xe55c
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
testl %r14d, %r14d
jle 0x10380
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)
movq %r12, %rdi
movl $0x1, %esi
movl %ebx, %ecx
callq 0xe55c
movsd 0x8(%rsp), %xmm0
divsd (%rax), %xmm0
xorpd %xmm2, %xmm2
addsd %xmm0, %xmm2
jmp 0x10386
xorl %ebp, %ebp
xorpd %xmm2, %xmm2
decl %r15d
cmpl %r14d, %r15d
jle 0x103d8
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, 0x10(%rsp)
movq %r12, %rdi
movl $0x1, %esi
movl %ebx, %ecx
movsd %xmm2, 0x8(%rsp)
callq 0xe55c
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm0
divsd (%rax), %xmm0
addsd %xmm0, %xmm2
incl %ebp
testl %ebp, %ebp
jle 0x10440
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
mulsd %xmm1, %xmm2
movsd 0x1bbff(%rip), %xmm0    # 0x2bff8
minsd %xmm2, %xmm0
movq 0x20(%rsp), %rcx
movq 0x38(%rcx), %rax
imull 0x28(%rcx), %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 0x1c2b1(%rip), %rdi     # 0x2c6d9
leaq 0x1c099(%rip), %rsi     # 0x2c4c8
leaq 0x1c2c2(%rip), %rcx     # 0x2c6f8
movl $0x1d8, %edx            # imm = 0x1D8
callq 0x31c0
leaq 0x1c0d0(%rip), %rdi     # 0x2c517
leaq 0x1c07a(%rip), %rsi     # 0x2c4c8
leaq 0x1c2a3(%rip), %rcx     # 0x2c6f8
movl $0x1f1, %edx            # imm = 0x1F1
callq 0x31c0
leaq 0x1c318(%rip), %rdi     # 0x2c77e
leaq 0x1c05b(%rip), %rsi     # 0x2c4c8
leaq 0x1c284(%rip), %rcx     # 0x2c6f8
movl $0x1dc, %edx            # imm = 0x1DC
callq 0x31c0