// File: kebwi[P]Trifid/src/ImagePairStats.cpp
// Function: calcImgLabDeltaE(Image3ChnlReal const&, Image3ChnlReal const&)
Float_t calcImgLabDeltaE(const Image3ChnlReal &img1, const Image3ChnlReal &img2)
{
	assert(img1.width() > 0 && img1.height() > 0);
	assert(img1.width() == img2.width() && img1.height() == img2.height());
	
	Float_t deltaEmean = 0;
	int width = img1.width(), height = img1.height();
	int numNonborderPixels = 0;
	for (int y = skEdgeSkip; y < height - skEdgeSkip; y++)
		for (int x = skEdgeSkip; x < width - skEdgeSkip; x++)
		{
			deltaEmean += calcLabDeltaE((*img1[0])(x, y), (*img1[1])(x, y), (*img1[2])(x, y),
										(*img2[0])(x, y), (*img2[1])(x, y), (*img2[2])(x, y));
			numNonborderPixels++;
		}
	
	deltaEmean /= (Float_t)numNonborderPixels;
		
	return deltaEmean;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedd0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2d(%rbp)
jle 0x36e87
movq -0x8(%rbp), %rdi
callq 0xedf0
cmpl $0x0, %eax
setg %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x36e90
jmp 0x36e92
jmp 0x36eb1
leaq 0x166eb(%rip), %rdi     # 0x4d584
leaq 0x1670a(%rip), %rsi     # 0x4d5aa
movl $0x22, %edx
leaq 0x16711(%rip), %rcx     # 0x4d5bd
callq 0x4240
movq -0x8(%rbp), %rdi
callq 0xedd0
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
callq 0xedd0
movl -0x34(%rbp), %ecx
movl %eax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x2e(%rbp)
jne 0x36ef6
movq -0x8(%rbp), %rdi
callq 0xedf0
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0xedf0
movl %eax, %ecx
movl -0x38(%rbp), %eax
cmpl %ecx, %eax
sete %al
movb %al, -0x2e(%rbp)
movb -0x2e(%rbp), %al
testb $0x1, %al
jne 0x36eff
jmp 0x36f01
jmp 0x36f20
leaq 0x14c1e(%rip), %rdi     # 0x4bb26
leaq 0x1669b(%rip), %rsi     # 0x4d5aa
movl $0x23, %edx
leaq 0x166a2(%rip), %rcx     # 0x4d5bd
callq 0x4240
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedd0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedf0
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl -0x20(%rbp), %ecx
subl $0x0, %ecx
cmpl %ecx, %eax
jge 0x37099
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x1c(%rbp), %ecx
subl $0x0, %ecx
cmpl %ecx, %eax
jge 0x37089
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x25920
movq %rax, %rdi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x1d980
movsd (%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x25920
movq %rax, %rdi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x1d980
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x25920
movq %rax, %rdi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x1d980
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x25920
movq %rax, %rdi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x1d980
movsd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x25920
movq %rax, %rdi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x1d980
movsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x25920
movq %rax, %rdi
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x1d980
movsd -0x60(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x50(%rbp), %xmm2
movsd -0x48(%rbp), %xmm3
movsd -0x40(%rbp), %xmm4
movsd (%rax), %xmm5
callq 0x36dc0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x36f66
jmp 0x3708b
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x36f4e
cvtsi2sdl -0x24(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x18(%rbp), %xmm0
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)