// File: 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
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x128(%rbp)
movq %rdi, %rax
movq %rax, -0x120(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
movb $0x0, -0x11(%rbp)
callq 0xcd5c0
movl $0x0, -0x18(%rbp)
movq -0x118(%rbp), %rdi
movl -0x18(%rbp), %eax
movq %rax, -0x130(%rbp)
addq $0x90, %rdi
callq 0x706e0
movq %rax, %rcx
movq -0x130(%rbp), %rax
cmpq %rcx, %rax
jae 0xc7052
movl $0x0, -0x1c(%rbp)
movq -0x118(%rbp), %rdi
movl -0x1c(%rbp), %eax
movq %rax, -0x138(%rbp)
addq $0xa8, %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x10890
movq %rax, %rdi
callq 0x10090
movq %rax, %rcx
movq -0x138(%rbp), %rax
cmpq %rcx, %rax
jae 0xc7042
movq -0x118(%rbp), %rdi
addq $0xa8, %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x10890
movq %rax, %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x101d0
movq %rax, -0x140(%rbp)
jmp 0xc6e31
movq -0x118(%rbp), %rdi
movq -0x140(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x20(%rbp)
addq $0x90, %rdi
movq %rdi, -0x158(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x658f0
movq -0x158(%rbp), %rdi
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0x150(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x658f0
movq -0x158(%rbp), %rdi
cvtsi2sdl 0x4(%rax), %xmm0
movsd %xmm0, -0x148(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x658f0
movsd -0x150(%rbp), %xmm0
movsd -0x148(%rbp), %xmm1
cvtsi2sdl 0x8(%rax), %xmm2
leaq -0x48(%rbp), %rdi
callq 0xea8e0
jmp 0xc6eb7
movq -0x118(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0x170(%rbp)
movslq -0x20(%rbp), %rsi
callq 0x2a4c0
movq -0x170(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x168(%rbp)
movslq -0x20(%rbp), %rsi
callq 0x2a4c0
movq -0x170(%rbp), %rdi
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x160(%rbp)
movslq -0x20(%rbp), %rsi
callq 0x2a4c0
movsd -0x168(%rbp), %xmm0
movsd -0x160(%rbp), %xmm1
movsd 0x18(%rax), %xmm2
leaq -0x60(%rbp), %rdi
callq 0xea8e0
jmp 0xc6f2c
movq -0x118(%rbp), %rsi
addq $0xc0, %rsi
movsd -0x48(%rbp), %xmm0
leaq -0xc0(%rbp), %rdi
callq 0xea9f0
jmp 0xc6f4d
leaq -0xa8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0xeae50
jmp 0xc6f66
movq -0x118(%rbp), %rsi
addq $0xd8, %rsi
movsd -0x40(%rbp), %xmm0
leaq -0xd8(%rbp), %rdi
callq 0xea9f0
jmp 0xc6f87
leaq -0x90(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0xeae50
jmp 0xc6fa3
movq -0x118(%rbp), %rsi
addq $0xf0, %rsi
movsd -0x38(%rbp), %xmm0
leaq -0xf0(%rbp), %rdi
callq 0xea9f0
jmp 0xc6fc4
leaq -0x78(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0xeae50
jmp 0xc6fdd
movq -0x68(%rbp), %rax
movq %rax, -0x50(%rbp)
movups -0x78(%rbp), %xmm0
movaps %xmm0, -0x60(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0xcd5e0
jmp 0xc7003
movq -0x128(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xcd620
jmp 0xc7018
jmp 0xc701a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc6dc6
movq -0x128(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x2aee0
jmp 0xc709f
jmp 0xc7044
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xc6d8f
movq -0x118(%rbp), %rax
cmpl $0x0, 0x108(%rax)
jle 0xc7079
movq 0x1abf57(%rip), %rdi    # 0x272fc0
leaq 0x134455(%rip), %rsi    # 0x1fb4c5
callq 0x5540
jmp 0xc7077
jmp 0xc7079
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0xc708f
movq -0x128(%rbp), %rdi
callq 0x2aee0
movq -0x120(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x58f0
nopl (%rax,%rax)