// File: /workspace/github_cpp_makefile_star2_O2/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, %r15d
movq %rsi, %r14
movq %rdi, %r12
movl 0x10(%rbp), %ebx
movl 0x18(%rbp), %r13d
callq 0x3db0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq %r14, %rdi
callq 0x3db0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq %r12, %rdi
callq 0x3db0
movq 0x10(%rax), %rax
movslq %r15d, %r12
movq (%rax,%r12,8), %r15
movq %r14, %rdi
callq 0x3db0
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %rcx
leaq 0xb44e(%rip), %rax      # 0x131d0
movl (%rax), %esi
movl %ebx, %edx
subl %esi, %edx
setne %al
testb $0x1, %dl
sete %dil
testb %dil, %al
jne 0x7da5
leal (%rsi,%rsi), %eax
notl %eax
movl (%r15), %edi
addl %eax, %edi
cmpl %edi, %edx
jne 0x7e0f
movl %r13d, %edx
subl %esi, %edx
setne %al
testb $0x1, %dl
sete %dil
testb %dil, %al
jne 0x7dcc
leal (%rsi,%rsi), %eax
notl %eax
movl 0x4(%r15), %edi
addl %eax, %edi
cmpl %edi, %edx
jne 0x7e8c
movl 0x20(%rbp), %r14d
movl %r14d, %eax
subl %esi, %eax
setne %dl
testb $0x1, %al
sete %dil
testb %dil, %dl
jne 0x7df4
leal (%rsi,%rsi), %edx
notl %edx
addl 0x8(%r15), %edx
cmpl %edx, %eax
jne 0x7ecc
addl %esi, %ebx
pushq $0x2
popq %r11
movl %ebx, %eax
cltd
idivl %r11d
movl 0x28(%rbp), %edx
leal (%rax,%rdx), %edi
leal (%rax,%rdx), %r8d
decl %r8d
jmp 0x7e6f
movl %r13d, %edx
subl %esi, %edx
setne %dil
testb $0x1, %dl
sete %r8b
testb %r8b, %dil
jne 0x7e32
movl 0x4(%r15), %edi
addl %eax, %edi
cmpl %edi, %edx
jne 0x7eea
movl 0x20(%rbp), %r14d
movl %r14d, %edx
subl %esi, %edx
setne %dil
testb $0x1, %dl
sete %r8b
testb %r8b, %dil
jne 0x7e57
addl 0x8(%r15), %eax
cmpl %eax, %edx
jne 0x7f5a
addl %esi, %ebx
pushq $0x2
popq %r11
movl %ebx, %eax
cltd
idivl %r11d
movl 0x28(%rbp), %edx
leal (%rax,%rdx), %r8d
leal (%rax,%rdx), %edi
incl %edi
addl %esi, %r13d
movl %r13d, %eax
cltd
idivl %r11d
movl 0x30(%rbp), %edx
leal (%rax,%rdx), %r9d
leal (%rax,%rdx), %r10d
decl %r10d
jmp 0x7f3f
movl 0x20(%rbp), %r14d
movl %r14d, %edx
subl %esi, %edx
setne %dil
testb $0x1, %dl
sete %r8b
testb %r8b, %dil
jne 0x7eb1
addl 0x8(%r15), %eax
cmpl %eax, %edx
jne 0x7f8c
addl %esi, %ebx
pushq $0x2
popq %r11
movl %ebx, %eax
cltd
idivl %r11d
movl 0x28(%rbp), %edx
leal (%rax,%rdx), %edi
leal (%rax,%rdx), %r8d
decl %r8d
jmp 0x7f27
addl %esi, %ebx
pushq $0x2
popq %r11
movl %ebx, %eax
cltd
idivl %r11d
movl 0x28(%rbp), %edx
leal (%rax,%rdx), %edi
leal (%rax,%rdx), %r8d
decl %r8d
jmp 0x7f72
movl 0x20(%rbp), %r14d
movl %r14d, %edx
subl %esi, %edx
setne %dil
testb $0x1, %dl
sete %r8b
testb %r8b, %dil
jne 0x7f0f
addl 0x8(%r15), %eax
cmpl %eax, %edx
jne 0x7fa7
addl %esi, %ebx
pushq $0x2
popq %r11
movl %ebx, %eax
cltd
idivl %r11d
movl 0x28(%rbp), %edx
leal (%rax,%rdx), %r8d
leal (%rax,%rdx), %edi
incl %edi
addl %esi, %r13d
movl %r13d, %eax
cltd
idivl %r11d
movl 0x30(%rbp), %edx
leal (%rax,%rdx), %r10d
leal (%rax,%rdx), %r9d
incl %r9d
addl %esi, %r14d
movl %r14d, %eax
cltd
idivl %r11d
movl 0x38(%rbp), %edx
movq %rdx, %rsi
addl %eax, %edx
addl %eax, %esi
decl %esi
jmp 0x7feb
addl %esi, %ebx
pushq $0x2
popq %r11
movl %ebx, %eax
cltd
idivl %r11d
movl 0x28(%rbp), %edx
leal (%rax,%rdx), %r8d
leal (%rax,%rdx), %edi
incl %edi
addl %esi, %r13d
movl %r13d, %eax
cltd
idivl %r11d
movl 0x30(%rbp), %edx
leal (%rax,%rdx), %r9d
leal (%rax,%rdx), %r10d
decl %r10d
jmp 0x7fd7
addl %esi, %ebx
pushq $0x2
popq %r11
movl %ebx, %eax
cltd
idivl %r11d
movl 0x28(%rbp), %edx
leal (%rax,%rdx), %edi
leal (%rax,%rdx), %r8d
decl %r8d
jmp 0x7fbf
addl %esi, %ebx
pushq $0x2
popq %r11
movl %ebx, %eax
cltd
idivl %r11d
movl 0x28(%rbp), %edx
leal (%rax,%rdx), %r8d
leal (%rax,%rdx), %edi
incl %edi
addl %esi, %r13d
movl %r13d, %eax
cltd
idivl %r11d
movl 0x30(%rbp), %edx
leal (%rax,%rdx), %r10d
leal (%rax,%rdx), %r9d
incl %r9d
addl %esi, %r14d
movl %r14d, %eax
cltd
idivl %r11d
movl 0x38(%rbp), %edx
leal (%rax,%rdx), %esi
addl %eax, %edx
incl %edx
movslq %r8d, %rax
movslq -0x34(%rbp), %rbx
movslq %edi, %rdi
movslq -0x30(%rbp), %r14
movslq %r10d, %r8
movslq %r9d, %r9
movq -0x40(%rbp), %r13
movq 0x20(%r13), %r10
movq (%r10,%r14,8), %r10
movq (%r10,%rbx,8), %r10
movslq %esi, %rsi
movsd (%r10,%rsi,8), %xmm0
movsd %xmm0, -0x30(%rbp)
movslq %edx, %rdx
movsd (%r10,%rdx,8), %xmm7
movq 0x10(%rcx), %rcx
movq (%rcx,%rax,8), %r10
movq (%r10,%r8,8), %r11
movsd (%r11,%rdx,8), %xmm8
movq (%r10,%r9,8), %r10
movsd (%r10,%rdx,8), %xmm9
movq (%rcx,%rdi,8), %rcx
movq (%rcx,%r8,8), %r12
movsd (%r12,%rdx,8), %xmm10
movq (%rcx,%r9,8), %rcx
movsd (%rcx,%rdx,8), %xmm11
movsd (%r11,%rsi,8), %xmm12
movsd (%r10,%rsi,8), %xmm13
movsd (%r12,%rsi,8), %xmm14
movsd (%rcx,%rsi,8), %xmm15
movq 0x10(%r13), %rcx
movq (%rcx,%rax,8), %rax
movq (%rax,%rbx,8), %rax
movslq -0x38(%rbp), %r12
movsd (%rax,%r12,8), %xmm6
movq (%rcx,%rdi,8), %rax
movq (%rax,%rbx,8), %rax
movsd (%rax,%r12,8), %xmm1
movq -0x48(%rbp), %rdx
movq 0x10(%rdx), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%rbx,8), %rax
movsd (%rax,%r12,8), %xmm2
movq 0x18(%r13), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r8,8), %rcx
movsd (%rcx,%r12,8), %xmm3
movq (%rax,%r9,8), %rax
movsd (%rax,%r12,8), %xmm4
movq 0x18(%rdx), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%rbx,8), %rax
movsd (%rax,%r12,8), %xmm5
movq 0x20(%rdx), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%rbx,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 0xc8b8
movq 0x10(%r15), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%rbx,8), %rax
movsd %xmm0, (%rax,%r12,8)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq