// File: /workspace/github_cpp_makefile_star2_O3/Doug0855[P]TigerZone/Board.cpp
// Function: Board::positionPoints(int, int)
int Board::positionPoints(int i, int j)
{
	const int LAKE_POINTS = 6;
	const int JUNGLE_POINTS = 3;
	const int TRAIL_POINTS = 1;

	int points = 0;
	// for the following if statements you'll be checking the positions adjacent tiles and adding points based on 
	// the adjacents tile's face as well as existing animals within that tile.
	if (m_board[i + 1][j] != NULL)
	{
		points += animalPoints(i + 1, j);
		if (m_board[i + 1][j]->getUpFace()->getType() == "lake")
		{
			points += LAKE_POINTS;
		}
		else if (m_board[i + 1][j]->getUpFace()->getType() == "jungle")
		{
			points += JUNGLE_POINTS;
		}
		else if (m_board[i + 1][j]->getUpFace()->getType() == "trail")
		{
			points += TRAIL_POINTS;
		}
	}
	if (m_board[i - 1][j] != NULL)
	{
		points += animalPoints(i - 1, j);
		if (m_board[i - 1][j]->getDownFace()->getType() == "lake")
		{
			points += LAKE_POINTS;
		}
		else if (m_board[i - 1][j]->getDownFace()->getType() == "jungle")
		{
			points += JUNGLE_POINTS;
		}
		else if (m_board[i - 1][j]->getDownFace()->getType() == "trail")
		{
			points += TRAIL_POINTS;
		}
	}
	if (m_board[i][j + 1] != NULL)
	{
		points += animalPoints(i, j + 1);
		if (m_board[i][j + 1]->getLeftFace()->getType() == "lake")
		{
			points += LAKE_POINTS;
		}
		else if (m_board[i][j + 1]->getLeftFace()->getType() == "jungle")
		{
			points += JUNGLE_POINTS;
		}
		else if (m_board[i][j + 1]->getLeftFace()->getType() == "trail")
		{
			points += TRAIL_POINTS;
		}
	}
	if (m_board[i][j - 1] != NULL)
	{
		points += animalPoints(i, j - 1);
		if (m_board[i][j - 1]->getRightFace()->getType() == "lake")
		{
			points += LAKE_POINTS;
		}
		else if (m_board[i][j - 1]->getRightFace()->getType() == "jungle")
		{
			points += JUNGLE_POINTS;
		}
		else if (m_board[i][j - 1]->getRightFace()->getType() == "trail")
		{
			points += TRAIL_POINTS;
		}
	}
	return points;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, %r8d
leal 0x1(%r8), %esi
movslq %esi, %rax
movq (%rdi), %rcx
leaq (%rax,%rax,2), %rbx
movslq %edx, %r14
movq (%rcx,%rbx,8), %rax
cmpq $0x0, (%rax,%r14,8)
movq %rdi, -0x50(%rbp)
movq %r8, -0x38(%rbp)
je 0x10cca
movq %rdi, %r15
movl %r14d, %edx
callq 0x110f0
movl %eax, -0x2c(%rbp)
movq (%r15), %rax
movq (%rax,%rbx,8), %rax
movq (%rax,%r14,8), %rax
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r12
movq %r12, %rdi
callq 0x9cc4
leaq 0x7ba9(%rip), %rsi      # 0x187b2
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x10c22
callq 0x3200
testl %r15d, %r15d
je 0x10ccf
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq (%rax,%rbx,8), %rax
movq (%rax,%r14,8), %rax
movq %r13, (%r12)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x9cc4
leaq 0x7b53(%rip), %rsi      # 0x187ab
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x10c71
callq 0x3200
testl %r15d, %r15d
je 0x10cd9
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq (%rax,%rbx,8), %rax
movq (%rax,%r14,8), %rax
movq %r13, (%r12)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x9cc4
leaq 0x7b14(%rip), %rsi      # 0x187b7
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x10cbc
callq 0x3200
cmpl $0x1, %r15d
movl -0x2c(%rbp), %r13d
adcl $0x0, %r13d
jmp 0x10ce1
xorl %r13d, %r13d
jmp 0x10ce5
movl -0x2c(%rbp), %r13d
addl $0x6, %r13d
jmp 0x10ce1
movl -0x2c(%rbp), %r13d
addl $0x3, %r13d
movq -0x38(%rbp), %r8
leal -0x1(%r8), %esi
movslq %esi, %rax
movq -0x50(%rbp), %r15
movq (%r15), %rcx
leaq (%rax,%rax,2), %rbx
movq (%rcx,%rbx,8), %rax
cmpq $0x0, (%rax,%r14,8)
je 0x10e30
movl %r13d, -0x2c(%rbp)
movq %r15, %rdi
movl %r14d, %edx
callq 0x110f0
movl %eax, %r13d
movq (%r15), %rax
movq (%rax,%rbx,8), %rax
movq %r14, -0x40(%rbp)
movq (%rax,%r14,8), %rax
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r12
movq %r12, %rdi
callq 0x9cc4
leaq 0x7a65(%rip), %rsi      # 0x187b2
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r14, %rdi
je 0x10d66
callq 0x3200
addl -0x2c(%rbp), %r13d
testl %r15d, %r15d
je 0x10e1e
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq (%rax,%rbx,8), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %r14, (%r12)
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x9cc4
leaq 0x7a07(%rip), %rsi      # 0x187ab
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r14, %rdi
je 0x10dbd
callq 0x3200
testl %r15d, %r15d
je 0x10e24
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq (%rax,%rbx,8), %rax
movq -0x40(%rbp), %r14
movq (%rax,%r14,8), %rax
leaq -0x60(%rbp), %rbx
movq %rbx, (%r12)
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x9cc4
leaq 0x79c0(%rip), %rsi      # 0x187b7
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %rbx, %rdi
je 0x10e10
callq 0x3200
cmpl $0x1, %r15d
adcl $0x0, %r13d
movq -0x38(%rbp), %r8
jmp 0x10e30
addl $0x6, %r13d
jmp 0x10e28
addl $0x3, %r13d
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %r14
movslq %r8d, %rax
movq -0x50(%rbp), %rbx
movq (%rbx), %rcx
leaq (%rax,%rax,2), %r12
movq (%rcx,%r12,8), %rax
cmpq $0x0, 0x8(%rax,%r14,8)
movq %r12, -0x40(%rbp)
je 0x10f90
movl %r13d, -0x2c(%rbp)
leaq 0x1(%r14), %r15
movq %rbx, %rdi
movl %r8d, %esi
movl %r15d, %edx
callq 0x110f0
movl %eax, -0x44(%rbp)
movq (%rbx), %rax
movq (%rax,%r12,8), %rax
movq %r15, -0x78(%rbp)
movq (%rax,%r15,8), %rax
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x9cc4
leaq 0x7912(%rip), %rsi      # 0x187b2
movq %r15, %rdi
callq 0x30b0
movl %eax, %r12d
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x10eb8
callq 0x3200
movl -0x44(%rbp), %r13d
addl -0x2c(%rbp), %r13d
testl %r12d, %r12d
je 0x10f7a
movl %r13d, -0x44(%rbp)
movq (%rbx), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
leaq -0x60(%rbp), %r13
movq %r13, (%r15)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x9cc4
leaq 0x78aa(%rip), %rsi      # 0x187ab
movq %r15, %rdi
callq 0x30b0
movl %eax, %r12d
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x10f19
callq 0x3200
testl %r12d, %r12d
je 0x10f80
movq (%rbx), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
leaq -0x70(%rbp), %r12
movq %r13, (%r12)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x9cc4
leaq 0x7864(%rip), %rsi      # 0x187b7
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x10f6c
callq 0x3200
cmpl $0x1, %r15d
movl -0x44(%rbp), %r13d
adcl $0x0, %r13d
jmp 0x10f88
addl $0x6, %r13d
jmp 0x10f88
movl -0x44(%rbp), %r13d
addl $0x3, %r13d
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %r12
movq (%rbx), %rax
movq (%rax,%r12,8), %rax
cmpq $0x0, -0x8(%rax,%r14,8)
je 0x110dd
movl %r13d, -0x2c(%rbp)
decq %r14
movq %rbx, %rdi
movl %r8d, %esi
movl %r14d, %edx
callq 0x110f0
movl %eax, -0x38(%rbp)
movq (%rbx), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r14,8), %rax
leaq -0x60(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x88(%rax), %rsi
movq 0x90(%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %r13
movq %r13, %rdi
callq 0x9cc4
leaq 0x77c0(%rip), %rsi      # 0x187b2
movq %r13, %rdi
callq 0x30b0
movl %eax, %r12d
movq (%r13), %rdi
cmpq %r15, %rdi
je 0x1100b
callq 0x3200
movl -0x38(%rbp), %r13d
addl -0x2c(%rbp), %r13d
testl %r12d, %r12d
je 0x110cf
movl %r13d, -0x38(%rbp)
movq (%rbx), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax,%r14,8), %rax
leaq -0x70(%rbp), %r13
movq %r15, (%r13)
movq 0x88(%rax), %rsi
movq 0x90(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x9cc4
leaq 0x7754(%rip), %rsi      # 0x187ab
movq %r13, %rdi
callq 0x30b0
movl %eax, %r12d
movq (%r13), %rdi
cmpq %r15, %rdi
je 0x11070
callq 0x3200
testl %r12d, %r12d
je 0x110d5
movq (%rbx), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax,%r14,8), %rax
leaq -0x70(%rbp), %r14
movq %r15, (%r14)
movq 0x88(%rax), %rsi
movq 0x90(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x9cc4
leaq 0x770c(%rip), %rsi      # 0x187b7
movq %r14, %rdi
callq 0x30b0
movl %eax, %ebx
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x110c2
callq 0x3200
cmpl $0x1, %ebx
movl -0x38(%rbp), %r13d
adcl $0x0, %r13d
jmp 0x110dd
addl $0x6, %r13d
jmp 0x110dd
movl -0x38(%rbp), %r13d
addl $0x3, %r13d
movl %r13d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop