// File: /workspace/github_cpp_makefile_star2_O3/suhasjains[P]AMR-Solver/src/multigrid.cpp
// Function: amrsolver::prolongate_domain_for_child(myOctree::Octree*, int, int, int, int, int, int, int)
void prolongate_domain_for_child(Octree* node, int l, int i, int j, int k, int addx, int addy, int addz) {
	//indices
	int i0, i1, j0, j1, k0, k1;	
	

	//grid and parent's grid
	VecField* mesh = node->get_block_data()->mesh;
	VecField* meshp = node->get_parent()->get_block_data()->mesh; 

	//field and parent's field
       	Field *f = node->get_block_data()->scalarfields[l];
       	Field *fp = node->get_parent()->get_block_data()->scalarfields[l];

	//domain
	if(node->get_block_data()->flag[i][j][k]==DOMAIN) {
		//change conditions
//		if((i-pad)%2==0) {
//			if((j-pad)%2==0) {
//				if((k-pad)%2==0) {
		if((((i-pad)%2==0)&&((i-pad)!=0))||((i-pad)==(f->Nx-1-2*pad))) {
			if((((j-pad)%2==0)&&((j-pad)!=0))||((j-pad)==(f->Ny-1-2*pad))) {
				if((((k-pad)%2==0)&&((k-pad)!=0))||((k-pad)==(f->Nz-1-2*pad))) {
					i0=addx+(i+pad)/2 - 1;
					i1=addx+(i+pad)/2;
					j0=addy+(j+pad)/2 - 1;
					j1=addy+(j+pad)/2;
					k0=addz+(k+pad)/2 - 1;
					k1=addz+(k+pad)/2;
					f->val[i][j][k] = Trilinear_interpolate(meshp->x[i0][j][k],meshp->x[i1][j][k],mesh->x[i][j][k], \
										meshp->y[i][j0][k],meshp->y[i][j1][k],mesh->y[i][j][k], \
										meshp->z[i][j][k0],meshp->z[i][j][k1],mesh->z[i][j][k], \
										fp->val[i0][j0][k1],fp->val[i0][j1][k1], \
										fp->val[i1][j0][k1],fp->val[i1][j1][k1], \
										fp->val[i0][j0][k0],fp->val[i0][j1][k0], \
										fp->val[i1][j0][k0],fp->val[i1][j1][k0]);
				}
				else if((((k-pad)%2!=0)&&((k-pad)!=(f->Nz-1-2*pad)))||((k-pad)==0)) {
//				else if((k-pad)%2!=0) {
					i0=addx+(i+pad)/2 - 1;
					i1=addx+(i+pad)/2;
					j0=addy+(j+pad)/2 - 1;
					j1=addy+(j+pad)/2;
					k0=addz+(k+pad)/2 ;
					k1=addz+(k+pad)/2 + 1;
					f->val[i][j][k] = Trilinear_interpolate(meshp->x[i0][j][k],meshp->x[i1][j][k],mesh->x[i][j][k], \
										meshp->y[i][j0][k],meshp->y[i][j1][k],mesh->y[i][j][k], \
										meshp->z[i][j][k0],meshp->z[i][j][k1],mesh->z[i][j][k], \
										fp->val[i0][j0][k1],fp->val[i0][j1][k1], \
										fp->val[i1][j0][k1],fp->val[i1][j1][k1], \
										fp->val[i0][j0][k0],fp->val[i0][j1][k0], \
										fp->val[i1][j0][k0],fp->val[i1][j1][k0]);
				}
			}
//			else if((j-pad)%2!=0) {
//				if((k-pad)%2==0) {
			else if((((j-pad)%2!=0)&&((j-pad)!=(f->Ny-1-2*pad)))||((j-pad)==0)) {
				if((((k-pad)%2==0)&&((k-pad)!=0))||((k-pad)==(f->Nz-1-2*pad))) {
					i0=addx+(i+pad)/2 - 1;
					i1=addx+(i+pad)/2;
					j0=addy+(j+pad)/2;
					j1=addy+(j+pad)/2 + 1;
					k0=addz+(k+pad)/2 - 1;
					k1=addz+(k+pad)/2;
					f->val[i][j][k] = Trilinear_interpolate(meshp->x[i0][j][k],meshp->x[i1][j][k],mesh->x[i][j][k], \
										meshp->y[i][j0][k],meshp->y[i][j1][k],mesh->y[i][j][k], \
										meshp->z[i][j][k0],meshp->z[i][j][k1],mesh->z[i][j][k], \
										fp->val[i0][j0][k1],fp->val[i0][j1][k1], \
										fp->val[i1][j0][k1],fp->val[i1][j1][k1], \
										fp->val[i0][j0][k0],fp->val[i0][j1][k0], \
										fp->val[i1][j0][k0],fp->val[i1][j1][k0]);
				}
//				else if((k-pad)%2!=0) {
				else if((((k-pad)%2!=0)&&((k-pad)!=(f->Nz-1-2*pad)))||((k-pad)==0)) {
					i0=addx+(i+pad)/2 - 1;
					i1=addx+(i+pad)/2;
					j0=addy+(j+pad)/2;
					j1=addy+(j+pad)/2 + 1;
					k0=addz+(k+pad)/2; 
					k1=addz+(k+pad)/2 + 1;
					f->val[i][j][k] = Trilinear_interpolate(meshp->x[i0][j][k],meshp->x[i1][j][k],mesh->x[i][j][k], \
										meshp->y[i][j0][k],meshp->y[i][j1][k],mesh->y[i][j][k], \
										meshp->z[i][j][k0],meshp->z[i][j][k1],mesh->z[i][j][k], \
										fp->val[i0][j0][k1],fp->val[i0][j1][k1], \
										fp->val[i1][j0][k1],fp->val[i1][j1][k1], \
										fp->val[i0][j0][k0],fp->val[i0][j1][k0], \
										fp->val[i1][j0][k0],fp->val[i1][j1][k0]);
				}
			}
		}
//		else if((i-pad)%2!=0) {
//			if((j-pad)%2==0) {
//				if((k-pad)%2==0) {
		else if((((i-pad)%2!=0)&&((i-pad)!=(f->Nx-1-2*pad)))||((i-pad)==0)) {
			if((((j-pad)%2==0)&&((j-pad)!=0))||((j-pad)==(f->Ny-1-2*pad))) {
				if((((k-pad)%2==0)&&((k-pad)!=0))||((k-pad)==(f->Nz-1-2*pad))) {
					i0=addx+(i+pad)/2; 
					i1=addx+(i+pad)/2 + 1;
					j0=addy+(j+pad)/2 - 1;
					j1=addy+(j+pad)/2;
					k0=addz+(k+pad)/2 - 1;
					k1=addz+(k+pad)/2;
					f->val[i][j][k] = Trilinear_interpolate(meshp->x[i0][j][k],meshp->x[i1][j][k],mesh->x[i][j][k], \
										meshp->y[i][j0][k],meshp->y[i][j1][k],mesh->y[i][j][k], \
										meshp->z[i][j][k0],meshp->z[i][j][k1],mesh->z[i][j][k], \
										fp->val[i0][j0][k1],fp->val[i0][j1][k1], \
										fp->val[i1][j0][k1],fp->val[i1][j1][k1], \
										fp->val[i0][j0][k0],fp->val[i0][j1][k0], \
										fp->val[i1][j0][k0],fp->val[i1][j1][k0]);
				}
				else if((((k-pad)%2!=0)&&((k-pad)!=(f->Nz-1-2*pad)))||((k-pad)==0)) {
//				else if((k-pad)%2!=0) {
					i0=addx+(i+pad)/2; 
					i1=addx+(i+pad)/2 + 1;
					j0=addy+(j+pad)/2 - 1;
					j1=addy+(j+pad)/2;
					k0=addz+(k+pad)/2; 
					k1=addz+(k+pad)/2 + 1;
					f->val[i][j][k] = Trilinear_interpolate(meshp->x[i0][j][k],meshp->x[i1][j][k],mesh->x[i][j][k], \
										meshp->y[i][j0][k],meshp->y[i][j1][k],mesh->y[i][j][k], \
										meshp->z[i][j][k0],meshp->z[i][j][k1],mesh->z[i][j][k], \
										fp->val[i0][j0][k1],fp->val[i0][j1][k1], \
										fp->val[i1][j0][k1],fp->val[i1][j1][k1], \
										fp->val[i0][j0][k0],fp->val[i0][j1][k0], \
										fp->val[i1][j0][k0],fp->val[i1][j1][k0]);
				}
			}
//			else if((j-pad)%2!=0) {
//				if((k-pad)%2==0) {
			else if((((j-pad)%2!=0)&&((j-pad)!=(f->Ny-1-2*pad)))||((j-pad)==0)) {
				if((((k-pad)%2==0)&&((k-pad)!=0))||((k-pad)==(f->Nz-1-2*pad))) {
					i0=addx+(i+pad)/2; 
					i1=addx+(i+pad)/2 + 1;
					j0=addy+(j+pad)/2; 
					j1=addy+(j+pad)/2 + 1;
					k0=addz+(k+pad)/2 - 1;
					k1=addz+(k+pad)/2;
					f->val[i][j][k] = Trilinear_interpolate(meshp->x[i0][j][k],meshp->x[i1][j][k],mesh->x[i][j][k], \
										meshp->y[i][j0][k],meshp->y[i][j1][k],mesh->y[i][j][k], \
										meshp->z[i][j][k0],meshp->z[i][j][k1],mesh->z[i][j][k], \
										fp->val[i0][j0][k1],fp->val[i0][j1][k1], \
										fp->val[i1][j0][k1],fp->val[i1][j1][k1], \
										fp->val[i0][j0][k0],fp->val[i0][j1][k0], \
										fp->val[i1][j0][k0],fp->val[i1][j1][k0]);
				}
//				else if((k-pad)%2!=0) {
				else if((((k-pad)%2!=0)&&((k-pad)!=(f->Nz-1-2*pad)))||((k-pad)==0)) {
					i0=addx+(i+pad)/2; 
					i1=addx+(i+pad)/2 + 1;
					j0=addy+(j+pad)/2; 
					j1=addy+(j+pad)/2 + 1;
					k0=addz+(k+pad)/2; 
					k1=addz+(k+pad)/2 + 1;
					f->val[i][j][k] = Trilinear_interpolate(meshp->x[i0][j][k],meshp->x[i1][j][k],mesh->x[i][j][k], \
										meshp->y[i][j0][k],meshp->y[i][j1][k],mesh->y[i][j][k], \
										meshp->z[i][j][k0],meshp->z[i][j][k1],mesh->z[i][j][k], \
										fp->val[i0][j0][k1],fp->val[i0][j1][k1], \
										fp->val[i1][j0][k1],fp->val[i1][j1][k1], \
										fp->val[i0][j0][k0],fp->val[i0][j1][k0], \
										fp->val[i1][j0][k0],fp->val[i1][j1][k0]);
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, -0x30(%rbp)
movl %r8d, %ebx
movl %ecx, %r14d
movl %edx, %r12d
movl %esi, %r15d
movq %rdi, %r13
callq 0x418c
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq %r13, %rdi
callq 0x423e
movq %rax, %rdi
callq 0x418c
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq %r13, %rdi
callq 0x418c
movq 0x10(%rax), %rax
movslq %r15d, %r15
movq (%rax,%r15,8), %rax
movq %rax, -0x38(%rbp)
movq %r13, %rdi
callq 0x423e
movq %rax, %rdi
callq 0x418c
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movq %rax, -0x40(%rbp)
movq %r13, %rdi
callq 0x418c
movq 0x88(%rax), %rax
movslq %r12d, %r10
movq (%rax,%r10,8), %rax
movslq %r14d, %r15
movq (%rax,%r15,8), %rax
movslq %ebx, %r13
cmpl $0x7, (%rax,%r13,4)
jne 0xf68c
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %edx
leaq 0x5f54(%rip), %rcx      # 0x151e8
movl (%rcx), %ecx
movl %r12d, %edi
subl %ecx, %edi
setne %sil
testb $0x1, %dil
sete %r8b
testb %r8b, %sil
jne 0xf2c0
leal (%rcx,%rcx), %esi
notl %esi
movq -0x38(%rbp), %r8
movl (%r8), %r8d
addl %esi, %r8d
cmpl %r8d, %edi
jne 0xf336
movl %r14d, %edi
subl %ecx, %edi
setne %sil
testb $0x1, %dil
sete %r8b
testb %r8b, %sil
jne 0xf2ef
leal (%rcx,%rcx), %esi
notl %esi
movq -0x38(%rbp), %r8
movl 0x4(%r8), %r8d
addl %esi, %r8d
cmpl %r8d, %edi
jne 0xf3bf
movl %ebx, %esi
subl %ecx, %esi
setne %dil
testb $0x1, %sil
sete %r8b
testb %r8b, %dil
jne 0xf319
leal (%rcx,%rcx), %edi
notl %edi
movq -0x38(%rbp), %r8
addl 0x8(%r8), %edi
cmpl %edi, %esi
jne 0xf401
addl %ecx, %r12d
movl %r12d, %esi
shrl $0x1f, %esi
addl %r12d, %esi
sarl %esi
movq -0x30(%rbp), %r8
leal (%rsi,%r8), %edi
decl %edi
addl %r8d, %esi
jmp 0xf3a0
movl %r14d, %edi
subl %ecx, %edi
setne %r8b
testb $0x1, %dil
sete %r9b
testb %r9b, %r8b
jne 0xf360
movq -0x38(%rbp), %r8
movl 0x4(%r8), %r8d
addl %esi, %r8d
cmpl %r8d, %edi
jne 0xf421
movl %ebx, %edi
subl %ecx, %edi
setne %r8b
testb $0x1, %dil
sete %r9b
testb %r9b, %r8b
jne 0xf385
movq -0x38(%rbp), %r8
addl 0x8(%r8), %esi
cmpl %esi, %edi
jne 0xf492
addl %ecx, %r12d
movl %r12d, %edi
shrl $0x1f, %edi
addl %r12d, %edi
sarl %edi
movq -0x30(%rbp), %r8
leal (%rdi,%r8), %esi
incl %esi
addl %r8d, %edi
addl %ecx, %r14d
movl %r14d, %r8d
shrl $0x1f, %r8d
addl %r14d, %r8d
sarl %r8d
leal (%r8,%rdx), %r9d
decl %r9d
addl %edx, %r8d
jmp 0xf47b
movl %ebx, %edi
subl %ecx, %edi
setne %r8b
testb $0x1, %dil
sete %r9b
testb %r9b, %r8b
jne 0xf3e4
movq -0x38(%rbp), %r8
addl 0x8(%r8), %esi
cmpl %esi, %edi
jne 0xf4c9
addl %ecx, %r12d
movl %r12d, %esi
shrl $0x1f, %esi
addl %r12d, %esi
sarl %esi
movq -0x30(%rbp), %r8
leal (%rsi,%r8), %edi
decl %edi
addl %r8d, %esi
jmp 0xf461
addl %ecx, %r12d
movl %r12d, %esi
shrl $0x1f, %esi
addl %r12d, %esi
sarl %esi
movq -0x30(%rbp), %r8
leal (%rsi,%r8), %edi
decl %edi
addl %r8d, %esi
jmp 0xf4ad
movl %ebx, %edi
subl %ecx, %edi
setne %r8b
testb $0x1, %dil
sete %r9b
testb %r9b, %r8b
jne 0xf446
movq -0x38(%rbp), %r8
addl 0x8(%r8), %esi
cmpl %esi, %edi
jne 0xf4e6
addl %ecx, %r12d
movl %r12d, %edi
shrl $0x1f, %edi
addl %r12d, %edi
sarl %edi
movq -0x30(%rbp), %r8
leal (%rdi,%r8), %esi
incl %esi
addl %r8d, %edi
addl %ecx, %r14d
movl %r14d, %r9d
shrl $0x1f, %r9d
addl %r14d, %r9d
sarl %r9d
leal (%r9,%rdx), %r8d
incl %r8d
addl %edx, %r9d
addl %ecx, %ebx
movl %ebx, %ecx
shrl $0x1f, %ecx
addl %ebx, %ecx
sarl %ecx
leal (%rcx,%rax), %edx
decl %edx
addl %eax, %ecx
jmp 0xf52d
addl %ecx, %r12d
movl %r12d, %edi
shrl $0x1f, %edi
addl %r12d, %edi
sarl %edi
movq -0x30(%rbp), %r8
leal (%rdi,%r8), %esi
incl %esi
addl %r8d, %edi
addl %ecx, %r14d
movl %r14d, %r8d
shrl $0x1f, %r8d
addl %r14d, %r8d
sarl %r8d
leal (%r8,%rdx), %r9d
decl %r9d
addl %edx, %r8d
jmp 0xf51b
addl %ecx, %r12d
movl %r12d, %esi
shrl $0x1f, %esi
addl %r12d, %esi
sarl %esi
movq -0x30(%rbp), %r8
leal (%rsi,%r8), %edi
decl %edi
addl %r8d, %esi
jmp 0xf501
addl %ecx, %r12d
movl %r12d, %edi
shrl $0x1f, %edi
addl %r12d, %edi
sarl %edi
movq -0x30(%rbp), %r8
leal (%rdi,%r8), %esi
incl %esi
addl %r8d, %edi
addl %ecx, %r14d
movl %r14d, %r9d
shrl $0x1f, %r9d
addl %r14d, %r9d
sarl %r9d
leal (%r9,%rdx), %r8d
incl %r8d
addl %edx, %r9d
addl %ecx, %ebx
movl %ebx, %edx
shrl $0x1f, %edx
addl %ebx, %edx
sarl %edx
leal (%rdx,%rax), %ecx
incl %ecx
addl %eax, %edx
movslq %edi, %rax
movslq %esi, %rsi
movslq %r9d, %rdi
movslq %r8d, %r8
movq -0x48(%rbp), %r12
movq 0x20(%r12), %r9
movq (%r9,%r10,8), %r9
movq (%r9,%r15,8), %r9
movslq %edx, %rdx
movsd (%r9,%rdx,8), %xmm0
movsd %xmm0, -0x30(%rbp)
movslq %ecx, %rcx
movsd (%r9,%rcx,8), %xmm7
movq -0x40(%rbp), %r9
movq 0x10(%r9), %r9
movq %r10, %r14
movq (%r9,%rax,8), %r10
movq (%r10,%rdi,8), %r11
movsd (%r11,%rcx,8), %xmm8
movq (%r10,%r8,8), %r10
movsd (%r10,%rcx,8), %xmm9
movq (%r9,%rsi,8), %r9
movq (%r9,%rdi,8), %rbx
movsd (%rbx,%rcx,8), %xmm10
movq (%r9,%r8,8), %r9
movsd (%r9,%rcx,8), %xmm11
movsd (%r11,%rdx,8), %xmm12
movsd (%r10,%rdx,8), %xmm13
movsd (%rbx,%rdx,8), %xmm14
movsd (%r9,%rdx,8), %xmm15
movq 0x10(%r12), %rcx
movq (%rcx,%rax,8), %rax
movq (%rax,%r15,8), %rax
movsd (%rax,%r13,8), %xmm6
movq (%rcx,%rsi,8), %rax
movq (%rax,%r15,8), %rax
movsd (%rax,%r13,8), %xmm1
movq -0x50(%rbp), %rdx
movq 0x10(%rdx), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rax
movsd (%rax,%r13,8), %xmm2
movq 0x18(%r12), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%rdi,8), %rcx
movsd (%rcx,%r13,8), %xmm3
movq (%rax,%r8,8), %rax
movsd (%rax,%r13,8), %xmm4
movq 0x18(%rdx), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rax
movsd (%rax,%r13,8), %xmm5
movq 0x20(%rdx), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rax
movsd (%rax,%r13,8), %xmm0
movsd %xmm15, 0x40(%rsp)
movsd %xmm14, 0x38(%rsp)
movsd %xmm13, 0x30(%rsp)
movsd %xmm12, 0x28(%rsp)
movsd %xmm11, 0x20(%rsp)
movsd %xmm10, 0x18(%rsp)
movsd %xmm9, 0x10(%rsp)
movsd %xmm8, 0x8(%rsp)
movsd %xmm0, (%rsp)
movaps %xmm6, %xmm0
movsd -0x30(%rbp), %xmm6
callq 0xeb30
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rax
movsd %xmm0, (%rax,%r13,8)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq