// File: /workspace/github_cpp_makefile_star2_O3/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: los_exists(int, int, int, int, bool (*)(int, int))
bool los_exists(int x1, int y1, int x2, int y2, bool (*opacity_test)(int,int))
{
    // if x1 == x2 or y1 == y2, then it does not matter what we set here
    int delta_x(x2 - x1);
    signed char ix((delta_x > 0) - (delta_x < 0));
    delta_x = std::abs(delta_x) << 1;
 
    int delta_y(y2 - y1);
    signed char iy((delta_y > 0) - (delta_y < 0));
    delta_y = std::abs(delta_y) << 1;
 
    if (delta_x >= delta_y)
    {
        // error may go below zero
        int error(delta_y - (delta_x >> 1));
 
        while (x1 != x2)
        {
            if (error >= 0)
            {
                if (error || (ix > 0))
                {
                    y1 += iy;
                    error -= delta_x;
                }
                // else do nothing
            }
            // else do nothing
 
            x1 += ix;
            error += delta_y;
			if (x1 != x2)//(x1 != x2 && y1 != y2)
			{
				if (opacity_test(x1, y1)) return false;
			}
        }
    }
    else
    {
        // error may go below zero
        int error(delta_x - (delta_y >> 1));
 
        while (y1 != y2)
        {
            if (error >= 0)
            {
                if (error || (iy > 0))
                {
                    x1 += ix;
                    error -= delta_y;
                }
                // else do nothing
            }
            // else do nothing
 
            y1 += iy;
            error += delta_x;
 
            if (y1 != y2)//(x1 != x2 && y1 != y2)
			{
				if (opacity_test(x1, y1)) return false;
			}
        }
    }
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x10(%rsp)
movl %edx, %r15d
movl %esi, %ebp
movl %edi, %r14d
xorl %edx, %edx
movl %r15d, %eax
subl %edi, %eax
setne %dl
movl %eax, %esi
sarl $0x1f, %esi
orl %esi, %edx
movl %edx, 0xc(%rsp)
movl %eax, %edi
negl %edi
cmovsl %eax, %edi
addl %edi, %edi
xorl %edx, %edx
movl %ecx, %eax
subl %ebp, %eax
setne %dl
movl %eax, %esi
sarl $0x1f, %esi
orl %esi, %edx
movl %edx, 0x8(%rsp)
movl %eax, %r12d
negl %r12d
cmovsl %eax, %r12d
addl %r12d, %r12d
movl %edi, 0x4(%rsp)
movb $0x1, %r13b
cmpl %r12d, %edi
jge 0xf64c
cmpl %ebp, %ecx
je 0xf69a
movl %r12d, %eax
sarl %eax
movl 0x4(%rsp), %ebx
subl %eax, %ebx
addl 0x8(%rsp), %ebp
testl %ebx, %ebx
js 0xf627
cmpl $0x0, 0x8(%rsp)
jg 0xf61f
testl %ebx, %ebx
jne 0xf61f
xorl %ebx, %ebx
jmp 0xf627
addl 0xc(%rsp), %r14d
subl %r12d, %ebx
cmpl %ebp, %ecx
sete %r13b
je 0xf69a
addl 0x4(%rsp), %ebx
movl %r14d, %edi
movl %ebp, %esi
movl %ecx, %r15d
callq *0x10(%rsp)
movl %r15d, %ecx
addl 0x8(%rsp), %ebp
testb %al, %al
je 0xf60c
jmp 0xf69a
cmpl %r14d, %r15d
je 0xf69a
movl 0x4(%rsp), %eax
sarl %eax
movl %r12d, %ebx
subl %eax, %ebx
addl 0xc(%rsp), %r14d
testl %ebx, %ebx
js 0xf67c
cmpl $0x0, 0xc(%rsp)
jg 0xf674
testl %ebx, %ebx
jne 0xf674
xorl %ebx, %ebx
jmp 0xf67c
addl 0x8(%rsp), %ebp
subl 0x4(%rsp), %ebx
cmpl %r14d, %r15d
sete %r13b
je 0xf69a
addl %r12d, %ebx
movl %r14d, %edi
movl %ebp, %esi
callq *0x10(%rsp)
addl 0xc(%rsp), %r14d
testb %al, %al
je 0xf661
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq