// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x8(%rsi), %r8
movl $0x10, %eax
subq %r8, %rax
movq %rax, -0x68(%rbp)
leaq (%r8,%r8,2), %rax
addq $0x2, %rax
movq %rax, -0x50(%rbp)
movb $0x1, %al
movq $0x0, -0x38(%rbp)
movq %rdi, -0x48(%rbp)
movq %rdi, -0x40(%rbp)
movq %rsi, -0x58(%rbp)
movb %al, -0x29(%rbp)
cmpq $0x10, %r8
je 0x470e
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rcx
xorl %r11d, %r11d
testq %r8, %r8
je 0x46fd
movq (%rsi), %r15
leaq (%r11,%r11,4), %rax
leaq (%rax,%rax,2), %rax
addq -0x48(%rbp), %rax
movq -0x38(%rbp), %rdx
movb -0xf(%rdx,%rax), %r12b
leal (%r8,%r11), %eax
cltq
leaq (%rax,%rax,4), %rax
leaq (%rax,%rax,2), %r13
addq -0x60(%rbp), %r13
xorl %r10d, %r10d
movq %rcx, %r14
xorl %eax, %eax
xorl %ebx, %ebx
movb (%r14), %dl
movb (%r15,%r10), %r9b
cmpb $0x5f, %dl
jne 0x4686
movl %r9d, %edi
jmp 0x468d
movl %edx, %edi
cmpb %r9b, %dl
jne 0x4692
incl %ebx
movl %edi, %r9d
cmpb %r9b, %dl
jne 0x46b2
cmpb $0x5f, 0xf(%r14)
jne 0x46b2
leal 0x2(%rbx), %edx
cmpb $0x5f, -0xf(%r14)
sete %dil
cmovnel %ebx, %edx
orb %dil, %al
movl %edx, %ebx
cmpb $0x5f, 0x1(%r14)
jne 0x46c6
cmpb $0x5f, -0x1(%r14)
leal 0x2(%rbx), %edx
cmovnel %ebx, %edx
movl %edx, %ebx
cmpb $0x5f, %r12b
jne 0x46df
leal 0x2(%rbx), %edx
cmpb $0x5f, (%r13)
cmovnel %ebx, %edx
testq %r10, %r10
cmovnel %ebx, %edx
movl %edx, %ebx
incq %r10
addq $0xf, %r14
cmpq %r10, %r8
jne 0x4675
movslq %ebx, %rdx
cmpq %rdx, -0x50(%rbp)
sete %dl
testb %al, %dl
movq -0x58(%rbp), %rsi
jne 0x4731
incq %r11
addq $0xf, %rcx
cmpq -0x68(%rbp), %r11
jne 0x4638
movq -0x38(%rbp), %rax
cmpq $0xe, %rax
leaq 0x1(%rax), %rcx
setb %al
incq -0x40(%rbp)
movq %rcx, -0x38(%rbp)
cmpq $0xf, %rcx
jne 0x4615
jmp 0x4781
movl %r11d, %eax
leaq (%rax,%rax,4), %rax
leaq (%rax,%rax,2), %rax
movq -0x40(%rbp), %rdx
addq %rax, %rdx
xorl %eax, %eax
movq (%rsi), %rcx
movb (%rcx,%rax), %cl
movb %cl, (%rdx)
incq %rax
addq $0xf, %rdx
cmpq %rax, 0x8(%rsi)
ja 0x4745
movq -0x48(%rbp), %rcx
movslq 0x408(%rcx), %rax
movl %r11d, 0xe4(%rcx,%rax,8)
movq -0x38(%rbp), %rdx
movl %edx, 0xe8(%rcx,%rax,8)
incl 0x408(%rcx)
movb -0x29(%rbp), %al
andb $0x1, %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq