// File: /workspace/github_cpp_makefile_star2_O3/iTruth[P]klotski/klotski_board.cpp
// Function: klotski_board::klotski_board(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int, char)
klotski_board::klotski_board(std::string situation_string, int dx, int dy, const char split):
	dx(dx), dy(dy),
	x_distribution(std::uniform_int_distribution<>(0, dx-1)),
	y_distribution(std::uniform_int_distribution<>(0, dy-1)){
		resize_board_to_fit();
		std::replace(situation_string.begin(), situation_string.end(), split, ' ');
		std::stringstream ss(situation_string);
		for(auto& i: situation){
			for(int& n: i){
				if(ss.eof()){
					std::stringstream ss;
					ss<<"situation is not fit for "<<dx<<"x"<<dy<<" board";
					throw std::runtime_error(ss.str().c_str());
				}
				ss>>n;
				if(ss.fail()){
					throw std::runtime_error("situation is not valid");
				}

			}
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x86d3(%rip), %rax      # 0xecb0
movq %rax, (%rdi)
movl %edx, 0x8(%rdi)
movl %ecx, 0xc(%rdi)
leal -0x1(%r15), %eax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
xorl %ecx, %ecx
movl %ecx, 0x30(%rdi)
movl %eax, 0x34(%rdi)
leal -0x1(%r14), %eax
movl %ecx, 0x38(%rdi)
movl %eax, 0x3c(%rdi)
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x40(%rdi)
callq 0x687e
movq 0x8(%r12), %rax
testq %rax, %rax
je 0x663c
movq (%r12), %rcx
xorl %edx, %edx
cmpb %bpl, (%rcx,%rdx)
jne 0x6634
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x662a
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
movl $0x18, %edx
callq 0x3370
movq 0x18(%rbx), %rbp
movq 0x20(%rbx), %r14
cmpq %r14, %rbp
je 0x66ba
leaq 0x38(%rsp), %r12
movq (%rbp), %r13
movq 0x8(%rbp), %r15
cmpq %r15, %r13
je 0x66b1
movq 0x38(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x58(%rsp,%rax), %eax
testb $0x2, %al
jne 0x6721
movq %r12, %rdi
movq %r13, %rsi
callq 0x3140
movq 0x38(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x58(%rsp,%rax), %eax
testb $0x5, %al
jne 0x66ea
addq $0x4, %r13
cmpq %r15, %r13
jne 0x6684
addq $0x18, %rbp
cmpq %r14, %rbp
jne 0x666a
movq 0x88b7(%rip), %rsi      # 0xef78
leaq 0x38(%rsp), %rdi
callq 0x31c0
leaq 0xb8(%rsp), %rdi
callq 0x3090
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x30f0
movq %rax, %r15
leaq 0x3fac(%rip), %rsi      # 0xa6aa
movq %rax, %rdi
callq 0x30b0
movq 0x88e3(%rip), %rsi      # 0xeff0
movq 0x8884(%rip), %rdx      # 0xef98
movq %r15, %rdi
callq 0x33b0
jmp 0x67d6
leaq 0x1c0(%rsp), %rdi
callq 0x3180
leaq 0x1d0(%rsp), %r12
leaq 0x3f53(%rip), %rsi      # 0xa690
movl $0x19, %edx
movq %r12, %rdi
callq 0x3290
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x33c0
movq %rax, %r15
leaq 0x3baa(%rip), %rsi      # 0xa30b
movl $0x1, %edx
movq %rax, %rdi
callq 0x3290
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x33c0
leaq 0x3a7c(%rip), %rsi      # 0xa1fe
movl $0x6, %edx
movq %rax, %rdi
callq 0x3290
movl $0x10, %edi
callq 0x30f0
movq %rax, %r15
leaq 0x1d8(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x3360
movb $0x1, %bpl
movq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x30b0
xorl %ebp, %ebp
movq 0x8829(%rip), %rsi      # 0xeff0
movq 0x87ca(%rip), %rdx      # 0xef98
movq %r15, %rdi
callq 0x33b0
jmp 0x67d8
movq %rax, %r14
jmp 0x686a
movq %rax, %r14
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x67fe
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3260
testb %bpl, %bpl
jne 0x6808
jmp 0x6815
movq %rax, %r14
movq %r15, %rdi
callq 0x31a0
jmp 0x6815
movq %rax, %r14
movq 0x875c(%rip), %rsi      # 0xef78
leaq 0x1c0(%rsp), %rdi
callq 0x31c0
leaq 0x240(%rsp), %rdi
callq 0x3090
jmp 0x684c
jmp 0x6849
jmp 0x6849
movq %rax, %r14
movq %r15, %rdi
callq 0x31a0
jmp 0x684c
movq %rax, %r14
movq 0x8725(%rip), %rsi      # 0xef78
leaq 0x38(%rsp), %rdi
callq 0x31c0
leaq 0xb8(%rsp), %rdi
callq 0x3090
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x59fa
movq %r14, %rdi
callq 0x33d0