// File: /workspace/github_cpp_makefile_star2_O1/iTruth[P]klotski/klotski.cpp
// Function: search_answer(std::shared_ptr<klotski_board>, bool, bool, std::ostream&)
void search_answer(std::shared_ptr<klotski_board> board, bool is_quiet, bool is_print_board, std::ostream& os = std::cout){
	if(board == nullptr){
		throw std::logic_error("board not init");
	}
	if(!is_quiet){
		board->print_board(is_print_board);
	}
	auto s = std::make_shared<klotski_search>(board);
	if(!is_quiet){
		std::cout<<"searching..."<<std::endl;
	}
	if(s->start_search()){
		const auto& route = s->get_last_route();
		if(!is_quiet){
			std::cout<<"answer found!"<<std::endl;
			os<<"steps = "<<route.size() - 1<<std::endl<<std::endl;
		}
		int step = 0;
		for(const auto& i: route){
			os<<"step "<<step++<<": "<<std::endl;
			klotski_board::print_board(i, board->get_dx(), board->get_dy(), is_print_board, os);
			os<<std::endl;
		}
	}else{
		os<<"No solution"<<std::endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, 0x10(%rsp)
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x40a4
movq %rcx, %rbx
movl %edx, %r13d
movl %esi, %ebp
testb %bpl, %bpl
je 0x3db1
leaq 0x20(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x18(%rsp), %rsi
leaq 0xf(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq 0x5748
jmp 0x3e25
movq (%rdi), %rax
movzbl %r13b, %esi
movq 0xb1f1(%rip), %r14      # 0xefb0
movq %r14, %rdx
callq *0x8(%rax)
leaq 0x20(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x18(%rsp), %rsi
leaq 0xf(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq 0x5748
leaq 0x64c2(%rip), %rsi      # 0xa2af
movl $0xc, %edx
movq %r14, %rdi
callq 0x3290
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xb198(%rip), %rdi      # 0xefb0
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq 0x18(%rsp), %rdi
movq (%rdi), %rax
callq *(%rax)
testb %al, %al
je 0x404b
movq 0x18(%rsp), %r12
testb %bpl, %bpl
jne 0x3f54
movq 0xb164(%rip), %r14      # 0xefb0
leaq 0x6469(%rip), %rsi      # 0xa2bc
movl $0xd, %edx
movq %r14, %rdi
callq 0x3290
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0xb132(%rip), %rdi      # 0xefb0
callq 0x3030
movq %rax, %rdi
callq 0x3160
leaq 0x6438(%rip), %rsi      # 0xa2ca
movl $0x8, %edx
movq %rbx, %rdi
callq 0x3290
movq 0x68(%r12), %rax
movq %rax, %rcx
subq 0x48(%r12), %rcx
sarq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
leaq (%rcx,%rcx,4), %rax
leaq (%rcx,%rax,4), %rax
movq 0x40(%r12), %rcx
movq 0x50(%r12), %rdx
subq 0x58(%r12), %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
subq 0x30(%r12), %rcx
sarq $0x3, %rcx
imulq %rsi, %rcx
addq %rax, %rdx
leaq (%rcx,%rdx), %rsi
decq %rsi
movq %rbx, %rdi
callq 0x3150
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq 0x30(%r12), %r15
movq 0x50(%r12), %rax
movq %rax, 0x30(%rsp)
cmpq %rax, %r15
je 0x4086
movq 0x40(%r12), %r14
movq 0x48(%r12), %rbp
xorl %r12d, %r12d
movzbl %r13b, %eax
movl %eax, 0x2c(%rsp)
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x6343(%rip), %rsi      # 0xa2d3
callq 0x3290
movq %rbx, %rdi
movl %r12d, %esi
callq 0x33c0
movq %rax, %r13
movl $0x2, %edx
movq %rax, %rdi
leaq 0x6446(%rip), %rsi      # 0xa3f8
callq 0x3290
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
movq %r15, %rdi
movl 0x2c(%rsp), %ecx
movq %rbx, %r8
callq 0x6c18
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
addq $0x18, %r15
cmpq %r14, %r15
jne 0x403b
movq 0x8(%rbp), %r15
addq $0x8, %rbp
leaq 0x1f8(%r15), %r14
incl %r12d
cmpq 0x30(%rsp), %r15
jne 0x3f81
jmp 0x4086
leaq 0x6287(%rip), %rsi      # 0xa2d9
movl $0xb, %edx
movq %rbx, %rdi
callq 0x3290
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x4095
callq 0x5648
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x30f0
movq %rax, %r14
leaq 0x61e8(%rip), %rsi      # 0xa2a0
movq %rax, %rdi
callq 0x3300
movq 0xaf01(%rip), %rsi      # 0xefc8
movq 0xaed2(%rip), %rdx      # 0xefa0
movq %r14, %rdi
callq 0x33b0
movq %rax, %rbx
movq %r14, %rdi
callq 0x31a0
jmp 0x40f9
jmp 0x40e7
jmp 0x40e7
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x40f9
callq 0x5648
movq %rbx, %rdi
callq 0x33d0