// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rdx, -0x50(%rbp)
movq %rsi, -0x38(%rbp)
leaq 0xcbb1(%rip), %rcx      # 0x131f8
xorl %r13d, %r13d
leaq 0xcb8b(%rip), %r15      # 0x131dc
movq %rcx, %r14
movl %edi, -0x2c(%rbp)
movq (%r14), %r14
cmpq %rcx, %r14
je 0x687c
movq 0x10(%r14), %rax
cmpl %edi, 0x98(%rax)
jne 0x6657
movq 0xc97a(%rip), %rdi      # 0x12ff0
leaq 0x8b7e(%rip), %rsi      # 0xf1fb
callq 0x21d0
movq 0x10(%r14), %rcx
movl 0x98(%rcx), %esi
movq %rax, %rdi
callq 0x2310
movq %rax, %rdi
callq 0x2110
xorl %r12d, %r12d
movq %r14, -0x40(%rbp)
leaq 0xcf6e(%rip), %rcx      # 0x13618
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x5, %rax
cmpq %r12, %rax
jbe 0x686d
movq 0x10(%r14), %rdi
callq 0x3db0
movq 0x10(%rax), %rax
movq %r12, -0x48(%rbp)
movq (%rax,%r12,8), %r12
leaq 0x18(%r12), %rdi
movq -0x38(%rbp), %rsi
callq 0x6c56
testb %al, %al
je 0x685d
pushq $0x7
popq %rax
cmpq $0xa, %rax
je 0x670e
movq -0x50(%rbp), %rcx
movq -0x38(%rcx,%rax,8), %rcx
movl (%rcx), %edx
movl %edx, (%r12,%rax,8)
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%r12,%rax,8)
incq %rax
jmp 0x66ec
movl (%r12), %eax
testl %eax, %eax
cmovlel %r13d, %eax
movq %rax, -0x58(%rbp)
xorl %ecx, %ecx
cmpq -0x58(%rbp), %rcx
je 0x685d
movl 0x4(%r12), %edx
testl %edx, %edx
cmovlel %r13d, %edx
xorl %esi, %esi
cmpq %rdx, %rsi
je 0x6855
movl 0x8(%r12), %edi
leaq 0xca86(%rip), %rax      # 0x131d0
movslq (%rax), %r8
leaq 0xca80(%rip), %rax      # 0x131d4
movslq (%rax), %r9
addq %r8, %r9
leaq 0xca77(%rip), %rax      # 0x131d8
movslq (%rax), %r10
addq %r8, %r10
movslq (%r15), %r11
addq %r8, %r11
testl %edi, %edi
cmovlel %r13d, %edi
xorl %eax, %eax
cmpq %rax, %rdi
je 0x684d
cmpq %r8, %rcx
jge 0x679f
movq (%rbx), %r14
movsd 0x8(%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rcx,8), %r14
movq (%r14,%rsi,8), %r14
movsd %xmm0, (%r14,%rax,8)
cmpq %r9, %rcx
jl 0x67bf
movq (%rbx), %r14
movsd (%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rcx,8), %r14
movq (%r14,%rsi,8), %r14
movsd %xmm0, (%r14,%rax,8)
cmpq %r8, %rsi
jge 0x67e1
movq 0x8(%rbx), %r14
movsd 0x8(%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rcx,8), %r14
movq (%r14,%rsi,8), %r14
movsd %xmm0, (%r14,%rax,8)
cmpq %r10, %rsi
jl 0x6802
movq 0x8(%rbx), %r14
movsd (%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rcx,8), %r14
movq (%r14,%rsi,8), %r14
movsd %xmm0, (%r14,%rax,8)
cmpq %r8, %rax
jge 0x6824
movq 0x10(%rbx), %r14
movsd 0x8(%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rcx,8), %r14
movq (%r14,%rsi,8), %r14
movsd %xmm0, (%r14,%rax,8)
cmpq %r11, %rax
jl 0x6845
movq 0x10(%rbx), %r14
movsd (%r14), %xmm0
movq 0x10(%r12), %r14
movq (%r14,%rcx,8), %r14
movq (%r14,%rsi,8), %r14
movsd %xmm0, (%r14,%rax,8)
incq %rax
jmp 0x6775
incq %rsi
jmp 0x6735
incq %rcx
jmp 0x671e
movq -0x48(%rbp), %r12
incq %r12
movq -0x40(%rbp), %r14
jmp 0x66a3
movl -0x2c(%rbp), %edi
leaq 0xc981(%rip), %rcx      # 0x131f8
jmp 0x6657
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq