// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/channel.cc
// Function: PORE::PORE(std::vector<int, std::allocator<int>>, DIJKSTRA_NETWORK*, int, int (*) [3])
PORE::PORE(vector<int> nodeIDs, DIJKSTRA_NETWORK *dnet, int dim, int basisVecs[3][3]){
    idMappings = map<int,int> ();
    reverseIDMappings = map<int,int> ();
    nodes = vector<DIJKSTRA_NODE> ();
    connections = vector<CONN> ();
    
    // Reindex the nodes to facilitate storage
    for(unsigned int i = 0; i < nodeIDs.size(); i++){
        idMappings.insert(pair<int,int>(nodeIDs.at(i),i));
        reverseIDMappings.insert(pair<int,int>(i,nodeIDs.at(i)));
    }
    
    // Iterate over all nodes in list
    for(unsigned int i = 0; i < nodeIDs.size(); i++){
        DIJKSTRA_NODE oldNode = dnet->nodes.at(nodeIDs.at(i));
        DIJKSTRA_NODE newNode = DIJKSTRA_NODE(i, oldNode.x, oldNode.y, oldNode.z, oldNode.max_radius);
        
        // Include connection only if end node is in pore
        // Reindex connection start and end ids
        for(unsigned int j = 0; j < oldNode.connections.size(); j++){
            CONN oldConn = oldNode.connections.at(j);
            map<int,int>::iterator id1Iter = idMappings.find(oldConn.from);
            map<int,int>::iterator id2Iter = idMappings.find(oldConn.to);
            if(id2Iter != idMappings.end()){
                CONN newConn = CONN(id1Iter->second,id2Iter->second,oldConn.length,oldConn.max_radius,oldConn.deltaPos);
                newNode.connections.push_back(newConn);
                connections.push_back(newConn);
            }
        }
        nodes.push_back(newNode);
    }
    
    basis[0][0] = basisVecs[0][0];  basis[0][1] = basisVecs[0][1];  basis[0][2] = basisVecs[0][2];
    basis[1][0] = basisVecs[1][0];  basis[1][1] = basisVecs[1][1];  basis[1][2] = basisVecs[1][2];
    basis[2][0] = basisVecs[2][0];  basis[2][1] = basisVecs[2][1];  basis[2][2] = basisVecs[2][2];
    dimensionality = dim;
    
    // Store unit cell vectors
    v_a = dnet->v_a;
    v_b = dnet->v_b;
    v_c = dnet->v_c;
    reconstruct();    // Reconstruct pore
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %r8, 0xa8(%rsp)
movl %ecx, 0x24(%rsp)
movq %rdx, 0x28(%rsp)
movq %rdi, %rbx
leaq 0x8(%rdi), %r13
andl $0x0, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
movq %r13, 0x18(%rdi)
movq %r13, 0x20(%rdi)
andq $0x0, 0x28(%rdi)
movq %rsi, %r12
andl $0x0, 0x38(%rdi)
leaq 0x30(%rdi), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x40(%rdi)
leaq 0x38(%rdi), %rax
movq %rax, 0x48(%rdi)
movq %rax, 0x50(%rdi)
leaq 0x60(%rdi), %rax
movq %rax, 0x8(%rsp)
leaq 0x78(%rdi), %rax
movq %rax, 0x18(%rsp)
addq $0xc0, %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x58(%rbx)
movups %xmm0, 0x68(%rbx)
movups %xmm0, 0x78(%rbx)
movups %xmm0, 0x88(%rbx)
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0xa8(%rbx)
andq $0x0, 0xb8(%rbx)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rdi, 0xa0(%rsp)
callq 0x6402e
leaq 0xd8(%rbx), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rdi, 0x98(%rsp)
callq 0x6402e
leaq 0xf0(%rbx), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rdi, 0x90(%rsp)
callq 0x6402e
leaq 0x48(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r15)
andq $0x0, 0x8(%r15)
movq %r15, 0x10(%r15)
movq %r15, 0x18(%r15)
andq $0x0, 0x20(%r15)
leaq 0x40(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd62a
movq %r14, %rdi
callq 0xaf66
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movq %r15, 0x18(%r14)
movq %r15, 0x20(%r14)
andq $0x0, 0x28(%r14)
leaq 0x40(%rsp), %r15
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0xd62a
movq %r15, %rdi
callq 0xaf66
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x40(%rsp), %r15
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x2ac56
movq %r15, %rdi
callq 0xae22
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x40(%rsp), %r15
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x2b9e2
movq %r15, %rdi
callq 0xaf14
xorl %ebp, %ebp
movl %ebp, %r15d
movq (%r12), %rcx
movq 0x8(%r12), %rax
movq %rax, %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
jbe 0x52420
movq %r12, %rdi
movq %r15, %rsi
callq 0xac00
movl (%rax), %eax
movl %eax, 0x40(%rsp)
movl %ebp, 0x44(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf6e0
movq %r12, %rdi
movq %r15, %rsi
callq 0xac00
movl %ebp, 0x40(%rsp)
movl (%rax), %eax
movl %eax, 0x44(%rsp)
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0xf6e0
incl %ebp
jmp 0x523bf
movq %r12, 0x30(%rsp)
xorl %esi, %esi
pushq $0x28
popq %r12
leaq 0x120(%rsp), %r15
subq %rcx, %rax
movl %esi, %esi
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x525a5
movq 0x30(%rsp), %rdi
movq %rsi, 0x38(%rsp)
callq 0xac00
movslq (%rax), %rsi
movq 0x28(%rsp), %rdi
callq 0xabe2
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x29ebe
movsd 0x48(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
movsd 0x58(%rsp), %xmm2
movsd 0x78(%rsp), %xmm3
leaq 0xd8(%rsp), %rdi
movq 0x38(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x3d56e
xorl %ebp, %ebp
movl %ebp, %ebp
movq 0x68(%rsp), %rax
subq 0x60(%rsp), %rax
cqto
idivq %r12
cmpq %rbp, %rax
jbe 0x52564
leaq 0x60(%rsp), %rdi
movq %rbp, %rsi
callq 0x29efa
movq 0x20(%rax), %rcx
movq %rcx, 0xd0(%rsp)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movq %rbx, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x10996
movq %rax, %r14
movq %rbx, %rdi
leaq 0xb4(%rsp), %rsi
callq 0x10996
cmpq %r13, %rax
je 0x5255d
movl 0x24(%r14), %esi
movl 0x24(%rax), %edx
movsd 0xb8(%rsp), %xmm0
movsd 0xc0(%rsp), %xmm1
movq 0xc8(%rsp), %rcx
movl 0xd0(%rsp), %r8d
movq %r15, %rdi
callq 0x3d47e
leaq 0xf8(%rsp), %rdi
movq %r15, %rsi
callq 0x29ff6
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x29ff6
incl %ebp
jmp 0x5249d
movq 0x8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x3d9ba
leaq 0xf8(%rsp), %rdi
callq 0xaf14
leaq 0x60(%rsp), %rdi
callq 0xaf14
movq 0x38(%rsp), %rsi
incl %esi
movq 0x30(%rsp), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
jmp 0x52433
movq 0xa8(%rsp), %rcx
movl (%rcx), %eax
movl %eax, 0x10c(%rbx)
movl 0x4(%rcx), %eax
movl %eax, 0x110(%rbx)
movl 0x8(%rcx), %eax
movl %eax, 0x114(%rbx)
movl 0xc(%rcx), %eax
movl %eax, 0x118(%rbx)
movl 0x10(%rcx), %eax
movl %eax, 0x11c(%rbx)
movl 0x14(%rcx), %eax
movl %eax, 0x120(%rbx)
movl 0x18(%rcx), %eax
movl %eax, 0x124(%rbx)
movl 0x1c(%rcx), %eax
movl %eax, 0x128(%rbx)
movl 0x20(%rcx), %eax
movl %eax, 0x12c(%rbx)
movl 0x24(%rsp), %eax
movl %eax, 0x108(%rbx)
movq 0x28(%rsp), %rcx
movq 0x28(%rcx), %rax
movq 0xa0(%rsp), %rdx
movq %rax, 0x10(%rdx)
movups 0x18(%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x40(%rcx), %rax
movq 0x98(%rsp), %rdx
movq %rax, 0x10(%rdx)
movups 0x30(%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x58(%rcx), %rax
movq 0x90(%rsp), %rdx
movq %rax, 0x10(%rdx)
movups 0x48(%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rbx, %rdi
callq 0x526e6
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x52678
jmp 0x52683
movq %rax, %r15
jmp 0x52693
jmp 0x52678
jmp 0x52678
movq %rax, %r15
jmp 0x5269d
jmp 0x52683
jmp 0x52683
jmp 0x52683
movq %rax, %r15
leaq 0xf8(%rsp), %rdi
callq 0xaf14
leaq 0x60(%rsp), %rdi
callq 0xaf14
leaq 0xa8(%rbx), %rdi
leaq 0x90(%rbx), %r14
callq 0xad7e
movq %r14, %rdi
callq 0xb758
movq 0x18(%rsp), %rdi
callq 0xaf14
movq 0x8(%rsp), %rdi
callq 0xae22
movq 0x10(%rsp), %rdi
callq 0xaf66
movq %rbx, %rdi
callq 0xaf66
movq %r15, %rdi
callq 0x4780