// File: /workspace/github_cpp_makefile_star2_O1/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 0x23404
cmpl $0x1, %eax
jne 0x10615
movq 0x38(%r15), %rax
testl %ebx, %ebx
jle 0x104e7
cmpq %r14, (%rax)
jne 0x104e7
leal -0x1(%rbx), %esi
movl %ebp, %edi
callq 0x23404
testl %eax, %eax
je 0x10504
leaq 0x1c333(%rip), %rdi     # 0x2c802
leaq 0x1bff2(%rip), %rsi     # 0x2c4c8
leaq 0x1c2c4(%rip), %rcx     # 0x2c7a1
movl $0x1ff, %edx            # imm = 0x1FF
callq 0x31c0
testl %ebx, %ebx
jle 0x10504
cmpq %r14, 0x10(%rax)
jne 0x10504
leal -0x1(%rbx), %esi
movl %ebp, %edi
callq 0x23404
cmpl $0x2, %eax
jne 0x10653
movq %r14, 0x20(%rsp)
movl 0x28(%r12), %r14d
movl $0x1, %r13d
movq %r15, %rdi
movl $0x1, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0xe55c
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
testl %ebp, %ebp
jle 0x10573
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 0xe55c
movsd 0x8(%rsp), %xmm0
divsd (%rax), %xmm0
xorpd %xmm2, %xmm2
addsd %xmm0, %xmm2
jmp 0x1057a
xorl %r13d, %r13d
xorpd %xmm2, %xmm2
decl %r14d
cmpl %ebp, %r14d
jle 0x105cb
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, 0x10(%rsp)
movq %r15, %rdi
movl $0x1, %esi
movl %ebp, %edx
movsd %xmm2, 0x8(%rsp)
callq 0xe55c
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm0
divsd (%rax), %xmm0
addsd %xmm0, %xmm2
incl %r13d
testl %r13d, %r13d
jle 0x10634
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd 0x18(%rsp), %xmm1
divsd %xmm0, %xmm1
mulsd %xmm1, %xmm2
movsd 0x1ba0a(%rip), %xmm0    # 0x2bff8
minsd %xmm2, %xmm0
movq 0x20(%rsp), %rcx
movq 0x38(%rcx), %rax
imull 0x28(%rcx), %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 0x1c0bd(%rip), %rdi     # 0x2c6d9
leaq 0x1bea5(%rip), %rsi     # 0x2c4c8
leaq 0x1c177(%rip), %rcx     # 0x2c7a1
movl $0x1fd, %edx            # imm = 0x1FD
callq 0x31c0
leaq 0x1bedc(%rip), %rdi     # 0x2c517
leaq 0x1be86(%rip), %rsi     # 0x2c4c8
leaq 0x1c158(%rip), %rcx     # 0x2c7a1
movl $0x216, %edx            # imm = 0x216
callq 0x31c0
leaq 0x1c1cb(%rip), %rdi     # 0x2c825
leaq 0x1be67(%rip), %rsi     # 0x2c4c8
leaq 0x1c139(%rip), %rcx     # 0x2c7a1
movl $0x201, %edx            # imm = 0x201
callq 0x31c0