// File: /workspace/github_cpp_makefile_star2_O3/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 $0x118, %rsp            # imm = 0x118
movq %r8, %r14
movl %ecx, %ebp
movq %rdx, 0x70(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdi, %rbx
leaq 0x8(%rdi), %r13
xorl %eax, %eax
movl %eax, 0x8(%rdi)
movq %rax, 0x10(%rdi)
movq %r13, 0x18(%rdi)
movq %r13, 0x20(%rdi)
movq %rax, 0x28(%rdi)
leaq 0x30(%rdi), %rcx
movq %rcx, 0x58(%rsp)
leaq 0x38(%rdi), %r15
movl %eax, 0x38(%rdi)
movq %rax, 0x40(%rdi)
movq %r15, 0x48(%rdi)
movq %r15, 0x50(%rdi)
leaq 0x60(%rdi), %rcx
movq %rcx, 0x50(%rsp)
leaq 0x78(%rdi), %rcx
movq %rcx, 0x60(%rsp)
leaq 0xc0(%rdi), %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)
movq %rax, 0xb8(%rbx)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rdi, 0xa0(%rsp)
callq 0x84364
leaq 0xd8(%rbx), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rdi, 0x98(%rsp)
callq 0x84364
leaq 0xf0(%rbx), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rdi, 0x90(%rsp)
callq 0x84364
movq %r14, 0x88(%rsp)
movl %ebp, 0x6c(%rsp)
leaq 0x8(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r12)
xorl %eax, %eax
movq %rax, 0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
movq %rax, 0x20(%r12)
movq %rbx, %rdi
callq 0x116ea
movq 0x8(%r12), %rax
testq %rax, %rax
je 0x6eefd
movl 0x8(%rsp), %ecx
movl %ecx, 0x8(%rbx)
movq %rax, 0x10(%rbx)
movups 0x18(%rsp), %xmm0
movups %xmm0, 0x18(%rbx)
movq %r13, 0x8(%rax)
movq 0x28(%rsp), %rax
movq %rax, 0x28(%rbx)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq %rsp, %r14
movq %r14, %rdi
callq 0xf1b6
xorl %eax, %eax
movq %rax, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq %r12, 0x18(%r14)
movq %r12, 0x20(%r14)
movq %rax, 0x28(%r14)
movq 0x58(%rsp), %rdi
callq 0x116ea
movq 0x10(%r14), %rax
testq %rax, %rax
movq 0x78(%rsp), %rbp
je 0x6ef70
movl 0x8(%rsp), %ecx
movl %ecx, 0x38(%rbx)
movq %rax, 0x40(%rbx)
movups 0x18(%rsp), %xmm0
movups %xmm0, 0x48(%rbx)
movq %r15, 0x8(%rax)
movq 0x28(%rsp), %rax
movq %rax, 0x58(%rbx)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq %rsp, %r14
movq %r14, %rdi
callq 0xf1b6
movq 0x70(%rbx), %rax
movups 0x60(%rbx), %xmm0
xorl %r15d, %r15d
movq 0x50(%rsp), %rcx
movq %r15, 0x10(%rcx)
xorps %xmm1, %xmm1
movups %xmm1, (%rcx)
movaps %xmm0, (%r14)
movq %rax, 0x10(%r14)
leaq 0xd0(%rsp), %r14
movaps %xmm1, (%r14)
movq %r15, 0x10(%r14)
movq %rsp, %rdi
callq 0xf10e
movq %r14, %rdi
callq 0xf10e
movq 0x78(%rbx), %rdi
movq 0x88(%rbx), %rsi
movq 0x60(%rsp), %rax
movq %r15, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
testq %rdi, %rdi
je 0x6efe4
subq %rdi, %rsi
callq 0x4470
movq (%rbp), %rax
movq 0x8(%rbp), %rcx
cmpq %rax, %rcx
je 0x6f059
xorl %r14d, %r14d
movq %rsp, %r15
movl (%rax,%r14,4), %eax
movl %eax, (%rsp)
movl %r14d, 0x4(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x135ee
movq (%rbp), %rax
movq 0x8(%rbp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
jbe 0x6f3de
movl %r14d, (%rsp)
movl (%rax,%r14,4), %eax
movl %eax, 0x4(%rsp)
movq 0x58(%rsp), %rdi
movq %r15, %rsi
callq 0x135ee
incl %r14d
movq (%rbp), %rax
movq 0x8(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
ja 0x6eff7
cmpq %rax, %rcx
je 0x6f318
leaq 0x20(%rsp), %r15
xorl %edx, %edx
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
movq %rdx, 0x80(%rsp)
movslq (%rax,%rdx,4), %rsi
movq 0x70(%rsp), %rax
movq (%rax), %rbp
movq 0x8(%rax), %rdx
subq %rbp, %rdx
sarq $0x3, %rdx
movabsq $-0x71c71c71c71c71c7, %rax # imm = 0x8E38E38E38E38E39
imulq %rax, %rdx
cmpq %rsi, %rdx
jbe 0x6f3ef
leaq (%rsi,%rsi,8), %r12
leaq 0x20(,%r12,8), %rsi
addq %rbp, %rsi
movups -0x20(%rsi), %xmm0
movups -0x10(%rsi), %xmm1
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %r15, %rdi
callq 0x37e9e
leaq (,%r12,8), %rax
addq %rbp, %rax
movb 0x40(%rax), %cl
movb %cl, 0x20(%r15)
movq 0x38(%rax), %rax
movq %rax, 0x18(%r15)
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movsd 0x38(%rsp), %xmm3
leaq 0xd0(%rsp), %r15
movq %r15, %rdi
movq 0x80(%rsp), %rsi
movl $0x1, %edx
callq 0x50946
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rdx
cmpq %rax, %rdx
je 0x6f2aa
xorl %ebp, %ebp
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x6f291
leaq (,%rbp,4), %r8
addq %rbp, %r8
movl (%rax,%r8,8), %r10d
movl 0x4(%rax,%r8,8), %edi
movsd 0x8(%rax,%r8,8), %xmm0
movsd 0x10(%rax,%r8,8), %xmm1
movq 0x18(%rax,%r8,8), %rcx
movl 0x20(%rax,%r8,8), %r8d
movq %rsi, %r9
movq %r13, %r11
xorl %r12d, %r12d
cmpl %r10d, 0x20(%r9)
setl %r12b
cmovgeq %r9, %r11
movq 0x10(%r9,%r12,8), %r9
testq %r9, %r9
jne 0x6f174
movq %r13, %r9
cmpq %r13, %r11
je 0x6f1a0
cmpl 0x20(%r11), %r10d
cmovlq %r13, %r11
movq %r11, %r9
movq %r13, %r10
xorl %r11d, %r11d
cmpl %edi, 0x20(%rsi)
setl %r11b
cmovgeq %rsi, %r10
movq 0x10(%rsi,%r11,8), %rsi
testq %rsi, %rsi
jne 0x6f1a3
cmpq %r13, %r10
je 0x6f291
cmpl 0x20(%r10), %edi
jl 0x6f291
movl 0x24(%r9), %esi
movl 0x24(%r10), %edx
leaq 0xa8(%rsp), %rdi
callq 0x5081a
movq 0xf8(%rsp), %rsi
cmpq 0x100(%rsp), %rsi
je 0x6f223
movq 0xc8(%rsp), %rax
movq %rax, 0x20(%rsi)
movups 0xa8(%rsp), %xmm0
movups 0xb8(%rsp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x28, 0xf8(%rsp)
jmp 0x6f238
leaq 0xf0(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x392d4
movq 0x80(%rbx), %rsi
cmpq 0x88(%rbx), %rsi
je 0x6f275
movq 0xc8(%rsp), %rax
movq %rax, 0x20(%rsi)
movups 0xa8(%rsp), %xmm0
movups 0xb8(%rsp), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x28, 0x80(%rbx)
jmp 0x6f287
movq 0x60(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x392d4
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rdx
incl %ebp
movq %rdx, %rcx
subq %rax, %rcx
sarq $0x3, %rcx
imulq %r14, %rcx
cmpq %rbp, %rcx
ja 0x6f135
movq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x50ea0
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
movq 0x78(%rsp), %r12
je 0x6f2d9
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x6f2f0
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x80(%rsp), %rdx
incl %edx
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rdx, %rcx
leaq 0x20(%rsp), %r15
ja 0x6f073
movq 0x88(%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 0x6c(%rsp), %eax
movl %eax, 0x108(%rbx)
movq 0x70(%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 0x6f4b2
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xde310(%rip), %rdi     # 0x14d6f5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xde2ff(%rip), %rdi     # 0x14d6f5
xorl %eax, %eax
callq 0x4630
jmp 0x6f40e
jmp 0x6f40e
jmp 0x6f40e
movq %rax, %r14
jmp 0x6f433
jmp 0x6f413
jmp 0x6f40e
jmp 0x6f40e
movq %rax, %r14
jmp 0x6f44a
movq %rax, %r14
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x6f433
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x6f44a
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0xa8(%rbx), %rdi
callq 0xf066
movq 0x90(%rbx), %rdi
testq %rdi, %rdi
je 0x6f471
movq 0xa0(%rbx), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x60(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x6f48d
movq 0x88(%rbx), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x50(%rsp), %rdi
callq 0xf10e
movq 0x58(%rsp), %rdi
callq 0xf1b6
movq %rbx, %rdi
callq 0xf1b6
movq %r14, %rdi
callq 0x4780
nop