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

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

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

	if((((iv-pad)%2==0)&&((iv-pad)!=0))||((iv-pad)==(f->Nx-1-2*pad))) {
		if((((jv-pad)%2==0)&&((jv-pad)!=0))||((jv-pad)==(f->Ny-1-2*pad))) {
			if((((kv-pad)%2==0)&&((kv-pad)!=0))||((kv-pad)==(f->Nz-1-2*pad))) {
				i0=addx+(iv+pad)/2 - 1;
				i1=addx+(iv+pad)/2;
				j0=addy+(jv+pad)/2 - 1;
				j1=addy+(jv+pad)/2;
				k0=addz+(kv+pad)/2 - 1;
				k1=addz+(kv+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((((kv-pad)%2!=0)&&((kv-pad)!=(f->Nz-1-2*pad)))||((kv-pad)==0)) {
				i0=addx+(iv+pad)/2 - 1;
				i1=addx+(iv+pad)/2;
				j0=addy+(jv+pad)/2 - 1;
				j1=addy+(jv+pad)/2;
				k0=addz+(kv+pad)/2 ;
				k1=addz+(kv+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((((jv-pad)%2!=0)&&((jv-pad)!=(f->Ny-1-2*pad)))||((jv-pad)==0)) {
			if((((kv-pad)%2==0)&&((kv-pad)!=0))||((kv-pad)==(f->Nz-1-2*pad))) {
				i0=addx+(iv+pad)/2 - 1;
				i1=addx+(iv+pad)/2;
				j0=addy+(jv+pad)/2;
				j1=addy+(jv+pad)/2 + 1;
				k0=addz+(kv+pad)/2 - 1;
				k1=addz+(kv+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((((kv-pad)%2!=0)&&((kv-pad)!=(f->Nz-1-2*pad)))||((kv-pad)==0)) {
				i0=addx+(iv+pad)/2 - 1;
				i1=addx+(iv+pad)/2;
				j0=addy+(jv+pad)/2;
				j1=addy+(jv+pad)/2 + 1;
				k0=addz+(kv+pad)/2; 
				k1=addz+(kv+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((((iv-pad)%2!=0)&&((iv-pad)!=(f->Nx-1-2*pad)))||((iv-pad)==0)) {
		if((((jv-pad)%2==0)&&((jv-pad)!=0))||((jv-pad)==(f->Ny-1-2*pad))) {
			if((((kv-pad)%2==0)&&((kv-pad)!=0))||((kv-pad)==(f->Nz-1-2*pad))) {
				i0=addx+(iv+pad)/2; 
				i1=addx+(iv+pad)/2 + 1;
				j0=addy+(jv+pad)/2 - 1;
				j1=addy+(jv+pad)/2;
				k0=addz+(kv+pad)/2 - 1;
				k1=addz+(kv+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((((kv-pad)%2!=0)&&((kv-pad)!=(f->Nz-1-2*pad)))||((kv-pad)==0)) {
				i0=addx+(iv+pad)/2; 
				i1=addx+(iv+pad)/2 + 1;
				j0=addy+(jv+pad)/2 - 1;
				j1=addy+(jv+pad)/2;
				k0=addz+(kv+pad)/2; 
				k1=addz+(kv+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((((jv-pad)%2!=0)&&((jv-pad)!=(f->Ny-1-2*pad)))||((jv-pad)==0)) {
			if((((kv-pad)%2==0)&&((kv-pad)!=0))||((kv-pad)==(f->Nz-1-2*pad))) {
				i0=addx+(iv+pad)/2; 
				i1=addx+(iv+pad)/2 + 1;
				j0=addy+(jv+pad)/2; 
				j1=addy+(jv+pad)/2 + 1;
				k0=addz+(kv+pad)/2 - 1;
				k1=addz+(kv+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((((kv-pad)%2!=0)&&((kv-pad)!=(f->Nz-1-2*pad)))||((kv-pad)==0)) {
				i0=addx+(iv+pad)/2; 
				i1=addx+(iv+pad)/2 + 1;
				j0=addy+(jv+pad)/2; 
				j1=addy+(jv+pad)/2 + 1;
				k0=addz+(kv+pad)/2; 
				k1=addz+(kv+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 $0x68, %rsp
movl %r9d, -0x38(%rbp)
movl %r8d, -0x34(%rbp)
movl %ecx, -0x30(%rbp)
movl %edx, %r13d
movq %rsi, %r12
movq %rdi, %rbx
movl 0x10(%rbp), %r14d
movl 0x18(%rbp), %r15d
callq 0x418c
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq %r12, %rdi
callq 0x418c
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq %rbx, %rdi
callq 0x418c
movq 0x10(%rax), %rax
movslq %r13d, %r13
movq (%rax,%r13,8), %rbx
movq %r12, %rdi
callq 0x418c
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %rax
leaq 0xca4a(%rip), %rcx      # 0x151e8
movl (%rcx), %ecx
movl %r14d, %esi
subl %ecx, %esi
setne %dl
testb $0x1, %sil
sete %dil
testb %dil, %dl
jne 0x87c2
leal (%rcx,%rcx), %edx
notl %edx
movl (%rbx), %edi
addl %edx, %edi
cmpl %edi, %esi
jne 0x882e
movl %r15d, %esi
subl %ecx, %esi
setne %dl
testb $0x1, %sil
sete %dil
testb %dil, %dl
jne 0x87e9
leal (%rcx,%rcx), %edx
notl %edx
movl 0x4(%rbx), %edi
addl %edx, %edi
cmpl %edi, %esi
jne 0x88b3
movl 0x20(%rbp), %r10d
movl %r10d, %edx
subl %ecx, %edx
setne %sil
testb $0x1, %dl
sete %dil
testb %dil, %sil
jne 0x8812
leal (%rcx,%rcx), %esi
notl %esi
addl 0x8(%rbx), %esi
cmpl %esi, %edx
jne 0x88f4
addl %ecx, %r14d
movl %r14d, %edx
shrl $0x1f, %edx
addl %r14d, %edx
sarl %edx
movl 0x28(%rbp), %esi
movq %rsi, %rdi
addl %edx, %esi
decl %esi
addl %edi, %edx
jmp 0x8890
movl %r15d, %esi
subl %ecx, %esi
setne %dil
testb $0x1, %sil
sete %r8b
testb %r8b, %dil
jne 0x8851
movl 0x4(%rbx), %edi
addl %edx, %edi
cmpl %edi, %esi
jne 0x8913
movl 0x20(%rbp), %r10d
movl %r10d, %esi
subl %ecx, %esi
setne %dil
testb $0x1, %sil
sete %r8b
testb %r8b, %dil
jne 0x8876
addl 0x8(%rbx), %edx
cmpl %edx, %esi
jne 0x8993
addl %ecx, %r14d
movl %r14d, %esi
shrl $0x1f, %esi
addl %r14d, %esi
sarl %esi
movl 0x28(%rbp), %edx
movq %rdx, %rdi
addl %esi, %edx
incl %edx
addl %edi, %esi
addl %ecx, %r15d
movl %r15d, %edi
shrl $0x1f, %edi
addl %r15d, %edi
sarl %edi
movl 0x30(%rbp), %r8d
movq %r8, %r9
addl %edi, %r8d
decl %r8d
addl %r9d, %edi
jmp 0x8970
movl 0x20(%rbp), %r10d
movl %r10d, %esi
subl %ecx, %esi
setne %dil
testb $0x1, %sil
sete %r8b
testb %r8b, %dil
jne 0x88d8
addl 0x8(%rbx), %edx
cmpl %edx, %esi
jne 0x89cd
addl %ecx, %r14d
movl %r14d, %edx
shrl $0x1f, %edx
addl %r14d, %edx
sarl %edx
movl 0x28(%rbp), %esi
movq %rsi, %rdi
addl %edx, %esi
decl %esi
addl %edi, %edx
jmp 0x8952
addl %ecx, %r14d
movl %r14d, %edx
shrl $0x1f, %edx
addl %r14d, %edx
sarl %edx
movl 0x28(%rbp), %esi
movq %rsi, %rdi
addl %edx, %esi
decl %esi
addl %edi, %edx
jmp 0x89ad
movl 0x20(%rbp), %r10d
movl %r10d, %esi
subl %ecx, %esi
setne %dil
testb $0x1, %sil
sete %r8b
testb %r8b, %dil
jne 0x8938
addl 0x8(%rbx), %edx
cmpl %edx, %esi
jne 0x89e9
addl %ecx, %r14d
movl %r14d, %esi
shrl $0x1f, %esi
addl %r14d, %esi
sarl %esi
movl 0x28(%rbp), %edx
movq %rdx, %rdi
addl %esi, %edx
incl %edx
addl %edi, %esi
addl %ecx, %r15d
movl %r15d, %r8d
shrl $0x1f, %r8d
addl %r15d, %r8d
sarl %r8d
movl 0x30(%rbp), %edi
movq %rdi, %r9
addl %r8d, %edi
incl %edi
addl %r9d, %r8d
addl %ecx, %r10d
movl %r10d, %ecx
shrl $0x1f, %ecx
addl %r10d, %ecx
sarl %ecx
movl 0x38(%rbp), %r9d
movq %r9, %r10
addl %ecx, %r9d
decl %r9d
addl %r10d, %ecx
jmp 0x8a3f
addl %ecx, %r14d
movl %r14d, %esi
shrl $0x1f, %esi
addl %r14d, %esi
sarl %esi
movl 0x28(%rbp), %edx
movq %rdx, %rdi
addl %esi, %edx
incl %edx
addl %edi, %esi
addl %ecx, %r15d
movl %r15d, %edi
shrl $0x1f, %edi
addl %r15d, %edi
sarl %edi
movl 0x30(%rbp), %r8d
movq %r8, %r9
addl %edi, %r8d
decl %r8d
addl %r9d, %edi
jmp 0x8a21
addl %ecx, %r14d
movl %r14d, %edx
shrl $0x1f, %edx
addl %r14d, %edx
sarl %edx
movl 0x28(%rbp), %esi
movq %rsi, %rdi
addl %edx, %esi
decl %esi
addl %edi, %edx
jmp 0x8a03
addl %ecx, %r14d
movl %r14d, %esi
shrl $0x1f, %esi
addl %r14d, %esi
sarl %esi
movl 0x28(%rbp), %edx
movq %rdx, %rdi
addl %esi, %edx
incl %edx
addl %edi, %esi
addl %ecx, %r15d
movl %r15d, %r8d
shrl $0x1f, %r8d
addl %r15d, %r8d
sarl %r8d
movl 0x30(%rbp), %edi
movq %rdi, %r9
addl %r8d, %edi
incl %edi
addl %r9d, %r8d
addl %ecx, %r10d
movl %r10d, %r9d
shrl $0x1f, %r9d
addl %r10d, %r9d
sarl %r9d
movl 0x38(%rbp), %ecx
movq %rcx, %r10
addl %r9d, %ecx
incl %ecx
addl %r10d, %r9d
movslq %esi, %rsi
movslq -0x34(%rbp), %r14
movslq %edx, %rdx
movslq -0x30(%rbp), %r15
movslq %r8d, %r8
movslq %edi, %rdi
movq -0x40(%rbp), %r13
movq 0x20(%r13), %r10
movq (%r10,%r15,8), %r10
movq (%r10,%r14,8), %r10
movslq %r9d, %r9
movsd (%r10,%r9,8), %xmm0
movsd %xmm0, -0x30(%rbp)
movslq %ecx, %rcx
movsd (%r10,%rcx,8), %xmm7
movq 0x10(%rax), %rax
movq (%rax,%rsi,8), %r10
movq (%r10,%r8,8), %r11
movsd (%r11,%rcx,8), %xmm8
movq (%r10,%rdi,8), %r10
movsd (%r10,%rcx,8), %xmm9
movq (%rax,%rdx,8), %rax
movq (%rax,%r8,8), %r12
movsd (%r12,%rcx,8), %xmm10
movq (%rax,%rdi,8), %rax
movsd (%rax,%rcx,8), %xmm11
movsd (%r11,%r9,8), %xmm12
movsd (%r10,%r9,8), %xmm13
movsd (%r12,%r9,8), %xmm14
movsd (%rax,%r9,8), %xmm15
movq 0x10(%r13), %rax
movq (%rax,%rsi,8), %rcx
movq (%rcx,%r14,8), %rcx
movslq -0x38(%rbp), %r12
movsd (%rcx,%r12,8), %xmm6
movq (%rax,%rdx,8), %rax
movq (%rax,%r14,8), %rax
movsd (%rax,%r12,8), %xmm1
movq -0x48(%rbp), %rdx
movq 0x10(%rdx), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rax
movsd (%rax,%r12,8), %xmm2
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r8,8), %rcx
movsd (%rcx,%r12,8), %xmm3
movq (%rax,%rdi,8), %rax
movsd (%rax,%r12,8), %xmm4
movq 0x18(%rdx), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rax
movsd (%rax,%r12,8), %xmm5
movq 0x20(%rdx), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rax
movsd (%rax,%r12,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 0x10(%rbx), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rax
movsd %xmm0, (%rax,%r12,8)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq