// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/channel.cc
// Function: PORE::getReconstructedPore()
vector< pair <int,XYZ> > PORE::getReconstructedPore(){

/*
 *  Pore variables
 *      std::vector<DELTA_POS> unitCells;    // List of displacements of unitcells in single PORE unit
 *          std::vector< std::vector<int> > ucNodes;  // List of nodes contained in each unit cell
 *              XYZ v_a, v_b, v_c;              // Unit cell vectors
 *
 *              */

 vector< pair <int,XYZ> > reconstructedNodeCoords;

 for(int unsigned i=0; i<unitCells.size(); i++)
    {
    for(int unsigned j=0; j<ucNodes[i].size(); j++)
       {
       int nd = ucNodes[i].at(j); // current node

       XYZ deltapos(double(unitCells[i].x), double(unitCells[i].y), double(unitCells[i].z));

       XYZ node(nodes[nd].x, nodes[nd].y, nodes[nd].z);

       node = node + v_a.scale(deltapos.x) + v_b.scale(deltapos.y) + v_c.scale(deltapos.z) ;

       pair <int,XYZ> p (nd,node);

       reconstructedNodeCoords.push_back(p);
       };
    };

/* DEBUGGING: Check if reconstructured nodes become duplicate atoms

 cout << "DEBUG: Pore/molecule size after reconstruction (XYZ coords) " << reconstructedNodeCoords.size() << endl;  
*/

 if(dimensionality>0) cout << "Calling PORE::getReconstructedPore for a pore with dim>0, it was not intended. DO NOT TRUST\n";

/* DEBUGGING: Printing out coordinates
 *  for(int unsigned i=0; i<reconstructedNodeCoords.size(); i++)
 *      {
 *          cout << "C    " << reconstructedNodeCoords[i].x << "  " << reconstructedNodeCoords[i].y << "  " << reconstructedNodeCoords[i].z << "\n";
 *              };
 *              */

 return reconstructedNodeCoords;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbx
andq $0x0, 0x10(%rdi)
xorpd %xmm0, %xmm0
movq %rdi, (%rsp)
movupd %xmm0, (%rdi)
leaq 0xc0(%rsi), %rax
movq %rax, 0x20(%rsp)
leaq 0xd8(%rsi), %rax
movq %rax, 0x18(%rsp)
leaq 0xf0(%rsi), %rax
movq %rax, 0x10(%rsp)
xorl %ecx, %ecx
leaq 0x60(%rsp), %r14
movl %ecx, %ecx
movq 0x98(%rbx), %rax
subq 0x90(%rbx), %rax
cqto
pushq $0xc
popq %rsi
idivq %rsi
cmpq %rcx, %rax
jbe 0x53d07
xorl %r15d, %r15d
imulq $0x18, %rcx, %r12
movq %rcx, 0x8(%rsp)
imulq $0xc, %rcx, %rax
movq %rax, 0x28(%rsp)
movl %r15d, %r15d
movq 0xa8(%rbx), %rdi
movq 0x8(%rdi,%r12), %rax
subq (%rdi,%r12), %rax
sarq $0x2, %rax
cmpq %r15, %rax
jbe 0x53cfb
addq %r12, %rdi
movq %r15, %rsi
callq 0xac00
movl (%rax), %ebp
movq 0x90(%rbx), %rax
movq 0x28(%rsp), %rcx
cvtsi2sdl (%rax,%rcx), %xmm0
cvtsi2sdl 0x4(%rax,%rcx), %xmm1
cvtsi2sdl 0x8(%rax,%rcx), %xmm2
leaq 0x48(%rsp), %rdi
callq 0x6402e
movslq %ebp, %rax
movq %rbx, %r13
movq 0x60(%rbx), %rcx
imulq $0x48, %rax, %rax
movsd 0x8(%rcx,%rax), %xmm0
movsd 0x10(%rcx,%rax), %xmm1
movsd 0x18(%rcx,%rax), %xmm2
leaq 0x30(%rsp), %rdi
callq 0x6402e
movsd 0x48(%rsp), %xmm0
leaq 0xe0(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x640ba
leaq 0x80(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movq %rbx, %rdx
callq 0x642d2
movsd 0x50(%rsp), %xmm0
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x640ba
leaq 0x98(%rsp), %rdi
leaq 0x80(%rsp), %rsi
movq %rbx, %rdx
callq 0x642d2
movsd 0x58(%rsp), %xmm0
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0x640ba
movq %r14, %rdi
leaq 0x98(%rsp), %rsi
movq %rbx, %rdx
callq 0x642d2
movq 0x70(%rsp), %rax
movq %rax, 0x40(%rsp)
movupd 0x60(%rsp), %xmm0
movapd %xmm0, 0x30(%rsp)
movl %ebp, 0x60(%rsp)
leaq 0x68(%rsp), %rcx
movq %rax, 0x10(%rcx)
movupd %xmm0, (%rcx)
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x57664
incl %r15d
movq %r13, %rbx
jmp 0x53bae
movq 0x8(%rsp), %rcx
incl %ecx
jmp 0x53b78
cmpl $0x0, 0x108(%rbx)
jle 0x53d23
movq 0xfc2a9(%rip), %rdi     # 0x14ffc0
leaq 0xafaaf(%rip), %rsi     # 0x1037cd
callq 0x4480
movq (%rsp), %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x53d47
jmp 0x53d47
jmp 0x53d47
jmp 0x53d47
jmp 0x53d47
jmp 0x53d47
jmp 0x53d47
movq %rax, %rbx
movq (%rsp), %rdi
callq 0x108f8
movq %rbx, %rdi
callq 0x4780
nop