// File: /workspace/github_cpp_makefile_star2_O2/XxAdi101xX[P]ChamberCrawler/Main/MainHelpers.cc
// Function: getValidMove(std::vector<int, std::allocator<int>>)
Direction getValidMove(vector<int> base) {
	// safety check
	vector<Direction>  checkedDirections;
	vector <int> tempCoordinates;
	Direction tempDirection;

	do {
		shared_ptr<Cell> tempCell = currentFloor.getCell(base);
		tempDirection = rng.genDirection();

		tempCoordinates
			= (tempCell->getNeighbour(tempDirection))->getCoords();

		bool checked = false;

		// checks if this direction has been logged
		for (auto direction: checkedDirections) {
			if (direction == tempDirection) {
				checked = true;
				break;
			}
		}

		// if directions was not logged, log it
		if (!(checked)) {
			checkedDirections.emplace_back(tempDirection);
		}

		// checks if all directions were tried
		if (checkedDirections.size() == DIRECTION_ENUMERATION) {
			// no valid move
			throw 1;
		}

		// reroll if cell in direction is not a FloorTile
		// or has an occupant already
	} while (!(isValidCoordinates(tempCoordinates))
		|| isOccupied(tempCoordinates));

	return tempDirection;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, 0x28(%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x50(%rsp), %r13
andq $0x0, 0x10(%r13)
movaps %xmm0, (%r13)
leaq 0x98(%rsp), %rbp
leaq 0xb0(%rsp), %rbx
leaq 0x80(%rsp), %r12
leaq 0x68(%rsp), %r15
movq %rbp, %rdi
movq 0x28(%rsp), %rsi
callq 0xcef6
leaq 0x40(%rsp), %rdi
leaq 0x168d2(%rip), %rsi     # 0x25030
movq %rbp, %rdx
callq 0x169dc
movq %rbp, %rdi
callq 0xd484
leaq 0x1668b(%rip), %rdi     # 0x24e00
callq 0x13c62
movl %eax, 0xc(%rsp)
movq 0x40(%rsp), %rsi
leaq 0x30(%rsp), %rdi
movl %eax, %edx
callq 0x10906
movq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x108b2
movq %r13, %rdi
movq %rbx, %rsi
callq 0xd56a
movq %rbx, %rdi
callq 0xd484
leaq 0x38(%rsp), %rdi
callq 0xd24a
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movl 0xc(%rsp), %edx
movq %rax, %rsi
cmpq %rcx, %rsi
je 0xe7dc
leaq 0x4(%rsi), %rdi
cmpl %edx, (%rsi)
movq %rdi, %rsi
jne 0xe7ca
jmp 0xe7f5
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0xec16
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
cmpq $0x20, %rcx
je 0xe88d
leaq 0x48(%rsp), %rdi
callq 0xd24a
movq %r12, %rdi
movq %r13, %rsi
callq 0xcef6
movq %r12, %rdi
callq 0xe1dc
testb %al, %al
je 0xe854
movq %r15, %rdi
movq %r13, %rsi
callq 0xcef6
movq %r15, %rdi
callq 0xe255
movl %eax, %r14d
movq %r15, %rdi
callq 0xd484
movq %r12, %rdi
callq 0xd484
testb %r14b, %r14b
jne 0xe745
jmp 0xe861
movq %r12, %rdi
callq 0xd484
jmp 0xe745
movl 0xc(%rsp), %ebx
leaq 0x50(%rsp), %rdi
callq 0xd484
leaq 0x10(%rsp), %rdi
callq 0xf1a4
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x4
popq %rdi
callq 0x5150
movl $0x1, (%rax)
movq 0x156de(%rip), %rsi     # 0x23f80
movq %rax, %rdi
xorl %edx, %edx
callq 0x53a0
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0xd484
jmp 0xe8f6
jmp 0xe8d5
jmp 0xe8c1
jmp 0xe8d5
movq %rax, %rbx
jmp 0xe903
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0xe8fe
jmp 0xe8d5
movq %rax, %rbx
jmp 0xe8e7
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xd24a
leaq 0x48(%rsp), %rdi
callq 0xd24a
jmp 0xe903
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xd484
leaq 0x50(%rsp), %rdi
callq 0xd484
leaq 0x10(%rsp), %rdi
callq 0xf1a4
movq %rbx, %rdi
callq 0x53c0