// File: /workspace/github_cpp_makefile_star2_O2/permui[P]CastleAdventure/src/main.cpp
// Function: main
int main(int args, char *argv[]) {
	std::map<Position, Grid> mp = GenMap();
	Player player{{1, 0}, 0, 0, args > 1 ? atoi(argv[1]) : 0};
	std::map<Position, std::string> note {
		{SUCC_POS, "success"}, {FAIL_POS, "fail"}, {QUIT_POS, "quit"}
	};
	while (true) {
		bool go_out = false;
		for (const auto &pr: note) if (player.pos == pr.first) {
			std::cout << pr.second << std::endl;
			go_out = true;
			break;
		}
		if (go_out) break;
		std::map<Position, Grid>::iterator it = mp.find(player.pos);
		assert(it != mp.end());
		Grid &gd = it->second;
		std::cout << "---------------" << std::endl;
		player.show_state(gd);
		std::cout << "---------------" << std::endl;
		if (!gd.desc.empty()) {
			std::cout << gd.desc << std::endl;
			std::cout << "---------------" << std::endl;
		}
		Command(player, gd, mp);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x8(%rsp), %rdi
callq 0x5d49
movq $0x1, 0x80(%rsp)
xorl %r8d, %r8d
cmpl $0x2, %ebp
jl 0x24fc
movq 0x8(%rbx), %rdi
callq 0x2260
movl %eax, %r8d
leaq 0x68(%rsp), %rdi
leaq 0x80(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3786
leaq 0x5aeb(%rip), %rsi      # 0x8004
leaq 0x5afc(%rip), %rdx      # 0x801c
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0x2750
leaq 0xa8(%rsp), %r15
leaq 0x5acd(%rip), %rsi      # 0x800c
leaq 0x5ade(%rip), %rdx      # 0x8024
movq %r15, %rdi
callq 0x276e
leaq 0xd0(%rsp), %r15
leaq 0x5ab7(%rip), %rsi      # 0x8014
leaq 0x5ac5(%rip), %rdx      # 0x8029
movq %r15, %rdi
callq 0x276e
leaq 0x38(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x3
popq %rdx
leaq 0x7(%rsp), %rcx
leaq 0x6(%rsp), %r8
callq 0x278c
pushq $0x58
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x80, %rdi
callq 0x20c0
addq $-0x28, %rbx
cmpq $-0x20, %rbx
jne 0x258e
leaq 0x40(%rsp), %rbx
leaq 0x68(%rsp), %r14
movq 0xaa17(%rip), %r15      # 0xcfd0
leaq 0x5aa1(%rip), %r12      # 0x8061
movq 0x50(%rsp), %r13
cmpq %rbx, %r13
je 0x25eb
leaq 0x20(%r13), %rsi
movq %r14, %rdi
callq 0x376a
testb %al, %al
jne 0x2684
movq %r13, %rdi
callq 0x2140
movq %rax, %r13
jmp 0x25c5
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2d7a
movq %rax, %rbp
leaq 0x10(%rsp), %rax
cmpq %rax, %rbp
je 0x26c7
movq %r15, %rdi
movq %r12, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
leaq 0x28(%rbp), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x379c
movq %r15, %rdi
movq %r12, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
cmpq $0x0, 0x60(%rbp)
je 0x266f
addq $0x58, %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
movq %r15, %rdi
movq %r12, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
movq %r14, %rdi
movq %r13, %rsi
leaq 0x8(%rsp), %rdx
callq 0x6b2c
jmp 0x25c0
addq $0x28, %r13
movq 0xa941(%rip), %rdi      # 0xcfd0
movq %r13, %rsi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
leaq 0x38(%rsp), %rdi
callq 0x28b0
leaq 0x8(%rsp), %rdi
callq 0x2914
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5960(%rip), %rdi      # 0x802e
leaq 0x5968(%rip), %rsi      # 0x803d
leaq 0x596e(%rip), %rcx      # 0x804a
pushq $0x18
popq %rdx
callq 0x2120
movq %rax, %rbx
pushq $0x58
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x80, %rdi
callq 0x20c0
addq $-0x28, %r14
cmpq $-0x20, %r14
jne 0x26eb
jmp 0x273e
jmp 0x2709
movq %rax, %rbx
jmp 0x273e
jmp 0x2731
jmp 0x2731
movq %rax, %rbx
leaq -0x28(%r15), %r12
addq $-0x20, %r15
movq %r15, %rdi
callq 0x20c0
movq %r12, %r15
cmpq %r14, %r12
jne 0x2715
jmp 0x273e
jmp 0x2731
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x28b0
leaq 0x8(%rsp), %rdi
callq 0x2914
movq %rbx, %rdi
callq 0x22d0