// File: /workspace/github_cpp_makefile_star2_O1/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 0x869b(%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 0x68b2
movq 0x8(%r12), %rax
testq %rax, %rax
je 0x6674
movq (%r12), %rcx
xorl %edx, %edx
cmpb %bpl, (%rcx,%rdx)
jne 0x666c
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x6662
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 0x66ed
leaq 0x38(%rsp), %r12
movq (%rbp), %r13
movq 0x8(%rbp), %r15
cmpq %r15, %r13
je 0x66e4
movq 0x38(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x58(%rsp,%rax)
jne 0x671d
movq %r12, %rdi
movq %r13, %rsi
callq 0x3140
movq 0x38(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x58(%rsp,%rax)
jne 0x67d4
addq $0x4, %r13
jmp 0x66aa
addq $0x18, %rbp
cmpq %r14, %rbp
jne 0x66a2
movq 0x8884(%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
leaq 0x1c0(%rsp), %rdi
callq 0x3180
leaq 0x1d0(%rsp), %r12
leaq 0x3f27(%rip), %rsi      # 0xa660
movl $0x19, %edx
movq %r12, %rdi
callq 0x3290
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x33c0
movq %rax, %r15
leaq 0x3bae(%rip), %rsi      # 0xa30b
movl $0x1, %edx
movq %rax, %rdi
callq 0x3290
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x33c0
leaq 0x3a80(%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 0x882d(%rip), %rsi      # 0xeff0
movq 0x87ce(%rip), %rdx      # 0xef98
movq %r15, %rdi
callq 0x33b0
jmp 0x6806
movl $0x10, %edi
callq 0x30f0
movq %rax, %r15
leaq 0x3e92(%rip), %rsi      # 0xa67a
movq %rax, %rdi
callq 0x30b0
movq 0x87f9(%rip), %rsi      # 0xeff0
movq 0x879a(%rip), %rdx      # 0xef98
movq %r15, %rdi
callq 0x33b0
jmp 0x6808
movq %rax, %r14
jmp 0x689d
movq %rax, %r14
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6836
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x6836
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x6848
movq %r15, %rdi
callq 0x31a0
jmp 0x6848
movq %rax, %r14
movq 0x8729(%rip), %rsi      # 0xef78
leaq 0x1c0(%rsp), %rdi
callq 0x31c0
leaq 0x240(%rsp), %rdi
callq 0x3090
jmp 0x687f
jmp 0x687c
movq %rax, %r14
movq %r15, %rdi
callq 0x31a0
jmp 0x687f
jmp 0x687c
movq %rax, %r14
movq 0x86f2(%rip), %rsi      # 0xef78
leaq 0x38(%rsp), %rdi
callq 0x31c0
leaq 0xb8(%rsp), %rdi
callq 0x3090
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x5a36
movq %r14, %rdi
callq 0x33d0
nop