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

	for (l = 1; l < h - 1; l++)
		for (i = l*w + 1; i < (l + 1)*w - 1; i++) {
			D = abs(2*(s[i + w + 0] - s[i - w + 0])
				+  s[i + w - 1] - s[i - w - 1]
				+  s[i + w + 1] - s[i - w + 1])
			    +
			    abs(2*(s[i + 0 + 1] - s[i + 0 - 1])
				+  s[i - w + 1] - s[i - w - 1]
				+  s[i + w + 1] - s[i + w - 1]);

			D = (D*scale)/8;
			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 $0x1, %ecx
cmpl %ecx, %eax
jge 0x2563
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 $0x1, %ecx
cmpl %ecx, %eax
jge 0x2553
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
addl -0x14(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movl -0x28(%rbp), %edx
subl -0x14(%rbp), %edx
addl $0x0, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
shll %eax
movq -0x10(%rbp), %rcx
movl -0x28(%rbp), %edx
addl -0x14(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x28(%rbp), %edx
subl -0x14(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x28(%rbp), %edx
addl -0x14(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x28(%rbp), %edx
subl -0x14(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x28(%rbp), %edx
addl $0x0, %edx
addl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
movq -0x10(%rbp), %rdx
movl -0x28(%rbp), %esi
addl $0x0, %esi
subl $0x1, %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
subl %edx, %ecx
shll %ecx
movq -0x10(%rbp), %rdx
movl -0x28(%rbp), %esi
subl -0x14(%rbp), %esi
addl $0x1, %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
addl %edx, %ecx
movq -0x10(%rbp), %rdx
movl -0x28(%rbp), %esi
subl -0x14(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
subl %edx, %ecx
movq -0x10(%rbp), %rdx
movl -0x28(%rbp), %esi
addl -0x14(%rbp), %esi
addl $0x1, %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
addl %edx, %ecx
movq -0x10(%rbp), %rdx
movl -0x28(%rbp), %esi
addl -0x14(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
subl %edx, %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
imull -0x1c(%rbp), %eax
shrl $0x3, %eax
movl %eax, -0x2c(%rbp)
cmpl $0xff, -0x2c(%rbp)
jbe 0x2512
movl $0xff, %eax
movl %eax, -0x30(%rbp)
jmp 0x2518
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jb 0x252e
movl -0x2c(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x2535
xorl %eax, %eax
movl %eax, -0x34(%rbp)
jmp 0x2535
movl -0x34(%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 0x23bf
jmp 0x2555
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x23a1
popq %rbp
retq
nopw %cs:(%rax,%rax)