// File: /workspace/github_cpp_makefile_star2_O3/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, %r13d
movl %ecx, %r15d
movq %rsi, %rbx
movq %rdi, %r12
movl %r13d, %r14d
cmpw $-0x1, %r13w
jne 0x173a9
movq %rdx, %rdi
movq %rbx, %rsi
movq %rdx, %r14
callq 0x2b7e4
movq %r14, %rdx
movl %eax, %r14d
movsbl %r15b, %eax
cmpw %ax, %r14w
jle 0x173bb
xorl %r15d, %r15d
jmp 0x174fc
movq %r12, -0x38(%rbp)
movb $0x1, %r15b
cmpw $0x2, %r14w
jl 0x174fc
movl %eax, -0x30(%rbp)
movswl %r14w, %r12d
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), %r15
movq %r15, %rdi
callq 0x2b798
movswl 0x2(%r15), %ecx
movl %ecx, %edx
movzwl (%r15), %eax
addl %r12d, %edx
jne 0x1740d
addl %r12d, %eax
jmp 0x17438
cmpw %r14w, %ax
jne 0x1741b
leal (%r12,%r12,2), %eax
addl %eax, %ecx
jmp 0x17427
cmpw %r14w, %cx
jne 0x1742b
leal (%r12,%r12,4), %ecx
subl %eax, %ecx
movl %ecx, %eax
jmp 0x17438
leal (,%r12,8), %eax
subl %r12d, %eax
subl %ecx, %eax
leal -0x2(%r12), %edx
movq %r12, -0x48(%rbp)
leal (%r12,%r12), %r14d
leaq 0x15844(%rip), %rcx     # 0x2cc90
movslq (%rcx,%rdx,4), %rdx
leaq (%rcx,%rdx), %rsi
movsbl %al, %eax
movl %r14d, %edi
imull %eax, %edi
movswq 0x2(%rbx), %r8
leaq (%r8,%r8,2), %r8
shlq $0x3, %r8
movq -0x38(%rbp), %r9
addq 0x8(%r9), %r8
movswq (%rbx), %r9
xorl %r15d, %r15d
leal (%r15,%rdi), %r10d
movslq %r10d, %r10
movsbq 0x1(%rsi,%r10), %r11
leaq (%r11,%r11,2), %r11
addq %rdx, %r10
movsbq (%rcx,%r10), %r10
shlq $0x2, %r10
addq (%r8,%r11,8), %r10
testb $0x4, (%r10,%r9,4)
je 0x174ae
addb $0x2, %r15b
movsbl %r15b, %r15d
cmpl %r14d, %r15d
jl 0x17479
cmpw $-0x1, %r13w
jne 0x174e7
cmpl %r14d, %r15d
je 0x174e7
cltd
movq -0x48(%rbp), %r8
idivl %r8d
testl %edx, %edx
je 0x1750e
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rbx, %rdx
movl -0x30(%rbp), %ecx
callq 0x1736e
movl %eax, %r15d
leaq -0x2c(%rbp), %rdi
callq 0x2b7a6
jmp 0x174fc
leaq -0x2c(%rbp), %rdi
callq 0x2b7a6
cmpl %r14d, %r15d
movb $0x1, %r15b
jne 0x173b3
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x2c(%rbp), %rdi
callq 0x2b7a6
jmp 0x173b3
movq %rax, %rbx
leaq -0x2c(%rbp), %rdi
callq 0x2b7a6
movq %rbx, %rdi
callq 0x4740