// File: /workspace/github_cpp_makefile_star2_O3/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
subq $0x18, %rsp
movq %rsi, %r13
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 0x2200
movq %rax, %r15
movq (%r13), %rsi
movq %rax, %rdi
callq 0x661e
movq %r15, (%r14)
movl $0x50, %edi
callq 0x2200
movq %rax, %r15
movq 0x8(%r13), %rsi
movq %rax, %rdi
callq 0x6b38
movq %r15, 0x8(%r14)
movsd 0x20(%r13), %xmm0
movsd %xmm0, 0x20(%r14)
movq 0xf723(%rip), %rbx      # 0x15640
movq 0xf714(%rip), %r12      # 0x15638
movq %rbx, %rax
subq %r12, %rax
movq %rax, %rdi
sarq $0x2, %rdi
testq %rax, %rax
movq $-0x1, %r15
cmovsq %r15, %rdi
callq 0x2030
movq %rax, 0x10(%r14)
cmpq %r12, %rbx
je 0x5f8e
xorl %ebx, %ebx
movl $0x50, %edi
callq 0x2200
movq %rax, %r12
movq 0x10(%r13), %rax
movq (%rax,%rbx,8), %rsi
movq %r12, %rdi
callq 0x6b38
movq 0x10(%r14), %rax
movq %r12, (%rax,%rbx,8)
incq %rbx
movq 0xf6c2(%rip), %rax      # 0x15640
subq 0xf6b3(%rip), %rax      # 0x15638
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x5f4f
movq 0xf6c3(%rip), %rbx      # 0x15658
movq 0xf6b4(%rip), %r12      # 0x15650
movq %rbx, %rax
subq %r12, %rax
movq %rax, %rcx
sarq $0x2, %rcx
testq %rax, %rax
cmovnsq %rcx, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x18(%r14)
cmpq %r12, %rbx
je 0x6002
xorl %ebx, %ebx
movl $0x90, %edi
callq 0x2200
movq %rax, %r15
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x661e
movq 0x18(%r14), %rax
movq %r15, (%rax,%rbx,8)
incq %rbx
movq 0xf666(%rip), %rax      # 0x15658
subq 0xf657(%rip), %rax      # 0x15650
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x5fc3
movq %r13, -0x38(%rbp)
movl 0xf65c(%rip), %eax      # 0x15668
movl 0xf1d5(%rip), %r15d     # 0x151e8
movq %r14, %r12
movq %rax, %r14
leal (%rax,%r15,2), %eax
movslq %eax, %rbx
leaq (,%rbx,8), %rdi
testl %ebx, %ebx
movq $-0x1, %rax
cmovsq %rax, %rdi
callq 0x2030
movq %r12, -0x30(%rbp)
movq %rax, 0x88(%r12)
testl %ebx, %ebx
movq $-0x1, %rbx
jle 0x614a
leal (%r15,%r15), %eax
movl 0xf60c(%rip), %r12d     # 0x1566c
xorl %r13d, %r13d
addl %r12d, %eax
cltq
leaq (,%rax,8), %rdi
testl %eax, %eax
cmovsq %rbx, %rdi
callq 0x2030
movq -0x30(%rbp), %rdx
movq 0x88(%rdx), %rcx
movq %rax, (%rcx,%r13,8)
leal (%r15,%r15), %eax
movl %eax, %ecx
addl %r12d, %ecx
jle 0x6133
xorl %ebx, %ebx
movq %rdx, %r14
movslq 0xf5cb(%rip), %rcx      # 0x15670
cltq
addq %rcx, %rax
movq %rax, %r15
shlq $0x2, %r15
testl %eax, %eax
movq %r15, %rdi
movq $-0x1, %rax
cmovsq %rax, %rdi
callq 0x2030
movq 0x88(%r14), %rcx
movq (%rcx,%r13,8), %rcx
movq %rax, (%rcx,%rbx,8)
movq 0x88(%r14), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx,8), %rdi
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdx
callq 0x2190
incq %rbx
movl 0xf563(%rip), %r12d     # 0x1566c
movl 0xf0d8(%rip), %r15d     # 0x151e8
leal (%r15,%r15), %eax
leal (%r12,%r15,2), %ecx
movslq %ecx, %rcx
cmpq %rcx, %rbx
jl 0x609e
movl 0xf53e(%rip), %ecx      # 0x15668
movq $-0x1, %rbx
jmp 0x6136
movq %r14, %rcx
incq %r13
movq %rcx, %r14
addl %eax, %ecx
movslq %ecx, %rcx
cmpq %rcx, %r13
jl 0x6063
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x50, %esi
jmp 0x616d
jmp 0x6165
movq %rax, %rbx
movl $0x90, %esi
movq %r15, %rdi
jmp 0x617d
movq %rax, %rbx
movl $0x50, %esi
movq %r12, %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x2350