// File: /workspace/github_cpp_makefile_star2_O3/iTruth[P]klotski/klotski.cpp
// Function: main
int main(int argc, char *argv[])
{
	if(argc == 1){
		print_help();
		return EXIT_FAILURE;
	}

	int dx = 3;
	int dy = 3;
	bool is_play = false;
	bool is_upset = false;
	bool is_already_upset = false;
	int upset_num = 10;
	bool is_edit = false;
	std::string situation_string;
	bool is_search = false;
	bool is_quiet = false;
	bool is_print_board = false;
	bool is_output_to_file = false;
	std::fstream situation_output_file;
	bool is_read_board_from_file = false;
	std::fstream situation_input_file;
	bool is_research = false;

	const char *optstring = "x:y:pu:e::sqbo:f:rh";
	static struct option long_options[] = {
		{"play",		no_argument, NULL, 'p'},
		{"upset",		required_argument, NULL, 'u'},
		{"edit",		optional_argument, NULL, 'e'},
		{"search",		required_argument, NULL, 's'},
		{"quiet",		no_argument, NULL, 'q'},
		{"board",		no_argument, NULL, 'b'},
		{"output",		required_argument, NULL, 'o'},
		{"file",		required_argument, NULL, 'f'},
		{"research",	no_argument, NULL, 'r'},
		{"help",		no_argument, NULL, 'h'},
		{0, 0, 0, 0}};

	int opt;
	int option_index = 0;
	while((opt = getopt_long(argc, argv,
					optstring, long_options, &option_index)) != -1) {
		switch(opt)
		{
			case 'x':
				try{
					dx = std::stoi(optarg);
				}catch(const std::invalid_argument&){
					cout<<"Invalid argument: x"<<endl;
					return EXIT_FAILURE;
				}
				break;

			case 'y':
				try{
					dy = std::stoi(optarg);
				}catch(const std::invalid_argument&){
					cout<<"Invalid argument: y"<<endl;
					return EXIT_FAILURE;
				}
				break;

			case 'p':
				is_play = true;
				break;

			case 'u':
				is_upset = true;
				try{
					upset_num = std::stoi(optarg);
				}catch(const std::invalid_argument&){
					cout<<"Invalid argument: upset number"<<endl;
					return EXIT_FAILURE;
				}
				break;

			case 'e':
				is_edit = true;
				if(optarg != nullptr){
					situation_string = optarg;
				}
				break;

			case 's':
				is_search = true;
				break;

			case 'q':
				is_quiet = true;
				break;

			case 'b':
				is_print_board = true;
				break;

			case 'o':
				is_output_to_file = true;
				situation_output_file.open(optarg, ios::trunc|ios::out);
				if(!situation_output_file.is_open()){
					cout<<"file not found"<<endl;
					return EXIT_FAILURE;
				}
				break;

			case 'f':
				is_read_board_from_file = true;
				situation_input_file.open(optarg, ios::in);
				if(!situation_input_file.is_open()){
					cout<<"file not found"<<endl;
					return EXIT_FAILURE;
				}
				break;

			case 'r':
				is_research = true;
				break;

			case '?':
			case 'h':
			default:
				print_help();
				return EXIT_SUCCESS;
				break;
		}
	}

	if(is_output_to_file && !is_search){
		cout<<"specifying -o must also specify -s"<<endl;
		return EXIT_FAILURE;
	}

	std::shared_ptr<klotski_board> board = nullptr;

	if(is_read_board_from_file){
		if(is_edit){
			cout<<"specifying -f can't also specify -e"<<endl;
			return EXIT_FAILURE;
		}
		try{
			board = std::make_shared<klotski_board>(situation_input_file, dx, dy);
		}catch(const std::runtime_error&){
			cout<<"file is not a valid board file"<<endl;
			return EXIT_FAILURE;
		}
	}

	if(is_edit){
		try{
			if(situation_string.empty()){
				if(!is_quiet){
					cout<<"Enter "<<dx*dy<<" numbers to construct klotski board"<<endl
						<<"Example input(3x3 board): "<<endl
						<<"1 0 6 7 3 8 2 4 5"<<endl<<endl;
					cout<<"Enter: ";
				}
				std::vector<int> situation;
				for(int i=0; i<dx*dy; ++i){
					int n;
					cin>>n;
					situation.push_back(n);
				}
				board = std::make_shared<klotski_board>(situation, dx, dy);
			}else{
				board = std::make_shared<klotski_board>(situation_string, dx, dy);
			}
		}catch(const std::runtime_error& e){
			cout<<e.what()<<endl;
			return EXIT_FAILURE;
		}
	}

	if(is_upset){
		if(board == nullptr){
			board = std::make_shared<klotski_board>(dx, dy);
		}
		board->upset(upset_num);
		is_already_upset = true;
	}

	if(is_search){
		if(board == nullptr){
			board = std::make_shared<klotski_board>(dx, dy);
		}
		search_answer(board, is_quiet, is_print_board, KLOTSKI_OUTPUT_STREAM);
	}

	if(is_play || is_research){
		int x, y;
		if(board == nullptr){
			board = std::make_shared<klotski_board>(dx, dy);
		}
		if(!is_edit && !is_already_upset){
			board->upset(upset_num);
			is_already_upset = true;
		}
		board->print_board(is_print_board);
		string line;
		string hint = "klotski>";
		while(is_research || !board->is_win()){
			cout<<hint;
			getline(cin, line);
			if(line.empty()){
				continue;
			}
			std::stringstream ss(line);
			ss>>x>>y;
			if(board->move_item(x, y)){
				board->print_board(is_print_board);
				continue;
			}
			line = line.substr(0, line.find_last_not_of(' ')+1);
			auto pos = line.find_first_of(' ');
			const std::string cmd_name = line.substr(0, pos==std::string::npos?line.size():pos);
			const std::string cmd_arg = line.substr(cmd_name.size(), line.size()-1);
			if(cmd_name == "quit" || cmd_name == "q"){
				return EXIT_SUCCESS;
			}else if(cmd_name == "reset" || cmd_name == "r"){
				board->reset();
				if(!is_quiet){
					board->print_board(is_print_board);
				}
			}else if(cmd_name == "print" || cmd_name == "p"){
				board->print_board(is_print_board);
			}else if(cmd_name == "search" || cmd_name == "s"){
				search_answer(board, is_quiet, is_print_board, KLOTSKI_OUTPUT_STREAM);
			}else if(cmd_name == "upset" || cmd_name == "u"){
				try{
					board->upset(std::stoi(cmd_arg));
					if(!is_quiet){
						board->print_board(is_print_board);
					}
				}catch(const std::invalid_argument&){
					cout<<"invalid argument"<<endl
						<<"usage: upset N"<<endl<<endl;
				}
			}else{
				system(line.c_str());
			}
		}
		cout<<"You Win!"<<endl;
	}
	return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6e8, %rsp            # imm = 0x6E8
cmpl $0x1, %edi
jne 0x4126
callq 0x369c
movl $0x1, %ebx
jmp 0x4649
movq %rsi, %rbx
movl %edi, %ebp
movl $0x3, %eax
movl %eax, 0xc(%rsp)
movl %eax, 0x8(%rsp)
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x2c8(%rsp), %rdi
callq 0x32a0
leaq 0x4d8(%rsp), %r14
movq %r14, %rdi
callq 0x32a0
leaq 0x2c(%rsp), %r13
movl $0x0, (%r13)
movl $0x80, %ecx
leaq (%r14,%rcx), %rax
movq %rax, 0x110(%rsp)
leaq 0x2c8(%rsp), %rax
addq %rax, %rcx
movq %rcx, 0x118(%rsp)
movl $0xa, %eax
movq %rax, 0x70(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0x5e4d(%rip), %r15      # 0xa004
movq $0x0, 0x10(%rsp)
movq $0x0, 0x80(%rsp)
movq $0x0, 0x78(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x60(%rsp)
xorl %ecx, %ecx
movq %rbx, 0x20(%rsp)
movl %ecx, %r12d
movl %ebp, %edi
movq %rbx, %rsi
leaq 0x60d6(%rip), %rdx      # 0xa2e5
leaq 0xb00a(%rip), %rcx      # 0xf220
movq %r13, %r8
callq 0x33a0
leal -0x62(%rax), %edx
cmpl $0x17, %edx
ja 0x4589
movb $0x1, %cl
movslq (%r15,%rdx,4), %rax
addq %r15, %rax
jmpq *%rax
movb $0x1, %al
movq %rax, 0x78(%rsp)
movl %r12d, %ecx
jmp 0x4200
movb $0x1, %al
movq %rax, 0x68(%rsp)
movl %r12d, %ecx
jmp 0x4200
movq 0xad34(%rip), %rax      # 0xef88
movq (%rax), %rsi
leaq 0x140(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x55cc
movq 0x140(%rsp), %r13
callq 0x3040
movq %rax, %r14
movl (%rax), %ebx
movl $0x0, (%rax)
movq %r13, %rdi
leaq 0x38(%rsp), %rsi
movl $0xa, %edx
callq 0x32f0
cmpq %r13, 0x38(%rsp)
je 0x50e3
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x50d7
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x50d7
testl %ecx, %ecx
leaq 0x2c(%rsp), %r13
jne 0x42d3
movl %ebx, (%r14)
movl %eax, 0x8(%rsp)
jmp 0x4507
movb $0x1, %al
movq %rax, 0x80(%rsp)
movl %r12d, %ecx
jmp 0x4200
movb $0x1, %al
movq %rax, 0x58(%rsp)
movl %r12d, %ecx
jmp 0x4200
movq 0xac84(%rip), %rax      # 0xef88
movq (%rax), %rsi
leaq 0x140(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x55cc
movq 0x140(%rsp), %r13
callq 0x3040
movq %rax, %r14
movl (%rax), %ebx
movl $0x0, (%rax)
movq %r13, %rdi
leaq 0x38(%rsp), %rsi
movl $0xa, %edx
callq 0x32f0
cmpq %r13, 0x38(%rsp)
je 0x50cb
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x50bf
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x50bf
movq %rax, 0x70(%rsp)
testl %ecx, %ecx
leaq 0x2c(%rsp), %r13
jne 0x4388
movl %ebx, (%r14)
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x43ad
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3260
movb $0x1, %al
movq %rax, 0x60(%rsp)
jmp 0x452c
movq 0xabc8(%rip), %rax      # 0xef88
movq (%rax), %r14
movb $0x1, %al
movq %rax, 0x18(%rsp)
movl %r12d, %ecx
testq %r14, %r14
je 0x4200
movq 0xd8(%rsp), %r13
movq %r14, %rdi
callq 0x30d0
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
leaq 0x2c(%rsp), %r13
movq %r14, %rcx
movq %rax, %r8
callq 0x3350
movl %r12d, %ecx
jmp 0x4200
movq 0xab76(%rip), %rax      # 0xef88
movq (%rax), %rsi
leaq 0x2c8(%rsp), %rdi
movl $0x30, %edx
callq 0x3210
movq 0x118(%rsp), %rdi
callq 0x3060
movb $0x1, %cl
movq %rcx, 0x30(%rsp)
jmp 0x446d
movq 0xab44(%rip), %rax      # 0xef88
movq (%rax), %rsi
leaq 0x4d8(%rsp), %rdi
movl $0x8, %edx
callq 0x3210
movq 0x110(%rsp), %rdi
callq 0x3060
movb $0x1, %cl
movq %rcx, 0x10(%rsp)
movl %r12d, %ecx
testb %al, %al
jne 0x4200
jmp 0x4539
movq 0xab04(%rip), %rax      # 0xef88
movq (%rax), %rsi
leaq 0x140(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x55cc
movq 0x140(%rsp), %r13
callq 0x3040
movq %rax, %r14
movl (%rax), %ebx
movl $0x0, (%rax)
movq %r13, %rdi
leaq 0x38(%rsp), %rsi
movl $0xa, %edx
callq 0x32f0
cmpq %r13, 0x38(%rsp)
je 0x50b3
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x50a7
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x50a7
testl %ecx, %ecx
leaq 0x2c(%rsp), %r13
jne 0x4503
movl %ebx, (%r14)
movl %eax, 0xc(%rsp)
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x452c
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3260
movl %r12d, %ecx
movq 0x20(%rsp), %rbx
jmp 0x4200
movl $0xe, %edx
leaq 0x5dfb(%rip), %rsi      # 0xa340
movq 0xaa64(%rip), %rbx      # 0xefb0
movq %rbx, %rdi
callq 0x3290
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xaa3e(%rip), %rdi      # 0xefb0
callq 0x3030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x3160
jmp 0x460a
cmpl $-0x1, %eax
jne 0x4603
testb $0x1, 0x30(%rsp)
je 0x45a0
testb $0x1, 0x68(%rsp)
je 0x46c4
testb $0x1, 0x10(%rsp)
je 0x465d
testb $0x1, 0x18(%rsp)
je 0x46d5
movq 0xa9f3(%rip), %rbx      # 0xefb0
leaq 0x5dae(%rip), %rsi      # 0xa372
movl $0x23, %edx
movq %rbx, %rdi
callq 0x3290
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xa9c1(%rip), %rdi      # 0xefb0
callq 0x3030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x3160
jmp 0x460a
xorl %ebx, %ebx
callq 0x369c
leaq 0x4d8(%rsp), %rdi
callq 0x3050
leaq 0x2c8(%rsp), %rdi
callq 0x3050
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x4649
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3260
movl %ebx, %eax
addq $0x6e8, %rsp            # imm = 0x6E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb $0x1, 0x18(%rsp)
je 0x4738
cmpq $0x0, 0xd8(%rsp)
je 0x48a3
leaq 0x148(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x140(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0xd0(%rsp), %rcx
leaq 0xc(%rsp), %r8
leaq 0x8(%rsp), %r9
callq 0x633a
movq 0x140(%rsp), %r15
movq 0x148(%rsp), %rbx
movb $0x1, %al
movq %rax, 0x18(%rsp)
jmp 0x4722
movl $0x22, %edx
leaq 0x5c7f(%rip), %rsi      # 0xa34f
jmp 0x4545
leaq 0x148(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x140(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0x4d8(%rsp), %rcx
leaq 0xc(%rsp), %r8
leaq 0x8(%rsp), %r9
callq 0x5fb8
movq 0x140(%rsp), %r15
movq 0x148(%rsp), %rbx
movq $0x0, 0x18(%rsp)
testb $0x1, 0x60(%rsp)
je 0x47c8
testq %r15, %r15
jne 0x47bb
jmp 0x474e
testb $0x1, 0x60(%rsp)
je 0x47e1
movq $0x0, 0x18(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x10(%rsp)
leaq 0x148(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x140(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
callq 0x64f4
movq 0x140(%rsp), %r15
movq 0x148(%rsp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x140(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x47bb
callq 0x5614
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
je 0x47bb
callq 0x5614
movq %r15, %rdi
movq 0x70(%rsp), %rsi
callq 0x6b0a
testb $0x1, 0x68(%rsp)
je 0x4a89
movq %rbx, %rax
testq %r15, %r15
jne 0x4872
jmp 0x4805
movq $0x0, 0x18(%rsp)
movl $0x0, %eax
movl $0x0, %ebx
movl $0x0, %r15d
testb $0x1, 0x68(%rsp)
je 0x4a89
movq %rax, 0x10(%rsp)
leaq 0x148(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x140(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
callq 0x64f4
movq 0x140(%rsp), %r15
movq 0x148(%rsp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x140(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4872
callq 0x5614
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
je 0x4872
callq 0x5614
movq %r15, 0x100(%rsp)
movq %rbx, 0x108(%rsp)
testq %rbx, %rbx
je 0x4a42
movq 0xa716(%rip), %rax      # 0xefa8
cmpb $0x0, (%rax)
je 0x4a3e
incl 0x8(%rbx)
jmp 0x4a42
testb $0x1, 0x58(%rsp)
jne 0x4958
movq 0xa6fb(%rip), %rdi      # 0xefb0
leaq 0x5af9(%rip), %rsi      # 0xa3b5
movl $0x6, %edx
callq 0x3290
movl 0x8(%rsp), %esi
imull 0xc(%rsp), %esi
movq 0xa6da(%rip), %rdi      # 0xefb0
callq 0x33c0
movq %rax, %rbx
leaq 0x5ad7(%rip), %rsi      # 0xa3bc
movl $0x23, %edx
movq %rax, %rdi
callq 0x3290
movq %rbx, %rdi
callq 0x30e0
movq %rax, %rbx
leaq 0x5adc(%rip), %rsi      # 0xa3e0
movl $0x1a, %edx
movq %rax, %rdi
callq 0x3290
movq %rbx, %rdi
callq 0x30e0
movq %rax, %rbx
leaq 0x5ad8(%rip), %rsi      # 0xa3fb
movl $0x11, %edx
movq %rax, %rdi
callq 0x3290
movq %rbx, %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x30e0
movq 0xa669(%rip), %rdi      # 0xefb0
leaq 0x5abf(%rip), %rsi      # 0xa40d
movl $0x7, %edx
callq 0x3290
xorps %xmm0, %xmm0
movaps %xmm0, 0x140(%rsp)
movq $0x0, 0x150(%rsp)
movl 0x8(%rsp), %eax
imull 0xc(%rsp), %eax
testl %eax, %eax
jle 0x49dd
xorl %ebp, %ebp
movq 0xa653(%rip), %rbx      # 0xefd8
leaq 0x38(%rsp), %r14
leaq 0x140(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3140
movq 0x148(%rsp), %rsi
cmpq 0x150(%rsp), %rsi
je 0x49c3
movl 0x38(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x148(%rsp)
jmp 0x49ce
movq %r15, %rdi
movq %r14, %rdx
callq 0x60a4
incl %ebp
movl 0x8(%rsp), %eax
imull 0xc(%rsp), %eax
cmpl %eax, %ebp
jl 0x4992
leaq 0x40(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x38(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x140(%rsp), %rcx
leaq 0xc(%rsp), %r8
leaq 0x8(%rsp), %r9
callq 0x61c4
movq 0x38(%rsp), %r15
movq 0x40(%rsp), %rbx
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x4722
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
jmp 0x4722
lock
incl 0x8(%rbx)
testb $0x1, 0x30(%rsp)
jne 0x4a52
movq 0xa560(%rip), %rcx      # 0xefb0
jmp 0x4a5a
leaq 0x2d8(%rsp), %rcx
movzbl 0x58(%rsp), %esi
andl $0x1, %esi
movzbl 0x78(%rsp), %edx
andl $0x1, %edx
leaq 0x100(%rsp), %rdi
callq 0x3d62
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x4a89
callq 0x5614
testb $0x1, %r12b
jne 0x4a9d
testb $0x1, 0x80(%rsp)
je 0x5088
testq %r15, %r15
jne 0x4b0b
leaq 0x148(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x140(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
callq 0x64f4
movq 0x140(%rsp), %r15
movq 0x148(%rsp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x140(%rsp)
testq %rbx, %rbx
je 0x4b08
movq %rbx, %rdi
callq 0x5614
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
je 0x4b08
callq 0x5614
movq %r14, %rbx
movq 0x60(%rsp), %rax
orb 0x18(%rsp), %al
testb $0x1, %al
jne 0x4b25
movq %r15, %rdi
movq 0x70(%rsp), %rsi
callq 0x6b0a
movq (%r15), %rax
movzbl 0x78(%rsp), %esi
andl $0x1, %esi
movq 0xa479(%rip), %r14      # 0xefb0
movq %r15, %rdi
movl %esi, 0x20(%rsp)
movq %r14, %rdx
callq *0x8(%rax)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x58aa(%rip), %rsi      # 0xa415
leaq 0x58ab(%rip), %rdx      # 0xa41d
leaq 0x90(%rsp), %rdi
movq %rbx, 0x10(%rsp)
callq 0x5684
testb $0x1, 0x30(%rsp)
jne 0x4b92
movq %r14, 0x30(%rsp)
jmp 0x4b9f
leaq 0x2d8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xa40a(%rip), %r13      # 0xefb0
movq 0xa42b(%rip), %r12      # 0xefd8
leaq 0x38(%rsp), %rbx
leaq 0x140(%rsp), %r14
leaq 0xb0(%rsp), %rbp
movzbl 0x58(%rsp), %eax
andl $0x1, %eax
movl %eax, 0x18(%rsp)
testb $0x1, 0x80(%rsp)
jne 0x4be8
movq %r15, %rdi
callq 0x739e
testb %al, %al
jne 0x4fff
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %r13, %rdi
callq 0x3290
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x33f0
cmpq $0x0, 0x40(%rsp)
je 0x4bce
movq %r14, %rdi
movq %rbx, %rsi
movl $0x18, %edx
callq 0x3370
movq %r14, %rdi
leaq 0x8c(%rsp), %rsi
callq 0x3140
movq %rax, %rdi
leaq 0x88(%rsp), %rsi
callq 0x3140
movl 0x8c(%rsp), %esi
movl 0x88(%rsp), %edx
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
testb %al, %al
je 0x4ca6
movq (%r15), %rax
movq %r15, %rdi
movl 0x20(%rsp), %esi
movq %r13, %rdx
callq *0x8(%rax)
movq %r14, %rdi
movq 0xa2e9(%rip), %rsi      # 0xef78
callq 0x31c0
leaq 0x1c0(%rsp), %rdi
callq 0x3090
jmp 0x4bce
movq %rbx, %rdi
movl $0x20, %esi
movq $-0x1, %rdx
callq 0x3170
leaq 0x1(%rax), %rcx
movq %rbp, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3280
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32b0
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x4cfb
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x32c0
cmpq $-0x1, %rax
jne 0x4d15
movq 0x40(%rsp), %rax
movq %rbp, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3280
movq 0xb8(%rsp), %rdx
movq 0x40(%rsp), %rcx
decq %rcx
leaq 0x120(%rsp), %rdi
movq %rbx, %rsi
callq 0x3280
movq %rbp, %rdi
leaq 0x56cf(%rip), %rsi      # 0xa41e
callq 0x3080
testl %eax, %eax
je 0x4e3a
movq %rbp, %rdi
leaq 0x56bd(%rip), %rsi      # 0xa423
callq 0x3080
testl %eax, %eax
je 0x4e3a
movq %rbp, %rdi
leaq 0x56a8(%rip), %rsi      # 0xa425
callq 0x3080
testl %eax, %eax
je 0x4eb8
movq %rbp, %rdi
leaq 0x55aa(%rip), %rsi      # 0xa33e
callq 0x3080
testl %eax, %eax
je 0x4eb8
movq %rbp, %rdi
leaq 0x5680(%rip), %rsi      # 0xa42b
callq 0x3080
testl %eax, %eax
je 0x4ee7
movq %rbp, %rdi
leaq 0x54dc(%rip), %rsi      # 0xa29e
callq 0x3080
testl %eax, %eax
je 0x4ee7
movq %rbp, %rdi
leaq 0x53d7(%rip), %rsi      # 0xa1b0
callq 0x3080
testl %eax, %eax
je 0x4eff
movq %rbp, %rdi
leaq 0x5580(%rip), %rsi      # 0xa370
callq 0x3080
testl %eax, %eax
je 0x4eff
movq %rbp, %rdi
leaq 0x5362(%rip), %rsi      # 0xa169
callq 0x3080
testl %eax, %eax
je 0x4f2f
movq %rbp, %rdi
leaq 0x5613(%rip), %rsi      # 0xa431
callq 0x3080
testl %eax, %eax
je 0x4f2f
movb $0x1, %r13b
movq 0x38(%rsp), %rdi
callq 0x31f0
jmp 0x4e3d
xorl %r13d, %r13d
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x4e62
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x4e87
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3260
movq %r14, %rdi
movq 0xa0e7(%rip), %rsi      # 0xef78
callq 0x31c0
leaq 0x1c0(%rsp), %rdi
callq 0x3090
testb %r13b, %r13b
movq 0xa103(%rip), %r13      # 0xefb0
jne 0x4bce
jmp 0x5045
movq %r15, %rdi
callq 0x6a98
movb $0x1, %r13b
testb $0x1, 0x58(%rsp)
jne 0x4e3d
movq (%r15), %rax
movq %r15, %rdi
movl 0x20(%rsp), %esi
movq 0xa0d1(%rip), %rdx      # 0xefb0
callq *0x8(%rax)
jmp 0x4e3d
movq (%r15), %rax
movq %r15, %rdi
movl 0x20(%rsp), %esi
movq %r13, %rdx
callq *0x8(%rax)
movb $0x1, %r13b
jmp 0x4e3d
movq %r15, 0xf0(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0xf8(%rsp)
testq %rax, %rax
je 0x4f5b
movq 0xa088(%rip), %rax      # 0xefa8
cmpb $0x0, (%rax)
je 0x4f52
movq 0x10(%rsp), %rax
incl 0x8(%rax)
jmp 0x4f5b
leaq 0x120(%rsp), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x553a
movq %r15, %rdi
movl %eax, %esi
callq 0x6b0a
jmp 0x4ec0
movq 0x10(%rsp), %rax
lock
incl 0x8(%rax)
leaq 0xf0(%rsp), %rdi
movl 0x18(%rsp), %esi
movl 0x20(%rsp), %edx
movq 0x30(%rsp), %rcx
callq 0x3d62
movq 0xf8(%rsp), %rdi
movb $0x1, %r13b
testq %rdi, %rdi
je 0x4e3d
callq 0x5614
jmp 0x4e3d
movq %rax, %r13
cmpl $0x1, %edx
jne 0x5131
movq %r13, %rdi
callq 0x30c0
movl $0x10, %edx
movq 0x9ffd(%rip), %rdi      # 0xefb0
leaq 0x5479(%rip), %rsi      # 0xa433
callq 0x3290
movq 0x9fea(%rip), %rdi      # 0xefb0
callq 0x30e0
movq %rax, %r13
movl $0xe, %edx
movq %rax, %rdi
leaq 0x5467(%rip), %rsi      # 0xa444
callq 0x3290
movq %r13, %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x30e0
movb $0x1, %r13b
callq 0x3390
jmp 0x4e3d
movq 0x9faa(%rip), %rbx      # 0xefb0
leaq 0x5446(%rip), %rsi      # 0xa453
movl $0x8, %edx
movq %rbx, %rdi
callq 0x3290
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x9f78(%rip), %rdi      # 0xefb0
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x506a
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x508d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x508d
movq %rbx, 0x10(%rsp)
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x460a
callq 0x5614
jmp 0x460a
leaq 0x53ae(%rip), %rdi      # 0xa45c
callq 0x3310
leaq 0x53a2(%rip), %rdi      # 0xa45c
callq 0x3130
leaq 0x5396(%rip), %rdi      # 0xa45c
callq 0x3310
leaq 0x538a(%rip), %rdi      # 0xa45c
callq 0x3130
leaq 0x537e(%rip), %rdi      # 0xa45c
callq 0x3310
leaq 0x5372(%rip), %rdi      # 0xa45c
callq 0x3130
jmp 0x50fb
movq %rax, %r13
callq 0x3390
jmp 0x5131
movq %rax, %r13
jmp 0x5131
jmp 0x51f1
jmp 0x51d7
jmp 0x5114
movq %rax, %r13
jmp 0x51cd
movq %rax, %r13
jmp 0x5336
movq %rax, %r13
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x5131
callq 0x5614
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x526b
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x526b
movq %rax, %r13
cmpl $0x2, %edx
jne 0x54f3
movq %r13, %rdi
callq 0x30c0
movq 0x9e36(%rip), %rdi      # 0xefb0
leaq 0x5215(%rip), %rsi      # 0xa396
movl $0x1e, %edx
callq 0x3290
movq 0x9e1e(%rip), %rdi      # 0xefb0
callq 0x30e0
movl $0x1, %ebx
callq 0x3390
jmp 0x460a
jmp 0x54f0
movq %rax, %r13
callq 0x3390
jmp 0x54f3
movq %rax, %r13
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x51cd
callq 0x5614
movq %rbx, 0x10(%rsp)
jmp 0x5336
movq %rdx, %rbx
movq %rax, %r13
jmp 0x5214
movq %rax, %r13
jmp 0x531a
jmp 0x54f0
jmp 0x52f2
movq %rdx, %rbx
movq %rax, %r13
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x5214
movq 0x150(%rsp), %rsi
subq %rdi, %rsi
callq 0x3260
cmpl $0x2, %ebx
jne 0x54f3
movq %r13, %rdi
callq 0x30c0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0x9d7b(%rip), %rdi      # 0xefb0
movq %rax, %rsi
callq 0x3240
movq %rax, %rdi
callq 0x30e0
movl $0x1, %ebx
callq 0x3390
jmp 0x460a
jmp 0x54f0
movq %rax, %r13
callq 0x3390
jmp 0x54f3
jmp 0x52ab
movq %rax, %r13
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x52ae
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x52ae
jmp 0x52ab
movq %rax, %r13
jmp 0x5500
movq %rax, %r13
jmp 0x550d
jmp 0x52f2
jmp 0x54f0
movq %rax, %r13
movq 0x9cc3(%rip), %rsi      # 0xef78
leaq 0x140(%rsp), %rdi
callq 0x31c0
leaq 0x1c0(%rsp), %rdi
callq 0x3090
jmp 0x52f5
movq %rdx, %r15
movq %rax, %r13
jmp 0x5385
movq %rdx, %r15
movq %rax, %r13
jmp 0x5410
movq %rdx, %r15
movq %rax, %r13
jmp 0x549b
movq %rax, %r13
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x531a
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x5336
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3260
cmpq $0x0, 0x10(%rsp)
je 0x54f3
movq 0x10(%rsp), %rdi
callq 0x5614
jmp 0x54f3
movq %rdx, %r15
movq %rax, %r13
cmpl $0x0, (%r14)
jne 0x5360
movl %ebx, (%r14)
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x5385
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3260
cmpl $0x1, %r15d
jne 0x54f3
movq %r13, %rdi
callq 0x30c0
movq 0x9c12(%rip), %rdi      # 0xefb0
leaq 0x4f68(%rip), %rsi      # 0xa30d
movl $0x13, %edx
callq 0x3290
movq 0x9bfa(%rip), %rdi      # 0xefb0
callq 0x30e0
movl $0x1, %ebx
callq 0x3390
jmp 0x460a
jmp 0x54f0
movq %rax, %r13
callq 0x3390
jmp 0x54f3
movq %rdx, %r15
movq %rax, %r13
cmpl $0x0, (%r14)
jne 0x53eb
movl %ebx, (%r14)
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x5410
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3260
cmpl $0x1, %r15d
jne 0x54f3
movq %r13, %rdi
callq 0x30c0
movq 0x9b87(%rip), %rdi      # 0xefb0
leaq 0x4ef1(%rip), %rsi      # 0xa321
movl $0x1e, %edx
callq 0x3290
movq 0x9b6f(%rip), %rdi      # 0xefb0
callq 0x30e0
movl $0x1, %ebx
callq 0x3390
jmp 0x460a
jmp 0x54f0
movq %rax, %r13
callq 0x3390
jmp 0x54f3
movq %rdx, %r15
movq %rax, %r13
cmpl $0x0, (%r14)
jne 0x5476
movl %ebx, (%r14)
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x549b
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3260
cmpl $0x1, %r15d
jne 0x54f3
movq %r13, %rdi
callq 0x30c0
movq 0x9b00(%rip), %rdi      # 0xefb0
leaq 0x4e42(%rip), %rsi      # 0xa2f9
movl $0x13, %edx
callq 0x3290
movq 0x9ae8(%rip), %rdi      # 0xefb0
callq 0x30e0
movl $0x1, %ebx
callq 0x3390
jmp 0x460a
jmp 0x54f0
movq %rax, %r13
callq 0x3390
jmp 0x54f3
movq %rax, %rdi
callq 0x5609
movq %rax, %r13
leaq 0x4d8(%rsp), %rdi
callq 0x3050
leaq 0x2c8(%rsp), %rdi
callq 0x3050
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x5532
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3260
movq %r13, %rdi
callq 0x33d0