// File: /workspace/github_cpp_makefile_star2_O2/lotuskip[P]yuxtapa/server/viewpoint.cpp
// Function: ViewPoint::fill_loslittbl(char)
void ViewPoint::fill_loslittbl(const char rad)
{
	char line, ind, x, y, oline;
	Coords c, obase;
	// determine which tiles are lit and which are in LOS (see los_lookup.h)
	for(line = 0; line < rad*8; ++line)
	{
		for(ind = 0; ind < 2*rad; ind += 2)
		{
			// lookup next point (NOTE: x,y point directly to loslittbl!!)
			x = loslookup[rad-2][line*2*rad+ind] + VIEWSIZE/2;
			y = loslookup[rad-2][line*2*rad+ind+1] + VIEWSIZE/2;
			c.x = pos.x + x - VIEWSIZE/2;
			c.y = pos.y + y - VIEWSIZE/2;
			if(fill_loslittbl_xy(c, x, y, ind <= 2*(rad+5)/3))
				break;
		}
		// For unsymmetric lines we need to check the other direction, too:
		if(line%rad)
		{
			oline = (line+4*rad)%(rad*8); // the "opposite" line
			obase.x = loslookup[rad-2][line*2*rad] // start pt of orig 'line'
				- loslookup[rad-2][(oline+1)*2*rad-2]; // end pt of 'oline'
			obase.y = loslookup[rad-2][line*2*rad+1] // same thing here
				- loslookup[rad-2][(oline+1)*2*rad-1];
			for(ind = 2*rad-2; ind >= 0; ind -= 2)
			{
				x = loslookup[rad-2][oline*2*rad+ind] + VIEWSIZE/2 + obase.x;
				y = loslookup[rad-2][oline*2*rad+ind+1] + VIEWSIZE/2 + obase.y;
				c.x = pos.x + x - VIEWSIZE/2;
				c.y = pos.y + y - VIEWSIZE/2;
				if(fill_loslittbl_xy(c, x, y, 2*rad-2-ind <= 2*(rad+5)/3))
					break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %r14d
movq %rdi, %rbx
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x24d90
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x24d90
movsbl %r14b, %edi
leal (,%rdi,8), %eax
movl %eax, -0x34(%rbp)
leal (%rdi,%rdi), %r13d
leal -0x2(%rdi), %eax
cltq
movq %rax, -0x58(%rbp)
leal 0xa(%rdi,%rdi), %ecx
pushq $0x3
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movl %eax, -0x44(%rbp)
leal (,%rdi,4), %eax
movq %rax, -0x60(%rbp)
leal -0x2(,%rdi,2), %eax
movl %eax, -0x38(%rbp)
pushq $-0x3
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movq %rdi, -0x50(%rbp)
leal (%rax,%rdi,2), %eax
addl $-0x2, %eax
movl %eax, -0x40(%rbp)
xorl %eax, %eax
movsbl %al, %r12d
cmpl %r12d, -0x34(%rbp)
jle 0x18bf1
movl %eax, -0x3c(%rbp)
movl %r13d, %r14d
imull %r12d, %r14d
xorl %r15d, %r15d
movsbl %r15b, %r15d
cmpl %r13d, %r15d
jge 0x18b0a
movq -0x58(%rbp), %rax
leaq 0x23fbe(%rip), %rcx     # 0x3ca70
movq (%rcx,%rax,8), %rax
leal (%r15,%r14), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movb 0x1(%rax,%rcx), %al
addb $0xb, %dl
addb $0xb, %al
movsbl %dl, %edx
movzwl 0x2(%rbx), %ecx
addw %dx, %cx
addl $-0xb, %ecx
movw %cx, -0x2c(%rbp)
movsbl %al, %ecx
movzwl 0x4(%rbx), %eax
addw %cx, %ax
addl $-0xb, %eax
movw %ax, -0x2a(%rbp)
xorl %r8d, %r8d
cmpl -0x44(%rbp), %r15d
setle %r8b
movq %rbx, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x18928
addl $0x2, %r15d
testb %al, %al
je 0x18a9e
movl %r12d, %eax
cltd
idivl -0x50(%rbp)
testl %edx, %edx
je 0x18be7
movq -0x60(%rbp), %rax
addl %r12d, %eax
cltd
idivl -0x34(%rbp)
movq -0x58(%rbp), %rax
leaq 0x23f41(%rip), %rcx     # 0x3ca70
movq (%rcx,%rax,8), %r14
movq -0x50(%rbp), %rdi
imull %edi, %r12d
addl %r12d, %r12d
movslq %r12d, %rax
movsbl (%r14,%rax), %ecx
movsbl %dl, %r12d
leal 0x2(,%r12,2), %edx
addl %r12d, %r12d
imull %edi, %edx
movslq %edx, %rdx
movsbl -0x2(%r14,%rdx), %esi
subl %esi, %ecx
movw %cx, -0x30(%rbp)
movsbl 0x1(%r14,%rax), %eax
movsbl -0x1(%r14,%rdx), %ecx
subl %ecx, %eax
movw %ax, -0x2e(%rbp)
imull %edi, %r12d
movl -0x38(%rbp), %eax
movl %eax, %r15d
movsbl %r15b, %r15d
testl %r15d, %r15d
js 0x18be7
leal (%r15,%r12), %eax
cltq
movb (%r14,%rax), %cl
movb 0x1(%r14,%rax), %al
addb -0x30(%rbp), %cl
addb $0xb, %cl
addb -0x2e(%rbp), %al
addb $0xb, %al
movsbl %cl, %edx
movzwl 0x2(%rbx), %ecx
addw %dx, %cx
addl $-0xb, %ecx
movw %cx, -0x2c(%rbp)
movsbl %al, %ecx
movzwl 0x4(%rbx), %eax
addw %cx, %ax
addl $-0xb, %eax
movw %ax, -0x2a(%rbp)
xorl %r8d, %r8d
cmpl -0x40(%rbp), %r15d
setge %r8b
movq %rbx, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x18928
addl $-0x2, %r15d
testb %al, %al
je 0x18b83
movl -0x3c(%rbp), %eax
incb %al
jmp 0x18a83
leaq -0x30(%rbp), %rdi
callq 0x24d9e
leaq -0x2c(%rbp), %rdi
callq 0x24d9e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x18c25
jmp 0x18c19
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x24d9e
leaq -0x2c(%rbp), %rdi
callq 0x24d9e
movq %rbx, %rdi
callq 0x4710