// File: /workspace/github_cpp_makefile_star2_O3/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 $0xe8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x90(%rsi), %rcx
movq 0x98(%rsi), %rdx
cmpq %rcx, %rdx
je 0x71427
leaq 0xc0(%r14), %rax
movq %rax, 0x18(%rsp)
leaq 0xd8(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0xf0(%r14), %rax
movq %rax, 0x8(%rsp)
movq 0xa8(%r14), %rax
xorl %edi, %edi
leaq (%rdi,%rdi,2), %r12
movq (%rax,%r12,8), %rsi
cmpq %rsi, 0x8(%rax,%r12,8)
je 0x71404
movq %rdi, (%rsp)
movl $0x1, %r13d
xorl %ecx, %ecx
movl (%rsi,%rcx,4), %ebp
movq 0x90(%r14), %rax
xorps %xmm0, %xmm0
cvtsi2sdl (%rax,%r12,4), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%rax,%r12,4), %xmm1
cvtsi2sdl 0x8(%rax,%r12,4), %xmm2
leaq 0x58(%rsp), %rdi
callq 0x84364
movslq %ebp, %rax
movq 0x60(%r14), %rcx
leaq (%rax,%rax,8), %rax
movsd 0x8(%rcx,%rax,8), %xmm0
movsd 0x10(%rcx,%rax,8), %xmm1
movsd 0x18(%rcx,%rax,8), %xmm2
leaq 0x40(%rsp), %rdi
callq 0x84364
movsd 0x58(%rsp), %xmm0
leaq 0xd0(%rsp), %r15
movq %r15, %rdi
movq 0x18(%rsp), %rsi
callq 0x84416
leaq 0x70(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movq %r15, %rdx
callq 0x84642
movsd 0x60(%rsp), %xmm0
leaq 0xb8(%rsp), %r15
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x84416
leaq 0x88(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movq %r15, %rdx
callq 0x84642
movsd 0x68(%rsp), %xmm0
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x84416
leaq 0x20(%rsp), %rdi
leaq 0x88(%rsp), %rsi
movq %r15, %rdx
callq 0x84642
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x20(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movl %ebp, 0x20(%rsp)
leaq 0x28(%rsp), %rcx
movq %rax, 0x10(%rcx)
movups %xmm0, (%rcx)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x713bf
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x20, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x713cc
movq %rbx, %rdi
leaq 0x20(%rsp), %rdx
callq 0x768aa
movl %r13d, %ecx
movq 0xa8(%r14), %rax
movq (%rax,%r12,8), %rsi
movq 0x8(%rax,%r12,8), %rdx
subq %rsi, %rdx
sarq $0x2, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0x71294
movq 0x90(%r14), %rcx
movq 0x98(%r14), %rdx
movq (%rsp), %rdi
incl %edi
movq %rdx, %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
movabsq $-0x5555555555555555, %r8 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r8, %rsi
cmpq %rdi, %rsi
ja 0x71275
cmpl $0x0, 0x108(%r14)
jle 0x71449
movq 0x123b88(%rip), %rdi    # 0x194fc0
leaq 0xe3436(%rip), %rsi     # 0x154875
movl $0x5c, %edx
callq 0x44e0
movq %rbx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7146a
jmp 0x7146a
jmp 0x7146a
jmp 0x7146a
jmp 0x7146a
jmp 0x7146a
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x71481
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x4470
movq %r14, %rdi
callq 0x4780
nop