// File: /workspace/github_cpp_makefile_star2_O1/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), %rcx
movq %rax, 0x10(%rcx)
movaps %xmm0, (%rcx)
leaq 0xc0(%rsp), %r12
leaq 0xa8(%rsp), %r14
movl $0x1, %r15d
movq %r12, %rdi
movq %rbx, %rsi
callq 0x11fd4
leaq 0x98(%rsp), %rdi
leaq 0x16d25(%rip), %rsi     # 0x2a038
movq %r12, %rdx
callq 0x1dcda
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x13338
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
leaq 0x16ac9(%rip), %rdi     # 0x29e08
callq 0x1a536
movl %eax, 0xc(%rsp)
movq 0x98(%rsp), %rsi
leaq 0x88(%rsp), %rdi
movl %eax, %edx
callq 0x14f5c
movq 0x88(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x14ed6
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
testq %rdi, %rdi
je 0x133ad
subq %rdi, %rsi
callq 0x5280
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x133c4
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x133d6
callq 0x12250
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
je 0x1340c
movl 0xc(%rsp), %ecx
addq $0x4, %rax
xorl %edx, %edx
movzbl %dl, %edx
cmpl %ecx, -0x4(%rax)
cmovel %r15d, %edx
je 0x13407
leaq 0x4(%rax), %rdi
cmpq %rsi, %rax
movq %rdi, %rax
jne 0x133ef
testb $0x1, %dl
jne 0x13433
cmpq 0x20(%rsp), %rsi
je 0x13424
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x13433
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x13e0c
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
cmpq $0x20, %rax
je 0x1351e
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x13459
callq 0x12250
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x11fd4
movq %r14, %rdi
callq 0x12bbc
movl %eax, %r13d
movb $0x1, %bpl
testb %al, %al
je 0x13493
leaq 0x70(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x11fd4
leaq 0x70(%rsp), %rdi
callq 0x12c59
movl %eax, %ebp
testb %r13b, %r13b
je 0x134b2
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x134b2
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x134cf
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
testb %bpl, %bpl
jne 0x132f9
movl 0xc(%rsp), %ebx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x134f3
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1350a
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 0x15a4b(%rip), %rsi     # 0x28f80
movq %rax, %rdi
xorl %edx, %edx
callq 0x53c0
jmp 0x1359c
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x135b6
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
jmp 0x135b6
jmp 0x13597
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x135d3
movq 0xd0(%rsp), %rsi
jmp 0x135cb
jmp 0x1359c
jmp 0x1359c
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x1359f
callq 0x12250
jmp 0x1359f
movq %rax, %rbx
jmp 0x135d3
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x135d3
callq 0x12250
jmp 0x135d3
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x135d3
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x135ea
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x13601
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5280
movq %rbx, %rdi
callq 0x53e0