// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/misc/codecs.cpp
// Function: GetDelta(int*, int*, int, int)
int GetDelta(int line[], int prevline[], int x, int parts)
{
	int	 pixb1 = (x > 0 ? line[x - 1] : 0);

	int	 bias;
	int	 redbias;
	int	 greenbias;
	int	 bluebias;
	int	 alphabias;

	switch (parts)
	{
		case 1:
			bias = line[x] - (pixb1 + prevline[x]) / 2;

			if ((bias > -Math::Pow(2l, 3)) && (bias <= Math::Pow(2l, 3))) return 1;

			break;
		case 3:
			redbias	  = Color(line[x]).GetRed()   - (Color(pixb1).GetRed()	 + Color(prevline[x]).GetRed())	  / 2;
			greenbias = Color(line[x]).GetGreen() - (Color(pixb1).GetGreen() + Color(prevline[x]).GetGreen()) / 2;
			bluebias  = Color(line[x]).GetBlue()  - (Color(pixb1).GetBlue()	 + Color(prevline[x]).GetBlue())  / 2;

			if (((redbias > -Math::Pow(2l, 5)) && (redbias <= Math::Pow(2l, 5))) && ((greenbias > -Math::Pow(2l, 5)) && (greenbias <= Math::Pow(2l, 5))) && ((bluebias > -Math::Pow(2l, 5)) && (bluebias <= Math::Pow(2l, 5)))) return 1;

			break;
		case 4:
			redbias	  = Color(line[x]).GetRed()   - (Color(pixb1).GetRed()	 + Color(prevline[x]).GetRed())	  / 2;
			greenbias = Color(line[x]).GetGreen() - (Color(pixb1).GetGreen() + Color(prevline[x]).GetGreen()) / 2;
			bluebias  = Color(line[x]).GetBlue()  - (Color(pixb1).GetBlue()	 + Color(prevline[x]).GetBlue())  / 2;
			alphabias = Color(line[x]).GetAlpha() - (Color(pixb1).GetAlpha() + Color(prevline[x]).GetAlpha()) / 2;

			if (((redbias > -Math::Pow(2l, 5)) && (redbias <= Math::Pow(2l, 5))) && ((greenbias > -Math::Pow(2l, 5)) && (greenbias <= Math::Pow(2l, 5))) && ((bluebias > -Math::Pow(2l, 5)) && (bluebias <= Math::Pow(2l, 5))) && ((alphabias > -Math::Pow(2l, 5)) && (alphabias <= Math::Pow(2l, 5)))) return 1;

			break;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testl %edx, %edx
jle 0xb8397
movl %edx, %eax
movl -0x4(%rdi,%rax,4), %ebx
jmp 0xb8399
xorl %ebx, %ebx
cmpl $0x4, %ecx
je 0xb854e
cmpl $0x3, %ecx
je 0xb8417
cmpl $0x1, %ecx
jne 0xb8683
movslq %edx, %rax
addl (%rsi,%rax,4), %ebx
movl (%rdi,%rax,4), %eax
movl %ebx, %ecx
shrl $0x1f, %ecx
addl %ebx, %ecx
sarl %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rsp)
movl $0x2, %edi
movl $0x3, %esi
callq 0x56010
xorpd 0x3b0cc(%rip), %xmm0    # 0xf34b0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb8683
movl $0x2, %edi
movl $0x3, %esi
callq 0x56010
movl $0x1, %eax
ucomisd (%rsp), %xmm0
jb 0xb8683
jmp 0xb8685
movslq %edx, %rax
movl (%rdi,%rax,4), %ebp
movl $0xff, %r15d
movl %ebp, %ecx
andl %r15d, %ecx
movl (%rsi,%rax,4), %r14d
movl %ebx, %eax
andl %r15d, %eax
movl %r14d, %edx
andl %r15d, %edx
addl %eax, %edx
shrl %edx
subl %edx, %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm0, (%rsp)
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
xorpd 0x3b053(%rip), %xmm0    # 0xf34b0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb8683
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
ucomisd (%rsp), %xmm0
jb 0xb8683
movl %ebp, %eax
shrl $0x8, %eax
andl %r15d, %eax
movl %ebx, %ecx
shrl $0x8, %ecx
movl %r14d, %edx
shrl $0x8, %edx
andl %r15d, %ecx
andl %r15d, %edx
addl %ecx, %edx
shrl %edx
subl %edx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rsp)
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
xorpd 0x3afe8(%rip), %xmm0    # 0xf34b0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb8683
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
ucomisd (%rsp), %xmm0
jb 0xb8683
shrl $0x10, %ebp
andl %r15d, %ebp
shrl $0x10, %ebx
shrl $0x10, %r14d
andl %r15d, %ebx
andl %r15d, %r14d
addl %ebx, %r14d
shrl %r14d
subl %r14d, %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, (%rsp)
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
xorpd 0x3af80(%rip), %xmm0    # 0xf34b0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb8683
movl $0x2, %edi
movl $0x5, %esi
jmp 0xb83fd
movslq %edx, %rax
movl (%rdi,%rax,4), %ebp
movl $0xff, %r15d
movl %ebp, %ecx
andl %r15d, %ecx
movl (%rsi,%rax,4), %r14d
movl %ebx, %eax
andl %r15d, %eax
movl %r14d, %edx
andl %r15d, %edx
addl %eax, %edx
shrl %edx
subl %edx, %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm0, (%rsp)
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
xorpd 0x3af1c(%rip), %xmm0    # 0xf34b0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb8683
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
ucomisd (%rsp), %xmm0
jb 0xb8683
movl %ebp, %eax
shrl $0x8, %eax
andl %r15d, %eax
movl %ebx, %ecx
shrl $0x8, %ecx
movl %r14d, %edx
shrl $0x8, %edx
andl %r15d, %ecx
andl %r15d, %edx
addl %ecx, %edx
shrl %edx
subl %edx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rsp)
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
xorpd 0x3aeb1(%rip), %xmm0    # 0xf34b0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb8683
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
ucomisd (%rsp), %xmm0
jb 0xb8683
movl %ebp, %eax
shrl $0x10, %eax
andl %r15d, %eax
movl %ebx, %ecx
shrl $0x10, %ecx
movl %r14d, %edx
shrl $0x10, %edx
andl %r15d, %ecx
andl %r15d, %edx
addl %ecx, %edx
shrl %edx
subl %edx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rsp)
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
xorpd 0x3ae4e(%rip), %xmm0    # 0xf34b0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb8683
movl $0x2, %edi
movl $0x5, %esi
callq 0x56010
ucomisd (%rsp), %xmm0
jae 0xb8690
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
shrl $0x18, %ebp
shrl $0x18, %ebx
shrl $0x18, %r14d
jmp 0xb8504