// File: scattana[P]Crossword-Anagram-CPP/board.cpp
// Function: Board::placeNextVer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool Board::placeNextVer(string word){
	int match = 0;
	bool isPlaced = 0, key = 0;
		for(int j=0; j<15; j++){
			for(int i=0; i<15+1-word.size(); i++){
				for(int k=0; k<word.size(); k++){
					if(getSpot(i+k,j)=='_' || getSpot(i+k,j)==word[k]){
						match++;
					}
					if(getSpot(i+k,j)==word[k]){
						if(getSpot(i+k+1,j)=='_' && getSpot(i+k-1,j)=='_'){
							match = match+2;
							key = 1;
						}
					}
					if(getSpot(i+k,j+1)=='_'&&getSpot(i+k,j-1)=='_'){
						match = match + 2;
					}
					if(getSpot(i-1,j)=='_' && getSpot((i+word.size()),j)=='_'){
						if(k==0) match = match + 2;
					}
				} // end of "k" for loop
				if(match == 3*word.size()+2 && key == 1 && isPlaced == 0){
					// place word
					for(int p=0; p<word.size(); p++){
						setSpot(word[p], i+p, j);
					}
					// set isPlaced to true
					isPlaced = 1;
					// assign coordinates to the newly-placed word
					locations[place][0] = i;
					locations[place][1] = j;
					place++;
					return 1;

				}
				match = 0;
				key = 0;
			} // end of second for loop (i)
		} // end of outermost for loop (j)
	return 0; // return false if the word was not able to be placed vertically
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, -0x40(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x1c(%rbp)
movb $0x0, -0x1d(%rbp)
movb $0x0, -0x1e(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0xf, -0x24(%rbp)
jge 0x5769
movl $0x0, -0x28(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0x2130
movq %rax, %rdx
movq -0x48(%rbp), %rax
movl $0x10, %ecx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0x5759
movl $0x0, -0x2c(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x2c(%rbp), %rax
movq %rax, -0x50(%rbp)
callq 0x2130
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0x5663
movq -0x38(%rbp), %rdi
movl -0x28(%rbp), %esi
addl -0x2c(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x5ac0
movsbl %al, %eax
cmpl $0x5f, %eax
je 0x5530
movq -0x38(%rbp), %rdi
movl -0x28(%rbp), %esi
addl -0x2c(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x5ac0
movq -0x40(%rbp), %rdi
movsbl %al, %eax
movl %eax, -0x54(%rbp)
movslq -0x2c(%rbp), %rsi
callq 0x22e0
movq %rax, %rcx
movl -0x54(%rbp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x5539
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x38(%rbp), %rdi
movl -0x28(%rbp), %esi
addl -0x2c(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x5ac0
movq -0x40(%rbp), %rdi
movsbl %al, %eax
movl %eax, -0x58(%rbp)
movslq -0x2c(%rbp), %rsi
callq 0x22e0
movq %rax, %rcx
movl -0x58(%rbp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x55b4
movq -0x38(%rbp), %rdi
movl -0x28(%rbp), %esi
addl -0x2c(%rbp), %esi
addl $0x1, %esi
movl -0x24(%rbp), %edx
callq 0x5ac0
movsbl %al, %eax
cmpl $0x5f, %eax
jne 0x55b2
movq -0x38(%rbp), %rdi
movl -0x28(%rbp), %esi
addl -0x2c(%rbp), %esi
subl $0x1, %esi
movl -0x24(%rbp), %edx
callq 0x5ac0
movsbl %al, %eax
cmpl $0x5f, %eax
jne 0x55b2
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x1c(%rbp)
movb $0x1, -0x1e(%rbp)
jmp 0x55b4
movq -0x38(%rbp), %rdi
movl -0x28(%rbp), %esi
addl -0x2c(%rbp), %esi
movl -0x24(%rbp), %edx
addl $0x1, %edx
callq 0x5ac0
movsbl %al, %eax
cmpl $0x5f, %eax
jne 0x55f7
movq -0x38(%rbp), %rdi
movl -0x28(%rbp), %esi
addl -0x2c(%rbp), %esi
movl -0x24(%rbp), %edx
subl $0x1, %edx
callq 0x5ac0
movsbl %al, %eax
cmpl $0x5f, %eax
jne 0x55f7
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x1c(%rbp)
movq -0x38(%rbp), %rdi
movl -0x28(%rbp), %esi
subl $0x1, %esi
movl -0x24(%rbp), %edx
callq 0x5ac0
movsbl %al, %eax
cmpl $0x5f, %eax
jne 0x5653
movq -0x40(%rbp), %rdi
movslq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
callq 0x2130
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movq -0x60(%rbp), %rax
addq %rcx, %rax
movl %eax, %esi
movl -0x24(%rbp), %edx
callq 0x5ac0
movsbl %al, %eax
cmpl $0x5f, %eax
jne 0x5653
cmpl $0x0, -0x2c(%rbp)
jne 0x5651
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5653
jmp 0x5655
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x54c3
movq -0x40(%rbp), %rdi
movslq -0x1c(%rbp), %rax
movq %rax, -0x68(%rbp)
callq 0x2130
movq %rax, %rcx
movq -0x68(%rbp), %rax
imulq $0x3, %rcx, %rcx
addq $0x2, %rcx
cmpq %rcx, %rax
jne 0x5740
movb -0x1e(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x5740
movb -0x1d(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5740
movl $0x0, -0x30(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
callq 0x2130
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
jae 0x5701
movq -0x40(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x22e0
movq -0x38(%rbp), %rdi
movb (%rax), %al
movl -0x28(%rbp), %edx
addl -0x30(%rbp), %edx
movl -0x24(%rbp), %ecx
movsbl %al, %esi
callq 0x4e80
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x56b5
movq -0x38(%rbp), %rax
movb $0x1, -0x1d(%rbp)
movl -0x28(%rbp), %edx
movslq 0x408(%rax), %rcx
movl %edx, 0xe4(%rax,%rcx,8)
movl -0x24(%rbp), %edx
movslq 0x408(%rax), %rcx
movl %edx, 0xe8(%rax,%rcx,8)
movl 0x408(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x408(%rax)
movb $0x1, -0x1(%rbp)
jmp 0x576d
movl $0x0, -0x1c(%rbp)
movb $0x0, -0x1e(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x5493
jmp 0x575b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5482
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)