// File: /workspace/github_cpp_makefile_star2_O3/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 $0xd8, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rcx
movaps %xmm0, (%rcx)
xorl %eax, %eax
movq %rax, 0x10(%rcx)
leaq 0x30(%rsp), %r15
movq %rax, 0x10(%r15)
movaps %xmm0, (%r15)
leaq 0xc0(%rsp), %r12
leaq 0xa8(%rsp), %r14
leaq 0x90(%rsp), %r13
movq %r12, %rdi
movq %rbx, %rsi
callq 0x120b4
leaq 0x80(%rsp), %rdi
leaq 0x16c27(%rip), %rsi     # 0x2a038
movq %r12, %rdx
callq 0x1db7a
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x13436
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
leaq 0x169cb(%rip), %rdi     # 0x29e08
callq 0x1a50e
movl %eax, 0xc(%rsp)
movq 0x80(%rsp), %rsi
leaq 0x70(%rsp), %rdi
movl %eax, %edx
callq 0x1504a
movq 0x70(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x14fc4
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movaps 0x50(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
testq %rdi, %rdi
je 0x134bc
subq %rdi, %rsi
callq 0x5280
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x134bc
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x134cb
callq 0x1235a
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
je 0x134eb
movl 0xc(%rsp), %ecx
cmpl %ecx, (%rax)
je 0x13517
addq $0x4, %rax
cmpq %rsi, %rax
jne 0x134de
cmpq 0x20(%rsp), %rsi
je 0x13503
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x13517
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x13daa
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
cmpq $0x20, %rsi
je 0x135f0
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x13538
callq 0x1235a
movq %r14, %rdi
movq %r15, %rsi
callq 0x120b4
movq %r14, %rdi
callq 0x12c90
movb $0x1, %bpl
testb %al, %al
je 0x13584
movq %r13, %rdi
movq %r15, %rsi
callq 0x120b4
movq %r13, %rdi
callq 0x12d2d
movl %eax, %ebp
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x13584
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x135a1
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
testb %bpl, %bpl
jne 0x133f7
movl 0xc(%rsp), %ebx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x135c5
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x135dc
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movl %ebx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x5160
movl $0x1, (%rax)
movq 0x15979(%rip), %rsi     # 0x28f80
movq %rax, %rdi
xorl %edx, %edx
callq 0x53c0
jmp 0x1366e
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x13688
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
jmp 0x13688
jmp 0x13669
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x136a5
movq 0xd0(%rsp), %rsi
jmp 0x1369d
jmp 0x1366e
jmp 0x1366e
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x13671
callq 0x1235a
jmp 0x13671
movq %rax, %rbx
jmp 0x136a5
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x136a5
callq 0x1235a
jmp 0x136a5
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x136a5
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x136bc
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x136d3
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq %rbx, %rdi
callq 0x53e0