// File: /workspace/github_cpp_makefile_star2_O1/XxAdi101xX[P]ChamberCrawler/Main/MainHelpers.cc
// Function: getValidNeighbourCoordinates(std::vector<int, std::allocator<int>>)
vector<int> getValidNeighbourCoordinates(vector<int> base) {
	// safety check
	vector<vector<int>> checkedCoordinates;
	vector<int> tempCoordinates;

	do {
		tempCoordinates = rng.genNeighbourCoord(base);

		bool checked = false;

		// checks if neighbour was logged
		for (auto coordinates: checkedCoordinates) {
			if (coordinates == tempCoordinates) {
					checked = true;
					break;
				}
		}

		// if neighbour was not logged, log it
		if (!(checked)) {
			checkedCoordinates.emplace_back(tempCoordinates);
		}

		// checks if all neighbours were tried
		if (checkedCoordinates.size() == DIRECTION_ENUMERATION) {
			// no valid neighbour
			throw 1;
		}

		// reroll if coordinates are not for a FloorTile
		// or has an occupant already
	} while (!(isValidCoordinates(tempCoordinates))
		|| isOccupied(tempCoordinates));

		return tempCoordinates;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, 0x38(%rsp)
movq %rdi, %rbx
xorl %eax, %eax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rcx)
movq %rax, 0x10(%rdi)
movups %xmm0, (%rdi)
leaq 0x58(%rsp), %r12
leaq 0x20(%rsp), %rbp
movq %r12, %rdi
movq 0x38(%rsp), %rsi
callq 0x11fd4
movq %rbp, %rdi
leaq 0x16e07(%rip), %rsi     # 0x29e08
movq %r12, %rdx
callq 0x1a54c
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1243c
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1302b
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x13042
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq (%rsp), %r13
movq 0x8(%rsp), %r15
cmpq %r15, %r13
je 0x130e1
xorl %r12d, %r12d
movq %rbp, %rdi
movq %r13, %rsi
callq 0x11fd4
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %rax
movq %rax, %rdx
subq %r14, %rdx
movq (%rbx), %rsi
movq 0x8(%rbx), %rcx
subq %rsi, %rcx
cmpq %rcx, %rdx
jne 0x13096
cmpq %r14, %rax
je 0x1309a
movq %r14, %rdi
callq 0x5290
testl %eax, %eax
sete %bpl
jmp 0x1309d
xorl %ebp, %ebp
jmp 0x1309d
movb $0x1, %bpl
movzbl %r12b, %r12d
testb %bpl, %bpl
movl $0x1, %eax
cmovnel %eax, %r12d
testq %r14, %r14
je 0x130c2
movq 0x30(%rsp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x5280
addq $0x18, %r13
cmpq %r15, %r13
sete %al
orb %al, %bpl
leaq 0x20(%rsp), %rbp
je 0x13057
testb $0x1, %r12b
leaq 0x58(%rsp), %r12
jne 0x130ec
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x13af4
movq 0x8(%rsp), %rax
subq (%rsp), %rax
cmpq $0xc0, %rax
je 0x13199
leaq 0x70(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x11fd4
movq %r14, %rdi
callq 0x12bbc
movl %eax, %r13d
movb $0x1, %r14b
testb %al, %al
je 0x1313d
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x11fd4
leaq 0x40(%rsp), %rdi
callq 0x12c59
movl %eax, %r14d
testb %r13b, %r13b
je 0x13159
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x13159
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x13173
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
testb %r14b, %r14b
jne 0x12fea
movq %rsp, %rdi
callq 0x13b2a
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x5160
movl $0x1, (%rax)
movq 0x15dd0(%rip), %rsi     # 0x28f80
movq %rax, %rdi
xorl %edx, %edx
callq 0x53c0
movq %rax, %r14
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x131f5
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
jmp 0x131f5
jmp 0x13211
jmp 0x13211
jmp 0x13211
jmp 0x13211
movq %rax, %r14
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x13214
movq 0x68(%rsp), %rsi
jmp 0x13207
movq %rax, %r14
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x13214
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
jmp 0x13214
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x13228
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x5280
movq %rsp, %rdi
callq 0x13b2a
movq %r14, %rdi
callq 0x53e0