// File: /workspace/github_c_makefile_star2_O0/ravenexp[P]aatrace/diff.c
// Function: aatrace_diff4
static
void aatrace_diff4(unsigned char* d, unsigned char* s,
		   int w, int h,
		   unsigned int scale,
		   unsigned int threshold)
{
	int l, i;
	int kl, kc;
	unsigned int D;

	for (l = 1; l < h - 2; l++)
		for (i = l*w + 1; i < (l + 1)*w - 2; i++) {
			int Dx = 0, Dy = 0;

			for (kl = 0; kl < 4; kl++)
				for (kc = 0; kc < 4; kc++) {
					Dx += s[i + (kl - 1)*w + kc - 1]
						* diff4_Kx[kl][kc];
					Dy += s[i + (kl - 1)*w + kc - 1]
						* diff4_Ky[kl][kc];
			}

			D = abs(Dx) + abs(Dy);
			D = (D*scale)/24;
			D = (D > 255) ? 255 : D;
			d[i] = (D >= threshold) ? D : 0;
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl -0x18(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x2725
movl -0x24(%rbp), %eax
imull -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
imull -0x14(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x2715
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x4, -0x2c(%rbp)
jge 0x2695
movl $0x0, -0x30(%rbp)
cmpl $0x4, -0x30(%rbp)
jge 0x2685
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl -0x2c(%rbp), %edx
subl $0x1, %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
addl -0x30(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movslq -0x2c(%rbp), %rdx
leaq 0xc0e(%rip), %rcx       # 0x3230
shlq $0x4, %rdx
addq %rdx, %rcx
movslq -0x30(%rbp), %rdx
imull (%rcx,%rdx,4), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl -0x2c(%rbp), %edx
subl $0x1, %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
addl -0x30(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movslq -0x2c(%rbp), %rdx
leaq 0xc0e(%rip), %rcx       # 0x3270
shlq $0x4, %rdx
addq %rdx, %rcx
movslq -0x30(%rbp), %rdx
imull (%rcx,%rdx,4), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x25ed
jmp 0x2687
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x25dc
movl -0x38(%rbp), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl -0x3c(%rbp), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
imull -0x1c(%rbp), %eax
movl $0x18, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x34(%rbp)
cmpl $0xff, -0x34(%rbp)
jbe 0x26d4
movl $0xff, %eax
movl %eax, -0x40(%rbp)
jmp 0x26da
movl -0x34(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x20(%rbp), %eax
jb 0x26f0
movl -0x34(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x26f7
xorl %eax, %eax
movl %eax, -0x44(%rbp)
jmp 0x26f7
movl -0x44(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x25af
jmp 0x2717
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2591
popq %rbp
retq