// File: tyhsu[P]Ewn/game.cpp
// Function: Game::set_board(char (*) [5], int)
void Game::set_board(char board_[5][5], int is_switch_)
{
	int chs_num_A_ = 0, chs_num_B_ = 0;
	int exist_bitwise_A_ = 0, exist_bitwise_B_ = 0;
	for (int i=0; i<6; i++) {
		this->chs_list_A[i].assign(0, false, 0, 0);
		this->chs_list_B[i].assign(0, false, 4, 4);
	}

	for (int i=0; i<5; i++) {
		for (int j=0; j<5; j++) {
			char c = board_[j][i];

			//Set the board
			this->board[i][j] = c;

			//Update other information
			if (c>='1' && c<='6') {
				chs_num_A_++;
				this->chs_list_A[c-'1'].assign(c, true, i, j);
				exist_bitwise_A_ |= 1 << (c-'1');
			}
			else if (c>='A' && c<='f') {
				chs_num_B_++;
				this->chs_list_B[c-'A'].assign(c, true, i, j);
				exist_bitwise_B_ |= 1 << (c-'A');
			}
		}
	}
	this->exist_chs_num_A = chs_num_A_;
	this->exist_chs_num_B = chs_num_B_;
	this->exist_bitwise_A = exist_bitwise_A_;
	this->exist_bitwise_B = exist_bitwise_B_;

	if (is_switch_) {
		this->cur_chs_list_ptr = this->chs_list_B;
		this->cur_exist_bitwise_ptr = this->exist_bitwise_B;
		this->is_switch = true;
	}
	else {
		this->cur_chs_list_ptr = this->chs_list_A;
		this->cur_exist_bitwise_ptr = this->exist_bitwise_A;
		this->is_switch = false;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x6, -0x28(%rbp)
jge 0xa9c5
movq -0x58(%rbp), %rdi
addq $0x3c, %rdi
movslq -0x28(%rbp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movb $0x0, -0x29(%rbp)
movb $0x0, -0x2a(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
leaq -0x29(%rbp), %rsi
leaq -0x2a(%rbp), %rdx
leaq -0x30(%rbp), %rcx
leaq -0x34(%rbp), %r8
callq 0xa110
movq -0x58(%rbp), %rdi
addq $0x84, %rdi
movslq -0x28(%rbp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movb $0x0, -0x35(%rbp)
movb $0x0, -0x36(%rbp)
movl $0x4, -0x3c(%rbp)
movl $0x4, -0x40(%rbp)
leaq -0x35(%rbp), %rsi
leaq -0x36(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
leaq -0x40(%rbp), %r8
callq 0xa110
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xa92e
movl $0x0, -0x44(%rbp)
cmpl $0x5, -0x44(%rbp)
jge 0xab00
movl $0x0, -0x48(%rbp)
cmpl $0x5, -0x48(%rbp)
jge 0xaaf0
movq -0x58(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x48(%rbp), %rdx
imulq $0x5, %rdx, %rdx
addq %rdx, %rcx
movslq -0x44(%rbp), %rdx
movb (%rcx,%rdx), %cl
movb %cl, -0x49(%rbp)
movb -0x49(%rbp), %dl
movslq -0x44(%rbp), %rcx
imulq $0x5, %rcx, %rcx
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
movb %dl, (%rax,%rcx)
movsbl -0x49(%rbp), %eax
cmpl $0x31, %eax
jl 0xaa7b
movsbl -0x49(%rbp), %eax
cmpl $0x36, %eax
jg 0xaa7b
movq -0x58(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
addq $0x3c, %rdi
movsbl -0x49(%rbp), %eax
subl $0x31, %eax
cltq
imulq $0xc, %rax, %rax
addq %rax, %rdi
movb $0x1, -0x4a(%rbp)
leaq -0x49(%rbp), %rsi
leaq -0x4a(%rbp), %rdx
leaq -0x44(%rbp), %rcx
leaq -0x48(%rbp), %r8
callq 0xa110
movsbl -0x49(%rbp), %ecx
subl $0x31, %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0xaae0
movsbl -0x49(%rbp), %eax
cmpl $0x41, %eax
jl 0xaade
movsbl -0x49(%rbp), %eax
cmpl $0x66, %eax
jg 0xaade
movq -0x58(%rbp), %rdi
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
addq $0x84, %rdi
movsbl -0x49(%rbp), %eax
subl $0x41, %eax
cltq
imulq $0xc, %rax, %rax
addq %rax, %rdi
movb $0x1, -0x4b(%rbp)
leaq -0x49(%rbp), %rsi
leaq -0x4b(%rbp), %rdx
leaq -0x44(%rbp), %rcx
leaq -0x48(%rbp), %r8
callq 0xa110
movsbl -0x49(%rbp), %ecx
subl $0x41, %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0xaae0
jmp 0xaae2
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xa9dd
jmp 0xaaf2
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xa9cc
movq -0x58(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, 0x34(%rax)
movl -0x1c(%rbp), %ecx
movl %ecx, 0x38(%rax)
movl -0x20(%rbp), %ecx
movl %ecx, 0xd8(%rax)
movl -0x24(%rbp), %ecx
movl %ecx, 0xdc(%rax)
cmpl $0x0, -0x14(%rbp)
je 0xab52
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x84, %rcx
movq %rcx, 0xd0(%rax)
movl 0xdc(%rax), %ecx
movl %ecx, 0xe0(%rax)
movb $0x1, 0xe4(%rax)
jmp 0xab77
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $0x3c, %rcx
movq %rcx, 0xd0(%rax)
movl 0xd8(%rax), %ecx
movl %ecx, 0xe0(%rax)
movb $0x0, 0xe4(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)