// File: /workspace/github_cpp_makefile_star2_O2/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 %ecx, %r14d
movq %rsi, %r12
movq %rdi, %rbx
movb %r8b, 0x7(%rsp)
leaq 0x9f3c(%rip), %rax      # 0xfcb0
movq %rax, (%rdi)
movl %edx, 0x8(%rdi)
movl %ecx, 0xc(%rdi)
movq %rdx, 0x10(%rsp)
leal -0x1(%rdx), %eax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
andl $0x0, 0x30(%rdi)
movl %eax, 0x34(%rdi)
andl $0x0, 0x38(%rdi)
leal -0x1(%r14), %eax
movl %eax, 0x3c(%rdi)
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0x40(%rdi)
callq 0x5f9a
movq %r14, 0x8(%rsp)
movq (%r12), %rdi
movq 0x8(%r12), %rsi
addq %rdi, %rsi
leaq 0x38(%rsp), %rcx
movb $0x20, (%rcx)
leaq 0x7(%rsp), %rdx
callq 0x6dc8
leaq 0x38(%rsp), %rdi
pushq $0x18
popq %rdx
movq %r12, %rsi
callq 0x3360
movq 0x18(%rbx), %rbp
movq 0x20(%rbx), %r14
leaq 0x38(%rsp), %r12
cmpq %r14, %rbp
je 0x5e3e
movq (%rbp), %r13
movq 0x8(%rbp), %r15
cmpq %r15, %r13
je 0x5e38
movq 0x38(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x58(%rsp,%rax)
jne 0x5e8f
movq %r12, %rdi
movq %r13, %rsi
callq 0x3150
movq 0x38(%rsp), %rax
movq -0x18(%rax), %rax
addq $0x4, %r13
testb $0x5, 0x58(%rsp,%rax)
je 0x5e02
jmp 0x5e5a
addq $0x18, %rbp
jmp 0x5df5
leaq 0x38(%rsp), %rdi
callq 0x31c0
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x3100
movq %rax, %r15
leaq 0x480e(%rip), %rsi      # 0xa67a
movq %rax, %rdi
callq 0x30a0
movq 0xa175(%rip), %rsi      # 0xfff0
movq 0xa10e(%rip), %rdx      # 0xff90
movq %r15, %rdi
callq 0x33a0
jmp 0x5f2d
leaq 0x1c0(%rsp), %rdi
callq 0x3180
leaq 0x1d0(%rsp), %rdi
leaq 0x47b5(%rip), %rsi      # 0xa660
callq 0x3240
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x33b0
leaq 0x4447(%rip), %rsi      # 0xa30b
movq %rax, %rdi
callq 0x3240
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x33b0
leaq 0x431e(%rip), %rsi      # 0xa1fe
movq %rax, %rdi
callq 0x3240
pushq $0x10
popq %rdi
callq 0x3100
movq %rax, %r15
leaq 0x1d8(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x3350
movb $0x1, %bpl
movq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x30a0
xorl %ebp, %ebp
movq 0xa0d2(%rip), %rsi      # 0xfff0
movq 0xa06b(%rip), %rdx      # 0xff90
movq %r15, %rdi
callq 0x33a0
jmp 0x5f2f
movq %rax, %r14
jmp 0x5f85
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x30e0
testb %bpl, %bpl
jne 0x5f4b
jmp 0x5f58
movq %rax, %r14
movq %r15, %rdi
callq 0x31a0
jmp 0x5f58
movq %rax, %r14
leaq 0x1c0(%rsp), %rdi
callq 0x31c0
jmp 0x5f7b
jmp 0x5f78
jmp 0x5f78
movq %rax, %r14
movq %r15, %rdi
callq 0x31a0
jmp 0x5f7b
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x31c0
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x4f26
movq %r14, %rdi
callq 0x33c0
nop