// File: /workspace/github_cpp_makefile_star2_O1/permui[P]CastleAdventure/src/command.cpp
// Function: Command(Player&, Grid&, std::map<Position, Grid, std::less<Position>, std::allocator<std::pair<Position const, Grid>>>&)
void Command(Player &player, Grid &grid, map<Position, Grid> &mp) {
	switch (grid.info.t) {
		case GT::Monster: {
			EncounterMonster(player, grid);
			if (player.pos == FAIL_POS || player.pos == QUIT_POS) return;
			break;
		}
		case GT::Princess: {
			EncounterPrincess(player, grid);
			break;
		}
		default:
			break;
	}
	cout << "Commands:";
	if (grid.commands.empty()) {
		// if the design is right, this is impossible
		cout << " no commands availible" << endl;
		return;
	}
	for (const auto &pr: grid.commands) cout << ' ' << pr.first;
	cout << endl;
	map<string, Action>::iterator it;
	while (true) {
		string com = GetA<string>();
		it = grid.commands.find(com);
		if (it != grid.commands.end()) break;
		cout << "given command not available, see the command list" << endl;
	}
	it->second(player, grid, mp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r14
movl 0x8(%rsi), %eax
testl %eax, %eax
je 0x8a39
cmpl $0x1, %eax
jne 0x8a44
movq %r14, %rdi
movq %rbp, %rsi
callq 0x8c11
leaq 0x1fa3(%rip), %rsi      # 0xa9b4
movq %r14, %rdi
callq 0x3c86
testb %al, %al
jne 0x8b8f
leaq 0x1f94(%rip), %rsi      # 0xa9bc
movq %r14, %rdi
callq 0x3c86
testb %al, %al
je 0x8a44
jmp 0x8b8f
movq %r14, %rdi
movq %rbp, %rsi
callq 0x8edf
movq 0x5585(%rip), %r12      # 0xdfd0
leaq 0x1f72(%rip), %rsi      # 0xa9c4
movl $0x9, %edx
movq %r12, %rdi
callq 0x21e0
cmpq $0x0, 0x78(%rbp)
je 0x8b9e
movq %r14, (%rsp)
movq %rbx, 0x10(%rsp)
movq 0x68(%rbp), %rbx
leaq 0x58(%rbp), %r14
cmpq %r14, %rbx
je 0x8ac1
movq 0x5549(%rip), %r15      # 0xdfd0
leaq 0x18(%rsp), %r13
movb $0x20, 0x18(%rsp)
movl $0x1, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x21e0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %rax, %rdi
callq 0x21e0
movq %rbx, %rdi
callq 0x2130
movq %rax, %rbx
cmpq %r14, %rax
jne 0x8a8c
movq %rbp, 0x8(%rsp)
leaq 0x50(%rbp), %r13
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
leaq 0x28(%rsp), %rbx
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0x8fee
movq %r13, %rdi
movq %rbp, %rsi
callq 0x90f0
movq %rax, %r15
cmpq %r14, %rax
jne 0x8b53
movl $0x31, %edx
movq %r12, %rdi
leaq 0x1ebf(%rip), %rsi      # 0xa9e5
callq 0x21e0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x8b6a
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpq %r14, %r15
je 0x8afc
cmpq $0x0, 0x50(%r15)
je 0x8be8
movq %r15, %rdi
addq $0x40, %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq *0x58(%r15)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e29(%rip), %rsi      # 0xa9ce
movl $0x16, %edx
movq %r12, %rdi
callq 0x21e0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2120
callq 0x20a0
jmp 0x8bef
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x8c09
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x22a0