// File: /workspace/github_cpp_makefile_star2_O2/kebwi[P]Trifid/src/ImageProcs.cpp
// Function: addSensorNoise(Image3ChnlReal&, bool, NoiseParam)
void addSensorNoise(Image3ChnlReal &rgbImage, bool applyBayer, NoiseParam noiseParams)
{
	cout << "Adding color sensor noise..." << endl;
	
	//Check to see if the image is normalized
	int totalPixels = rgbImage.totalPixels();
	Float_t maxVal = 0;
	for (int c = 0; c < 3; c++)
		for (int i = 0; i < totalPixels; i++)
		{
			assert((*rgbImage[c])[i] >= 0 && (*rgbImage[c])[i] <= 1.0);
			if ((*rgbImage[c])[i] > maxVal)
				maxVal = (*rgbImage[c])[i];
		}
	if (maxVal != 1.0)
		cout << "***  NOTE  ***  This input image is not normalized yet" << endl;
	
	//Noisify the image
	cout << endl << setw(40) << left << "  Noisifying with ags: " << noiseParams.ampGain_ << endl;
	for (int c = 0; c < 3; c++)
		addSensorNoise(*rgbImage[c], applyBayer, noiseParams);
	
	rgbImage.appendFilename("_n-");
	rgbImage.appendFilename(noiseParams.label_);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movq 0x1da3d(%rip), %rdi     # 0x2ffd0
leaq 0x1232b(%rip), %rsi     # 0x248c5
callq 0x32c0
movq %rax, %rdi
callq 0x3120
movl 0x30(%rbx), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movq 0x38(%rbx), %rdx
xorpd %xmm0, %xmm0
movsd 0xfa97(%rip), %xmm1     # 0x22058
xorpd %xmm2, %xmm2
cmpq $0x3, %rcx
je 0x12605
xorl %esi, %esi
cmpq %rsi, %rax
je 0x12600
movq (%rdx,%rcx,8), %rdi
movq 0x38(%rdi), %rdi
movsd (%rdi,%rsi,8), %xmm3
ucomisd %xmm0, %xmm3
jb 0x12709
ucomisd %xmm3, %xmm1
jb 0x12709
maxsd %xmm2, %xmm3
incq %rsi
movapd %xmm3, %xmm2
jmp 0x125cd
incq %rcx
jmp 0x125c5
ucomisd 0xfa4b(%rip), %xmm2     # 0x22058
jne 0x12611
jnp 0x1262c
movq 0x1d9b8(%rip), %rdi     # 0x2ffd0
leaq 0x1209a(%rip), %rsi     # 0x246b9
callq 0x32c0
movq %rax, %rdi
callq 0x3120
movq 0x1d99d(%rip), %rdi     # 0x2ffd0
callq 0x3120
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq $0x28, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl 0x18(%rax,%rcx), %edx
orl $0x20, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x1216d(%rip), %rsi     # 0x247d0
movq %rax, %rdi
callq 0x32c0
movsd 0xa0(%r14), %xmm0
movq %rax, %rdi
callq 0x3460
movq %rax, %rdi
callq 0x3120
xorl %r13d, %r13d
leaq 0x28(%rsp), %r15
movzbl %bpl, %ebp
cmpq $0x3, %r13
je 0x126c3
movq 0x38(%rbx), %rax
movq (%rax,%r13,8), %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x8544
movq %r12, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x105a0
movq %r15, %rdi
callq 0x805c
incq %r13
jmp 0x12690
leaq 0x11eee(%rip), %rsi     # 0x245b8
movq %rbx, %rdi
callq 0x8686
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x33b0
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa508
leaq 0x8(%rsp), %rdi
callq 0x3548
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x121d2(%rip), %rdi     # 0x248e2
leaq 0x115aa(%rip), %rsi     # 0x23cc1
leaq 0x121f7(%rip), %rcx     # 0x24915
movl $0x473, %edx            # imm = 0x473
callq 0x31a0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3548
jmp 0x12744
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x805c
movq %rbx, %rdi
callq 0x34d0