// File: 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
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rcx
movsd 0x28(%rcx), %xmm0
movsd %xmm0, 0x28(%rax)
movq -0x10(%rbp), %rcx
movsd 0x30(%rcx), %xmm0
movsd %xmm0, 0x30(%rax)
movq -0x10(%rbp), %rcx
movsd 0x38(%rcx), %xmm0
movsd %xmm0, 0x38(%rax)
movq -0x10(%rbp), %rcx
movsd 0x40(%rcx), %xmm0
movsd %xmm0, 0x40(%rax)
movq -0x10(%rbp), %rcx
movsd 0x50(%rcx), %xmm0
movsd %xmm0, 0x50(%rax)
movq -0x10(%rbp), %rcx
movsd 0x60(%rcx), %xmm0
movsd %xmm0, 0x60(%rax)
movq -0x10(%rbp), %rcx
movsd 0x48(%rcx), %xmm0
movsd %xmm0, 0x48(%rax)
movq -0x10(%rbp), %rcx
movsd 0x58(%rcx), %xmm0
movsd %xmm0, 0x58(%rax)
movq -0x10(%rbp), %rcx
movsd 0x68(%rcx), %xmm0
movsd %xmm0, 0x68(%rax)
movq -0x10(%rbp), %rcx
movsd 0x70(%rcx), %xmm0
movsd %xmm0, 0x70(%rax)
movq -0x10(%rbp), %rcx
movsd 0x78(%rcx), %xmm0
movsd %xmm0, 0x78(%rax)
movq -0x10(%rbp), %rcx
movsd 0x80(%rcx), %xmm0
movsd %xmm0, 0x80(%rax)
movl $0x90, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0xbaf0
jmp 0xaaf8
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movl $0x50, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xc440
jmp 0xab26
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movsd 0x20(%rcx), %xmm0
movsd %xmm0, 0x20(%rax)
leaq 0x1bb71(%rip), %rdi     # 0x266b8
callq 0x5b00
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x20(%rbp)
movslq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x1bb2a(%rip), %rdi     # 0x266b8
callq 0x5b00
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0xac4a
movl $0x50, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xc440
jmp 0xabce
movq -0x58(%rbp), %rdx
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xab7f
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x90, %esi
callq 0x3260
jmp 0xaea3
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x50, %esi
callq 0x3260
jmp 0xaea3
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x50, %esi
callq 0x3260
jmp 0xaea3
leaq 0x1ba7f(%rip), %rdi     # 0x266d0
callq 0x5b00
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq 0x1ba38(%rip), %rdi     # 0x266d0
callq 0x5b00
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0xad12
movl $0x90, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xbaf0
jmp 0xacd4
movq -0x68(%rbp), %rdx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xac89
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x90, %esi
callq 0x3260
jmp 0xaea3
movl 0x1b9d0(%rip), %eax     # 0x266e8
movl 0x1b54a(%rip), %ecx     # 0x26268
shll %ecx
addl %ecx, %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x88(%rax)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl 0x1b985(%rip), %ecx     # 0x266e8
movl 0x1b4ff(%rip), %edx     # 0x26268
shll %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0xae9d
movl 0x1b971(%rip), %eax     # 0x266ec
movl 0x1b4e7(%rip), %ecx     # 0x26268
shll %ecx
addl %ecx, %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, %rdx
movq -0x40(%rbp), %rax
movq 0x88(%rax), %rax
movslq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl 0x1b91e(%rip), %ecx     # 0x266ec
movl 0x1b494(%rip), %edx     # 0x26268
shll %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0xae8d
movl 0x1b90a(%rip), %eax     # 0x266f0
movl 0x1b47c(%rip), %ecx     # 0x26268
shll %ecx
addl %ecx, %eax
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, %rsi
movq -0x40(%rbp), %rax
movq 0x88(%rax), %rcx
movslq -0x28(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x2c(%rbp), %rdx
movq %rsi, (%rcx,%rdx,8)
movq 0x88(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl 0x1b887(%rip), %eax     # 0x266f0
movl 0x1b3f9(%rip), %ecx     # 0x26268
shll %ecx
addl %ecx, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
callq 0x31f0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xadc5
jmp 0xae8f
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xad5a
addq $0x70, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x3420
nopl (%rax)