// File: /workspace/github_cpp_makefile_star2_O3/permui[P]CastleAdventure/src/command.cpp
// Function: EncounterMonster(Player&, Grid&)
void EncounterMonster(Player &player, Grid &grid) {
	cout << "Encounter Monster!" << endl;
	cout << "A shield (" << shield_price << " BTC) can defend against one time of monster attact, but cannot kill the monster." << endl;
	cout << "A sword (" << sword_price << " BTC) can kill the monster." << endl;
	cout << "Commands: use_shield use_sword give_up" << endl;
	while (true) {
		string com = GetA<string>();
		if (com == "use_shield") {
			if (player.shield > 0) {
				--player.shield;
				cout << "You defend the monster!" << endl;
				break;
			}
			cout << "not enough shield, choose an alternative" << endl;
		} else if (com == "use_sword") {
			if (player.sword > 0) {
				--player.sword;
				grid.info.t = GT::None;
				cout << "You kill the monster!" << endl;
				break;
			}
			cout << "not enogh sword, choose an alternative" << endl;
		} else if (com == "give_up") {
			player.pos = FAIL_POS;
			break;
		} else {
			cout << "given command not available, see the command list" << endl;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, (%rsp)
movq %rdi, %r14
movq 0x47d3(%rip), %r15      # 0xcfd0
leaq 0x1213(%rip), %rsi      # 0x9a17
movl $0x12, %edx
movq %r15, %rdi
callq 0x21e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
leaq 0x11eb(%rip), %rsi      # 0x9a2a
movl $0xa, %edx
movq %r15, %rdi
callq 0x21e0
movq %r15, %rdi
movl $0xa, %esi
callq 0x2280
movq %rax, %rbx
leaq 0x11d2(%rip), %rsi      # 0x9a35
movl $0x51, %edx
movq %rax, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
leaq 0x11e9(%rip), %rsi      # 0x9a87
movl $0x9, %edx
movq %r15, %rdi
callq 0x21e0
movq %r15, %rdi
movl $0xf, %esi
callq 0x2280
movq %rax, %rbx
leaq 0x11cf(%rip), %rsi      # 0x9a91
movl $0x1b, %edx
movq %rax, %rdi
callq 0x21e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
leaq 0x11b0(%rip), %rsi      # 0x9aad
movl $0x26, %edx
movq %r15, %rdi
callq 0x21e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
leaq 0x18(%rsp), %rbx
leaq 0x8(%rsp), %r12
leaq 0x1192(%rip), %r13      # 0x9ad4
movq %r12, %rdi
callq 0x8bbe
movq %r12, %rdi
movq %r13, %rsi
callq 0x2080
testl %eax, %eax
je 0x899e
movq %r12, %rdi
leaq 0x11bd(%rip), %rsi      # 0x9b20
callq 0x2080
testl %eax, %eax
je 0x89ba
movq %r12, %rdi
leaq 0x1156(%rip), %rsi      # 0x9acc
callq 0x2080
movl $0x31, %edx
leaq 0x105e(%rip), %rsi      # 0x99e5
testl %eax, %eax
jne 0x8a2c
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, (%r14)
jmp 0x8a0e
movl 0x8(%r14), %eax
testl %eax, %eax
jle 0x8a12
decl %eax
movl %eax, 0x8(%r14)
movl $0x17, %edx
leaq 0x1127(%rip), %rsi      # 0x9adf
jmp 0x89df
movl 0xc(%r14), %eax
testl %eax, %eax
jle 0x8a20
decl %eax
movl %eax, 0xc(%r14)
movq (%rsp), %rax
movl $0x3, 0x8(%rax)
movl $0x15, %edx
leaq 0x114b(%rip), %rsi      # 0x9b2a
movq %r15, %rdi
callq 0x21e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
xorl %ebp, %ebp
jmp 0x8a5e
movl $0x28, %edx
leaq 0x10d9(%rip), %rsi      # 0x9af7
jmp 0x8a2c
movl $0x26, %edx
leaq 0x1114(%rip), %rsi      # 0x9b40
movq %r15, %rdi
callq 0x21e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movb $0x1, %bpl
movq %rax, %rdi
callq 0x2120
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x8a75
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
testb %bpl, %bpl
jne 0x8942
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x8aa7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x22a0