// File: suhasjains[P]AMR-Solver/src/boundary.cpp
// Function: myOctree::set_FieldBc_FieldBcVal(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, myOctree::field_boundary_flags**, double**)
void set_FieldBc_FieldBcVal(int number, std::string name, FieldBc **bc, double **bcval ) {

	for (std::list<Octree*>::iterator it = nodes.begin(), end = nodes.end(); it != end; ++it) {	

	
		if((*it)->number==number) {

			std::cerr << "Block " <<  (*it)->number << std::endl;	


			for(int l = 0; l<scalar_fields.size() ; l++) {	

				Field *f = (*it)->get_block_data()->scalarfields[l];			

				if( f->name == name ) {
		
					//setting BC	
					//std::cerr << "Setting BC to " << (*it)->get_block_data()->scalarfields[l]->name << std::endl;
					for (int i=0; i<3; i++) {
					      	for (int j=0; j<2; j++) {
							 f->bc[i][j] = bc[i][j];

							 //std::cerr << (*it)->get_block_data()->scalarfields[l]->bc[i][j];
						}
					}
					

					//Setting BC values
					for(int i=0; i<f->Nx; i++) {
						for(int j=0; j<f->Ny; j++) {
							for(int k=0; k<f->Nz; k++) {
								if(i<pad)	f->val[i][j][k] = bcval[XDIR][LEFT]; 			
								if(i>=(nx_block + pad))	f->val[i][j][k] = bcval[XDIR][RIGHT]; 			
								if(j<pad)	f->val[i][j][k] = bcval[YDIR][LEFT]; 			
								if(j>=(ny_block + pad))	f->val[i][j][k] = bcval[YDIR][RIGHT]; 			
								if(k<pad)	f->val[i][j][k] = bcval[ZDIR][LEFT]; 			
								if(k>=(nz_block + pad))	f->val[i][j][k] = bcval[ZDIR][RIGHT]; 			
									
							}
						}
					}
				}
			}		
		}
	}	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, -0x60(%rbp)
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq 0x19b56(%rip), %rdi     # 0x26298
callq 0x4490
movq %rax, -0x28(%rbp)
leaq 0x19b46(%rip), %rdi     # 0x26298
callq 0x44c0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x44f0
testb $0x1, %al
jne 0xc771
jmp 0xcaae
leaq -0x28(%rbp), %rdi
callq 0x4520
movq (%rax), %rax
movl 0x98(%rax), %eax
cmpl -0x4(%rbp), %eax
jne 0xca9e
movq 0x1985d(%rip), %rdi     # 0x25ff0
leaq 0x14a2f(%rip), %rsi     # 0x211c9
callq 0x3240
movq %rax, -0x68(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x4520
movq -0x68(%rbp), %rdi
movq (%rax), %rax
movl 0x98(%rax), %esi
callq 0x3400
movq %rax, %rdi
movq 0x197f8(%rip), %rsi     # 0x25fc0
callq 0x3270
movl $0x0, -0x34(%rbp)
movslq -0x34(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq 0x19ed5(%rip), %rdi     # 0x266b8
callq 0x5b00
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
jae 0xca9c
leaq -0x28(%rbp), %rdi
callq 0x4520
movq (%rax), %rdi
callq 0x6de0
movq -0x60(%rbp), %rsi
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
addq $0x18, %rdi
callq 0xd110
testb $0x1, %al
jne 0xc833
jmp 0xca8c
movl $0x0, -0x44(%rbp)
cmpl $0x3, -0x44(%rbp)
jge 0xc892
movl $0x0, -0x48(%rbp)
cmpl $0x2, -0x48(%rbp)
jge 0xc885
movq -0x18(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x40(%rbp), %rax
addq $0x38, %rax
movslq -0x44(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xc847
jmp 0xc887
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xc83a
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xca8a
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xca7a
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xca6a
movl -0x4c(%rbp), %eax
leaq 0x19988(%rip), %rcx     # 0x26268
cmpl (%rcx), %eax
jge 0xc911
movq -0x20(%rbp), %rax
movq (%rax), %rax
movsd 0x8(%rax), %xmm0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
leaq 0x19951(%rip), %rcx     # 0x2626c
movl (%rcx), %ecx
leaq 0x19944(%rip), %rdx     # 0x26268
addl (%rdx), %ecx
cmpl %ecx, %eax
jl 0xc956
movq -0x20(%rbp), %rax
movq (%rax), %rax
movsd (%rax), %xmm0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x50(%rbp), %eax
leaq 0x19908(%rip), %rcx     # 0x26268
cmpl (%rcx), %eax
jge 0xc992
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movsd 0x8(%rax), %xmm0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x50(%rbp), %eax
leaq 0x198d4(%rip), %rcx     # 0x26270
movl (%rcx), %ecx
leaq 0x198c3(%rip), %rdx     # 0x26268
addl (%rdx), %ecx
cmpl %ecx, %eax
jl 0xc9d8
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
leaq 0x19886(%rip), %rcx     # 0x26268
cmpl (%rcx), %eax
jge 0xca14
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movsd 0x8(%rax), %xmm0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
leaq 0x19856(%rip), %rcx     # 0x26274
movl (%rcx), %ecx
leaq 0x19841(%rip), %rdx     # 0x26268
addl (%rdx), %ecx
cmpl %ecx, %eax
jl 0xca5a
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movsd (%rax), %xmm0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x54(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0xca5c
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xc8c6
jmp 0xca6c
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xc8af
jmp 0xca7c
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xc899
jmp 0xca8c
jmp 0xca8e
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xc7d4
jmp 0xca9e
jmp 0xcaa0
leaq -0x28(%rbp), %rdi
callq 0x4550
jmp 0xc75b
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)