// File: /workspace/github_cpp_makefile_star2_O1/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, %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 0x21f0
movq %rax, %r15
movq (%r13), %rsi
movq %rax, %rdi
callq 0x6568
movq %r15, (%r14)
movl $0x50, %edi
callq 0x21f0
movq %rax, %r15
movq 0x8(%r13), %rsi
movq %rax, %rdi
callq 0x6aae
movq %r15, 0x8(%r14)
movsd 0x20(%r13), %xmm0
movsd %xmm0, 0x20(%r14)
movq 0xf7ea(%rip), %rax      # 0x15630
subq 0xf7db(%rip), %rax      # 0x15628
movq %rax, %rdi
sarq $0x2, %rdi
testq %rax, %rax
movq $-0x1, %r15
cmovsq %r15, %rdi
callq 0x2030
movq %rax, 0x10(%r14)
movq 0xf7be(%rip), %rax      # 0x15630
cmpq 0xf7af(%rip), %rax      # 0x15628
je 0x5ebc
xorl %ebx, %ebx
movl $0x50, %edi
callq 0x21f0
movq %rax, %r12
movq 0x10(%r13), %rax
movq (%rax,%rbx,8), %rsi
movq %r12, %rdi
callq 0x6aae
movq 0x10(%r14), %rax
movq %r12, (%rax,%rbx,8)
incq %rbx
movq 0xf784(%rip), %rax      # 0x15630
subq 0xf775(%rip), %rax      # 0x15628
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x5e7d
movq 0xf785(%rip), %rax      # 0x15648
subq 0xf776(%rip), %rax      # 0x15640
movq %rax, %rcx
sarq $0x2, %rcx
testq %rax, %rax
cmovnsq %rcx, %r15
movq %r15, %rdi
callq 0x2030
movq %rax, 0x18(%r14)
movq 0xf75d(%rip), %rax      # 0x15648
cmpq 0xf74e(%rip), %rax      # 0x15640
je 0x5f35
xorl %ebx, %ebx
movl $0x90, %edi
callq 0x21f0
movq %rax, %r15
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x6568
movq 0x18(%r14), %rax
movq %r15, (%rax,%rbx,8)
incq %rbx
movq 0xf723(%rip), %rax      # 0x15648
subq 0xf714(%rip), %rax      # 0x15640
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x5ef6
movq %r13, -0x30(%rbp)
movslq 0xf718(%rip), %rax      # 0x15658
movslq 0xf299(%rip), %rcx      # 0x151e0
leaq (%rax,%rcx,2), %rax
movq %rax, %rdi
shlq $0x3, %rdi
testl %eax, %eax
movq $-0x1, %rbx
cmovsq %rbx, %rdi
callq 0x2030
movq %rax, 0x88(%r14)
movl 0xf26f(%rip), %eax      # 0x151e0
addl %eax, %eax
movl 0xf6df(%rip), %ecx      # 0x15658
addl %eax, %ecx
jle 0x606f
xorl %r13d, %r13d
movq -0x30(%rbp), %r12
movslq 0xf6cd(%rip), %rcx      # 0x1565c
cltq
addq %rcx, %rax
movq %rax, %rdi
shlq $0x3, %rdi
testl %eax, %eax
cmovsq %rbx, %rdi
callq 0x2030
movq 0x88(%r14), %rcx
movq %rax, (%rcx,%r13,8)
movl 0xf229(%rip), %eax      # 0x151e0
addl %eax, %eax
movl 0xf69d(%rip), %ecx      # 0x1565c
addl %eax, %ecx
movq $-0x1, %rdx
jle 0x6047
xorl %ebx, %ebx
movslq 0xf68d(%rip), %rcx      # 0x15660
cltq
addq %rcx, %rax
movq %rax, %r15
shlq $0x2, %r15
testl %eax, %eax
movq %r15, %rdi
cmovsq %rdx, %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 0x88(%r12), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdx
callq 0x2180
movq $-0x1, %rdx
incq %rbx
movslq 0xf628(%rip), %rcx      # 0x1565c
movslq 0xf1a5(%rip), %rax      # 0x151e0
leaq (%rcx,%rax,2), %rcx
addq %rax, %rax
cmpq %rcx, %rbx
jl 0x5fcc
incq %r13
movslq 0xf607(%rip), %rcx      # 0x15658
movslq 0xf188(%rip), %rax      # 0x151e0
leaq (%rcx,%rax,2), %rcx
addq %rax, %rax
cmpq %rcx, %r13
movq $-0x1, %rbx
jl 0x5f88
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x50, %esi
jmp 0x6092
jmp 0x608a
movq %rax, %rbx
movl $0x90, %esi
movq %r15, %rdi
jmp 0x60a2
movq %rax, %rbx
movl $0x50, %esi
movq %r12, %rdi
callq 0x2200
movq %rbx, %rdi
callq 0x2340
nop