#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int board[16][16] , lock[16][16];
__global__
void possible_move(int sqr , int row,int col ,int move ,int n,int *brd, int *flag){
int tid = threadIdx.x;
if(brd[row*n + tid]==move||brd[tid*n + col]==move||brd[((row/sqr)*sqr+tid/sqr)*n + (col/sqr)*sqr+tid%sqr]==move)
    *flag=1;
}
void print_board(int n){
  int i ,t1;
  for ( i = 0; i < n; i++) {
    for (t1  = 0; t1 < n; t1++) {
      printf("%d  ",board[i][t1]);
    }
    printf("\n");
  }
}
void solve(int n)
{
  int i, j ,k,sqr,*ibd,*flag,size,zero;
  size = sizeof(int);
  sqr=sqrt(n);
  zero=0;
  cudaMalloc(&ibd,size*n*n);
  cudaMalloc(&flag,size);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(board[i][j]==0){
        for(k=0;k<=n;k++){
        cudaMemcpy(flag,&zero,size,cudaMemcpyHostToDevice);
        for(int t=0; t<n; t++){
            cudaMemcpy(ibd+t*n,(int *)board[t],size*n,cudaMemcpyHostToDevice);
        }
        possible_move<<<1,n>>>(sqr,i,j,k,n,ibd,flag);
        cudaMemcpy(&zero,flag,size,cudaMemcpyDeviceToHost);
      if(zero==0)
            {board[i][j]=k;break;}
          else{
            if(k==n){
              if(i==0&&j==0)
                return;
              lock:;
              if(j==0){
                j=n;
                i--;
                if(lock[i][j]==1)
                  goto lock;
                k=board[i][j];
                board[i][j]=0;
              }
              else{
                j--;
                if(lock[i][j]==1)
                  goto lock;
                k=board[i][j];
                board[i][j]=0;
              }
              if(k==n){
                goto lock;
              }
            }
            zero=0;
          }
        }
      }
      printf("\nNextmove %d %d\n",i,j);
      print_board(n);
    }
  }
}
int main(){
  int n,**s,i,p,t1,t2,t3;
  float t4;
  printf("Enter Board Size:");
  while(1){
    scanf("%d",&n);
    t4 = sqrt(n);
    if(n==(int)t4*(int)t4)
      break;
    printf("Enter correct Boards size:");
  }
//Predefined board Numbers
  printf("Enter no. of Predefined numbers:");
  scanf("%d",&p );
  for(i=0;i<p;i++){
    scanf("%d%d%d",&t1,&t2,&t3);
    if(t1<=n&&t2<=n&&t3<=n&&t1>0&&t2>0&&t3>0){
      board[t1-1][t2-1]=t3;
      lock[t1-1][t2-1]=1;
    }
}

  //Print board
  printf("\nInitial Board\n");
  print_board(n);
  //solve board
  solve(n);
  printf("\nFinal Board\n");
  print_board(n);
  return 0;
}

	.file	"tmpxft_00374c3b_00000000-6_gpusudokusolver.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2032:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2032:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d  "
.LC1:
	.string	"\n"
	.text
	.globl	_Z11print_boardi
	.type	_Z11print_boardi, @function
_Z11print_boardi:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movslq	%edi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r14, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	pushq	%rdx
	.cfi_def_cfa_offset 64
.L3:
	cmpl	%ebx, %ebp
	jle	.L9
	movq	%rbx, %r13
	leaq	board(%rip), %rax
	xorl	%r12d, %r12d
	salq	$6, %r13
	leaq	.LC0(%rip), %r15
	addq	%rax, %r13
.L4:
	movl	0(%r13,%r12,4), %edx
	movq	%r15, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r12
	call	__printf_chk@PLT
	cmpq	%r14, %r12
	jne	.L4
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L3
.L9:
	popq	%rax
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z11print_boardi, .-_Z11print_boardi
	.globl	_Z40__device_stub__Z13possible_moveiiiiiPiS_iiiiiPiS_
	.type	_Z40__device_stub__Z13possible_moveiiiiiPiS_iiiiiPiS_, @function
_Z40__device_stub__Z13possible_moveiiiiiPiS_iiiiiPiS_:
.LFB2054:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	192(%rsp), %rax
	movl	%edi, 44(%rsp)
	leaq	64(%rsp), %rdi
	movl	%esi, 40(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 36(%rsp)
	leaq	48(%rsp), %rdx
	movl	%ecx, 32(%rsp)
	leaq	56(%rsp), %rcx
	movl	%r8d, 28(%rsp)
	movq	%r9, 16(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L10
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z13possible_moveiiiiiPiS_(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 208
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L10:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2054:
	.size	_Z40__device_stub__Z13possible_moveiiiiiPiS_iiiiiPiS_, .-_Z40__device_stub__Z13possible_moveiiiiiPiS_iiiiiPiS_
	.globl	_Z13possible_moveiiiiiPiS_
	.type	_Z13possible_moveiiiiiPiS_, @function
_Z13possible_moveiiiiiPiS_:
.LFB2055:
	.cfi_startproc
	endbr64
	jmp	_Z40__device_stub__Z13possible_moveiiiiiPiS_iiiiiPiS_
	.cfi_endproc
.LFE2055:
	.size	_Z13possible_moveiiiiiPiS_, .-_Z13possible_moveiiiiiPiS_
	.section	.rodata.str1.1
.LC2:
	.string	"\nNextmove %d %d\n"
	.text
	.globl	_Z5solvei
	.type	_Z5solvei, @function
_Z5solvei:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	cvtsi2sdl	%r15d, %xmm0
	leaq	board(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r15, %rbx
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	call	sqrt@PLT
	movl	%r15d, %esi
	xorl	%r10d, %r10d
	leaq	64(%rsp), %rdi
	imull	%r15d, %esi
	movl	%r10d, 60(%rsp)
	cvttsd2sil	%xmm0, %eax
	sall	$2, %esi
	movslq	%esi, %rsi
	movl	%eax, 40(%rsp)
	call	cudaMalloc@PLT
	leaq	72(%rsp), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	leal	0(,%r15,4), %eax
	cltq
	movq	%rax, 8(%rsp)
	leaq	0(,%r15,4), %rax
	movq	%rax, 16(%rsp)
.L16:
	cmpl	%ebx, %r12d
	jge	.L15
	xorl	%ebp, %ebp
.L31:
	cmpl	%ebx, %ebp
	jge	.L39
	movslq	%r12d, %rax
	movslq	%ebp, %rdx
	salq	$4, %rax
	addq	%rdx, %rax
	cmpl	$0, (%r14,%rax,4)
	jne	.L18
	xorl	%r13d, %r13d
.L17:
	cmpl	%ebx, %r13d
	jg	.L18
	leaq	60(%rsp), %rax
	movq	72(%rsp), %rdi
	movl	$1, %ecx
	movl	$4, %edx
	movq	%rax, %rsi
	movq	%rax, (%rsp)
	call	cudaMemcpy@PLT
	leaq	board(%rip), %rsi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
.L19:
	cmpl	%ebx, %r8d
	jge	.L40
	movq	8(%rsp), %rdx
	movq	%r9, %rdi
	movl	$1, %ecx
	addq	64(%rsp), %rdi
	movl	%r8d, 44(%rsp)
	movq	%r9, 32(%rsp)
	movq	%rsi, 24(%rsp)
	call	cudaMemcpy@PLT
	movl	44(%rsp), %r8d
	movq	16(%rsp), %rax
	movq	32(%rsp), %r9
	movq	24(%rsp), %rsi
	incl	%r8d
	addq	%rax, %r9
	addq	$64, %rsi
	jmp	.L19
.L40:
	movl	%ebx, 92(%rsp)
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %esi
	movabsq	$4294967297, %rax
	movq	%rax, 96(%rsp)
	movl	100(%rsp), %ecx
	movq	%rax, %rdi
	movq	92(%rsp), %rdx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L21
	pushq	%rdi
	.cfi_def_cfa_offset 184
	movl	%ebx, %r8d
	movl	%r13d, %ecx
	movl	%ebp, %edx
	pushq	80(%rsp)
	.cfi_def_cfa_offset 192
	movq	80(%rsp), %r9
	movl	%r12d, %esi
	movl	56(%rsp), %edi
	call	_Z40__device_stub__Z13possible_moveiiiiiPiS_iiiiiPiS_
	popq	%r8
	.cfi_def_cfa_offset 184
	popq	%r9
	.cfi_def_cfa_offset 176
.L21:
	movq	72(%rsp), %rsi
	movq	(%rsp), %rdi
	movl	$2, %ecx
	movl	$4, %edx
	call	cudaMemcpy@PLT
	cmpl	$0, 60(%rsp)
	jne	.L22
	movslq	%r12d, %rax
	movslq	%ebp, %rdx
	salq	$4, %rax
	addq	%rdx, %rax
	movl	%r13d, (%r14,%rax,4)
	jmp	.L18
.L22:
	cmpl	%ebx, %r13d
	jne	.L24
	movl	%r12d, %eax
	orl	%ebp, %eax
	je	.L15
	leaq	lock(%rip), %rdx
.L25:
	testl	%ebp, %ebp
	jne	.L26
	decl	%r12d
	movslq	%r12d, %rax
	salq	$4, %rax
	addq	%r15, %rax
	cmpl	$1, (%rdx,%rax,4)
	jne	.L41
	movl	%ebx, %ebp
	jmp	.L25
.L41:
	xorl	%esi, %esi
	movl	(%r14,%rax,4), %r13d
	movl	%ebx, %ebp
	movl	%esi, (%r14,%rax,4)
	jmp	.L28
.L26:
	decl	%ebp
	movslq	%r12d, %rax
	salq	$4, %rax
	movslq	%ebp, %rcx
	addq	%rcx, %rax
	cmpl	$1, (%rdx,%rax,4)
	je	.L25
	xorl	%ecx, %ecx
	movl	(%r14,%rax,4), %r13d
	movl	%ecx, (%r14,%rax,4)
.L28:
	cmpl	%ebx, %r13d
	je	.L25
.L24:
	xorl	%eax, %eax
	incl	%r13d
	movl	%eax, 60(%rsp)
	jmp	.L17
.L18:
	movl	%ebp, %ecx
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	incl	%ebp
	call	__printf_chk@PLT
	movl	%ebx, %edi
	call	_Z11print_boardi
	jmp	.L31
.L39:
	incl	%r12d
	jmp	.L16
.L15:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	addq	$120, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z5solvei, .-_Z5solvei
	.section	.rodata.str1.1
.LC3:
	.string	"Enter Board Size:"
.LC4:
	.string	"%d"
.LC5:
	.string	"Enter correct Boards size:"
.LC6:
	.string	"Enter no. of Predefined numbers:"
.LC7:
	.string	"%d%d%d"
.LC8:
	.string	"\nInitial Board\n"
.LC9:
	.string	"\nFinal Board\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	.LC4(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L44:
	leaq	4(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movl	4(%rsp), %ebp
	cvtsi2sdl	%ebp, %xmm0
	call	sqrt@PLT
	cvtsd2ss	%xmm0, %xmm0
	cvttss2sil	%xmm0, %eax
	imull	%eax, %eax
	cmpl	%eax, %ebp
	je	.L43
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L44
.L43:
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%ebp, %ebp
	call	__printf_chk@PLT
	movq	%rbx, %rdi
	leaq	8(%rsp), %rsi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	.LC7(%rip), %rbx
.L45:
	cmpl	%ebp, 8(%rsp)
	jle	.L56
	leaq	12(%rsp), %rsi
	leaq	20(%rsp), %rcx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	call	__isoc23_scanf@PLT
	movl	12(%rsp), %eax
	movl	4(%rsp), %esi
	cmpl	%esi, %eax
	jg	.L46
	movl	16(%rsp), %edx
	cmpl	%edx, %esi
	jl	.L46
	movl	20(%rsp), %ecx
	cmpl	%ecx, %esi
	setge	%sil
	testl	%eax, %eax
	setg	%dil
	andl	%edi, %esi
	testl	%edx, %edx
	setg	%dil
	testb	%dil, %sil
	je	.L46
	testl	%ecx, %ecx
	jle	.L46
	decl	%eax
	decl	%edx
	cltq
	movslq	%edx, %rdx
	salq	$4, %rax
	addq	%rdx, %rax
	leaq	board(%rip), %rdx
	movl	%ecx, (%rdx,%rax,4)
	leaq	lock(%rip), %rdx
	movl	$1, (%rdx,%rax,4)
.L46:
	incl	%ebp
	jmp	.L45
.L56:
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	4(%rsp), %edi
	call	_Z11print_boardi
	movl	4(%rsp), %edi
	call	_Z5solvei
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC9(%rip), %rsi
	call	__printf_chk@PLT
	movl	4(%rsp), %edi
	call	_Z11print_boardi
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L48
	call	__stack_chk_fail@PLT
.L48:
	addq	$40, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	main, .-main
	.section	.rodata.str1.1
.LC10:
	.string	"_Z13possible_moveiiiiiPiS_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2057:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC10(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z13possible_moveiiiiiPiS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2057:
	.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	lock
	.bss
	.align 32
	.type	lock, @object
	.size	lock, 1024
lock:
	.zero	1024
	.globl	board
	.align 32
	.type	board, @object
	.size	board, 1024
board:
	.zero	1024
	.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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int board[16][16] , lock[16][16];
__global__
void possible_move(int sqr , int row,int col ,int move ,int n,int *brd, int *flag){
int tid = threadIdx.x;
if(brd[row*n + tid]==move||brd[tid*n + col]==move||brd[((row/sqr)*sqr+tid/sqr)*n + (col/sqr)*sqr+tid%sqr]==move)
    *flag=1;
}
void print_board(int n){
  int i ,t1;
  for ( i = 0; i < n; i++) {
    for (t1  = 0; t1 < n; t1++) {
      printf("%d  ",board[i][t1]);
    }
    printf("\n");
  }
}
void solve(int n)
{
  int i, j ,k,sqr,*ibd,*flag,size,zero;
  size = sizeof(int);
  sqr=sqrt(n);
  zero=0;
  hipMalloc(&ibd,size*n*n);
  hipMalloc(&flag,size);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(board[i][j]==0){
        for(k=0;k<=n;k++){
        hipMemcpy(flag,&zero,size,hipMemcpyHostToDevice);
        for(int t=0; t<n; t++){
            hipMemcpy(ibd+t*n,(int *)board[t],size*n,hipMemcpyHostToDevice);
        }
        possible_move<<<1,n>>>(sqr,i,j,k,n,ibd,flag);
        hipMemcpy(&zero,flag,size,hipMemcpyDeviceToHost);
      if(zero==0)
            {board[i][j]=k;break;}
          else{
            if(k==n){
              if(i==0&&j==0)
                return;
              lock:;
              if(j==0){
                j=n;
                i--;
                if(lock[i][j]==1)
                  goto lock;
                k=board[i][j];
                board[i][j]=0;
              }
              else{
                j--;
                if(lock[i][j]==1)
                  goto lock;
                k=board[i][j];
                board[i][j]=0;
              }
              if(k==n){
                goto lock;
              }
            }
            zero=0;
          }
        }
      }
      printf("\nNextmove %d %d\n",i,j);
      print_board(n);
    }
  }
}
int main(){
  int n,**s,i,p,t1,t2,t3;
  float t4;
  printf("Enter Board Size:");
  while(1){
    scanf("%d",&n);
    t4 = sqrt(n);
    if(n==(int)t4*(int)t4)
      break;
    printf("Enter correct Boards size:");
  }
//Predefined board Numbers
  printf("Enter no. of Predefined numbers:");
  scanf("%d",&p );
  for(i=0;i<p;i++){
    scanf("%d%d%d",&t1,&t2,&t3);
    if(t1<=n&&t2<=n&&t3<=n&&t1>0&&t2>0&&t3>0){
      board[t1-1][t2-1]=t3;
      lock[t1-1][t2-1]=1;
    }
}

  //Print board
  printf("\nInitial Board\n");
  print_board(n);
  //solve board
  solve(n);
  printf("\nFinal Board\n");
  print_board(n);
  return 0;
}

	.text
	.file	"gpusudokusolver.hip"
	.globl	_Z28__device_stub__possible_moveiiiiiPiS_ # -- Begin function _Z28__device_stub__possible_moveiiiiiPiS_
	.type	_Z28__device_stub__possible_moveiiiiiPiS_,@function
_Z28__device_stub__possible_moveiiiiiPiS_: # @_Z28__device_stub__possible_moveiiiiiPiS_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	20(%rsp), %rax
	movl	%edi, (%rax)
	leaq	16(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	8(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	40(%rsp), %r8
	movq	%r9, (%r8)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	192(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13possible_moveiiiiiPiS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z28__device_stub__possible_moveiiiiiPiS_, .Lfunc_end0-_Z28__device_stub__possible_moveiiiiiPiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z11print_boardi                # -- Begin function _Z11print_boardi
	.type	_Z11print_boardi,@function
_Z11print_boardi:                       # @_Z11print_boardi
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jle	.LBB1_6
# %bb.1:                                # %.preheader.lr.ph
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%edi, %ebx
	movl	$board, %r14d
	xorl	%r15d, %r15d
.LBB1_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_3 Depth 2
	xorl	%r12d, %r12d
.LBB1_3:                                #   Parent Loop BB1_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	(%r14,%r12,4), %esi
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	incq	%r12
	cmpq	%r12, %rbx
	jne	.LBB1_3
# %bb.4:                                # %._crit_edge
                                        #   in Loop: Header=BB1_2 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r15
	addq	$64, %r14
	cmpq	%rbx, %r15
	jne	.LBB1_2
# %bb.5:
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r14
	.cfi_restore %r15
.LBB1_6:                                # %._crit_edge12
	retq
.Lfunc_end1:
	.size	_Z11print_boardi, .Lfunc_end1-_Z11print_boardi
	.cfi_endproc
                                        # -- End function
	.globl	_Z5solvei                       # -- Begin function _Z5solvei
	.type	_Z5solvei,@function
_Z5solvei:                              # @_Z5solvei
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%edi, %r15d
	cvtsi2sd	%edi, %xmm0
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jb	.LBB2_2
# %bb.1:
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB2_3
.LBB2_2:                                # %call.sqrt
	callq	sqrt
.LBB2_3:                                # %.split
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$0, 20(%rsp)
	leal	(,%r15,4), %ebx
	movl	%ebx, %eax
	imull	%r15d, %eax
	movslq	%eax, %rsi
	leaq	48(%rsp), %rdi
	callq	hipMalloc
	leaq	32(%rsp), %rdi
	movl	$4, %esi
	callq	hipMalloc
	testl	%r15d, %r15d
	jle	.LBB2_24
# %bb.4:                                # %.preheader81.lr.ph
	cvttsd2si	8(%rsp), %eax           # 8-byte Folded Reload
	movl	%eax, 44(%rsp)                  # 4-byte Spill
	movabsq	$4294967296, %rax               # imm = 0x100000000
	movl	%ebx, %ebp
	movl	%r15d, %r13d
	movq	%r13, %rcx
	btsq	$32, %rcx
	movq	%rcx, 56(%rsp)                  # 8-byte Spill
	leaq	(,%r13,4), %r12
	leaq	20(%rsp), %r14
	incq	%rax
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	xorl	%esi, %esi
	xorl	%ebx, %ebx
	movq	%r15, 80(%rsp)                  # 8-byte Spill
	movq	%r13, 64(%rsp)                  # 8-byte Spill
.LBB2_5:                                # %.lr.ph101
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_7 Depth 2
                                        #       Child Loop BB2_8 Depth 3
                                        #       Child Loop BB2_15 Depth 3
                                        #         Child Loop BB2_16 Depth 4
	movslq	%esi, %rax
	movslq	%ebx, %rcx
	shlq	$6, %rax
	cmpl	$0, board(%rax,%rcx,4)
	je	.LBB2_6
.LBB2_22:                               # %.loopexit79
                                        #   in Loop: Header=BB2_5 Depth=1
	movl	%esi, 8(%rsp)                   # 4-byte Spill
	movl	$.L.str.2, %edi
	movl	8(%rsp), %esi                   # 4-byte Reload
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	printf
	movl	%r15d, %edi
	callq	_Z11print_boardi
	movl	8(%rsp), %esi                   # 4-byte Reload
	incl	%ebx
	cmpl	%r15d, %ebx
	jl	.LBB2_5
# %bb.23:                               # %._crit_edge102
                                        #   in Loop: Header=BB2_5 Depth=1
	incl	%esi
	movl	$0, %ebx
	cmpl	%r15d, %esi
	jl	.LBB2_5
	jmp	.LBB2_24
.LBB2_6:                                # %.lr.ph97.preheader
                                        #   in Loop: Header=BB2_5 Depth=1
	xorl	%eax, %eax
.LBB2_7:                                # %.lr.ph97
                                        #   Parent Loop BB2_5 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB2_8 Depth 3
                                        #       Child Loop BB2_15 Depth 3
                                        #         Child Loop BB2_16 Depth 4
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	movl	%esi, 8(%rsp)                   # 4-byte Spill
	movq	32(%rsp), %rdi
	movl	$4, %edx
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	%r12, %r14
	movl	$board, %r12d
	movq	%r13, %r15
	xorl	%r13d, %r13d
.LBB2_8:                                #   Parent Loop BB2_5 Depth=1
                                        #     Parent Loop BB2_7 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movq	48(%rsp), %rdi
	addq	%r13, %rdi
	movq	%r12, %rsi
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	addq	%r14, %r13
	addq	$64, %r12
	decq	%r15
	jne	.LBB2_8
# %bb.9:                                # %._crit_edge
                                        #   in Loop: Header=BB2_7 Depth=2
	movq	%r14, %r12
	movq	72(%rsp), %rdi                  # 8-byte Reload
	movl	$1, %esi
	movq	56(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	movq	80(%rsp), %r15                  # 8-byte Reload
	jne	.LBB2_11
# %bb.10:                               #   in Loop: Header=BB2_7 Depth=2
	movq	48(%rsp), %r9
	movq	32(%rsp), %rax
	movq	%rax, (%rsp)
	movl	44(%rsp), %edi                  # 4-byte Reload
	movl	8(%rsp), %esi                   # 4-byte Reload
	movl	%ebx, %edx
	movq	24(%rsp), %rcx                  # 8-byte Reload
                                        # kill: def $ecx killed $ecx killed $rcx
	movl	%r15d, %r8d
	callq	_Z28__device_stub__possible_moveiiiiiPiS_
.LBB2_11:                               #   in Loop: Header=BB2_7 Depth=2
	movq	32(%rsp), %rsi
	movl	$4, %edx
	leaq	20(%rsp), %r14
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	cmpl	$0, 20(%rsp)
	movq	64(%rsp), %r13                  # 8-byte Reload
	je	.LBB2_12
# %bb.13:                               #   in Loop: Header=BB2_7 Depth=2
	movq	24(%rsp), %rdx                  # 8-byte Reload
	cmpl	%r15d, %edx
	movl	8(%rsp), %esi                   # 4-byte Reload
	jne	.LBB2_21
# %bb.14:                               #   in Loop: Header=BB2_7 Depth=2
	movl	%esi, %eax
	orl	%ebx, %eax
	je	.LBB2_24
.LBB2_15:                               # %.outer
                                        #   Parent Loop BB2_5 Depth=1
                                        #     Parent Loop BB2_7 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB2_16 Depth 4
	movslq	%esi, %rax
	movslq	%ebx, %rbx
	movq	%rax, %rdx
	shlq	$6, %rdx
	leaq	(%rdx,%rbx,4), %rcx
	addq	$board, %rcx
.LBB2_16:                               #   Parent Loop BB2_5 Depth=1
                                        #     Parent Loop BB2_7 Depth=2
                                        #       Parent Loop BB2_15 Depth=3
                                        # =>      This Inner Loop Header: Depth=4
	subq	$1, %rbx
	jb	.LBB2_17
# %bb.19:                               #   in Loop: Header=BB2_16 Depth=4
	addq	$-4, %rcx
	cmpl	$1, lock(%rdx,%rbx,4)
	je	.LBB2_16
	jmp	.LBB2_20
.LBB2_17:                               #   in Loop: Header=BB2_15 Depth=3
	leal	-1(%rax), %esi
	decq	%rax
	shlq	$6, %rax
	cmpl	$1, lock(%rax,%r13,4)
	movl	%r15d, %ebx
	je	.LBB2_15
# %bb.18:                               #   in Loop: Header=BB2_15 Depth=3
	leaq	(%rax,%r13,4), %rcx
	addq	$board, %rcx
	movl	%r15d, %ebx
.LBB2_20:                               #   in Loop: Header=BB2_15 Depth=3
	movl	(%rcx), %edx
	movl	$0, (%rcx)
	cmpl	%r15d, %edx
	je	.LBB2_15
.LBB2_21:                               # %.loopexit
                                        #   in Loop: Header=BB2_7 Depth=2
	movl	$0, 20(%rsp)
	leal	1(%rdx), %eax
	cmpl	%r15d, %edx
                                        # kill: def $eax killed $eax def $rax
	jl	.LBB2_7
	jmp	.LBB2_22
.LBB2_12:                               #   in Loop: Header=BB2_5 Depth=1
	movl	8(%rsp), %esi                   # 4-byte Reload
	movslq	%esi, %rax
	movslq	%ebx, %rcx
	shlq	$6, %rax
	movq	24(%rsp), %rdx                  # 8-byte Reload
	movl	%edx, board(%rax,%rcx,4)
	jmp	.LBB2_22
.LBB2_24:                               # %.loopexit80
	addq	$88, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z5solvei, .Lfunc_end2-_Z5solvei
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI3_0:
	.quad	0x0000000000000000              # double 0
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$.L.str.3, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	4(%rsp), %rbx
	movl	$.L.str.4, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	cvtsi2sdl	(%rbx), %xmm0
	xorpd	%xmm1, %xmm1
	ucomisd	%xmm1, %xmm0
	jb	.LBB3_2
# %bb.1:
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB3_3
.LBB3_2:                                # %call.sqrt
	callq	sqrt
.LBB3_3:                                # %.split
	cvtsd2ss	%xmm0, %xmm0
	cvttss2si	%xmm0, %eax
	imull	%eax, %eax
	cmpl	%eax, 4(%rsp)
	je	.LBB3_9
# %bb.4:                                # %.lr.ph.preheader
	leaq	4(%rsp), %rbx
.LBB3_5:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str.5, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.4, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	xorps	%xmm0, %xmm0
	cvtsi2sdl	4(%rsp), %xmm0
	ucomisd	.LCPI3_0(%rip), %xmm0
	jb	.LBB3_7
# %bb.6:                                #   in Loop: Header=BB3_5 Depth=1
	sqrtsd	%xmm0, %xmm0
	jmp	.LBB3_8
.LBB3_7:                                # %call.sqrt18
                                        #   in Loop: Header=BB3_5 Depth=1
	callq	sqrt
.LBB3_8:                                # %.lr.ph.split
                                        #   in Loop: Header=BB3_5 Depth=1
	cvtsd2ss	%xmm0, %xmm0
	cvttss2si	%xmm0, %eax
	imull	%eax, %eax
	cmpl	%eax, 4(%rsp)
	jne	.LBB3_5
.LBB3_9:                                # %._crit_edge
	movl	$.L.str.6, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	20(%rsp), %rbx
	movl	$.L.str.4, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	cmpl	$0, (%rbx)
	jle	.LBB3_19
# %bb.10:                               # %.lr.ph16.preheader
	leaq	16(%rsp), %rbx
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r15
	xorl	%ebp, %ebp
.LBB3_11:                               # %.lr.ph16
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str.7, %edi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movq	%r15, %rcx
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	16(%rsp), %eax
	movl	4(%rsp), %esi
	cmpl	%esi, %eax
	jg	.LBB3_18
# %bb.12:                               #   in Loop: Header=BB3_11 Depth=1
	movl	12(%rsp), %ecx
	cmpl	%esi, %ecx
	jg	.LBB3_18
# %bb.13:                               #   in Loop: Header=BB3_11 Depth=1
	movl	8(%rsp), %edx
	testl	%edx, %edx
	jle	.LBB3_18
# %bb.14:                               #   in Loop: Header=BB3_11 Depth=1
	testl	%ecx, %ecx
	jle	.LBB3_18
# %bb.15:                               #   in Loop: Header=BB3_11 Depth=1
	testl	%eax, %eax
	jle	.LBB3_18
# %bb.16:                               #   in Loop: Header=BB3_11 Depth=1
	cmpl	%esi, %edx
	jg	.LBB3_18
# %bb.17:                               #   in Loop: Header=BB3_11 Depth=1
	decl	%eax
	decl	%ecx
	shlq	$6, %rax
	movl	%edx, board(%rax,%rcx,4)
	movl	$1, lock(%rax,%rcx,4)
.LBB3_18:                               #   in Loop: Header=BB3_11 Depth=1
	incl	%ebp
	cmpl	20(%rsp), %ebp
	jl	.LBB3_11
.LBB3_19:                               # %._crit_edge17
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	4(%rsp), %edi
	callq	_Z11print_boardi
	movl	4(%rsp), %edi
	callq	_Z5solvei
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	4(%rsp), %edi
	callq	_Z11print_boardi
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13possible_moveiiiiiPiS_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB5_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	board,@object                   # @board
	.bss
	.globl	board
	.p2align	4, 0x0
board:
	.zero	1024
	.size	board, 1024

	.type	lock,@object                    # @lock
	.globl	lock
	.p2align	4, 0x0
lock:
	.zero	1024
	.size	lock, 1024

	.type	_Z13possible_moveiiiiiPiS_,@object # @_Z13possible_moveiiiiiPiS_
	.section	.rodata,"a",@progbits
	.globl	_Z13possible_moveiiiiiPiS_
	.p2align	3, 0x0
_Z13possible_moveiiiiiPiS_:
	.quad	_Z28__device_stub__possible_moveiiiiiPiS_
	.size	_Z13possible_moveiiiiiPiS_, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%d  "
	.size	.L.str, 5

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"\nNextmove %d %d\n"
	.size	.L.str.2, 17

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Enter Board Size:"
	.size	.L.str.3, 18

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%d"
	.size	.L.str.4, 3

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Enter correct Boards size:"
	.size	.L.str.5, 27

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Enter no. of Predefined numbers:"
	.size	.L.str.6, 33

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"%d%d%d"
	.size	.L.str.7, 7

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13possible_moveiiiiiPiS_"
	.size	.L__unnamed_1, 27

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"\nInitial Board"
	.size	.Lstr, 15

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"\nFinal Board"
	.size	.Lstr.1, 13

	.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 _Z28__device_stub__possible_moveiiiiiPiS_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym board
	.addrsig_sym _Z13possible_moveiiiiiPiS_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13possible_moveiiiiiPiS_ ; -- Begin function _Z13possible_moveiiiiiPiS_
	.globl	_Z13possible_moveiiiiiPiS_
	.p2align	8
	.type	_Z13possible_moveiiiiiPiS_,@function
_Z13possible_moveiiiiiPiS_:             ; @_Z13possible_moveiiiiiPiS_
; %bb.0:
	s_clause 0x2
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b32 s10, s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x18
	s_mov_b32 s9, exec_lo
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[1:2], null, s10, s5, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v1, vcc_lo, s0, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	global_load_b32 v1, v[1:2], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e64 s8, s7, v1
	v_cmpx_ne_u32_e64 s7, v1
	s_cbranch_execz .LBB0_4
; %bb.1:
	v_mad_u64_u32 v[1:2], null, v0, s10, s[6:7]
	s_mov_b32 s12, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v2, 31, v1
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v1, vcc_lo, s0, v1
	v_add_co_ci_u32_e32 v2, vcc_lo, s1, v2, vcc_lo
	global_load_b32 v1, v[1:2], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e64 s11, s7, v1
	v_cmpx_ne_u32_e64 s7, v1
	s_cbranch_execz .LBB0_3
; %bb.2:
	s_ashr_i32 s13, s4, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s14, s4, s13
	s_xor_b32 s14, s14, s13
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v1, s14
	s_sub_i32 s16, 0, s14
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_u32_f32_e32 v1, v1
	v_readfirstlane_b32 s15, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_i32 s16, s16, s15
	s_mul_hi_u32 s16, s15, s16
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(SALU_CYCLE_1)
	s_add_i32 s15, s15, s16
	s_ashr_i32 s16, s5, 31
	v_mul_hi_u32 v1, v0, s15
	s_add_i32 s17, s5, s16
	s_xor_b32 s17, s17, s16
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_mul_hi_u32 s18, s17, s15
	s_mul_i32 s18, s18, s14
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_mul_lo_u32 v2, v1, s14
	v_add_nc_u32_e32 v3, 1, v1
	s_sub_i32 s17, s17, s18
	s_sub_i32 s18, s17, s14
	s_cmp_ge_u32 s17, s14
	s_cselect_b32 s17, s18, s17
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v2, v0, v2
	s_sub_i32 s18, s17, s14
	s_cmp_ge_u32 s17, s14
	s_cselect_b32 s17, s18, s17
	v_subrev_nc_u32_e32 v4, s14, v2
	v_cmp_le_u32_e32 vcc_lo, s14, v2
	s_ashr_i32 s18, s6, 31
	s_xor_b32 s17, s17, s16
	s_add_i32 s19, s6, s18
	s_sub_i32 s16, s16, s17
	v_dual_cndmask_b32 v2, v2, v4 :: v_dual_cndmask_b32 v1, v1, v3
	s_xor_b32 s19, s19, s18
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_mul_hi_u32 s15, s19, s15
	v_cmp_le_u32_e32 vcc_lo, s14, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_add_nc_u32_e32 v3, 1, v1
	s_mul_i32 s15, s15, s14
	s_sub_i32 s15, s19, s15
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v1, v1, v3, vcc_lo
	v_xor_b32_e32 v1, s13, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_subrev_nc_u32_e32 v1, s13, v1
	s_sub_i32 s13, s15, s14
	s_cmp_ge_u32 s15, s14
	s_cselect_b32 s13, s13, s15
	v_add3_u32 v2, s5, s16, v1
	v_mul_lo_u32 v1, v1, s4
	s_sub_i32 s4, s13, s14
	s_cmp_ge_u32 s13, s14
	s_cselect_b32 s4, s4, s13
	v_mul_lo_u32 v2, v2, s10
	s_xor_b32 s4, s4, s18
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_sub_nc_u32_e32 v0, v0, v1
	s_sub_i32 s4, s18, s4
	s_add_i32 s4, s6, s4
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_add3_u32 v0, s4, v2, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v1, 31, v0
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_and_not1_b32 s0, s11, exec_lo
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, s7, v0
	s_and_b32 s1, vcc_lo, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s11, s0, s1
.LBB0_3:                                ; %Flow47
	s_or_b32 exec_lo, exec_lo, s12
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	s_and_not1_b32 s0, s8, exec_lo
	s_and_b32 s1, s11, exec_lo
	s_or_b32 s8, s0, s1
.LBB0_4:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s9
	s_delay_alu instid0(VALU_DEP_2)
	s_and_saveexec_b32 s0, s8
	s_cbranch_execz .LBB0_6
; %bb.5:
	v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, 1
	global_store_b32 v0, v1, s[2:3]
.LBB0_6:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13possible_moveiiiiiPiS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 40
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 5
		.amdhsa_next_free_sgpr 20
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z13possible_moveiiiiiPiS_, .Lfunc_end0-_Z13possible_moveiiiiiPiS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 636
; NumSgprs: 22
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 22
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.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_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 40
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13possible_moveiiiiiPiS_
    .private_segment_fixed_size: 0
    .sgpr_count:     22
    .sgpr_spill_count: 0
    .symbol:         _Z13possible_moveiiiiiPiS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
