// File: /workspace/github_cpp_makefile_star2_O1/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 0x10d76
movq %rdi, %r15
movl %r14d, %edx
callq 0x1119c
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 0x9da8
leaq 0x7afd(%rip), %rsi      # 0x187b2
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x10cce
callq 0x3200
testl %r15d, %r15d
je 0x10d7b
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 0x9da8
leaq 0x7aa7(%rip), %rsi      # 0x187ab
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x10d1d
callq 0x3200
testl %r15d, %r15d
je 0x10d85
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 0x9da8
leaq 0x7a68(%rip), %rsi      # 0x187b7
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x10d68
callq 0x3200
cmpl $0x1, %r15d
movl -0x2c(%rbp), %r13d
adcl $0x0, %r13d
jmp 0x10d8d
xorl %r13d, %r13d
jmp 0x10d91
movl -0x2c(%rbp), %r13d
addl $0x6, %r13d
jmp 0x10d8d
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 0x10edc
movl %r13d, -0x2c(%rbp)
movq %r15, %rdi
movl %r14d, %edx
callq 0x1119c
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 0x9da8
leaq 0x79b9(%rip), %rsi      # 0x187b2
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r14, %rdi
je 0x10e12
callq 0x3200
addl -0x2c(%rbp), %r13d
testl %r15d, %r15d
je 0x10eca
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 0x9da8
leaq 0x795b(%rip), %rsi      # 0x187ab
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r14, %rdi
je 0x10e69
callq 0x3200
testl %r15d, %r15d
je 0x10ed0
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 0x9da8
leaq 0x7914(%rip), %rsi      # 0x187b7
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %rbx, %rdi
je 0x10ebc
callq 0x3200
cmpl $0x1, %r15d
adcl $0x0, %r13d
movq -0x38(%rbp), %r8
jmp 0x10edc
addl $0x6, %r13d
jmp 0x10ed4
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 0x1103c
movl %r13d, -0x2c(%rbp)
leaq 0x1(%r14), %r15
movq %rbx, %rdi
movl %r8d, %esi
movl %r15d, %edx
callq 0x1119c
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 0x9da8
leaq 0x7866(%rip), %rsi      # 0x187b2
movq %r15, %rdi
callq 0x30b0
movl %eax, %r12d
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x10f64
callq 0x3200
movl -0x44(%rbp), %r13d
addl -0x2c(%rbp), %r13d
testl %r12d, %r12d
je 0x11026
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 0x9da8
leaq 0x77fe(%rip), %rsi      # 0x187ab
movq %r15, %rdi
callq 0x30b0
movl %eax, %r12d
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x10fc5
callq 0x3200
testl %r12d, %r12d
je 0x1102c
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 0x9da8
leaq 0x77b8(%rip), %rsi      # 0x187b7
movq %r12, %rdi
callq 0x30b0
movl %eax, %r15d
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x11018
callq 0x3200
cmpl $0x1, %r15d
movl -0x44(%rbp), %r13d
adcl $0x0, %r13d
jmp 0x11034
addl $0x6, %r13d
jmp 0x11034
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 0x11189
movl %r13d, -0x2c(%rbp)
decq %r14
movq %rbx, %rdi
movl %r8d, %esi
movl %r14d, %edx
callq 0x1119c
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 0x9da8
leaq 0x7714(%rip), %rsi      # 0x187b2
movq %r13, %rdi
callq 0x30b0
movl %eax, %r12d
movq (%r13), %rdi
cmpq %r15, %rdi
je 0x110b7
callq 0x3200
movl -0x38(%rbp), %r13d
addl -0x2c(%rbp), %r13d
testl %r12d, %r12d
je 0x1117b
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 0x9da8
leaq 0x76a8(%rip), %rsi      # 0x187ab
movq %r13, %rdi
callq 0x30b0
movl %eax, %r12d
movq (%r13), %rdi
cmpq %r15, %rdi
je 0x1111c
callq 0x3200
testl %r12d, %r12d
je 0x11181
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 0x9da8
leaq 0x7660(%rip), %rsi      # 0x187b7
movq %r14, %rdi
callq 0x30b0
movl %eax, %ebx
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x1116e
callq 0x3200
cmpl $0x1, %ebx
movl -0x38(%rbp), %r13d
adcl $0x0, %r13d
jmp 0x11189
addl $0x6, %r13d
jmp 0x11189
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