// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
movq %r8, 0x20(%rsp)
movl %esi, %r14d
movl %edi, %r15d
xorl %r8d, %r8d
movl %edx, %eax
subl %edi, %eax
setne %r8b
movl %eax, %esi
sarl $0x1f, %esi
orl %esi, %r8d
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
addl %esi, %esi
xorl %ebx, %ebx
movl %ecx, %eax
subl %r14d, %eax
setne %bl
movl %eax, %edi
sarl $0x1f, %edi
orl %edi, %ebx
movl %eax, %edi
negl %edi
cmovsl %eax, %edi
addl %edi, %edi
cmpl %edi, %esi
movq %r8, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movl %edi, 0x10(%rsp)
jge 0xc238
movl %edi, %eax
sarl %eax
movl %esi, %r12d
subl %eax, %r12d
movl %ebx, %eax
subl %ecx, %eax
movl %eax, 0xc(%rsp)
negl %ecx
movl %ecx, %eax
addl %r14d, %eax
sete %bpl
je 0xc2a7
testl %r12d, %r12d
js 0xc201
testl %ebx, %ebx
jg 0xc1fb
testl %r12d, %r12d
jne 0xc1fb
xorl %r12d, %r12d
jmp 0xc201
addl %r8d, %r15d
subl %edi, %r12d
leal (%r14,%rbx), %r13d
addl %esi, %r12d
addl 0xc(%rsp), %r14d
movl %r13d, %r14d
je 0xc1d9
movl %r15d, %edi
movl %r13d, %esi
movl %ecx, %r14d
callq *0x20(%rsp)
movl %r14d, %ecx
movl 0x10(%rsp), %edi
movl 0x14(%rsp), %esi
movq 0x18(%rsp), %r8
movl %r13d, %r14d
testb %al, %al
je 0xc1d9
jmp 0xc2a7
movl %esi, %eax
sarl %eax
movl %edi, %r13d
subl %eax, %r13d
movl %r8d, %eax
subl %edx, %eax
movl %eax, 0xc(%rsp)
negl %edx
movl %edx, %eax
addl %r15d, %eax
sete %bpl
je 0xc2a7
testl %r13d, %r13d
js 0xc272
testl %r8d, %r8d
jg 0xc26c
testl %r13d, %r13d
jne 0xc26c
xorl %r13d, %r13d
jmp 0xc272
addl %ebx, %r14d
subl %esi, %r13d
leal (%r15,%r8), %r12d
addl %edi, %r13d
addl 0xc(%rsp), %r15d
movl %r12d, %r15d
je 0xc24d
movl %r12d, %edi
movl %r14d, %esi
movl %edx, %r15d
callq *0x20(%rsp)
movl %r15d, %edx
movl 0x10(%rsp), %edi
movl 0x14(%rsp), %esi
movq 0x18(%rsp), %r8
movl %r12d, %r15d
testb %al, %al
je 0xc24d
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq