#include "GOL_runner.cuh"
#include <stdio.h>
#define threadWidth 16
#define threadHeight 16


  __device__ int horizCheck(bool* board, int width, int height, int x, int y) {
	int horizIndex, vertIndex, realIndex, countH;
	vertIndex = (y); countH = 0;

	if ((x) + 1 == (width)) { horizIndex = 0; }
	else { horizIndex = (x) + 1; }
	realIndex = (width) * vertIndex + horizIndex;
	if (board[realIndex]) { countH++; }

	if ((x) == 0) { horizIndex = (width) - 1; }
	else { horizIndex = (x) - 1; }
	realIndex = (width) * vertIndex + horizIndex;
	if (board[realIndex]) { countH++; }

	if (x > 0 && x < 4) {
		if (y > 0 && y < 4) {
			realIndex = y * width + x;
		//	printf("Horiz: x: %d y: %d count: %d RealIndex: %d\n", x, y, countH, realIndex);
		}
	}

	return countH;
}


 __device__ int vertCheck( bool* board, int width, int height, int x, int y) {
	int horizIndex, vertIndex, realIndex, countV;
	horizIndex = (x); countV = 0;

	if (((y) + 1) == (height)) { vertIndex = 0; }
	else { vertIndex = (y) + 1; }
	realIndex = (width) * vertIndex + horizIndex;
	if (board[realIndex]) { countV++; }
	if (x > 0 && x < 4) {
		if (y >= 0 && y < 4) {
			//printf("Lower Verts: x: %d y: %d count: %d RealIndex: %d Board: %s\n", x, y, countV, realIndex, board[realIndex] ? "true" : "false");
		}
	}
	if ((y) == 0) { vertIndex = (height) - 1; }
	else { vertIndex = (y) - 1; }
	realIndex = (width) * vertIndex + horizIndex;
	if (board[realIndex]) { countV++; }
	if (x > 0 && x < 4) {
		if (y >= 0 && y < 4) {
			//printf("Higher Verts: x: %d y: %d count: %d RealIndex: %d\n", x, y, countV, realIndex);
		}
	}
	if (x > 0 && x < 4) {
		if (y > 0 && y < 4) {
			realIndex = y * width + x;
			//printf("Verts: x: %d y: %d count: %d RealIndex: %d\n", x, y, countV, realIndex);
		}
	}

	return countV;

}

 __device__ int cornerCheck(bool* board, int width, int height, int x, int y) {
	int horizIndex, vertIndex, realIndex, countC;
	countC = 0;

	if ((y) + 1 == (height)) { vertIndex = 0; }
	else { vertIndex = (y) + 1; }
	if ((x) + 1 == (width)) { horizIndex = 0; }
	else { horizIndex = (x) + 1; }
	realIndex = (width) * vertIndex + horizIndex;
	if (board[realIndex]) countC++;

	if ((x) == 0) { horizIndex = (width) - 1; }
	else { horizIndex = (x) - 1; }
	realIndex = (width) * vertIndex + horizIndex;
	if (board[realIndex]) countC++;

	if ((y) == 0) { vertIndex = (height) - 1; }
	else { vertIndex = (y) - 1; }
	realIndex = (width) * vertIndex + horizIndex;
	if (board[realIndex]) countC++;

	if ((x) + 1 == (width)) { horizIndex = 0; }
	else { horizIndex = (x) + 1; }
	realIndex = (width) * vertIndex + horizIndex;
	if (board[realIndex]) countC++;

	if (x > 0 && x < 4) {
		if (y > 0 && y < 4) {
			//printf("Corners: x: %d y: %d count: %d\n", x, y, countC);
		}
	}

	return countC;
}

 __global__ void stepper(bool* board, bool* newBoard, int* width, int* height) {
	// if (board[198])printf("Fill at center\n");
	int x = blockIdx.x * blockDim.x + threadIdx.x;
	int y = blockIdx.y * blockDim.y + threadIdx.y;

	//printf("threadidx.x: %d, threadidx.y: %d\n", threadIdx.x, threadIdx.y);
	
	if (x < (*width) && y < (*height)) {
		//int count = 0; int horizIndex, vertIndex, realIndex;
		int realIndex;
		/*if (x > 8 && x < 12) {
			if (y > 8 && y < 12) {
				printf("x: %d y: %d width: %d height: %d \n", x, y, (*width), (*height));
			}
		}*/
		/*vertIndex = (y);

		if ((x)+1 == (*width)) { horizIndex = 0; }
		else { horizIndex = (*width)+1; }
		realIndex = (*width)*vertIndex + horizIndex;
		if (board[realIndex]) count++;

		if ((x) == 0) { horizIndex = (*width)-1; }
		else { horizIndex = (x)-1; }
		realIndex = (*width)*vertIndex + horizIndex;
		if (board[realIndex]) count++;

		horizIndex = (x);

		if ((y)+1 == (*height)) { vertIndex = 0; }
		else { vertIndex = (*height)+1; }
		realIndex = (*width)*vertIndex + horizIndex;
		if (board[realIndex]) count++;

		if ((y) == 0) { vertIndex = (*height)-1; }
		else { vertIndex = (y)-1; }
		realIndex = (*width)*vertIndex + horizIndex;
		if (board[realIndex]) count++;

		if ((y)+1 == (*height)) { vertIndex = 0; }
		else { vertIndex = (*height)+1; }
		if ((x)+1 == (*width)) { horizIndex = 0; }
		else { horizIndex = (*width)+1; }
		realIndex = (*width)*vertIndex + horizIndex;
		if (board[realIndex]) count++;

		if ((x) == 0) { horizIndex = (*width)-1; }
		else { horizIndex = (x)-1; }
		realIndex = (*width)*vertIndex + horizIndex;
		if (board[realIndex]) count++;

		if ((y) == 0) { vertIndex = (*height)-1; }
		else { vertIndex = (y)-1; }
		realIndex = (*width)*vertIndex + horizIndex;
		if (board[realIndex]) count++;

		if ((x)+1 == (*width)) { horizIndex = 0; }
		else { horizIndex = (*width)+1; }
		realIndex = (*width)*vertIndex + horizIndex;
		if (board[realIndex]) count++;*/


		int neighborCount = horizCheck(board, *width, *height, x, y);
		neighborCount += vertCheck(board, *width, *height, x, y);
		neighborCount += cornerCheck(board, *width, *height, x, y);
		int count = neighborCount;
		if (x < 4 && x > 0 && y < 4 && y > 0) {
			//printf("X: %d Y: %d NeighborCount: %d\n", x, y, count);
		}
		realIndex = y * (*width) + x;
		bool cellState = board[realIndex];
		if (cellState && count < 2) { newBoard[realIndex] = false; }
		else if (cellState && count > 3) { newBoard[realIndex] = false; }
		else if (cellState && count >= 2) { newBoard[realIndex] = true; }
		else if (!cellState && count == 3) { newBoard[realIndex] = true; }
	}
}

GOL::GOL(int width, int height, bool* data) {
	this->width = width;
	this->height = height;
	size = sizeof(bool) * width * height;
	board = data;
}

void GOL::init() {
	cudaMalloc((void **)&d_board, size);
	cudaMalloc((void **)&d_boardNew, size);

	size = sizeof(int);
	cudaMalloc((void**)&d_width, size); cudaMalloc((void**)&d_height, size);
	cudaMemcpy(d_width, &width, size, cudaMemcpyHostToDevice);
	cudaMemcpy(d_height, &height, size, cudaMemcpyHostToDevice);


	size = sizeof(bool) * width * height;
	cudaMemcpy(d_board, board, size, cudaMemcpyHostToDevice);

	numBlockVert = height / threadHeight;
	if (height % threadHeight > 0) numBlockVert++;
	numBlockHoriz = width / threadWidth;
	if (height % threadWidth > 0) numBlockHoriz++;
}

bool GOL::step() {
	
	dim3 dimGrid(numBlockHoriz, numBlockVert);
	dim3 dimBlock(threadWidth, threadHeight);
	stepper << <dimGrid, dimBlock >> > (d_board, d_boardNew, d_width, d_height);
	
	cudaMemcpy(d_board, d_boardNew, size, cudaMemcpyDeviceToDevice);
	cudaMemcpy(board, d_board, size, cudaMemcpyDeviceToHost);

	return true;
}

GOL::~GOL() {
	cudaFree(&d_board); cudaFree(&d_boardNew);
	cudaFree(&d_width); cudaFree(&d_height);
}
	.file	"tmpxft_00284c2a_00000000-6_GOL_runner.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2040:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2040:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z10horizCheckPbiiii
	.type	_Z10horizCheckPbiiii, @function
_Z10horizCheckPbiiii:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z10horizCheckPbiiii, .-_Z10horizCheckPbiiii
	.globl	_Z9vertCheckPbiiii
	.type	_Z9vertCheckPbiiii, @function
_Z9vertCheckPbiiii:
.LFB2182:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2182:
	.size	_Z9vertCheckPbiiii, .-_Z9vertCheckPbiiii
	.globl	_Z11cornerCheckPbiiii
	.type	_Z11cornerCheckPbiiii, @function
_Z11cornerCheckPbiiii:
.LFB2184:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2184:
	.size	_Z11cornerCheckPbiiii, .-_Z11cornerCheckPbiiii
	.align 2
	.globl	_ZN3GOLC2EiiPb
	.type	_ZN3GOLC2EiiPb, @function
_ZN3GOLC2EiiPb:
.LFB2031:
	.cfi_startproc
	endbr64
	movl	%esi, (%rdi)
	imull	%edx, %esi
	movl	%edx, 16(%rdi)
	movq	%rcx, 32(%rdi)
	movl	%esi, 56(%rdi)
	ret
	.cfi_endproc
.LFE2031:
	.size	_ZN3GOLC2EiiPb, .-_ZN3GOLC2EiiPb
	.globl	_ZN3GOLC1EiiPb
	.set	_ZN3GOLC1EiiPb,_ZN3GOLC2EiiPb
	.align 2
	.globl	_ZN3GOL4initEv
	.type	_ZN3GOL4initEv, @function
