// File: /workspace/github_cpp_makefile_star2_O1/lotuskip[P]yuxtapa/server/map.cpp
// Function: Map::LOS_between(Coords const&, Coords const&, char, short)
bool Map::LOS_between(const Coords& c1, const Coords& c2, const char maxrad,
	const short calced_rad)
{
	short r = (calced_rad == -1) ? c2.dist_walk(c1) : calced_rad;
	if(r <= maxrad) // close enough
	{
		// Check if there is a LOS between c1 and c2:
		if(r <= 1)
			return true; // seen, done
		// Construct vector from c1 to c2:
		Coords v(c2.x - c1.x, c2.y - c1.y);
		char line, ind;
		if(v.y == -r) line = v.x + r;
		else if(v.x == r) line = 3*r + v.y;
		else if(v.y == r) line = 5*r - v.x;
		else if(v.x == -r) line = 7*r - v.y;
		else /* v.x == -r */ line = 7*r - v.y;
		for(ind = 0; ind < 2*r; ind += 2)
		{
			if(!(data[loslookup[r-2][line*2*r+ind+1]+c1.y]
				[loslookup[r-2][line*2*r+ind]+c1.x].flags & TF_SEETHRU))
				break;
		}
		if(ind == 2*r) // got all the way!
			return true; // seen, done
		// else, need to check the opposite direction, the line from c2 to c1
		// (but only if the line is one of the unsymmetric ones):
		if(calced_rad == -1 && line%r)
			return LOS_between(c2, c1, maxrad, r);
	}
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r12d
movl %ecx, %r14d
movq %rsi, %rbx
movq %rdi, -0x38(%rbp)
movl %r12d, %r15d
cmpw $-0x1, %r12w
jne 0x174e4
movq %rdx, %rdi
movq %rbx, %rsi
movq %rdx, %r15
callq 0x2bc42
movq %r15, %rdx
movl %eax, %r15d
movsbl %r14b, %eax
cmpw %ax, %r15w
jle 0x174f6
xorl %r14d, %r14d
jmp 0x1763a
movb $0x1, %r14b
cmpw $0x2, %r15w
jl 0x1763a
movl %eax, -0x30(%rbp)
movswl %r15w, %r13d
movzwl (%rdx), %eax
movq %rdx, -0x40(%rbp)
movzwl 0x2(%rdx), %ecx
subw (%rbx), %ax
subw 0x2(%rbx), %cx
movswl %ax, %esi
movswl %cx, %edx
leaq -0x2c(%rbp), %r14
movq %r14, %rdi
callq 0x2bbe8
movswl 0x2(%r14), %ecx
movl %ecx, %edx
movzwl (%r14), %eax
addl %r13d, %edx
jne 0x17544
addl %r13d, %eax
jmp 0x17571
cmpw %r15w, %ax
jne 0x17553
leal (%r13,%r13,2), %eax
addl %eax, %ecx
jmp 0x17560
cmpw %r15w, %cx
jne 0x17564
leal (%r13,%r13,4), %ecx
subl %eax, %ecx
movl %ecx, %eax
jmp 0x17571
leal (,%r13,8), %eax
subl %r13d, %eax
subl %ecx, %eax
leal -0x2(%r13), %esi
movq %r13, -0x48(%rbp)
leal (,%r13,2), %ecx
leaq 0x15708(%rip), %rdx     # 0x2cc90
movslq (%rdx,%rsi,4), %rsi
leaq (%rdx,%rsi), %r8
movsbl %al, %r9d
imull %ecx, %r9d
movswq 0x2(%rbx), %rdi
leaq (%rdi,%rdi,2), %r10
shlq $0x3, %r10
movq -0x38(%rbp), %rdi
addq 0x8(%rdi), %r10
movswq (%rbx), %r11
xorl %edi, %edi
leal (%rdi,%r9), %r14d
movslq %r14d, %r14
movsbq 0x1(%r8,%r14), %r15
leaq (%r15,%r15,2), %r15
addq %rsi, %r14
movsbq (%rdx,%r14), %r14
shlq $0x2, %r14
addq (%r10,%r15,8), %r14
testb $0x4, (%r14,%r11,4)
je 0x175e7
addb $0x2, %dil
movsbl %dil, %edi
cmpl %ecx, %edi
jl 0x175b3
cmpl %ecx, %edi
setne %r15b
movb $0x1, %r14b
cmpw $-0x1, %r12w
jne 0x17628
cmpl %ecx, %edi
je 0x17628
movsbl %al, %eax
cltd
movq -0x48(%rbp), %r8
idivl %r8d
testl %edx, %edx
je 0x17625
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rbx, %rdx
movl -0x30(%rbp), %ecx
callq 0x174a8
movl %eax, %r14d
xorl %r15d, %r15d
jmp 0x17628
movb $0x1, %r15b
leaq -0x2c(%rbp), %rdi
callq 0x2bbf6
testb %r15b, %r15b
jne 0x174ee
andb $0x1, %r14b
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x2c(%rbp), %rdi
callq 0x2bbf6
movq %rbx, %rdi
callq 0x4750