// File: /workspace/github_cpp_makefile_star2_O1/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 %rdi, %r8
movq $0x0, -0x38(%rbp)
movb $0x1, %al
movq %rdi, -0x48(%rbp)
xorl %r9d, %r9d
movq $0x0, -0x50(%rbp)
xorl %r10d, %r10d
movq 0x8(%rsi), %r15
movq %r15, %rdx
subq $0x10, %rdx
setne %cl
je 0x47f6
movb %al, -0x29(%rbp)
negq %rdx
leaq (%r15,%r15,2), %rax
addq $0x2, %rax
movq %rax, -0x60(%rbp)
xorl %r13d, %r13d
movq %r8, -0x40(%rbp)
xorl %r14d, %r14d
movq %rdx, -0x58(%rbp)
movb %cl, -0x2a(%rbp)
testq %r15, %r15
je 0x474c
movq (%rsi), %r11
leaq (%r14,%r14,4), %rax
leaq (%rax,%rax,2), %rax
movq -0x48(%rbp), %rcx
addq %rcx, %rax
movq -0x38(%rbp), %rbx
movb -0xf(%rbx,%rax), %dl
leal (%r14,%r15), %eax
cltq
leaq (%rax,%rax,4), %rax
leaq (%rax,%rax,2), %rdi
addq %rcx, %rdi
addq %rbx, %rdi
movq %r8, %rax
xorl %ecx, %ecx
movb (%rax), %r12b
cmpb $0x5f, %r12b
je 0x46e5
movq (%rsi), %rbx
cmpb (%rbx,%rcx), %r12b
jne 0x46e8
incl %r10d
cmpb (%r11,%rcx), %r12b
jne 0x4711
cmpb $0x5f, 0xf(%rax)
jne 0x4711
leal 0x2(%r10), %ebx
cmpb $0x5f, -0xf(%rax)
cmovnel %r10d, %ebx
movzbl %r9b, %r9d
movl $0x1, %r10d
cmovel %r10d, %r9d
movl %ebx, %r10d
cmpb $0x5f, 0x1(%rax)
jne 0x4726
cmpb $0x5f, -0x1(%rax)
leal 0x2(%r10), %ebx
cmovnel %r10d, %ebx
movl %ebx, %r10d
cmpb $0x5f, %dl
jne 0x4740
leal 0x2(%r10), %ebx
cmpb $0x5f, (%rdi)
cmovnel %r10d, %ebx
testq %rcx, %rcx
cmovnel %r10d, %ebx
movl %ebx, %r10d
incq %rcx
addq $0xf, %rax
cmpq %rcx, %r15
jne 0x46d3
testb $0x1, -0x50(%rbp)
sete %al
movslq %r10d, %rcx
cmpq %rcx, -0x60(%rbp)
sete %cl
andb %r9b, %cl
testb %al, %cl
jne 0x4796
incq %r14
movq -0x58(%rbp), %rdx
cmpq %r14, %rdx
seta %cl
addq $0xf, %r8
incl %r13d
xorl %r9d, %r9d
movl $0x0, %r10d
cmpq %rdx, %r14
jne 0x4694
xorl %r10d, %r10d
movb -0x29(%rbp), %al
movq -0x40(%rbp), %r8
jmp 0x47f6
cmpq $0x0, 0x8(%rsi)
movq -0x40(%rbp), %r8
je 0x47c6
movl %r13d, %eax
leaq (%rax,%rax,4), %rax
leaq (%rax,%rax,2), %rax
addq %r8, %rax
xorl %ecx, %ecx
movq (%rsi), %rdx
movb (%rdx,%rcx), %dl
movb %dl, (%rax)
incq %rcx
addq $0xf, %rax
cmpq %rcx, 0x8(%rsi)
ja 0x47b1
movq -0x48(%rbp), %rcx
movslq 0x408(%rcx), %rax
movl %r14d, 0xe4(%rcx,%rax,8)
movq -0x38(%rbp), %rdx
movl %edx, 0xe8(%rcx,%rax,8)
incl 0x408(%rcx)
movb $0x1, %al
movq %rax, -0x50(%rbp)
movb -0x29(%rbp), %al
movb -0x2a(%rbp), %cl
testb $0x1, %cl
jne 0x481b
movq -0x38(%rbp), %rax
cmpq $0xe, %rax
leaq 0x1(%rax), %rcx
setb %al
incq %r8
movq %rcx, -0x38(%rbp)
cmpq $0xf, %rcx
jne 0x4660
andb $0x1, %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq