// File: kebwi[P]Trifid/src/ImageProcs.cpp
// Function: diffImages(ImageReal const&, ImageReal const&, ImageReal&)
void diffImages(const ImageReal &img1, const ImageReal &img2, ImageReal &diff)
{
	assert(img1.width() == img2.width() && img1.height() == img2.height());
	int width = img1.width(), height = img1.height();
	diff.resize(width, height);
	int totalPixels = img1.totalPixels();
	assert(totalPixels = width * height);
	
	Float_t maxDif = 0;
	for (int i = 0; i < totalPixels; i++)
	{
		diff[i] = fabs(img1[i] - img2[i]);
		if (diff[i] > maxDif)
			maxDif = diff[i];
	}
	
	//cout << "Max dif = " << maxDif << "        x 255 = " << maxDif * 255.0 << "        x 65535 = " << maxDif * 65535.0 << endl;
	
	diff.setFilename(img1.filename());
	diff.appendFilename("_dif");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedd0
movl %eax, -0x6c(%rbp)
movq -0x10(%rbp), %rdi
callq 0xedd0
movl -0x6c(%rbp), %ecx
movl %eax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x65(%rbp)
jne 0x2558c
movq -0x8(%rbp), %rdi
callq 0xedf0
movl %eax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0xedf0
movl %eax, %ecx
movl -0x70(%rbp), %eax
cmpl %ecx, %eax
sete %al
movb %al, -0x65(%rbp)
movb -0x65(%rbp), %al
testb $0x1, %al
jne 0x25595
jmp 0x25597
jmp 0x255b6
leaq 0x26588(%rip), %rdi     # 0x4bb26
leaq 0x2578c(%rip), %rsi     # 0x4ad31
movl $0x595, %edx            # imm = 0x595
leaq 0x265b4(%rip), %rcx     # 0x4bb65
callq 0x4240
movq -0x8(%rbp), %rdi
callq 0xedd0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedf0
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movq (%rdi), %rax
callq *0x28(%rax)
movq -0x8(%rbp), %rdi
callq 0xf200
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
imull -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
je 0x255fb
jmp 0x2561a
leaq 0x265a6(%rip), %rdi     # 0x4bba8
leaq 0x25728(%rip), %rsi     # 0x4ad31
movl $0x599, %edx            # imm = 0x599
leaq 0x26550(%rip), %rcx     # 0x4bb65
callq 0x4240
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x256c0
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x25950
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x25950
movsd -0x80(%rbp), %xmm0
subsd (%rax), %xmm0
movaps 0x239da(%rip), %xmm1    # 0x49040
pand %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x18(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xef70
movsd -0x78(%rbp), %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xef70
movsd (%rax), %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x256b0
movq -0x18(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xef70
movsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x256b2
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x25629
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0xf090
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x154b0
jmp 0x256f4
leaq -0x58(%rbp), %rdi
callq 0x46c8
movq -0x18(%rbp), %rdi
leaq 0x264bd(%rip), %rsi     # 0x4bbc5
callq 0xf220
addq $0x90, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x46c8
movq -0x60(%rbp), %rdi
callq 0x4620
nopw %cs:(%rax,%rax)