// File: /workspace/github_cpp_makefile_star2_O2/suhasjains[P]AMR-Solver/src/block.cpp
// Function: myOctree::Block::Block(myOctree::Block const&)
Block::Block(const Block &obj) {
  //		std::cerr << "copy constructor of block is working" << std::endl;

        x_centre = obj.x_centre;
        y_centre = obj.y_centre;
        z_centre = obj.z_centre;
        x_min = obj.x_min;
        y_min = obj.y_min;
        z_min = obj.z_min;
        x_max = obj.x_max;
        y_max = obj.y_max;
        z_max = obj.z_max;
        dx = obj.dx;
        dy = obj.dy;
        dz = obj.dz;
        iNx = obj.iNx;
        iNy = obj.iNy;
        iNz = obj.iNz;
	mesh = new VecField(*(obj.mesh));
        field = new Field(*(obj.field));
	max_gradient = obj.max_gradient;

	scalarfields = new Field* [scalar_fields.size()];
        for(int i = 0; i<scalar_fields.size() ; i++) {
                scalarfields[i] = new Field(*((obj.scalarfields)[i]));
        }

        vectorfields = new VecField* [vector_fields.size()];
        for(int i = 0; i<vector_fields.size() ; i++) {
                vectorfields[i] = new VecField(*((obj.vectorfields)[i]));
        }

	//dynamic allocation of domain masking - stored here because it is common for all fields. 
	flag = new Mask** [iNx+2*pad];
	for(int i=0;i<(iNx+2*pad);i++) {
		flag[i] = new Mask* [iNy+2*pad];
 		for(int j=0;j<(iNy+2*pad);j++) {
                  	flag[i][j] = new Mask [iNz+2*pad];
           		memcpy(flag[i][j],obj.flag[i][j],sizeof(Mask)*(iNz+2*pad));
		}
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x28(%rsi), %xmm0
movsd %xmm0, 0x28(%rdi)
movsd 0x30(%rsi), %xmm0
movsd %xmm0, 0x30(%rdi)
movsd 0x38(%rsi), %xmm0
movsd %xmm0, 0x38(%rdi)
movsd 0x40(%rsi), %xmm0
movsd %xmm0, 0x40(%rdi)
movsd 0x50(%rsi), %xmm0
movsd %xmm0, 0x50(%rdi)
movsd 0x60(%rsi), %xmm0
movsd %xmm0, 0x60(%rdi)
movsd 0x48(%rsi), %xmm0
movsd %xmm0, 0x48(%rdi)
movsd 0x58(%rsi), %xmm0
movsd %xmm0, 0x58(%rdi)
movsd 0x68(%rsi), %xmm0
movsd %xmm0, 0x68(%rdi)
movsd 0x70(%rsi), %xmm0
movsd %xmm0, 0x70(%rdi)
movsd 0x78(%rsi), %xmm0
movsd %xmm0, 0x78(%rdi)
movsd 0x80(%rsi), %xmm0
movsd %xmm0, 0x80(%rdi)
movl $0x90, %edi
callq 0x21e0
movq %rax, %r15
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x5fa8
movq %r15, (%r14)
pushq $0x50
popq %rdi
callq 0x21e0
movq %rax, %r15
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x646c
movq %r15, 0x8(%r14)
movq %rbx, -0x30(%rbp)
movsd 0x20(%rbx), %xmm0
movsd %xmm0, 0x20(%r14)
movq 0xdd14(%rip), %r12      # 0x13620
movq 0xdd05(%rip), %rbx      # 0x13618
movq %r12, %rax
subq %rbx, %rax
movq %rax, %rdi
sarq $0x2, %rdi
testq %rax, %rax
pushq $-0x1
popq %rax
cmovsq %rax, %rdi
callq 0x2030
movq %rax, 0x10(%r14)
xorl %r13d, %r13d
pushq $0x50
popq %r15
subq %rbx, %r12
sarq $0x5, %r12
cmpq %r13, %r12
jbe 0x5980
movq %r15, %rdi
callq 0x21e0
movq %rax, %r12
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %rsi
movq %r12, %rdi
callq 0x646c
movq 0x10(%r14), %rax
movq %r12, (%rax,%r13,8)
incq %r13
movq 0xdca9(%rip), %r12      # 0x13620
movq 0xdc9a(%rip), %rbx      # 0x13618
jmp 0x593a
movq 0xdcb1(%rip), %r15      # 0x13638
movq 0xdca2(%rip), %rbx      # 0x13630
movq %r15, %rax
subq %rbx, %rax
movq %rax, %rdi
sarq $0x2, %rdi
testq %rax, %rax
pushq $-0x1
popq %rax
cmovsq %rax, %rdi
callq 0x2030
movq %rax, 0x18(%r14)
xorl %r12d, %r12d
subq %rbx, %r15
sarq $0x5, %r15
cmpq %r12, %r15
jbe 0x59f9
movl $0x90, %edi
callq 0x21e0
movq %rax, %r15
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x5fa8
movq 0x18(%r14), %rax
movq %r15, (%rax,%r12,8)
incq %r12
movq 0xdc48(%rip), %r15      # 0x13638
movq 0xdc39(%rip), %rbx      # 0x13630
jmp 0x59b1
movl 0xdc49(%rip), %ebx      # 0x13648
movl 0xd7ca(%rip), %r15d     # 0x131d0
leal (%rbx,%r15,2), %eax
cltq
leaq (,%rax,8), %rdi
testl %eax, %eax
pushq $-0x1
popq %rax
cmovsq %rax, %rdi
callq 0x2030
movq %rax, 0x88(%r14)
xorl %r12d, %r12d
leal (%rbx,%r15,2), %eax
cltq
cmpq %rax, %r12
jge 0x5af8
leal (%r15,%r15), %eax
movl 0xdc07(%rip), %ebx      # 0x1364c
addl %ebx, %eax
cltq
leaq (,%rax,8), %rdi
testl %eax, %eax
pushq $-0x1
popq %rax
cmovsq %rax, %rdi
callq 0x2030
movq 0x88(%r14), %rcx
movq %rax, (%rcx,%r12,8)
xorl %r13d, %r13d
movslq %r15d, %rax
addq %rax, %rax
addl %eax, %ebx
movslq %ebx, %rcx
cmpq %rcx, %r13
jge 0x5aea
movslq 0xdbcc(%rip), %rcx      # 0x13650
addq %rax, %rcx
movq %rcx, %r15
shlq $0x2, %r15
testl %ecx, %ecx
movq %r15, %rdi
pushq $-0x1
popq %rax
cmovsq %rax, %rdi
callq 0x2030
movq 0x88(%r14), %rcx
movq (%rcx,%r12,8), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x88(%r14), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r13,8), %rdi
movq -0x30(%rbp), %rax
movq 0x88(%rax), %rax
movq (%rax,%r12,8), %rax
movq (%rax,%r13,8), %rsi
movq %r15, %rdx
callq 0x2180
incq %r13
movl 0xdb6b(%rip), %ebx      # 0x1364c
movl 0xd6e8(%rip), %r15d     # 0x131d0
jmp 0x5a6d
incq %r12
movl 0xdb55(%rip), %ebx      # 0x13648
jmp 0x5a2c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x50
popq %rsi
jmp 0x5b19
jmp 0x5b11
movq %rax, %rbx
movl $0x90, %esi
movq %r15, %rdi
jmp 0x5b27
movq %rax, %rbx
pushq $0x50
popq %rsi
movq %r12, %rdi
callq 0x21f0
movq %rbx, %rdi
callq 0x2320