#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#define NS_PER_SEC (1000*1000*1000)
using namespace std;

int base[3][4];
int base7[3][7];
int tranposeBase7[7][3];
int base8[3][8];
int tranposeBase8[8][3];
int base11[3][11];
int base12[3][12];
int base13[3][13];
int base14[3][14];
int board7[7][7];
int board8[8][8];

inline unsigned long int monotonicTime(void)
{
  //const unsigned long int NS_PER_SEC = 1000 * 1000 * 1000;
  struct timespec now;
  clock_gettime(CLOCK_MONOTONIC, &now);
  return now.tv_sec * NS_PER_SEC + now.tv_nsec;
}

void loadData()
{
 //base 3*4
	base[0][0]=1;
	base[0][1]=4;
	base[0][2]=7;
	base[0][3]=10;
	base[1][0]=8;
	base[1][1]=11;
	base[1][2]=2;
	base[1][3]=5;
	base[2][0]=3;
	base[2][1]=6;
	base[2][2]=9;
	base[2][3]=12;

    //base 3*7
    	base7[0][0]=1;
	base7[0][1]=14;
	base7[0][2]=17;
	base7[0][3]=20;
	base7[0][4]=9;
	base7[0][5]=4;
	base7[0][6]=7;
	base7[1][0]=16;
	base7[1][1]=19;
	base7[1][2]=12;
	base7[1][3]=3;
	base7[1][4]=6;
	base7[1][5]=21;
	base7[1][6]=10;
	base7[2][0]=13;
	base7[2][1]=2;
	base7[2][2]=15;
	base7[2][3]=18;
	base7[2][4]=11;
	base7[2][5]=8;
	base7[2][6]=5;
    //Tranpose base 7
	for(int x = 0; x < 3; x++)
	  {
		for(int y = 0; y < 7 ; y++)
		{
		    	tranposeBase7[y][x] = base7[x][y];                
	    	}
	  }
    //base 3*8
    	base8[0][0]=1;
	base8[0][1]=16;
	base8[0][2]=3;
	base8[0][3]=22;
	base8[0][4]=19;
	base8[0][5]=12;
	base8[0][6]=7;
	base8[0][7]=10;
	base8[1][0]=4;
	base8[1][1]=21;
	base8[1][2]=18;
	base8[1][3]=15;
	base8[1][4]=6;
	base8[1][5]=9;
	base8[1][6]=24;
	base8[1][7]=13;
	base8[2][0]=17;
	base8[2][1]=2;
	base8[2][2]=5;
	base8[2][3]=20;
	base8[2][4]=23;
	base8[2][5]=14;
	base8[2][6]=11;
	base8[2][7]=8;
    //Tranpose base 8
	for(int x = 0; x < 3; x++)
	  {
		for(int y = 0; y < 8 ; y++)
		{
		    	tranposeBase8[y][x] = base8[x][y];                
	    	}
	  }	
	
    //base 3*11
    for(int x = 0; x < 3; x++)
    {
        for(int y = 0; y < 11 ; y++)
        {
            if(y < 4)
            	base11[x][y] = base[x][y];            
            else
            	base11[x][y] = base7[x][y-4]+3*4;     
    	}// end of inner loop
    }
    //base 3*12
    for(int x = 0; x < 3; x++)
    {
        for(int y =0; y<12; y++)
        {
            if(y<4)
            base12[x][y] = base[x][y];
            else
            base12[x][y] = base8[x][y-4]+3*4;
	}
    }
    //board 3*13
    	base13[0][0]=1;
	base13[0][1]=4;
	base13[0][2]=13;
	base13[0][3]=16;
	base13[0][4]=21;
	base13[0][5]=8;
	base13[0][6]=23;
	base13[0][7]=18;
	base13[0][8]=35;
	base13[0][9]=38;
	base13[0][10]=27;
	base13[0][11]=32;
	base13[0][12]=29;
	base13[1][0]=12;
	base13[1][1]=15;
	base13[1][2]=6;
	base13[1][3]=3;
	base13[1][4]=10;
	base13[1][5]=17;
	base13[1][6]=20;
	base13[1][7]=37;
	base13[1][8]=24;
	base13[1][9]=33;
	base13[1][10]=30;
	base13[1][11]=39;
	base13[1][12]=26;
	base13[2][0]=5;
	base13[2][1]=2;
	base13[2][2]=11;
	base13[2][3]=14;
	base13[2][4]=7;
	base13[2][5]=22;
	base13[2][6]=9;
	base13[2][7]=34;
	base13[2][8]=19;
	base13[2][9]=36;
	base13[2][10]=25;
	base13[2][11]=28;
	base13[2][12]=31;
    //base 3*14
    for(int x = 0; x < 3; x++)
    {	
       for(int y =0; y<14; y++)
        {
            if(y < 7)
                base14[x][y] = base7[x][y];
            else
               base14[x][y] = base7[x][y-7]+3*7;         
     	}
    }
    // load board 7
   	board7[0][0] = 1;
	board7[0][1] = 26;
	board7[0][2] = 11;
	board7[0][3] = 46;
	board7[0][4] = 29;
	board7[0][5] = 24;
	board7[0][6] = 9;
	board7[1][0] = 12;
	board7[1][1] = 45;
	board7[1][2] = 28;
	board7[1][3] = 25;
	board7[1][4] = 10;
	board7[1][5] = 47;
	board7[1][6] = 30;
	board7[2][0] = 27;
	board7[2][1] = 2;
	board7[2][2] = 35;
	board7[2][3] = 44;
	board7[2][4] = 49;
	board7[2][5] = 8;
	board7[2][6] = 23;
	board7[3][0] = 40;
	board7[3][1] = 13;
	board7[3][2] = 42;
	board7[3][3] = 19;
	board7[3][4] = 36;
	board7[3][5] = 31;
	board7[3][6] = 48;
	board7[4][0] = 3;
	board7[4][1] = 16;
	board7[4][2] = 39;
	board7[4][3] = 34;
	board7[4][4] = 43;
	board7[4][5] = 22;
	board7[4][6] = 7;
	board7[5][0] = 14;
	board7[5][1] = 41;
	board7[5][2] = 18;
	board7[5][3] = 5;
	board7[5][4] = 20;
	board7[5][5] = 37;
	board7[5][6] = 32;
	board7[6][0] = 17;
	board7[6][1] = 4;
	board7[6][2] = 15;
	board7[6][3] = 38;
	board7[6][4] = 33;
	board7[6][5] = 6;
	board7[6][6] = 21;
   //Board 8
	 board8[0][0] = 1;
	board8[0][1] = 46;
	board8[0][2] = 15;
	board8[0][3] = 24;
	board8[0][4] = 59;
	board8[0][5] = 28;
	board8[0][6] = 13;
	board8[0][7] = 26;
	board8[1][0] = 16;
	board8[1][1] = 23;
	board8[1][2] = 58;
	board8[1][3] = 51;
	board8[1][4] = 14;
	board8[1][5] = 25;
	board8[1][6] = 64;
	board8[1][7] = 29;
	board8[2][0] = 47;
	board8[2][1] = 2;
	board8[2][2] = 45;
	board8[2][3] = 54;
	board8[2][4] = 63;
	board8[2][5] = 60;
	board8[2][6] = 27;
	board8[2][7] = 12;
	board8[3][0] = 22;
	board8[3][1] = 17;
	board8[3][2] = 52;
	board8[3][3] = 57;
	board8[3][4] = 50;
	board8[3][5] = 55;
	board8[3][6] = 30;
	board8[3][7] = 61;
	board8[4][0] = 3;
	board8[4][1] = 48;
	board8[4][2] = 21;
	board8[4][3] = 44;
	board8[4][4] = 53;
	board8[4][5] = 62;
	board8[4][6] = 11;
	board8[4][7] = 34;
	board8[5][0] = 18;
	board8[5][1] = 39;
	board8[5][2] = 42;
	board8[5][3] = 49;
	board8[5][4] = 56;
	board8[5][5] = 33;
	board8[5][6] = 8;
	board8[5][7] = 31;
	board8[6][0] = 41;
	board8[6][1] = 4;
	board8[6][2] = 37;
	board8[6][3] = 20;
	board8[6][4] = 43;
	board8[6][5] = 6;
	board8[6][6] = 35;
	board8[6][7] = 10;
	board8[7][0] = 38;
	board8[7][1] = 19;
	board8[7][2] = 40;
	board8[7][3] = 5;
	board8[7][4] = 36;
	board8[7][5] = 9;
	board8[7][6] = 32;
	board8[7][7] = 7;

}

int blockOfFour(int n) // getting num blocks of four in each stripe.
{
    if(n < 11)
    {
	return 0;
    }
    else
    {
        int num = 0;
        switch(n%4)
        {
	    case 0:
	       num = (n-8);
	       break;
	    case 1:
	       num = (n-13);
	       break;
	    case 2:
	       num = (n-14);
	       break;
	    case 3:
	       num = (n-7);
	       break;
        }
	return num;
    }		
}


void solveBoard(int n)
{
    int board[n][n]; // initialize the board
    for (int i = 0; i < n; i++)
       for (int j = 0; j < n; j++)
            board[i][j] = 0;
    int BaseOfFour = blockOfFour(n)/4; // number blocks of 3*4
    
    switch(n % 3)
    {	
	case 0: // for all board size that is divisibe by 3
	   for (int x = 0; x < 3; x++)
	   {
	       for(int y = 0; y < n; y++)
	       {
		    if(y < blockOfFour(n))
		    {
			int temp = y/4;	
			for(int i = 0; i < n; i+= 6) // parrallel here parrallel here i+6 to get stripe without flipping order
			{
			    int stride = i/3;		    	
			    board[x+i][y] = base[x][y%4]+ temp*12 + 3*n*stride;
			    if(x+3+i < n)
			    	board[x+3+i][n-y-1] = base[x][y%4]+ temp*12 + 3*n*(stride+1);
			}
		    }
		    else
		    {
			for(int i = 0 ; i < n; i+= 6) // parallel here
			{
			    int stride = i/3;
			    if(n % 4 == 0)
			    {
			    	board[x+i][y] = base8[x][y-blockOfFour(n)]+BaseOfFour*12 + 3*n*stride;
				board[x+3+i][n-y-1] = base8[x][y-blockOfFour(n)]+ BaseOfFour*12 + 3*n*(stride+1); //using base 8
			    }
 			    if(n % 4 == 1)
			    {
			    	board[x+i][y] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n)
				   board[x+3+i][n-y-1] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1); //using base 13
			    }
			    if(n % 4 == 2)
			    {
			    	board[x+i][y] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n)
				   board[x+3+i][n-y-1] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1); // using base 14
			    }
			    if(n % 4 == 3)
			    {
			    	board[x+i][y] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n)
				   board[x+3+i][n-y-1] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1); // using base 7
			    }
			}
		    }
	       }   
	   }
	   break; //  end of first case
	case 1:
	   for (int x = 0; x < 3; x++)
	   {
	       for(int y = 0; y < n; y++)
	       {
		    if(y < blockOfFour(n))
		    {
			int temp = y/4; // temp get index of blockOf4
			for(int i = 0; i < n-7; i+= 6) // 
			{
			    int stride = i/3; 	    	
			    board[x+i][y] = base[x][y%4]+ temp*12 + 3*n*stride; 
			    if(x+3+i < n-7)
			    	board[x+3+i][n-y-1] = base[x][y%4]+ temp*12 + 3*n*(stride+1);
			}
		    }// end of if
		    else
		    {
			for(int i = 0 ; i < n-7; i+= 6) // parallel here
			{
			    int stride = i/3;
			    if(n % 4 == 0)
			    {
			    	board[x+i][y] = base8[x][y-blockOfFour(n)]+BaseOfFour*12 + 3*n*stride;
				if(x+3+i < n-7)// Don't want to get in the 7 stride
				board[x+3+i][n-y-1] = base8[x][y-blockOfFour(n)]+ BaseOfFour*12 + 3*n*(stride+1);
			    }
 			    if(n % 4 == 1)
			    {
			    	board[x+i][y] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-7) // Don't want to get in the 7 stride
				   board[x+3+i][n-y-1] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			    if(n % 4 == 2)
			    {
			    	board[x+i][y] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-7) // Don't want to get in the 7 stride
				   board[x+3+i][n-y-1] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			    if(n % 4 == 3)
			    {
			    	board[x+i][y] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-7) // Don't want to get in the 7 stride
				   board[x+3+i][n-y-1] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			}
		    }// end of else
	       }// end of for y   
	   }// end of big 4
	   //Handling 7*3(k-1) here 2 case 
	   if(n%2 != 0)
	   {
		   for(int x = 0; x < 7; x++)
		   {
			for(int y = 0; y < n-7 ; y++) // NOTE !!!!
			{
			    if(y%6 == 0) //0,6,12....
			    {
				int temp = y/6;
			    	board[n+x-7][y] = tranposeBase7[x][y%3]+ 2*temp*21 + (n-7)*n; // minus 7 because we want to start at line n-7
				board[n+x-7][y+1] = tranposeBase7[x][y%3+1]+ 2*temp*21 + (n-7)*n;
				board[n+x-7][y+2] = tranposeBase7[x][y%3+2]+ 2*temp*21 + (n-7)*n;
			    }
			    else if( y%3 == 0) //3,9,15,21...
			    {
				int temp = y/6;
			    	board[n-x-1][y] = tranposeBase7[x][y%3]+ 21 + 2*temp*21 + (n-7)*n;
				board[n-x-1][y+1] = tranposeBase7[x][y%3+1]+ 21 + 2*temp*21+ (n-7)*n;
				board[n-x-1][y+2] = tranposeBase7[x][y%3+2]+ 21 + 2*temp*21+ (n-7)*n;
			    }
			}
		   }
		   //handling 7*7 chessboard here
		   for(int x = 0; x < 7; x++)
		   {
			for(int y = 0; y < 7 ; y++)
			{
			    board[n+x-7][n+y-7] = board7[x][y] + (n*n-49);
			}
		   }
           } else
		{
		for(int x = 0; x < 7; x++)
		   {
			for(int y = n; y > 7 ; y--) // NOTE !!!!
			{
			    if((n-y)%6 == 0) // n-y because we start from ending
			    {
				int temp = (n-y)/6;
			    	board[n+x-7][y-1] = tranposeBase7[x][(n-y)%3] + 2*temp*21 + (n-7)*n;
				board[n+x-7][y-2] = tranposeBase7[x][(n-y)%3+1] + 2*temp*21 + (n-7)*n; //+ 2*temp*21 + (n-7)*n
				board[n+x-7][y-3] = tranposeBase7[x][(n-y)%3+2] + 2*temp*21 + (n-7)*n; 
			    }
			    else if((n-y)%3 == 0) // n-y because we start from ending
			    {
				int temp = (n-y)/6;
			    	board[n-x-1][y-1] = tranposeBase7[x][(n-y)%3] + 21 +  2*temp*21 + (n-7)*n;
				board[n-x-1][y-2] = tranposeBase7[x][(n-y)%3+1]+ 21 + 2*temp*21 + (n-7)*n;
				board[n-x-1][y-3] = tranposeBase7[x][(n-y)%3+2]+ 21 + 2*temp*21 + (n-7)*n;
			    }
			}
		   }
		   //handling 7*7 chessboard here
		   for(int x = 6; x >= 0; x--)
		   {
			for(int y = 6; y >=0 ; y--)
			{
			    board[n+x-7][y] = board7[6-x][6-y] + (n*n-49);
			    //cout << "testing" << endl;
			}
		   }
	   }// end of else

	  
	
	break;
      case 2:
	 for (int x = 0; x < 3; x++)
	   {
	       for(int y = 0; y < n; y++)
	       {
		    if(y < blockOfFour(n))
		    {
			int temp = y/4;	
			for(int i = 0; i < n-8; i+= 6) 
			{
			    int stride = i/3; 	    	
			    board[x+i][y] = base[x][y%4]+ temp*12 + 3*n*stride;
			    if(x+3+i < n-8)
			    	board[x+3+i][n-y-1] = base[x][y%4]+ temp*12 + 3*n*(stride+1);
			}
		    }// end of if
		    else
		    {
			for(int i = 0 ; i < n-8; i+= 6)
			{
			    int stride = i/3;
			    if(n % 4 == 0)
			    {
			    	board[x+i][y] = base8[x][y-blockOfFour(n)]+BaseOfFour*12 + 3*n*stride;
				if(x+3+i < n-8)// Don't want to get in the 8 stride
				board[x+3+i][n-y-1] = base8[x][y-blockOfFour(n)]+ BaseOfFour*12 + 3*n*(stride+1);
			    }
 			    if(n % 4 == 1)
			    {
			    	board[x+i][y] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-8) // Don't want to get in the 8 stride
				   board[x+3+i][n-y-1] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			    if(n % 4 == 2)
			    {
			    	board[x+i][y] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-8) // Don't want to get in the 8 stride
				   board[x+3+i][n-y-1] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			    if(n % 4 == 3)
			    {
			    	board[x+i][y] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-8) // Don't want to get in the 8 stride
				   board[x+3+i][n-y-1] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			}
		    }// end of else
	       }// end of for y   
	   }// end of big 4
	// Handling 8*n stride here
	 if(n%2 == 0)
	   {
		   for(int x = 0; x < 8; x++)
		   {
			for(int y = 0; y < n-8 ; y++) // NOTE !!!!
			{
			    if(y%6 == 0) //0,6,12....
			    {
				int temp = y/6;
			    	board[n+x-8][y] = tranposeBase8[x][y%3]+ 2*temp*24 + (n-8)*n; // minus 8 because we want to start at line n-8
				board[n+x-8][y+1] = tranposeBase8[x][y%3+1]+ 2*temp*24 + (n-8)*n;
				board[n+x-8][y+2] = tranposeBase8[x][y%3+2]+ 2*temp*24 + (n-8)*n;
			    }
			    else if( y%3 == 0) //3,9,15,21...
			    {
				int temp = y/6;
			    	board[n-x-1][y] = tranposeBase8[x][y%3]+ 24 + 2*temp*24 + (n-8)*n;
				board[n-x-1][y+1] = tranposeBase8[x][y%3+1]+ 24 + 2*temp*24+ (n-8)*n;
				board[n-x-1][y+2] = tranposeBase8[x][y%3+2]+ 24 + 2*temp*24+ (n-8)*n;
			    }
			}
		   }
		   //handling 8*8 chessboard here
		   for(int x = 0; x < 8; x++)
		   {
			for(int y = 0; y < 8 ; y++)
			{
			    board[n+x-8][n+y-8] = board8[x][y] + (n*n-64);
			}
		   }
           } else
		{
		for(int x = 0; x < 8; x++)
		   {
			for(int y = n; y > 8 ; y--) // NOTE !!!!
			{
			    if((n-y)%6 == 0) // n-y because we start from ending
			    {
				int temp = (n-y)/6; // getting index of block 8*3
			    	board[n+x-8][y-1] = tranposeBase8[x][(n-y)%3] + 2*temp*24 + (n-8)*n;
				board[n+x-8][y-2] = tranposeBase8[x][(n-y)%3+1] + 2*temp*24 + (n-8)*n;
				board[n+x-8][y-3] = tranposeBase8[x][(n-y)%3+2] + 2*temp*24 + (n-8)*n; 
			    }
			    else if((n-y)%3 == 0) // n-y because we start from ending
			    {
				int temp = (n-y)/6; // getting index of block 8*3
			    	board[n-x-1][y-1] = tranposeBase8[x][(n-y)%3] + 24 +  2*temp*24 + (n-8)*n; // note 24 = 3*8 
				board[n-x-1][y-2] = tranposeBase8[x][(n-y)%3+1]+ 24 + 2*temp*24 + (n-8)*n;
				board[n-x-1][y-3] = tranposeBase8[x][(n-y)%3+2]+ 24 + 2*temp*24 + (n-8)*n;
			    }
			}
		   }
		   //handling 7*7 chessboard here
		   for(int x = 7; x >= 0; x--)
		   {
			for(int y = 7; y >=0 ; y--)
			{
			    board[n+x-7][y] = board8[7-x][7-y] + (n*n-64);
			    //cout << "testing" << endl;
			}
		   }
	   }// end of else
    } // end of switch


    // print out the thingy
    
    /*for (int x = 0; x < n; x++) {
        for (int y = 0; y < n; y++)
            cout << board[x][y]<< "\t";
        cout << endl;
    }*/
    
}

int main()
{
    loadData();
    int n;
    cout << "Enter size of board:";
    cin >> n;
    unsigned long int cpuTime = monotonicTime();
    solveBoard(n);
    cpuTime = monotonicTime() - cpuTime;  
    fprintf(stderr, "Time to perform operation on CPU = %ld ns\n", cpuTime);
    /*for(int x = 0; x < 3; x++)
    {
	for(int y = 0; y < 8 ; y++)
	    	cout << base8[x][y] << "\t";                
	cout << endl;
    }
    for(int x = 0; x < 8; x++)
    {
	for(int y = 0; y < 3 ; y++)
	    	cout << tranposeBase8[x][y] << "\t";   
	cout << endl;             
    }*/
    return 0;
}

	.file	"tmpxft_0025f303_00000000-6_Parrallel.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3900:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3900:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.text._Z13monotonicTimev,"axG",@progbits,_Z13monotonicTimev,comdat
	.weak	_Z13monotonicTimev
	.type	_Z13monotonicTimev, @function
_Z13monotonicTimev:
.LFB3893:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movl	$1, %edi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	clock_gettime@PLT
	imulq	$1000000000, 8(%rsp), %rax
	addq	16(%rsp), %rax
	movq	24(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3893:
	.size	_Z13monotonicTimev, .-_Z13monotonicTimev
	.text
	.globl	_Z8loadDatav
	.type	_Z8loadDatav, @function
_Z8loadDatav:
.LFB3894:
	.cfi_startproc
	endbr64
	movabsq	$17179869185, %rax
	movabsq	$51539607561, %rcx
	movl	$5, 80+base7(%rip)
	movabsq	$68719476743, %rdi
	movq	%rax, base(%rip)
	leaq	tranposeBase7(%rip), %rdx
	movabsq	$42949672967, %rax
	movq	%rax, 8+base(%rip)
	leaq	12(%rdx), %r8
	movabsq	$47244640264, %rax
	movq	%rax, 16+base(%rip)
	movabsq	$21474836482, %rax
	movq	%rax, 24+base(%rip)
	movabsq	$25769803779, %rax
	movq	%rax, 32+base(%rip)
	movq	%rax, 40+base7(%rip)
	movabsq	$42949672981, %rax
	movq	%rcx, 40+base(%rip)
	movabsq	$60129542145, %rcx
	movq	%rax, 48+base7(%rip)
	movabsq	$8589934605, %rax
	movq	%rcx, base7(%rip)
	movabsq	$85899345937, %rcx
	movq	%rax, 56+base7(%rip)
	movabsq	$77309411343, %rax
	movq	%rcx, 8+base7(%rip)
	movabsq	$17179869193, %rcx
	movq	%rax, 64+base7(%rip)
	movabsq	$34359738379, %rax
	movq	%rcx, 16+base7(%rip)
	movabsq	$51539607571, %rcx
	movq	%rax, 72+base7(%rip)
	movq	%rcx, 32+base7(%rip)
	leaq	base7(%rip), %rcx
	movq	%rdi, 24+base7(%rip)
	movq	%rcx, %rdi
.L7:
	movq	%rdx, %rsi
	xorl	%eax, %eax
.L8:
	movl	(%rdi,%rax,4), %r9d
	incq	%rax
	addq	$12, %rsi
	movl	%r9d, -12(%rsi)
	cmpq	$7, %rax
	jne	.L8
	addq	$4, %rdx
	addq	$28, %rdi
	cmpq	%r8, %rdx
	jne	.L7
	leaq	tranposeBase8(%rip), %rdx
	leaq	base8(%rip), %rdi
	movabsq	$68719476737, %rax
	movq	%rax, base8(%rip)
	leaq	12(%rdx), %r9
	movq	%rdi, %r8
	movabsq	$94489280515, %rax
	movq	%rax, 8+base8(%rip)
	movabsq	$51539607571, %rax
	movq	%rax, 16+base8(%rip)
	movabsq	$42949672967, %rax
	movq	%rax, 24+base8(%rip)
	movabsq	$90194313220, %rax
	movq	%rax, 32+base8(%rip)
	movabsq	$64424509458, %rax
	movq	%rax, 40+base8(%rip)
	movabsq	$38654705670, %rax
	movq	%rax, 48+base8(%rip)
	movabsq	$55834574872, %rax
	movq	%rax, 56+base8(%rip)
	movabsq	$8589934609, %rax
	movq	%rax, 64+base8(%rip)
	movabsq	$85899345925, %rax
	movq	%rax, 72+base8(%rip)
	movabsq	$60129542167, %rax
	movq	%rax, 80+base8(%rip)
	movabsq	$34359738379, %rax
	movq	%rax, 88+base8(%rip)
.L10:
	movq	%rdx, %rsi
	xorl	%eax, %eax
.L11:
	movl	(%r8,%rax,4), %r10d
	incq	%rax
	addq	$12, %rsi
	movl	%r10d, -12(%rsi)
	cmpq	$8, %rax
	jne	.L11
	addq	$4, %rdx
	addq	$32, %r8
	cmpq	%r9, %rdx
	jne	.L10
	leaq	base11(%rip), %rdx
	leaq	base(%rip), %rsi
	leaq	132(%rdx), %r11
	leaq	base7(%rip), %r10
	movq	%rsi, %r9
.L16:
	xorl	%eax, %eax
.L15:
	cmpq	$3, %rax
	ja	.L13
	movl	(%r9,%rax,4), %r8d
	jmp	.L14
.L13:
	movl	-16(%r10,%rax,4), %r8d
	addl	$12, %r8d
.L14:
	movl	%r8d, (%rdx,%rax,4)
	incq	%rax
	cmpq	$11, %rax
	jne	.L15
	addq	$44, %rdx
	addq	$16, %r9
	addq	$28, %r10
	cmpq	%r11, %rdx
	jne	.L16
	leaq	base12(%rip), %rdx
	leaq	144(%rdx), %r9
.L17:
	xorl	%eax, %eax
.L20:
	cmpq	$3, %rax
	ja	.L18
	movl	(%rsi,%rax,4), %r8d
	jmp	.L19
.L18:
	movl	-16(%rdi,%rax,4), %r11d
	leal	12(%r11), %r8d
.L19:
	movl	%r8d, (%rdx,%rax,4)
	incq	%rax
	cmpq	$12, %rax
	jne	.L20
	addq	$48, %rdx
	addq	$16, %rsi
	addq	$32, %rdi
	cmpq	%r9, %rdx
	jne	.L17
	movabsq	$17179869185, %rax
	leaq	base14(%rip), %rsi
	movl	$31, 152+base13(%rip)
	movq	%rax, base13(%rip)
	leaq	168(%rsi), %r8
	movabsq	$68719476749, %rax
	movq	%rax, 8+base13(%rip)
	movabsq	$34359738389, %rax
	movq	%rax, 16+base13(%rip)
	movabsq	$77309411351, %rax
	movq	%rax, 24+base13(%rip)
	movabsq	$163208757283, %rax
	movq	%rax, 32+base13(%rip)
	movabsq	$137438953499, %rax
	movq	%rax, 40+base13(%rip)
	movabsq	$51539607581, %rax
	movq	%rax, 48+base13(%rip)
	movabsq	$25769803791, %rax
	movq	%rax, 56+base13(%rip)
	movabsq	$42949672963, %rax
	movq	%rax, 64+base13(%rip)
	movabsq	$85899345937, %rax
	movq	%rax, 72+base13(%rip)
	movabsq	$103079215141, %rax
	movq	%rax, 80+base13(%rip)
	movabsq	$128849018913, %rax
	movq	%rax, 88+base13(%rip)
	movabsq	$111669149735, %rax
	movq	%rax, 96+base13(%rip)
	movabsq	$8589934597, %rax
	movq	%rax, 104+base13(%rip)
	movabsq	$60129542155, %rax
	movq	%rax, 112+base13(%rip)
	movabsq	$94489280519, %rax
	movq	%rax, 120+base13(%rip)
	movabsq	$146028888073, %rax
	movq	%rax, 128+base13(%rip)
	movabsq	$154618822675, %rax
	movq	%rax, 136+base13(%rip)
	movabsq	$120259084313, %rax
	movq	%rax, 144+base13(%rip)
.L22:
	movq	%rcx, %rdx
	xorl	%eax, %eax
.L25:
	cmpq	$6, %rax
	ja	.L23
	movl	(%rdx), %edi
	jmp	.L24
.L23:
	movl	-28(%rdx), %edi
	addl	$21, %edi
.L24:
	movl	%edi, (%rsi,%rax,4)
	incq	%rax
	addq	$4, %rdx
	cmpq	$14, %rax
	jne	.L25
	addq	$56, %rsi
	addq	$28, %rcx
	cmpq	%rsi, %r8
	jne	.L22
	movabsq	$111669149697, %rax
	movl	$21, 192+board7(%rip)
	movq	%rax, board7(%rip)
	movabsq	$197568495627, %rax
	movq	%rax, 8+board7(%rip)
	movabsq	$103079215133, %rax
	movq	%rax, 16+board7(%rip)
	movabsq	$51539607561, %rax
	movq	%rax, 24+board7(%rip)
	movabsq	$120259084333, %rax
	movq	%rax, 32+board7(%rip)
	movabsq	$42949672985, %rax
	movq	%rax, 40+board7(%rip)
	movabsq	$128849018927, %rax
	movq	%rax, 48+board7(%rip)
	movabsq	$8589934619, %rax
	movq	%rax, 56+board7(%rip)
	movabsq	$188978561059, %rax
	movq	%rax, 64+board7(%rip)
	movabsq	$34359738417, %rax
	movq	%rax, 72+board7(%rip)
	movabsq	$171798691863, %rax
	movq	%rax, 80+board7(%rip)
	movabsq	$180388626445, %rax
	movq	%rax, 88+board7(%rip)
	movabsq	$154618822675, %rax
	movq	%rax, 96+board7(%rip)
	movabsq	$206158430239, %rax
	movq	%rax, 104+board7(%rip)
	movabsq	$68719476739, %rax
	movq	%rax, 112+board7(%rip)
	movabsq	$146028888103, %rax
	movq	%rax, 120+board7(%rip)
	movabsq	$94489280555, %rax
	movq	%rax, 128+board7(%rip)
	movabsq	$60129542151, %rax
	movq	%rax, 136+board7(%rip)
	movabsq	$77309411369, %rax
	movq	%rax, 144+board7(%rip)
	movabsq	$85899345925, %rax
	movq	%rax, 152+board7(%rip)
	movabsq	$137438953509, %rax
	movq	%rax, 160+board7(%rip)
	movabsq	$17179869201, %rax
	movq	%rax, 168+board7(%rip)
	movabsq	$163208757263, %rax
	movq	%rax, 176+board7(%rip)
	movabsq	$25769803809, %rax
	movq	%rax, 184+board7(%rip)
	movabsq	$197568495617, %rax
	movq	%rax, board8(%rip)
	movabsq	$103079215119, %rax
	movq	%rax, 8+board8(%rip)
	movabsq	$120259084347, %rax
	movq	%rax, 16+board8(%rip)
	movabsq	$111669149709, %rax
	movq	%rax, 24+board8(%rip)
	movabsq	$98784247824, %rax
	movq	%rax, 32+board8(%rip)
	movabsq	$219043332154, %rax
	movq	%rax, 40+board8(%rip)
	movabsq	$107374182414, %rax
	movq	%rax, 48+board8(%rip)
	movl	$1946157057, %eax
	salq	$6, %rax
	movq	%rax, 56+board8(%rip)
	movabsq	$8589934639, %rax
	movq	%rax, 64+board8(%rip)
	movabsq	$231928234029, %rax
	movq	%rax, 72+board8(%rip)
	movabsq	$257698037823, %rax
	movq	%rax, 80+board8(%rip)
	movabsq	$51539607579, %rax
	movq	%rax, 88+board8(%rip)
	movabsq	$73014444054, %rax
	movq	%rax, 96+board8(%rip)
	movabsq	$244813135924, %rax
	movq	%rax, 104+board8(%rip)
	movabsq	$236223201330, %rax
	movq	%rax, 112+board8(%rip)
	movabsq	$261993005086, %rax
	movq	%rax, 120+board8(%rip)
	movabsq	$206158430211, %rax
	movq	%rax, 128+board8(%rip)
	movabsq	$188978561045, %rax
	movq	%rax, 136+board8(%rip)
	movabsq	$266287972405, %rax
	movq	%rax, 144+board8(%rip)
	movabsq	$146028888075, %rax
	movq	%rax, 152+board8(%rip)
	movabsq	$167503724562, %rax
	movq	%rax, 160+board8(%rip)
	movabsq	$210453397546, %rax
	movq	%rax, 168+board8(%rip)
	movabsq	$141733920824, %rax
	movq	%rax, 176+board8(%rip)
	movabsq	$133143986184, %rax
	movq	%rax, 184+board8(%rip)
	movabsq	$17179869225, %rax
	movq	%rax, 192+board8(%rip)
	movabsq	$85899345957, %rax
	movq	%rax, 200+board8(%rip)
	movabsq	$25769803819, %rax
	movq	%rax, 208+board8(%rip)
	movabsq	$42949672995, %rax
	movq	%rax, 216+board8(%rip)
	movabsq	$81604378662, %rax
	movq	%rax, 224+board8(%rip)
	movl	$2684354565, %eax
	salq	$3, %rax
	movq	%rax, 232+board8(%rip)
	movabsq	$38654705700, %rax
	movq	%rax, 240+board8(%rip)
	movl	$939524097, %eax
	salq	$5, %rax
	movq	%rax, 248+board8(%rip)
	ret
	.cfi_endproc
.LFE3894:
	.size	_Z8loadDatav, .-_Z8loadDatav
	.globl	_Z11blockOfFouri
	.type	_Z11blockOfFouri, @function
_Z11blockOfFouri:
.LFB3895:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	cmpl	$10, %edi
	jle	.L33
	movl	%edi, %edx
	leal	-14(%rdi), %eax
	andl	$3, %edx
	cmpl	$2, %edx
	je	.L33
	leal	-7(%rdi), %eax
	cmpl	$3, %edx
	je	.L33
	decl	%edx
	leal	-13(%rdi), %eax
	je	.L33
	leal	-8(%rdi), %eax
.L33:
	ret
	.cfi_endproc
.LFE3895:
	.size	_Z11blockOfFouri, .-_Z11blockOfFouri
	.globl	_Z10solveBoardi
	.type	_Z10solveBoardi, @function
_Z10solveBoardi:
.LFB3896:
	.cfi_startproc
	endbr64
	ret
	.cfi_endproc
.LFE3896:
	.size	_Z10solveBoardi, .-_Z10solveBoardi
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Enter size of board:"
.LC1:
	.string	"Time to perform operation on CPU = %ld ns\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3897:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	_Z8loadDatav
	movl	$20, %edx
	leaq	.LC0(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	leaq	4(%rsp), %rsi
	leaq	_ZSt3cin(%rip), %rdi
	call	_ZNSirsERi@PLT
	call	_Z13monotonicTimev
	movq	%rax, %rbx
	call	_Z13monotonicTimev
	movq	stderr(%rip), %rdi
	movl	$2, %esi
	leaq	.LC1(%rip), %rdx
	subq	%rbx, %rax
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__fprintf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3897:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3923:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3923:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	board8
	.bss
	.align 32
	.type	board8, @object
	.size	board8, 256
board8:
	.zero	256
	.globl	board7
	.align 32
	.type	board7, @object
	.size	board7, 196
board7:
	.zero	196
	.globl	base14
	.align 32
	.type	base14, @object
	.size	base14, 168
base14:
	.zero	168
	.globl	base13
	.align 32
	.type	base13, @object
	.size	base13, 156
base13:
	.zero	156
	.globl	base12
	.align 32
	.type	base12, @object
	.size	base12, 144
base12:
	.zero	144
	.globl	base11
	.align 32
	.type	base11, @object
	.size	base11, 132
base11:
	.zero	132
	.globl	tranposeBase8
	.align 32
	.type	tranposeBase8, @object
	.size	tranposeBase8, 96
tranposeBase8:
	.zero	96
	.globl	base8
	.align 32
	.type	base8, @object
	.size	base8, 96
base8:
	.zero	96
	.globl	tranposeBase7
	.align 32
	.type	tranposeBase7, @object
	.size	tranposeBase7, 84
tranposeBase7:
	.zero	84
	.globl	base7
	.align 32
	.type	base7, @object
	.size	base7, 84
base7:
	.zero	84
	.globl	base
	.align 32
	.type	base, @object
	.size	base, 48
base:
	.zero	48
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#define NS_PER_SEC (1000*1000*1000)
using namespace std;

int base[3][4];
int base7[3][7];
int tranposeBase7[7][3];
int base8[3][8];
int tranposeBase8[8][3];
int base11[3][11];
int base12[3][12];
int base13[3][13];
int base14[3][14];
int board7[7][7];
int board8[8][8];

inline unsigned long int monotonicTime(void)
{
  //const unsigned long int NS_PER_SEC = 1000 * 1000 * 1000;
  struct timespec now;
  clock_gettime(CLOCK_MONOTONIC, &now);
  return now.tv_sec * NS_PER_SEC + now.tv_nsec;
}

void loadData()
{
 //base 3*4
	base[0][0]=1;
	base[0][1]=4;
	base[0][2]=7;
	base[0][3]=10;
	base[1][0]=8;
	base[1][1]=11;
	base[1][2]=2;
	base[1][3]=5;
	base[2][0]=3;
	base[2][1]=6;
	base[2][2]=9;
	base[2][3]=12;

    //base 3*7
    	base7[0][0]=1;
	base7[0][1]=14;
	base7[0][2]=17;
	base7[0][3]=20;
	base7[0][4]=9;
	base7[0][5]=4;
	base7[0][6]=7;
	base7[1][0]=16;
	base7[1][1]=19;
	base7[1][2]=12;
	base7[1][3]=3;
	base7[1][4]=6;
	base7[1][5]=21;
	base7[1][6]=10;
	base7[2][0]=13;
	base7[2][1]=2;
	base7[2][2]=15;
	base7[2][3]=18;
	base7[2][4]=11;
	base7[2][5]=8;
	base7[2][6]=5;
    //Tranpose base 7
	for(int x = 0; x < 3; x++)
	  {
		for(int y = 0; y < 7 ; y++)
		{
		    	tranposeBase7[y][x] = base7[x][y];                
	    	}
	  }
    //base 3*8
    	base8[0][0]=1;
	base8[0][1]=16;
	base8[0][2]=3;
	base8[0][3]=22;
	base8[0][4]=19;
	base8[0][5]=12;
	base8[0][6]=7;
	base8[0][7]=10;
	base8[1][0]=4;
	base8[1][1]=21;
	base8[1][2]=18;
	base8[1][3]=15;
	base8[1][4]=6;
	base8[1][5]=9;
	base8[1][6]=24;
	base8[1][7]=13;
	base8[2][0]=17;
	base8[2][1]=2;
	base8[2][2]=5;
	base8[2][3]=20;
	base8[2][4]=23;
	base8[2][5]=14;
	base8[2][6]=11;
	base8[2][7]=8;
    //Tranpose base 8
	for(int x = 0; x < 3; x++)
	  {
		for(int y = 0; y < 8 ; y++)
		{
		    	tranposeBase8[y][x] = base8[x][y];                
	    	}
	  }	
	
    //base 3*11
    for(int x = 0; x < 3; x++)
    {
        for(int y = 0; y < 11 ; y++)
        {
            if(y < 4)
            	base11[x][y] = base[x][y];            
            else
            	base11[x][y] = base7[x][y-4]+3*4;     
    	}// end of inner loop
    }
    //base 3*12
    for(int x = 0; x < 3; x++)
    {
        for(int y =0; y<12; y++)
        {
            if(y<4)
            base12[x][y] = base[x][y];
            else
            base12[x][y] = base8[x][y-4]+3*4;
	}
    }
    //board 3*13
    	base13[0][0]=1;
	base13[0][1]=4;
	base13[0][2]=13;
	base13[0][3]=16;
	base13[0][4]=21;
	base13[0][5]=8;
	base13[0][6]=23;
	base13[0][7]=18;
	base13[0][8]=35;
	base13[0][9]=38;
	base13[0][10]=27;
	base13[0][11]=32;
	base13[0][12]=29;
	base13[1][0]=12;
	base13[1][1]=15;
	base13[1][2]=6;
	base13[1][3]=3;
	base13[1][4]=10;
	base13[1][5]=17;
	base13[1][6]=20;
	base13[1][7]=37;
	base13[1][8]=24;
	base13[1][9]=33;
	base13[1][10]=30;
	base13[1][11]=39;
	base13[1][12]=26;
	base13[2][0]=5;
	base13[2][1]=2;
	base13[2][2]=11;
	base13[2][3]=14;
	base13[2][4]=7;
	base13[2][5]=22;
	base13[2][6]=9;
	base13[2][7]=34;
	base13[2][8]=19;
	base13[2][9]=36;
	base13[2][10]=25;
	base13[2][11]=28;
	base13[2][12]=31;
    //base 3*14
    for(int x = 0; x < 3; x++)
    {	
       for(int y =0; y<14; y++)
        {
            if(y < 7)
                base14[x][y] = base7[x][y];
            else
               base14[x][y] = base7[x][y-7]+3*7;         
     	}
    }
    // load board 7
   	board7[0][0] = 1;
	board7[0][1] = 26;
	board7[0][2] = 11;
	board7[0][3] = 46;
	board7[0][4] = 29;
	board7[0][5] = 24;
	board7[0][6] = 9;
	board7[1][0] = 12;
	board7[1][1] = 45;
	board7[1][2] = 28;
	board7[1][3] = 25;
	board7[1][4] = 10;
	board7[1][5] = 47;
	board7[1][6] = 30;
	board7[2][0] = 27;
	board7[2][1] = 2;
	board7[2][2] = 35;
	board7[2][3] = 44;
	board7[2][4] = 49;
	board7[2][5] = 8;
	board7[2][6] = 23;
	board7[3][0] = 40;
	board7[3][1] = 13;
	board7[3][2] = 42;
	board7[3][3] = 19;
	board7[3][4] = 36;
	board7[3][5] = 31;
	board7[3][6] = 48;
	board7[4][0] = 3;
	board7[4][1] = 16;
	board7[4][2] = 39;
	board7[4][3] = 34;
	board7[4][4] = 43;
	board7[4][5] = 22;
	board7[4][6] = 7;
	board7[5][0] = 14;
	board7[5][1] = 41;
	board7[5][2] = 18;
	board7[5][3] = 5;
	board7[5][4] = 20;
	board7[5][5] = 37;
	board7[5][6] = 32;
	board7[6][0] = 17;
	board7[6][1] = 4;
	board7[6][2] = 15;
	board7[6][3] = 38;
	board7[6][4] = 33;
	board7[6][5] = 6;
	board7[6][6] = 21;
   //Board 8
	 board8[0][0] = 1;
	board8[0][1] = 46;
	board8[0][2] = 15;
	board8[0][3] = 24;
	board8[0][4] = 59;
	board8[0][5] = 28;
	board8[0][6] = 13;
	board8[0][7] = 26;
	board8[1][0] = 16;
	board8[1][1] = 23;
	board8[1][2] = 58;
	board8[1][3] = 51;
	board8[1][4] = 14;
	board8[1][5] = 25;
	board8[1][6] = 64;
	board8[1][7] = 29;
	board8[2][0] = 47;
	board8[2][1] = 2;
	board8[2][2] = 45;
	board8[2][3] = 54;
	board8[2][4] = 63;
	board8[2][5] = 60;
	board8[2][6] = 27;
	board8[2][7] = 12;
	board8[3][0] = 22;
	board8[3][1] = 17;
	board8[3][2] = 52;
	board8[3][3] = 57;
	board8[3][4] = 50;
	board8[3][5] = 55;
	board8[3][6] = 30;
	board8[3][7] = 61;
	board8[4][0] = 3;
	board8[4][1] = 48;
	board8[4][2] = 21;
	board8[4][3] = 44;
	board8[4][4] = 53;
	board8[4][5] = 62;
	board8[4][6] = 11;
	board8[4][7] = 34;
	board8[5][0] = 18;
	board8[5][1] = 39;
	board8[5][2] = 42;
	board8[5][3] = 49;
	board8[5][4] = 56;
	board8[5][5] = 33;
	board8[5][6] = 8;
	board8[5][7] = 31;
	board8[6][0] = 41;
	board8[6][1] = 4;
	board8[6][2] = 37;
	board8[6][3] = 20;
	board8[6][4] = 43;
	board8[6][5] = 6;
	board8[6][6] = 35;
	board8[6][7] = 10;
	board8[7][0] = 38;
	board8[7][1] = 19;
	board8[7][2] = 40;
	board8[7][3] = 5;
	board8[7][4] = 36;
	board8[7][5] = 9;
	board8[7][6] = 32;
	board8[7][7] = 7;

}

int blockOfFour(int n) // getting num blocks of four in each stripe.
{
    if(n < 11)
    {
	return 0;
    }
    else
    {
        int num = 0;
        switch(n%4)
        {
	    case 0:
	       num = (n-8);
	       break;
	    case 1:
	       num = (n-13);
	       break;
	    case 2:
	       num = (n-14);
	       break;
	    case 3:
	       num = (n-7);
	       break;
        }
	return num;
    }		
}


void solveBoard(int n)
{
    int board[n][n]; // initialize the board
    for (int i = 0; i < n; i++)
       for (int j = 0; j < n; j++)
            board[i][j] = 0;
    int BaseOfFour = blockOfFour(n)/4; // number blocks of 3*4
    
    switch(n % 3)
    {	
	case 0: // for all board size that is divisibe by 3
	   for (int x = 0; x < 3; x++)
	   {
	       for(int y = 0; y < n; y++)
	       {
		    if(y < blockOfFour(n))
		    {
			int temp = y/4;	
			for(int i = 0; i < n; i+= 6) // parrallel here parrallel here i+6 to get stripe without flipping order
			{
			    int stride = i/3;		    	
			    board[x+i][y] = base[x][y%4]+ temp*12 + 3*n*stride;
			    if(x+3+i < n)
			    	board[x+3+i][n-y-1] = base[x][y%4]+ temp*12 + 3*n*(stride+1);
			}
		    }
		    else
		    {
			for(int i = 0 ; i < n; i+= 6) // parallel here
			{
			    int stride = i/3;
			    if(n % 4 == 0)
			    {
			    	board[x+i][y] = base8[x][y-blockOfFour(n)]+BaseOfFour*12 + 3*n*stride;
				board[x+3+i][n-y-1] = base8[x][y-blockOfFour(n)]+ BaseOfFour*12 + 3*n*(stride+1); //using base 8
			    }
 			    if(n % 4 == 1)
			    {
			    	board[x+i][y] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n)
				   board[x+3+i][n-y-1] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1); //using base 13
			    }
			    if(n % 4 == 2)
			    {
			    	board[x+i][y] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n)
				   board[x+3+i][n-y-1] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1); // using base 14
			    }
			    if(n % 4 == 3)
			    {
			    	board[x+i][y] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n)
				   board[x+3+i][n-y-1] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1); // using base 7
			    }
			}
		    }
	       }   
	   }
	   break; //  end of first case
	case 1:
	   for (int x = 0; x < 3; x++)
	   {
	       for(int y = 0; y < n; y++)
	       {
		    if(y < blockOfFour(n))
		    {
			int temp = y/4; // temp get index of blockOf4
			for(int i = 0; i < n-7; i+= 6) // 
			{
			    int stride = i/3; 	    	
			    board[x+i][y] = base[x][y%4]+ temp*12 + 3*n*stride; 
			    if(x+3+i < n-7)
			    	board[x+3+i][n-y-1] = base[x][y%4]+ temp*12 + 3*n*(stride+1);
			}
		    }// end of if
		    else
		    {
			for(int i = 0 ; i < n-7; i+= 6) // parallel here
			{
			    int stride = i/3;
			    if(n % 4 == 0)
			    {
			    	board[x+i][y] = base8[x][y-blockOfFour(n)]+BaseOfFour*12 + 3*n*stride;
				if(x+3+i < n-7)// Don't want to get in the 7 stride
				board[x+3+i][n-y-1] = base8[x][y-blockOfFour(n)]+ BaseOfFour*12 + 3*n*(stride+1);
			    }
 			    if(n % 4 == 1)
			    {
			    	board[x+i][y] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-7) // Don't want to get in the 7 stride
				   board[x+3+i][n-y-1] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			    if(n % 4 == 2)
			    {
			    	board[x+i][y] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-7) // Don't want to get in the 7 stride
				   board[x+3+i][n-y-1] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			    if(n % 4 == 3)
			    {
			    	board[x+i][y] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-7) // Don't want to get in the 7 stride
				   board[x+3+i][n-y-1] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			}
		    }// end of else
	       }// end of for y   
	   }// end of big 4
	   //Handling 7*3(k-1) here 2 case 
	   if(n%2 != 0)
	   {
		   for(int x = 0; x < 7; x++)
		   {
			for(int y = 0; y < n-7 ; y++) // NOTE !!!!
			{
			    if(y%6 == 0) //0,6,12....
			    {
				int temp = y/6;
			    	board[n+x-7][y] = tranposeBase7[x][y%3]+ 2*temp*21 + (n-7)*n; // minus 7 because we want to start at line n-7
				board[n+x-7][y+1] = tranposeBase7[x][y%3+1]+ 2*temp*21 + (n-7)*n;
				board[n+x-7][y+2] = tranposeBase7[x][y%3+2]+ 2*temp*21 + (n-7)*n;
			    }
			    else if( y%3 == 0) //3,9,15,21...
			    {
				int temp = y/6;
			    	board[n-x-1][y] = tranposeBase7[x][y%3]+ 21 + 2*temp*21 + (n-7)*n;
				board[n-x-1][y+1] = tranposeBase7[x][y%3+1]+ 21 + 2*temp*21+ (n-7)*n;
				board[n-x-1][y+2] = tranposeBase7[x][y%3+2]+ 21 + 2*temp*21+ (n-7)*n;
			    }
			}
		   }
		   //handling 7*7 chessboard here
		   for(int x = 0; x < 7; x++)
		   {
			for(int y = 0; y < 7 ; y++)
			{
			    board[n+x-7][n+y-7] = board7[x][y] + (n*n-49);
			}
		   }
           } else
		{
		for(int x = 0; x < 7; x++)
		   {
			for(int y = n; y > 7 ; y--) // NOTE !!!!
			{
			    if((n-y)%6 == 0) // n-y because we start from ending
			    {
				int temp = (n-y)/6;
			    	board[n+x-7][y-1] = tranposeBase7[x][(n-y)%3] + 2*temp*21 + (n-7)*n;
				board[n+x-7][y-2] = tranposeBase7[x][(n-y)%3+1] + 2*temp*21 + (n-7)*n; //+ 2*temp*21 + (n-7)*n
				board[n+x-7][y-3] = tranposeBase7[x][(n-y)%3+2] + 2*temp*21 + (n-7)*n; 
			    }
			    else if((n-y)%3 == 0) // n-y because we start from ending
			    {
				int temp = (n-y)/6;
			    	board[n-x-1][y-1] = tranposeBase7[x][(n-y)%3] + 21 +  2*temp*21 + (n-7)*n;
				board[n-x-1][y-2] = tranposeBase7[x][(n-y)%3+1]+ 21 + 2*temp*21 + (n-7)*n;
				board[n-x-1][y-3] = tranposeBase7[x][(n-y)%3+2]+ 21 + 2*temp*21 + (n-7)*n;
			    }
			}
		   }
		   //handling 7*7 chessboard here
		   for(int x = 6; x >= 0; x--)
		   {
			for(int y = 6; y >=0 ; y--)
			{
			    board[n+x-7][y] = board7[6-x][6-y] + (n*n-49);
			    //cout << "testing" << endl;
			}
		   }
	   }// end of else

	  
	
	break;
      case 2:
	 for (int x = 0; x < 3; x++)
	   {
	       for(int y = 0; y < n; y++)
	       {
		    if(y < blockOfFour(n))
		    {
			int temp = y/4;	
			for(int i = 0; i < n-8; i+= 6) 
			{
			    int stride = i/3; 	    	
			    board[x+i][y] = base[x][y%4]+ temp*12 + 3*n*stride;
			    if(x+3+i < n-8)
			    	board[x+3+i][n-y-1] = base[x][y%4]+ temp*12 + 3*n*(stride+1);
			}
		    }// end of if
		    else
		    {
			for(int i = 0 ; i < n-8; i+= 6)
			{
			    int stride = i/3;
			    if(n % 4 == 0)
			    {
			    	board[x+i][y] = base8[x][y-blockOfFour(n)]+BaseOfFour*12 + 3*n*stride;
				if(x+3+i < n-8)// Don't want to get in the 8 stride
				board[x+3+i][n-y-1] = base8[x][y-blockOfFour(n)]+ BaseOfFour*12 + 3*n*(stride+1);
			    }
 			    if(n % 4 == 1)
			    {
			    	board[x+i][y] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-8) // Don't want to get in the 8 stride
				   board[x+3+i][n-y-1] = base13[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			    if(n % 4 == 2)
			    {
			    	board[x+i][y] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-8) // Don't want to get in the 8 stride
				   board[x+3+i][n-y-1] = base14[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			    if(n % 4 == 3)
			    {
			    	board[x+i][y] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*stride;
				if(x+3+i < n-8) // Don't want to get in the 8 stride
				   board[x+3+i][n-y-1] = base7[x][y-blockOfFour(n)]+ BaseOfFour * 12 + 3*n*(stride+1);
			    }
			}
		    }// end of else
	       }// end of for y   
	   }// end of big 4
	// Handling 8*n stride here
	 if(n%2 == 0)
	   {
		   for(int x = 0; x < 8; x++)
		   {
			for(int y = 0; y < n-8 ; y++) // NOTE !!!!
			{
			    if(y%6 == 0) //0,6,12....
			    {
				int temp = y/6;
			    	board[n+x-8][y] = tranposeBase8[x][y%3]+ 2*temp*24 + (n-8)*n; // minus 8 because we want to start at line n-8
				board[n+x-8][y+1] = tranposeBase8[x][y%3+1]+ 2*temp*24 + (n-8)*n;
				board[n+x-8][y+2] = tranposeBase8[x][y%3+2]+ 2*temp*24 + (n-8)*n;
			    }
			    else if( y%3 == 0) //3,9,15,21...
			    {
				int temp = y/6;
			    	board[n-x-1][y] = tranposeBase8[x][y%3]+ 24 + 2*temp*24 + (n-8)*n;
				board[n-x-1][y+1] = tranposeBase8[x][y%3+1]+ 24 + 2*temp*24+ (n-8)*n;
				board[n-x-1][y+2] = tranposeBase8[x][y%3+2]+ 24 + 2*temp*24+ (n-8)*n;
			    }
			}
		   }
		   //handling 8*8 chessboard here
		   for(int x = 0; x < 8; x++)
		   {
			for(int y = 0; y < 8 ; y++)
			{
			    board[n+x-8][n+y-8] = board8[x][y] + (n*n-64);
			}
		   }
           } else
		{
		for(int x = 0; x < 8; x++)
		   {
			for(int y = n; y > 8 ; y--) // NOTE !!!!
			{
			    if((n-y)%6 == 0) // n-y because we start from ending
			    {
				int temp = (n-y)/6; // getting index of block 8*3
			    	board[n+x-8][y-1] = tranposeBase8[x][(n-y)%3] + 2*temp*24 + (n-8)*n;
				board[n+x-8][y-2] = tranposeBase8[x][(n-y)%3+1] + 2*temp*24 + (n-8)*n;
				board[n+x-8][y-3] = tranposeBase8[x][(n-y)%3+2] + 2*temp*24 + (n-8)*n; 
			    }
			    else if((n-y)%3 == 0) // n-y because we start from ending
			    {
				int temp = (n-y)/6; // getting index of block 8*3
			    	board[n-x-1][y-1] = tranposeBase8[x][(n-y)%3] + 24 +  2*temp*24 + (n-8)*n; // note 24 = 3*8 
				board[n-x-1][y-2] = tranposeBase8[x][(n-y)%3+1]+ 24 + 2*temp*24 + (n-8)*n;
				board[n-x-1][y-3] = tranposeBase8[x][(n-y)%3+2]+ 24 + 2*temp*24 + (n-8)*n;
			    }
			}
		   }
		   //handling 7*7 chessboard here
		   for(int x = 7; x >= 0; x--)
		   {
			for(int y = 7; y >=0 ; y--)
			{
			    board[n+x-7][y] = board8[7-x][7-y] + (n*n-64);
			    //cout << "testing" << endl;
			}
		   }
	   }// end of else
    } // end of switch


    // print out the thingy
    
    /*for (int x = 0; x < n; x++) {
        for (int y = 0; y < n; y++)
            cout << board[x][y]<< "\t";
        cout << endl;
    }*/
    
}

int main()
{
    loadData();
    int n;
    cout << "Enter size of board:";
    cin >> n;
    unsigned long int cpuTime = monotonicTime();
    solveBoard(n);
    cpuTime = monotonicTime() - cpuTime;  
    fprintf(stderr, "Time to perform operation on CPU = %ld ns\n", cpuTime);
    /*for(int x = 0; x < 3; x++)
    {
	for(int y = 0; y < 8 ; y++)
	    	cout << base8[x][y] << "\t";                
	cout << endl;
    }
    for(int x = 0; x < 8; x++)
    {
	for(int y = 0; y < 3 ; y++)
	    	cout << tranposeBase8[x][y] << "\t";   
	cout << endl;             
    }*/
    return 0;
}

	.text
	.file	"Parrallel.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z8loadDatav
.LCPI0_0:
	.long	1                               # 0x1
	.long	4                               # 0x4
	.long	7                               # 0x7
	.long	10                              # 0xa
.LCPI0_1:
	.long	8                               # 0x8
	.long	11                              # 0xb
	.long	2                               # 0x2
	.long	5                               # 0x5
.LCPI0_2:
	.long	3                               # 0x3
	.long	6                               # 0x6
	.long	9                               # 0x9
	.long	12                              # 0xc
.LCPI0_3:
	.long	1                               # 0x1
	.long	14                              # 0xe
	.long	17                              # 0x11
	.long	20                              # 0x14
.LCPI0_4:
	.long	9                               # 0x9
	.long	4                               # 0x4
	.long	7                               # 0x7
	.long	16                              # 0x10
.LCPI0_5:
	.long	19                              # 0x13
	.long	12                              # 0xc
	.long	3                               # 0x3
	.long	6                               # 0x6
.LCPI0_6:
	.long	21                              # 0x15
	.long	10                              # 0xa
	.long	13                              # 0xd
	.long	2                               # 0x2
.LCPI0_7:
	.long	15                              # 0xf
	.long	18                              # 0x12
	.long	11                              # 0xb
	.long	8                               # 0x8
.LCPI0_8:
	.long	1                               # 0x1
	.long	16                              # 0x10
	.long	3                               # 0x3
	.long	22                              # 0x16
.LCPI0_9:
	.long	19                              # 0x13
	.long	12                              # 0xc
	.long	7                               # 0x7
	.long	10                              # 0xa
.LCPI0_10:
	.long	4                               # 0x4
	.long	21                              # 0x15
	.long	18                              # 0x12
	.long	15                              # 0xf
.LCPI0_11:
	.long	6                               # 0x6
	.long	9                               # 0x9
	.long	24                              # 0x18
	.long	13                              # 0xd
.LCPI0_12:
	.long	17                              # 0x11
	.long	2                               # 0x2
	.long	5                               # 0x5
	.long	20                              # 0x14
.LCPI0_13:
	.long	23                              # 0x17
	.long	14                              # 0xe
	.long	11                              # 0xb
	.long	8                               # 0x8
.LCPI0_14:
	.long	1                               # 0x1
	.long	4                               # 0x4
	.long	13                              # 0xd
	.long	16                              # 0x10
.LCPI0_15:
	.long	21                              # 0x15
	.long	8                               # 0x8
	.long	23                              # 0x17
	.long	18                              # 0x12
.LCPI0_16:
	.long	35                              # 0x23
	.long	38                              # 0x26
	.long	27                              # 0x1b
	.long	32                              # 0x20
.LCPI0_17:
	.long	29                              # 0x1d
	.long	12                              # 0xc
	.long	15                              # 0xf
	.long	6                               # 0x6
.LCPI0_18:
	.long	3                               # 0x3
	.long	10                              # 0xa
	.long	17                              # 0x11
	.long	20                              # 0x14
.LCPI0_19:
	.long	37                              # 0x25
	.long	24                              # 0x18
	.long	33                              # 0x21
	.long	30                              # 0x1e
.LCPI0_20:
	.long	39                              # 0x27
	.long	26                              # 0x1a
	.long	5                               # 0x5
	.long	2                               # 0x2
.LCPI0_21:
	.long	11                              # 0xb
	.long	14                              # 0xe
	.long	7                               # 0x7
	.long	22                              # 0x16
.LCPI0_22:
	.long	9                               # 0x9
	.long	34                              # 0x22
	.long	19                              # 0x13
	.long	36                              # 0x24
.LCPI0_23:
	.long	1                               # 0x1
	.long	26                              # 0x1a
	.long	11                              # 0xb
	.long	46                              # 0x2e
.LCPI0_24:
	.long	29                              # 0x1d
	.long	24                              # 0x18
	.long	9                               # 0x9
	.long	12                              # 0xc
.LCPI0_25:
	.long	45                              # 0x2d
	.long	28                              # 0x1c
	.long	25                              # 0x19
	.long	10                              # 0xa
.LCPI0_26:
	.long	47                              # 0x2f
	.long	30                              # 0x1e
	.long	27                              # 0x1b
	.long	2                               # 0x2
.LCPI0_27:
	.long	35                              # 0x23
	.long	44                              # 0x2c
	.long	49                              # 0x31
	.long	8                               # 0x8
.LCPI0_28:
	.long	23                              # 0x17
	.long	40                              # 0x28
	.long	13                              # 0xd
	.long	42                              # 0x2a
.LCPI0_29:
	.long	19                              # 0x13
	.long	36                              # 0x24
	.long	31                              # 0x1f
	.long	48                              # 0x30
.LCPI0_30:
	.long	3                               # 0x3
	.long	16                              # 0x10
	.long	39                              # 0x27
	.long	34                              # 0x22
.LCPI0_31:
	.long	43                              # 0x2b
	.long	22                              # 0x16
	.long	7                               # 0x7
	.long	14                              # 0xe
.LCPI0_32:
	.long	41                              # 0x29
	.long	18                              # 0x12
	.long	5                               # 0x5
	.long	20                              # 0x14
.LCPI0_33:
	.long	37                              # 0x25
	.long	32                              # 0x20
	.long	17                              # 0x11
	.long	4                               # 0x4
.LCPI0_34:
	.long	15                              # 0xf
	.long	38                              # 0x26
	.long	33                              # 0x21
	.long	6                               # 0x6
.LCPI0_35:
	.long	1                               # 0x1
	.long	46                              # 0x2e
	.long	15                              # 0xf
	.long	24                              # 0x18
.LCPI0_36:
	.long	59                              # 0x3b
	.long	28                              # 0x1c
	.long	13                              # 0xd
	.long	26                              # 0x1a
.LCPI0_37:
	.long	16                              # 0x10
	.long	23                              # 0x17
	.long	58                              # 0x3a
	.long	51                              # 0x33
.LCPI0_38:
	.long	14                              # 0xe
	.long	25                              # 0x19
	.long	64                              # 0x40
	.long	29                              # 0x1d
.LCPI0_39:
	.long	47                              # 0x2f
	.long	2                               # 0x2
	.long	45                              # 0x2d
	.long	54                              # 0x36
.LCPI0_40:
	.long	63                              # 0x3f
	.long	60                              # 0x3c
	.long	27                              # 0x1b
	.long	12                              # 0xc
.LCPI0_41:
	.long	22                              # 0x16
	.long	17                              # 0x11
	.long	52                              # 0x34
	.long	57                              # 0x39
.LCPI0_42:
	.long	50                              # 0x32
	.long	55                              # 0x37
	.long	30                              # 0x1e
	.long	61                              # 0x3d
.LCPI0_43:
	.long	3                               # 0x3
	.long	48                              # 0x30
	.long	21                              # 0x15
	.long	44                              # 0x2c
.LCPI0_44:
	.long	53                              # 0x35
	.long	62                              # 0x3e
	.long	11                              # 0xb
	.long	34                              # 0x22
.LCPI0_45:
	.long	18                              # 0x12
	.long	39                              # 0x27
	.long	42                              # 0x2a
	.long	49                              # 0x31
.LCPI0_46:
	.long	56                              # 0x38
	.long	33                              # 0x21
	.long	8                               # 0x8
	.long	31                              # 0x1f
.LCPI0_47:
	.long	41                              # 0x29
	.long	4                               # 0x4
	.long	37                              # 0x25
	.long	20                              # 0x14
.LCPI0_48:
	.long	43                              # 0x2b
	.long	6                               # 0x6
	.long	35                              # 0x23
	.long	10                              # 0xa
.LCPI0_49:
	.long	38                              # 0x26
	.long	19                              # 0x13
	.long	40                              # 0x28
	.long	5                               # 0x5
.LCPI0_50:
	.long	36                              # 0x24
	.long	9                               # 0x9
	.long	32                              # 0x20
	.long	7                               # 0x7
	.text
	.globl	_Z8loadDatav
	.type	_Z8loadDatav,@function
_Z8loadDatav:                           # @_Z8loadDatav
	.cfi_startproc
# %bb.0:
	movaps	.LCPI0_0(%rip), %xmm0           # xmm0 = [1,4,7,10]
	movaps	%xmm0, base(%rip)
	movaps	.LCPI0_1(%rip), %xmm0           # xmm0 = [8,11,2,5]
	movaps	%xmm0, base+16(%rip)
	movaps	.LCPI0_2(%rip), %xmm0           # xmm0 = [3,6,9,12]
	movaps	%xmm0, base+32(%rip)
	movaps	.LCPI0_3(%rip), %xmm0           # xmm0 = [1,14,17,20]
	movaps	%xmm0, base7(%rip)
	movl	$base7, %eax
	movaps	.LCPI0_4(%rip), %xmm0           # xmm0 = [9,4,7,16]
	movaps	%xmm0, base7+16(%rip)
	movaps	.LCPI0_5(%rip), %xmm0           # xmm0 = [19,12,3,6]
	movaps	%xmm0, base7+32(%rip)
	movaps	.LCPI0_6(%rip), %xmm0           # xmm0 = [21,10,13,2]
	movaps	%xmm0, base7+48(%rip)
	movaps	.LCPI0_7(%rip), %xmm0           # xmm0 = [15,18,11,8]
	movaps	%xmm0, base7+64(%rip)
	movl	$5, base7+80(%rip)
	movl	$tranposeBase7, %ecx
	xorl	%edx, %edx
.LBB0_1:                                # %.preheader69
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_2 Depth 2
	movq	%rcx, %rsi
	xorl	%edi, %edi
.LBB0_2:                                #   Parent Loop BB0_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%rax,%rdi,4), %r8d
	movl	%r8d, (%rsi)
	incq	%rdi
	addq	$12, %rsi
	cmpq	$7, %rdi
	jne	.LBB0_2
# %bb.3:                                #   in Loop: Header=BB0_1 Depth=1
	incq	%rdx
	addq	$28, %rax
	addq	$4, %rcx
	cmpq	$3, %rdx
	jne	.LBB0_1
# %bb.4:
	movaps	.LCPI0_8(%rip), %xmm0           # xmm0 = [1,16,3,22]
	movaps	%xmm0, base8(%rip)
	movl	$base8, %eax
	movaps	.LCPI0_9(%rip), %xmm0           # xmm0 = [19,12,7,10]
	movaps	%xmm0, base8+16(%rip)
	movaps	.LCPI0_10(%rip), %xmm0          # xmm0 = [4,21,18,15]
	movaps	%xmm0, base8+32(%rip)
	movaps	.LCPI0_11(%rip), %xmm0          # xmm0 = [6,9,24,13]
	movaps	%xmm0, base8+48(%rip)
	movaps	.LCPI0_12(%rip), %xmm0          # xmm0 = [17,2,5,20]
	movaps	%xmm0, base8+64(%rip)
	movaps	.LCPI0_13(%rip), %xmm0          # xmm0 = [23,14,11,8]
	movaps	%xmm0, base8+80(%rip)
	movl	$tranposeBase8, %ecx
	xorl	%edx, %edx
.LBB0_5:                                # %.preheader68
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_6 Depth 2
	movq	%rcx, %rsi
	xorl	%edi, %edi
.LBB0_6:                                #   Parent Loop BB0_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%rax,%rdi,4), %r8d
	movl	%r8d, (%rsi)
	incq	%rdi
	addq	$12, %rsi
	cmpq	$8, %rdi
	jne	.LBB0_6
# %bb.7:                                #   in Loop: Header=BB0_5 Depth=1
	incq	%rdx
	addq	$32, %rax
	addq	$4, %rcx
	cmpq	$3, %rdx
	jne	.LBB0_5
# %bb.8:                                # %.preheader66.preheader
	movl	$base11, %eax
	leaq	base7-16(%rip), %rcx
	movl	$base, %edx
	xorl	%esi, %esi
.LBB0_9:                                # %.preheader66
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_10 Depth 2
	xorl	%edi, %edi
.LBB0_10:                               #   Parent Loop BB0_9 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	$3, %rdi
	ja	.LBB0_17
# %bb.11:                               #   in Loop: Header=BB0_10 Depth=2
	movl	(%rdx,%rdi,4), %r8d
	jmp	.LBB0_18
.LBB0_17:                               #   in Loop: Header=BB0_10 Depth=2
	movl	(%rcx,%rdi,4), %r8d
	addl	$12, %r8d
.LBB0_18:                               #   in Loop: Header=BB0_10 Depth=2
	movl	%r8d, (%rax,%rdi,4)
	incq	%rdi
	cmpq	$11, %rdi
	jne	.LBB0_10
# %bb.12:                               #   in Loop: Header=BB0_9 Depth=1
	incq	%rsi
	addq	$44, %rax
	addq	$28, %rcx
	addq	$16, %rdx
	cmpq	$3, %rsi
	jne	.LBB0_9
# %bb.13:                               # %.preheader64.preheader
	movl	$base12, %eax
	leaq	base8-16(%rip), %rcx
	movl	$base, %edx
	xorl	%esi, %esi
.LBB0_14:                               # %.preheader64
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_15 Depth 2
	xorl	%edi, %edi
.LBB0_15:                               #   Parent Loop BB0_14 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	$3, %rdi
	ja	.LBB0_24
# %bb.16:                               #   in Loop: Header=BB0_15 Depth=2
	movl	(%rdx,%rdi,4), %r8d
	jmp	.LBB0_25
.LBB0_24:                               #   in Loop: Header=BB0_15 Depth=2
	movl	(%rcx,%rdi,4), %r8d
	addl	$12, %r8d
.LBB0_25:                               #   in Loop: Header=BB0_15 Depth=2
	movl	%r8d, (%rax,%rdi,4)
	incq	%rdi
	cmpq	$12, %rdi
	jne	.LBB0_15
# %bb.19:                               #   in Loop: Header=BB0_14 Depth=1
	incq	%rsi
	addq	$48, %rax
	addq	$32, %rcx
	addq	$16, %rdx
	cmpq	$3, %rsi
	jne	.LBB0_14
# %bb.20:
	movaps	.LCPI0_14(%rip), %xmm0          # xmm0 = [1,4,13,16]
	movaps	%xmm0, base13(%rip)
	movaps	.LCPI0_15(%rip), %xmm0          # xmm0 = [21,8,23,18]
	movaps	%xmm0, base13+16(%rip)
	movaps	.LCPI0_16(%rip), %xmm0          # xmm0 = [35,38,27,32]
	movaps	%xmm0, base13+32(%rip)
	movaps	.LCPI0_17(%rip), %xmm0          # xmm0 = [29,12,15,6]
	movaps	%xmm0, base13+48(%rip)
	movaps	.LCPI0_18(%rip), %xmm0          # xmm0 = [3,10,17,20]
	movaps	%xmm0, base13+64(%rip)
	movaps	.LCPI0_19(%rip), %xmm0          # xmm0 = [37,24,33,30]
	movaps	%xmm0, base13+80(%rip)
	movaps	.LCPI0_20(%rip), %xmm0          # xmm0 = [39,26,5,2]
	movaps	%xmm0, base13+96(%rip)
	movaps	.LCPI0_21(%rip), %xmm0          # xmm0 = [11,14,7,22]
	movaps	%xmm0, base13+112(%rip)
	movaps	.LCPI0_22(%rip), %xmm0          # xmm0 = [9,34,19,36]
	movaps	%xmm0, base13+128(%rip)
	movabsq	$120259084313, %rax             # imm = 0x1C00000019
	movq	%rax, base13+144(%rip)
	movl	$31, base13+152(%rip)
	movl	$base14, %eax
	leaq	base7-28(%rip), %rcx
	xorl	%edx, %edx
.LBB0_21:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_22 Depth 2
	xorl	%esi, %esi
.LBB0_22:                               #   Parent Loop BB0_21 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	$6, %rsi
	ja	.LBB0_28
# %bb.23:                               #   in Loop: Header=BB0_22 Depth=2
	movl	28(%rcx,%rsi,4), %edi
	jmp	.LBB0_29
.LBB0_28:                               #   in Loop: Header=BB0_22 Depth=2
	movl	(%rcx,%rsi,4), %edi
	addl	$21, %edi
.LBB0_29:                               #   in Loop: Header=BB0_22 Depth=2
	movl	%edi, (%rax,%rsi,4)
	incq	%rsi
	cmpq	$14, %rsi
	jne	.LBB0_22
# %bb.26:                               #   in Loop: Header=BB0_21 Depth=1
	incq	%rdx
	addq	$56, %rax
	addq	$28, %rcx
	cmpq	$3, %rdx
	jne	.LBB0_21
# %bb.27:
	movaps	.LCPI0_23(%rip), %xmm0          # xmm0 = [1,26,11,46]
	movaps	%xmm0, board7(%rip)
	movaps	.LCPI0_24(%rip), %xmm0          # xmm0 = [29,24,9,12]
	movaps	%xmm0, board7+16(%rip)
	movaps	.LCPI0_25(%rip), %xmm0          # xmm0 = [45,28,25,10]
	movaps	%xmm0, board7+32(%rip)
	movaps	.LCPI0_26(%rip), %xmm0          # xmm0 = [47,30,27,2]
	movaps	%xmm0, board7+48(%rip)
	movaps	.LCPI0_27(%rip), %xmm0          # xmm0 = [35,44,49,8]
	movaps	%xmm0, board7+64(%rip)
	movaps	.LCPI0_28(%rip), %xmm0          # xmm0 = [23,40,13,42]
	movaps	%xmm0, board7+80(%rip)
	movaps	.LCPI0_29(%rip), %xmm0          # xmm0 = [19,36,31,48]
	movaps	%xmm0, board7+96(%rip)
	movaps	.LCPI0_30(%rip), %xmm0          # xmm0 = [3,16,39,34]
	movaps	%xmm0, board7+112(%rip)
	movaps	.LCPI0_31(%rip), %xmm0          # xmm0 = [43,22,7,14]
	movaps	%xmm0, board7+128(%rip)
	movaps	.LCPI0_32(%rip), %xmm0          # xmm0 = [41,18,5,20]
	movaps	%xmm0, board7+144(%rip)
	movaps	.LCPI0_33(%rip), %xmm0          # xmm0 = [37,32,17,4]
	movaps	%xmm0, board7+160(%rip)
	movaps	.LCPI0_34(%rip), %xmm0          # xmm0 = [15,38,33,6]
	movaps	%xmm0, board7+176(%rip)
	movl	$21, board7+192(%rip)
	movaps	.LCPI0_35(%rip), %xmm0          # xmm0 = [1,46,15,24]
	movaps	%xmm0, board8(%rip)
	movaps	.LCPI0_36(%rip), %xmm0          # xmm0 = [59,28,13,26]
	movaps	%xmm0, board8+16(%rip)
	movaps	.LCPI0_37(%rip), %xmm0          # xmm0 = [16,23,58,51]
	movaps	%xmm0, board8+32(%rip)
	movaps	.LCPI0_38(%rip), %xmm0          # xmm0 = [14,25,64,29]
	movaps	%xmm0, board8+48(%rip)
	movaps	.LCPI0_39(%rip), %xmm0          # xmm0 = [47,2,45,54]
	movaps	%xmm0, board8+64(%rip)
	movaps	.LCPI0_40(%rip), %xmm0          # xmm0 = [63,60,27,12]
	movaps	%xmm0, board8+80(%rip)
	movaps	.LCPI0_41(%rip), %xmm0          # xmm0 = [22,17,52,57]
	movaps	%xmm0, board8+96(%rip)
	movaps	.LCPI0_42(%rip), %xmm0          # xmm0 = [50,55,30,61]
	movaps	%xmm0, board8+112(%rip)
	movaps	.LCPI0_43(%rip), %xmm0          # xmm0 = [3,48,21,44]
	movaps	%xmm0, board8+128(%rip)
	movaps	.LCPI0_44(%rip), %xmm0          # xmm0 = [53,62,11,34]
	movaps	%xmm0, board8+144(%rip)
	movaps	.LCPI0_45(%rip), %xmm0          # xmm0 = [18,39,42,49]
	movaps	%xmm0, board8+160(%rip)
	movaps	.LCPI0_46(%rip), %xmm0          # xmm0 = [56,33,8,31]
	movaps	%xmm0, board8+176(%rip)
	movaps	.LCPI0_47(%rip), %xmm0          # xmm0 = [41,4,37,20]
	movaps	%xmm0, board8+192(%rip)
	movaps	.LCPI0_48(%rip), %xmm0          # xmm0 = [43,6,35,10]
	movaps	%xmm0, board8+208(%rip)
	movaps	.LCPI0_49(%rip), %xmm0          # xmm0 = [38,19,40,5]
	movaps	%xmm0, board8+224(%rip)
	movaps	.LCPI0_50(%rip), %xmm0          # xmm0 = [36,9,32,7]
	movaps	%xmm0, board8+240(%rip)
	retq
.Lfunc_end0:
	.size	_Z8loadDatav, .Lfunc_end0-_Z8loadDatav
	.cfi_endproc
                                        # -- End function
	.globl	_Z11blockOfFouri                # -- Begin function _Z11blockOfFouri
	.type	_Z11blockOfFouri,@function
_Z11blockOfFouri:                       # @_Z11blockOfFouri
	.cfi_startproc
# %bb.0:
	xorl	%eax, %eax
	cmpl	$11, %edi
	jl	.LBB1_7
# %bb.1:
	movl	%edi, %eax
	andl	$3, %eax
	jmpq	*.LJTI1_0(,%rax,8)
.LBB1_2:
	addl	$-8, %edi
	jmp	.LBB1_6
.LBB1_4:
	addl	$-14, %edi
	jmp	.LBB1_6
.LBB1_5:
	addl	$-7, %edi
	jmp	.LBB1_6
.LBB1_3:
	addl	$-13, %edi
.LBB1_6:
	movl	%edi, %eax
.LBB1_7:
	retq
.Lfunc_end1:
	.size	_Z11blockOfFouri, .Lfunc_end1-_Z11blockOfFouri
	.cfi_endproc
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
.LJTI1_0:
	.quad	.LBB1_2
	.quad	.LBB1_3
	.quad	.LBB1_4
	.quad	.LBB1_5
                                        # -- End function
	.text
	.globl	_Z10solveBoardi                 # -- Begin function _Z10solveBoardi
	.type	_Z10solveBoardi,@function
_Z10solveBoardi:                        # @_Z10solveBoardi
	.cfi_startproc
# %bb.0:                                # %_Z11blockOfFouri.exit
	retq
.Lfunc_end2:
	.size	_Z10solveBoardi, .Lfunc_end2-_Z10solveBoardi
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	callq	_Z8loadDatav
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$20, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	leaq	12(%rsp), %rsi
	movl	$_ZSt3cin, %edi
	callq	_ZNSirsERi
	leaq	16(%rsp), %rbx
	movl	$1, %edi
	movq	%rbx, %rsi
	callq	clock_gettime
	movq	(%rbx), %r14
	movq	8(%rbx), %r15
	leaq	16(%rsp), %rbx
	movl	$1, %edi
	movq	%rbx, %rsi
	callq	clock_gettime
	movq	(%rbx), %rax
	subq	%r14, %rax
	movq	8(%rbx), %rcx
	subq	%r15, %rcx
	imulq	$1000000000, %rax, %rdx         # imm = 0x3B9ACA00
	addq	%rcx, %rdx
	movq	stderr(%rip), %rdi
	movl	$.L.str.1, %esi
	xorl	%eax, %eax
	callq	fprintf
	xorl	%eax, %eax
	addq	$32, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.type	base,@object                    # @base
	.bss
	.globl	base
	.p2align	4, 0x0
base:
	.zero	48
	.size	base, 48

	.type	base7,@object                   # @base7
	.globl	base7
	.p2align	4, 0x0
base7:
	.zero	84
	.size	base7, 84

	.type	tranposeBase7,@object           # @tranposeBase7
	.globl	tranposeBase7
	.p2align	4, 0x0
tranposeBase7:
	.zero	84
	.size	tranposeBase7, 84

	.type	base8,@object                   # @base8
	.globl	base8
	.p2align	4, 0x0
base8:
	.zero	96
	.size	base8, 96

	.type	tranposeBase8,@object           # @tranposeBase8
	.globl	tranposeBase8
	.p2align	4, 0x0
tranposeBase8:
	.zero	96
	.size	tranposeBase8, 96

	.type	base11,@object                  # @base11
	.globl	base11
	.p2align	4, 0x0
base11:
	.zero	132
	.size	base11, 132

	.type	base12,@object                  # @base12
	.globl	base12
	.p2align	4, 0x0
base12:
	.zero	144
	.size	base12, 144

	.type	base13,@object                  # @base13
	.globl	base13
	.p2align	4, 0x0
base13:
	.zero	156
	.size	base13, 156

	.type	base14,@object                  # @base14
	.globl	base14
	.p2align	4, 0x0
base14:
	.zero	168
	.size	base14, 168

	.type	board7,@object                  # @board7
	.globl	board7
	.p2align	4, 0x0
board7:
	.zero	196
	.size	board7, 196

	.type	board8,@object                  # @board8
	.globl	board8
	.p2align	4, 0x0
board8:
	.zero	256
	.size	board8, 256

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Enter size of board:"
	.size	.L.str, 21

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Time to perform operation on CPU = %ld ns\n"
	.size	.L.str.1, 43

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _ZSt4cout
	.addrsig_sym _ZSt3cin
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
