// File: 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
subq $0x40, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x12(%rbp), %rdi
xorl %edx, %edx
movl %edx, -0x28(%rbp)
movl %edx, %esi
callq 0x60430
movl -0x28(%rbp), %edx
leaq -0x16(%rbp), %rdi
movl %edx, %esi
callq 0x60430
jmp 0x4119a
movb $0x0, -0xa(%rbp)
movsbl -0xa(%rbp), %eax
movsbl -0x9(%rbp), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jge 0x414f9
movb $0x0, -0xb(%rbp)
movsbl -0xb(%rbp), %eax
movsbl -0x9(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jge 0x412dd
movq -0x30(%rbp), %rdi
movsbq -0x9(%rbp), %rax
movl %eax, %edx
leaq 0x4b887(%rip), %rcx     # 0x8ca60
movq -0x10(%rcx,%rax,8), %rax
movsbl -0xa(%rbp), %r8d
imull %edx, %r8d
movsbl -0xb(%rbp), %esi
movl %esi, %edx
movl %r8d, %esi
leal (%rdx,%rsi,2), %edx
movslq %edx, %rdx
movb (%rax,%rdx), %al
addb $0xb, %al
movb %al, -0xc(%rbp)
movsbq -0x9(%rbp), %rdx
movl %edx, %eax
movq -0x10(%rcx,%rdx,8), %rcx
movsbl -0xa(%rbp), %esi
imull %eax, %esi
movsbl -0xb(%rbp), %edx
movl %edx, %eax
movl %esi, %edx
leal (%rax,%rdx,2), %eax
cltq
movb 0x1(%rax,%rcx), %al
addb $0xb, %al
movb %al, -0xd(%rbp)
movzwl 0x2(%rdi), %edx
movsbl -0xc(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal -0xb(%rax,%rcx), %eax
movw %ax, -0x12(%rbp)
movzwl 0x4(%rdi), %edx
movsbl -0xd(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal -0xb(%rax,%rcx), %eax
movw %ax, -0x10(%rbp)
movsbl -0xc(%rbp), %edx
movsbl -0xd(%rbp), %ecx
movsbl -0xb(%rbp), %eax
movsbl -0x9(%rbp), %r8d
movl %r8d, %esi
leal 0xa(%rsi,%rsi), %esi
movslq %esi, %rsi
imulq $0x55555556, %rsi, %rsi # imm = 0x55555556
movq %rsi, %r8
shrq $0x3f, %r8
shrq $0x20, %rsi
addl %r8d, %esi
subl %esi, %eax
setle %al
movzbl %al, %r8d
leaq -0x12(%rbp), %rsi
callq 0x41000
movb %al, -0x31(%rbp)
jmp 0x41296
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x4129f
jmp 0x412cc
jmp 0x412dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x41511
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x16(%rbp), %rdi
callq 0x60460
jmp 0x41511
jmp 0x412ce
movsbl -0xb(%rbp), %eax
addl $0x2, %eax
movb %al, -0xb(%rbp)
jmp 0x411b5
movsbl -0xa(%rbp), %eax
movsbl -0x9(%rbp), %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x414ea
movsbl -0xa(%rbp), %eax
movsbl -0x9(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
movsbl -0x9(%rbp), %ecx
shll $0x3, %ecx
cltd
idivl %ecx
movb %dl, %al
movb %al, -0xe(%rbp)
movsbl -0x9(%rbp), %eax
subl $0x2, %eax
movslq %eax, %rcx
leaq 0x4b742(%rip), %rax     # 0x8ca60
movq (%rax,%rcx,8), %rax
movsbl -0xa(%rbp), %ecx
shll %ecx
movsbl -0x9(%rbp), %edx
imull %edx, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movsbl -0x9(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x4b719(%rip), %rcx     # 0x8ca60
movq (%rcx,%rdx,8), %rcx
movsbl -0xe(%rbp), %edx
addl $0x1, %edx
shll %edx
movsbl -0x9(%rbp), %esi
imull %esi, %edx
subl $0x2, %edx
movslq %edx, %rdx
movsbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movw %ax, -0x16(%rbp)
movsbl -0x9(%rbp), %eax
subl $0x2, %eax
movslq %eax, %rcx
leaq 0x4b6e4(%rip), %rax     # 0x8ca60
movq (%rax,%rcx,8), %rax
movsbl -0xa(%rbp), %ecx
shll %ecx
movsbl -0x9(%rbp), %edx
imull %edx, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movsbl -0x9(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x4b6b8(%rip), %rcx     # 0x8ca60
movq (%rcx,%rdx,8), %rcx
movsbl -0xe(%rbp), %edx
addl $0x1, %edx
shll %edx
movsbl -0x9(%rbp), %esi
imull %esi, %edx
subl $0x1, %edx
movslq %edx, %rdx
movsbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movw %ax, -0x14(%rbp)
movsbl -0x9(%rbp), %eax
shll %eax
subl $0x2, %eax
movb %al, -0xb(%rbp)
movsbl -0xb(%rbp), %eax
cmpl $0x0, %eax
jl 0x414e8
movq -0x30(%rbp), %rdi
movsbq -0x9(%rbp), %rax
movl %eax, %edx
leaq 0x4b669(%rip), %rcx     # 0x8ca60
movq -0x10(%rcx,%rax,8), %rax
movsbl -0xe(%rbp), %r8d
imull %edx, %r8d
movsbl -0xb(%rbp), %esi
movl %esi, %edx
movl %r8d, %esi
leal (%rdx,%rsi,2), %edx
movslq %edx, %rdx
movzbl (%rax,%rdx), %eax
movzwl -0x16(%rbp), %edx
addl %edx, %eax
addb $0xb, %al
movb %al, -0xc(%rbp)
movsbq -0x9(%rbp), %rdx
movl %edx, %eax
movq -0x10(%rcx,%rdx,8), %rcx
movsbl -0xe(%rbp), %esi
imull %eax, %esi
movsbl -0xb(%rbp), %edx
movl %edx, %eax
movl %esi, %edx
leal (%rax,%rdx,2), %eax
cltq
movzbl 0x1(%rax,%rcx), %eax
movzwl -0x14(%rbp), %ecx
addl %ecx, %eax
addb $0xb, %al
movb %al, -0xd(%rbp)
movzwl 0x2(%rdi), %edx
movsbl -0xc(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal -0xb(%rax,%rcx), %eax
movw %ax, -0x12(%rbp)
movzwl 0x4(%rdi), %edx
movsbl -0xd(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal -0xb(%rax,%rcx), %eax
movw %ax, -0x10(%rbp)
movsbl -0xc(%rbp), %edx
movsbl -0xd(%rbp), %ecx
movsbl -0x9(%rbp), %r8d
movsbl -0xb(%rbp), %esi
movl %r8d, %eax
addl %eax, %eax
subl %esi, %eax
addl $-0x2, %eax
movl %r8d, %esi
leal 0xa(%rsi,%rsi), %esi
movslq %esi, %rsi
imulq $0x55555556, %rsi, %rsi # imm = 0x55555556
movq %rsi, %r8
shrq $0x3f, %r8
shrq $0x20, %rsi
addl %r8d, %esi
subl %esi, %eax
setle %al
movzbl %al, %r8d
leaq -0x12(%rbp), %rsi
callq 0x41000
movb %al, -0x32(%rbp)
jmp 0x414cc
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0x414d5
jmp 0x414d7
jmp 0x414e8
jmp 0x414d9
movsbl -0xb(%rbp), %eax
subl $0x2, %eax
movb %al, -0xb(%rbp)
jmp 0x413d8
jmp 0x414ea
jmp 0x414ec
movb -0xa(%rbp), %al
addb $0x1, %al
movb %al, -0xa(%rbp)
jmp 0x4119e
leaq -0x16(%rbp), %rdi
callq 0x60460
leaq -0x12(%rbp), %rdi
callq 0x60460
addq $0x40, %rsp
popq %rbp
retq
leaq -0x12(%rbp), %rdi
callq 0x60460
movq -0x20(%rbp), %rdi
callq 0x5920
nopw %cs:(%rax,%rax)