// File: /workspace/github_cpp_makefile_star2_O1/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 0x38(%rsp), %rdi
callq 0x7b0e
movq $0x1, 0x68(%rsp)
xorl %r8d, %r8d
cmpl $0x2, %ebp
jl 0x2549
movq 0x8(%rbx), %rdi
callq 0x2230
movl %eax, %r8d
leaq 0xe0(%rsp), %rdi
leaq 0x68(%rsp), %rbx
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3c96
leaq 0x70(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7a82(%rip), %rsi      # 0xa004
leaq 0x7a82(%rip), %rdx      # 0xa00b
movq %rbx, %r15
callq 0x2936
leaq 0x90(%rsp), %r15
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, (%r15)
leaq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7a4b(%rip), %rsi      # 0xa00c
leaq 0x7a48(%rip), %rdx      # 0xa010
callq 0x2936
leaq 0xb8(%rsp), %r15
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, (%r15)
leaq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x7a14(%rip), %rsi      # 0xa011
leaq 0x7a11(%rip), %rdx      # 0xa015
callq 0x2936
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x7(%rsp), %rcx
leaq 0x6(%rsp), %r8
movl $0x3, %edx
callq 0x28b2
movq $-0x78, %rbx
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0x2642
movq (%r14), %rsi
incq %rsi
callq 0x21c0
addq $-0x28, %r14
addq $0x28, %rbx
jne 0x262e
leaq 0xe0(%rsp), %r14
movq 0xb975(%rip), %r15      # 0xdfd0
movq 0x20(%rsp), %r13
leaq 0x10(%rsp), %rax
xorl %r12d, %r12d
cmpq %rax, %r13
je 0x26d3
leaq 0x20(%r13), %rsi
movq %r14, %rdi
callq 0x3c86
movl %eax, %ebp
testb %al, %al
je 0x26bc
movq 0x28(%r13), %rsi
movq 0x30(%r13), %rdx
movq %r15, %rdi
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
movb $0x1, %r12b
movq %rax, %rdi
callq 0x2120
testb %bpl, %bpl
jne 0x26d3
movq %r13, %rdi
callq 0x2130
movq %rax, %r13
leaq 0x10(%rsp), %rax
jmp 0x2668
testb $0x1, %r12b
jne 0x2814
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x2ea4
movq %rax, %rbp
leaq 0x40(%rsp), %rax
cmpq %rax, %rbp
je 0x283c
movl $0xf, %edx
movq %r15, %rdi
leaq 0x793f(%rip), %rsi      # 0xa049
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 0x3cac
movl $0xf, %edx
movq %r15, %rdi
leaq 0x78f5(%rip), %rsi      # 0xa049
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 0x27fa
movq 0x58(%rbp), %rsi
movq %r15, %rdi
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
movl $0xf, %edx
movq %r15, %rdi
leaq 0x787b(%rip), %rsi      # 0xa049
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 0x38(%rsp), %rdx
callq 0x89dc
testb $0x1, %r12b
je 0x265b
leaq 0x8(%rsp), %rdi
callq 0x29d2
leaq 0x38(%rsp), %rdi
callq 0x2a4a
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x77d3(%rip), %rdi      # 0xa016
leaq 0x77db(%rip), %rsi      # 0xa025
leaq 0x77e1(%rip), %rcx      # 0xa032
movl $0x18, %edx
callq 0x2100
movq %rax, %r14
leaq 0xe0(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x230a
jmp 0x289f
movq %rax, %r14
jmp 0x289f
movq %rax, %r14
cmpq %r15, %rbx
je 0x289f
leaq 0x68(%rsp), %rsi
movq %r15, %rdi
callq 0x22d0
jmp 0x289f
jmp 0x2892
jmp 0x2892
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x29d2
leaq 0x38(%rsp), %rdi
callq 0x2a4a
movq %r14, %rdi
callq 0x22a0
nop