_ZN3GOL4initEv:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movslq	56(%rdi), %rsi
	movq	%rdi, %rbx
	addq	$40, %rdi
	call	cudaMalloc@PLT
	movslq	56(%rbx), %rsi
	leaq	48(%rbx), %rdi
	call	cudaMalloc@PLT
	movl	$4, 56(%rbx)
	leaq	8(%rbx), %rdi
	movl	$4, %esi
	call	cudaMalloc@PLT
	movslq	56(%rbx), %rsi
	leaq	24(%rbx), %rdi
	call	cudaMalloc@PLT
	movslq	56(%rbx), %rdx
	movq	8(%rbx), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movslq	56(%rbx), %rdx
	movq	24(%rbx), %rdi
	leaq	16(%rbx), %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	(%rbx), %edx
	imull	16(%rbx), %edx
	movl	$1, %ecx
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdi
	movl	%edx, 56(%rbx)
	movslq	%edx, %rdx
	call	cudaMemcpy@PLT
	movl	16(%rbx), %eax
	movl	$16, %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	testl	%edx, %edx
	jle	.L10
	incl	%eax
.L10:
	movl	%eax, 60(%rbx)
	movl	(%rbx), %eax
	movl	$16, %esi
	cltd
	idivl	%esi
	testl	%ecx, %ecx
	jle	.L11
	incl	%eax
.L11:
	movl	%eax, 64(%rbx)
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2033:
	.size	_ZN3GOL4initEv, .-_ZN3GOL4initEv
	.align 2
	.globl	_ZN3GOLD2Ev
	.type	_ZN3GOLD2Ev, @function
_ZN3GOLD2Ev:
.LFB2036:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA2036
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	leaq	40(%rdi), %rdi
	call	cudaFree@PLT
	leaq	48(%rbx), %rdi
	call	cudaFree@PLT
	leaq	8(%rbx), %rdi
	call	cudaFree@PLT
	leaq	24(%rbx), %rdi
	call	cudaFree@PLT
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2036:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA2036:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE2036-.LLSDACSB2036
.LLSDACSB2036:
.LLSDACSE2036:
	.text
	.size	_ZN3GOLD2Ev, .-_ZN3GOLD2Ev
	.globl	_ZN3GOLD1Ev
	.set	_ZN3GOLD1Ev,_ZN3GOLD2Ev
	.globl	_Z33__device_stub__Z7stepperPbS_PiS0_PbS_PiS0_
	.type	_Z33__device_stub__Z7stepperPbS_PiS0_PbS_PiS0_, @function
_Z33__device_stub__Z7stepperPbS_PiS0_PbS_PiS0_:
.LFB2062:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L16
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z7stepperPbS_PiS0_(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L16:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2062:
	.size	_Z33__device_stub__Z7stepperPbS_PiS0_PbS_PiS0_, .-_Z33__device_stub__Z7stepperPbS_PiS0_PbS_PiS0_
	.globl	_Z7stepperPbS_PiS0_
	.type	_Z7stepperPbS_PiS0_, @function
_Z7stepperPbS_PiS0_:
.LFB2063:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z7stepperPbS_PiS0_PbS_PiS0_
	.cfi_endproc
.LFE2063:
	.size	_Z7stepperPbS_PiS0_, .-_Z7stepperPbS_PiS0_
	.align 2
	.globl	_ZN3GOL4stepEv
	.type	_ZN3GOL4stepEv, @function
_ZN3GOL4stepEv:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movl	$1, %esi
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movl	64(%rdi), %edx
	movl	60(%rdi), %eax
	movl	%edx, 8(%rsp)
	movabsq	$68719476752, %rdx
	movl	%eax, 12(%rsp)
	movq	8(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L22
	movq	24(%rbx), %rcx
	movq	8(%rbx), %rdx
	movq	48(%rbx), %rsi
	movq	40(%rbx), %rdi
	call	_Z33__device_stub__Z7stepperPbS_PiS0_PbS_PiS0_
.L22:
	movslq	56(%rbx), %rdx
	movq	48(%rbx), %rsi
	movl	$3, %ecx
	movq	40(%rbx), %rdi
	call	cudaMemcpy@PLT
	movslq	56(%rbx), %rdx
	movq	40(%rbx), %rsi
	movl	$2, %ecx
	movq	32(%rbx), %rdi
	call	cudaMemcpy@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movb	$1, %al
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	_ZN3GOL4stepEv, .-_ZN3GOL4stepEv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z7stepperPbS_PiS0_"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2065:
	.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	.LC0(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z7stepperPbS_PiS0_(%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
.LFE2065:
	.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
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.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:

#ifndef GOL_RUNNER_H
#define GOL_RUNNER_H
#include <hip/hip_runtime.h>

#include <cstdlib>



class GOL {
	public:
		GOL(int width, int height, bool* data);
		void init();
		bool step();
		int width; int* d_width;
		int height; int* d_height;
		bool* board, * d_board, * d_boardNew;
		~GOL();
	private:
		
		int size, numBlockVert, numBlockHoriz;

};
#endif
	.text
	.file	"GOL_runner.hip"
	.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 __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
