// File: 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
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rsi, -0xf8(%rbp)
movq %rdi, -0xe8(%rbp)
movq %rdi, %rax
movq %rax, -0xf0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x21640
movq -0xe8(%rbp), %rdi
movb $0x0, -0x29(%rbp)
callq 0x19550
movq -0xf8(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x19880
jmp 0x20956
leaq 0x47583(%rip), %rsi     # 0x67ee0
leaq -0x48(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x34270
jmp 0x2096c
movq -0xe8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x19610
leaq -0x48(%rbp), %rdi
callq 0x19640
leaq -0x60(%rbp), %rdi
callq 0x19640
movb $0x0, -0x6d(%rbp)
leaq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
callq 0x21660
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
callq 0x21690
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x216c0
testb $0x1, %al
jne 0x209d0
jmp 0x20a9d
leaq -0x80(%rbp), %rdi
callq 0x21700
movq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x19880
jmp 0x209ea
movq -0xe8(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x1a240
movb %al, -0xf9(%rbp)
jmp 0x20a05
movb -0xf9(%rbp), %al
testb $0x1, %al
jne 0x20a11
jmp 0x20a69
movb $0x1, -0x6d(%rbp)
movl $0x4, -0xa4(%rbp)
jmp 0x20a73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x20c2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x19640
jmp 0x20c2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x19640
jmp 0x20c2c
movl $0x0, -0xa4(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x19640
movl -0xa4(%rbp), %eax
testl %eax, %eax
je 0x20a8d
jmp 0x20a8b
jmp 0x20a9d
jmp 0x20a8f
leaq -0x80(%rbp), %rdi
callq 0x21720
jmp 0x209b7
testb $0x1, -0x6d(%rbp)
jne 0x20ab7
movq -0xe8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x21740
jmp 0x20ab5
jmp 0x20ab7
leaq -0x28(%rbp), %rdi
callq 0x217c0
cmpq $0x8, %rax
jne 0x20aee
movl $0x4, %edi
callq 0x61a0
movq %rax, %rdi
movl $0x1, (%rdi)
movq 0x46490(%rip), %rsi     # 0x66f70
xorl %eax, %eax
movl %eax, %edx
callq 0x6520
jmp 0x20c4a
jmp 0x20af0
movq -0xe8(%rbp), %rsi
movb $0x0, -0xd9(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x19880
jmp 0x20b0c
leaq -0xc0(%rbp), %rdi
callq 0x20420
movb %al, -0xfa(%rbp)
jmp 0x20b20
movb -0xfa(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xfb(%rbp)
jne 0x20b35
jmp 0x20b73
movq -0xe8(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x19880
jmp 0x20b4a
movb $0x1, -0xd9(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x204d0
movb %al, -0xfc(%rbp)
jmp 0x20b65
movb -0xfc(%rbp), %al
movb %al, -0xfb(%rbp)
jmp 0x20b73
movb -0xfb(%rbp), %al
movb %al, -0xfd(%rbp)
testb $0x1, -0xd9(%rbp)
jne 0x20b8a
jmp 0x20b96
leaq -0xd8(%rbp), %rdi
callq 0x19640
leaq -0xc0(%rbp), %rdi
callq 0x19640
movb -0xfd(%rbp), %al
testb $0x1, %al
jne 0x20944
movb $0x1, -0x29(%rbp)
movl $0x1, -0xa4(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x20c13
jmp 0x20c07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x20bf9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
testb $0x1, -0xd9(%rbp)
jne 0x20beb
jmp 0x20bf7
leaq -0xd8(%rbp), %rdi
callq 0x19640
jmp 0x20bf9
leaq -0xc0(%rbp), %rdi
callq 0x19640
jmp 0x20c2c
movq -0xe8(%rbp), %rdi
callq 0x19640
leaq -0x28(%rbp), %rdi
callq 0x217f0
movq -0xf0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0xe8(%rbp), %rdi
callq 0x19640
leaq -0x28(%rbp), %rdi
callq 0x217f0
movq -0x68(%rbp), %rdi
callq 0x6550
nopw (%rax,%rax)