// File: /workspace/github_cpp_makefile_star2_O3/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 0x76db
movq $0x1, 0x38(%rsp)
xorl %r8d, %r8d
cmpl $0x2, %ebp
jl 0x2549
movq 0x8(%rbx), %rdi
callq 0x2230
movl %eax, %r8d
leaq 0xe0(%rsp), %rdi
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3c8a
leaq 0x40(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x6a88(%rip), %rsi      # 0x9004
leaq 0x6a88(%rip), %rdx      # 0x900b
callq 0x2916
leaq 0x60(%rsp), %r14
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, (%r14)
leaq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x6a5d(%rip), %rsi      # 0x900c
leaq 0x6a5a(%rip), %rdx      # 0x9010
callq 0x2916
leaq 0x88(%rsp), %r14
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, (%r14)
leaq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x6a26(%rip), %rsi      # 0x9011
leaq 0x6a23(%rip), %rdx      # 0x9015
callq 0x2916
leaq 0xb0(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x7(%rsp), %rcx
leaq 0x6(%rsp), %r8
movl $0x3, %edx
callq 0x2892
movq $-0x78, %r14
movq -0x10(%rbx), %rdi
cmpq %rdi, %rbx
je 0x2633
movq (%rbx), %rsi
incq %rsi
callq 0x21c0
addq $-0x28, %rbx
addq $0x28, %r14
jne 0x261f
leaq 0xb8(%rsp), %rbx
leaq 0xe0(%rsp), %r14
movq 0xa97c(%rip), %r15      # 0xcfd0
leaq 0x69ee(%rip), %r12      # 0x9049
movq 0xc8(%rsp), %r13
cmpq %rbx, %r13
je 0x268c
leaq 0x20(%r13), %rsi
movq %r14, %rdi
callq 0x3c6e
testb %al, %al
jne 0x27b2
movq %r13, %rdi
callq 0x2130
movq %rax, %r13
cmpq %rbx, %rax
jne 0x2668
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2e90
movq %rax, %rbp
leaq 0x10(%rsp), %rax
cmpq %rax, %rbp
je 0x281b
movl $0xf, %edx
movq %r15, %rdi
movq %r12, %rsi
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 0x28(%rbp), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x3ca0
movl $0xf, %edx
movq %r15, %rdi
movq %r12, %rsi
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
movq 0x60(%rbp), %rdx
testq %rdx, %rdx
je 0x279d
movq 0x58(%rbp), %rsi
movq %r15, %rdi
callq 0x21e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movl $0xf, %edx
movq %r15, %rdi
movq %r12, %rsi
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
movq %r14, %rdi
movq %r13, %rsi
leaq 0x8(%rsp), %rdx
callq 0x85ac
jmp 0x265b
movq 0x28(%r13), %rsi
movq 0x30(%r13), %rdx
movq 0xa80f(%rip), %rdi      # 0xcfd0
callq 0x21e0
movq %rax, %rbx
movq (%rax), %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 0xb0(%rsp), %rdi
callq 0x29b6
leaq 0x8(%rsp), %rdi
callq 0x2a2e
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x67f4(%rip), %rdi      # 0x9016
leaq 0x67fc(%rip), %rsi      # 0x9025
leaq 0x6802(%rip), %rcx      # 0x9032
movl $0x18, %edx
callq 0x2100
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x230a
jmp 0x2880
jmp 0x2853
movq %rax, %rbx
jmp 0x2880
movq %rax, %rbx
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
callq 0x22d0
jmp 0x2880
jmp 0x2870
jmp 0x2870
jmp 0x2870
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x29b6
leaq 0x8(%rsp), %rdi
callq 0x2a2e
movq %rbx, %rdi
callq 0x22a0