// File: bestcoder12[P]Sudoku_Game/functions.cpp
// Function: s_brd::Sudoku::Sudoku()
Sudoku::Sudoku() 
{
	/*
	 * Taking a string input for difficulty of the board so as 
	 * to enhance the readablity of the code and to remember 
	 * what value corresponds to which difficulty 
	 */
	
    string Difficulty; 
      
	cout << "Choose the difficulty from one of the below options: " << "\n";
	cout << "\n\tEasy\n";
	cout << "\tMedium\n";
	cout << "\tHard" << "\n";
	cout << "\n" << "\n";
	cout << "Your choice: ";		
	getline(cin,Difficulty); 
		
	
    if(Difficulty.compare("Easy") == 0) 
	{			
		filled = 30; 
	}
	else if(Difficulty.compare("Medium") == 0)
	{ 
		
		filled = 25; 
	}
	else if(Difficulty.compare("Hard") == 0)
	{
		
		filled = 20;  
	}
	else
	{
		cout << "Invalid option selected, defaulting to Easy..." << "\n";
		filled = 30;
	}

	/*
	 * Initializing the board with valid values
	 * that is initializing every element or cells of the board
	 * so as to have a solved board at the beginning from which 
	 * cells of required amount are unfilled.
	 */

	srand(time(0));
	
	/* Random numbers to be put in 1st row */
	int rand_nums[9];
	
	for (int o = 0; o < 9; o++)
	{
		rand_nums[o] = o+1; 
	}
	random_shuffle(rand_nums,rand_nums+9,mix_numbers);

	for (int i = 0; i < 9; i++)
	{
		
		board[0][i].set_Val(rand_nums[i],false);
	}
	
	for (int j = 1; j < 9; j++)
	{
		if (j%3 == 0)
		{
			shift_one(board,j);
		}
		else
		{
			shift_three(board,j);
		}
	}

	/* Copying solution board to sol_board */
	for (int k = 0; k < 9; k++)
	{
		for (int l = 0; l < 9; l++)
		{
			sol_board[k][l] = board[k][l];
		}
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2150
movq 0x5aae(%rip), %rdi      # 0x7fc8
leaq 0x2b07(%rip), %rsi      # 0x5028
callq 0x2100
movq %rax, -0x80(%rbp)
jmp 0x252c
movq -0x80(%rbp), %rdi
leaq 0x2ea7(%rip), %rsi      # 0x53de
callq 0x2100
jmp 0x253e
movq 0x5a83(%rip), %rdi      # 0x7fc8
leaq 0x2b12(%rip), %rsi      # 0x505e
callq 0x2100
jmp 0x2553
movq 0x5a6e(%rip), %rdi      # 0x7fc8
leaq 0x2b05(%rip), %rsi      # 0x5066
callq 0x2100
jmp 0x2568
movq 0x5a59(%rip), %rdi      # 0x7fc8
leaq 0x2af9(%rip), %rsi      # 0x506f
callq 0x2100
movq %rax, -0x90(%rbp)
jmp 0x2584
movq -0x90(%rbp), %rdi
leaq 0x2e4c(%rip), %rsi      # 0x53de
callq 0x2100
jmp 0x2599
movq 0x5a28(%rip), %rdi      # 0x7fc8
leaq 0x2e37(%rip), %rsi      # 0x53de
callq 0x2100
movq %rax, -0x98(%rbp)
jmp 0x25b5
movq -0x98(%rbp), %rdi
leaq 0x2e1b(%rip), %rsi      # 0x53de
callq 0x2100
jmp 0x25ca
movq 0x59f7(%rip), %rdi      # 0x7fc8
leaq 0x2a9d(%rip), %rsi      # 0x5075
callq 0x2100
jmp 0x25df
movq 0x59f2(%rip), %rdi      # 0x7fd8
leaq -0x28(%rbp), %rsi
callq 0x2040
jmp 0x25f1
leaq -0x28(%rbp), %rdi
leaq 0x2a87(%rip), %rsi      # 0x5083
callq 0x2060
cmpl $0x0, %eax
jne 0x2636
movq -0x88(%rbp), %rax
movl $0x1e, 0x288(%rax)
jmp 0x26cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2090
jmp 0x281b
leaq -0x28(%rbp), %rdi
leaq 0x2a47(%rip), %rsi      # 0x5088
callq 0x2060
cmpl $0x0, %eax
jne 0x265e
movq -0x88(%rbp), %rax
movl $0x19, 0x288(%rax)
jmp 0x26ca
leaq -0x28(%rbp), %rdi
leaq 0x2a07(%rip), %rsi      # 0x5070
callq 0x2060
cmpl $0x0, %eax
jne 0x2686
movq -0x88(%rbp), %rax
movl $0x14, 0x288(%rax)
jmp 0x26c8
movq 0x593b(%rip), %rdi      # 0x7fc8
leaq 0x29fb(%rip), %rsi      # 0x508f
callq 0x2100
movq %rax, -0xa0(%rbp)
jmp 0x26a2
movq -0xa0(%rbp), %rdi
leaq 0x2d2e(%rip), %rsi      # 0x53de
callq 0x2100
jmp 0x26b7
movq -0x88(%rbp), %rax
movl $0x1e, 0x288(%rax)
jmp 0x26ca
jmp 0x26cc
xorl %eax, %eax
movl %eax, %edi
callq 0x20e0
movl %eax, %edi
callq 0x20f0
movl $0x0, -0x64(%rbp)
cmpl $0x9, -0x64(%rbp)
jge 0x2702
movl -0x64(%rbp), %ecx
addl $0x1, %ecx
movslq -0x64(%rbp), %rax
movl %ecx, -0x60(%rbp,%rax,4)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x26e3
leaq -0x3c(%rbp), %rsi
leaq -0x33d(%rip), %rdx      # 0x23d0
leaq -0x60(%rbp), %rdi
callq 0x3590
jmp 0x2718
movl $0x0, -0x68(%rbp)
cmpl $0x9, -0x68(%rbp)
jge 0x2751
movq -0x88(%rbp), %rdi
movslq -0x68(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movslq -0x68(%rbp), %rax
movl -0x60(%rbp,%rax,4), %esi
xorl %edx, %edx
callq 0x2370
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x271f
movl $0x1, -0x6c(%rbp)
cmpl $0x9, -0x6c(%rbp)
jge 0x279b
movl -0x6c(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x277f
movq -0x88(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x2470
jmp 0x278e
movq -0x88(%rbp), %rdi
movl -0x6c(%rbp), %esi
callq 0x23f0
jmp 0x2790
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x2758
movl $0x0, -0x70(%rbp)
cmpl $0x9, -0x70(%rbp)
jge 0x2809
movl $0x0, -0x74(%rbp)
cmpl $0x9, -0x74(%rbp)
jge 0x27fc
movq -0x88(%rbp), %rax
movslq -0x70(%rbp), %rcx
imulq $0x48, %rcx, %rcx
movq %rax, %rdx
addq %rcx, %rdx
movslq -0x74(%rbp), %rsi
addq $0x28c, %rax            # imm = 0x28C
movslq -0x70(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movslq -0x74(%rbp), %rcx
movl (%rdx,%rsi,8), %edi
movl %edi, (%rax,%rcx,8)
movb 0x4(%rdx,%rsi,8), %dl
movb %dl, 0x4(%rax,%rcx,8)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x27af
jmp 0x27fe
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x27a2
leaq -0x28(%rbp), %rdi
callq 0x2090
addq $0xa0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x21a0
nopw %cs:(%rax,%rax)