// File: bestcoder12[P]Sudoku_Game/functions.cpp
// Function: s_brd::Sudoku::chk_num(int, int, int)
int Sudoku::chk_num(int temp_num, int t_row, int t_col)
{
	if (temp_num > 9 || temp_num < 1)
	{
		return -1;
	}
	int i = 0, j = 0;
	
	for (j = 0; j < 9; j++)
	{
		if (temp_num == board[t_row][j].get_Int())
		{
			return -1;
		}
	}
	
	for (i = 0; i < 9; i++)
	{
		if (temp_num == board[i][t_col].get_Int())
		{
			return -1;
		}
	}

	i = t_row - (t_row%3);
	j = t_col - (t_col%3);
	int row_lim = i+3;
	int col_lim = j+3;

	for (i = t_row - (t_row%3); i < row_lim; i++)
	{
		for (j = t_col - (t_col%3); j < col_lim; j++)
		{
			if (temp_num == board[i][j].get_Int())
			{
				return -1;
			}
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x9, -0x14(%rbp)
jg 0x2859
cmpl $0x1, -0x14(%rbp)
jge 0x2865
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x29f9
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x9, -0x24(%rbp)
jge 0x28c7
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movslq -0x18(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rdi
movslq -0x24(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x23a0
movl %eax, %ecx
movl -0x3c(%rbp), %eax
cmpl %ecx, %eax
jne 0x28ba
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x29f9
jmp 0x28bc
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x287a
movl $0x0, -0x20(%rbp)
cmpl $0x9, -0x20(%rbp)
jge 0x291b
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x40(%rbp)
movslq -0x20(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rdi
movslq -0x1c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x23a0
movl %eax, %ecx
movl -0x40(%rbp), %eax
cmpl %ecx, %eax
jne 0x290e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x29f9
jmp 0x2910
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x28ce
movl -0x18(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x18(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl -0x4c(%rbp), %eax
subl %edx, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x1c(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl -0x48(%rbp), %eax
subl %edx, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x2c(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x18(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl -0x44(%rbp), %eax
subl %edx, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x29f2
movl -0x1c(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x1c(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl -0x50(%rbp), %eax
subl %edx, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x29e5
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x54(%rbp)
movslq -0x20(%rbp), %rax
imulq $0x48, %rax, %rax
addq %rax, %rdi
movslq -0x24(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x23a0
movl %eax, %ecx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
jne 0x29d8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x29f9
jmp 0x29da
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2999
jmp 0x29e7
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2978
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)