// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/networkstorage.cc
// Function: pruneVoronoiNetworkfromEdgeList(VORONOI_NETWORK*, VORONOI_NETWORK*, std::vector<int, std::allocator<int>>)
void pruneVoronoiNetworkfromEdgeList(VORONOI_NETWORK *vornet,
                                     VORONOI_NETWORK *newVornet,
                                     vector <int> ids){
    
    newVornet->nodes = vornet->nodes;
    
    vector<VOR_EDGE>::iterator edgeIter = vornet->edges.begin();
    vector<VOR_EDGE> newEdges;
    
    // Add all edges whose are not connected to specified nodes
    while(edgeIter != vornet->edges.end()){
        int flag=0;
        for(unsigned int i=0; i<ids.size(); i++){
            // if edge connects to node of specified id, flag it
            if(edgeIter->from==ids[i]||edgeIter->to==ids[i]) flag++;
        };
        
        if(flag==0){ // only keep unflagged edges
            VOR_EDGE newEdge;
            newEdge.from = edgeIter->from;
            newEdge.to   = edgeIter->to;
            newEdge.rad_moving_sphere = edgeIter->rad_moving_sphere;
            newEdge.delta_uc_x = edgeIter->delta_uc_x;
            newEdge.delta_uc_y = edgeIter->delta_uc_y;
            newEdge.delta_uc_z = edgeIter->delta_uc_z;
            newEdge.length = edgeIter->length;
            newEdges.push_back(newEdge);
        }
        edgeIter++;
    }
    
    
    newVornet->edges = newEdges;
    newVornet->v_a = vornet->v_a;
    newVornet->v_b = vornet->v_b;
    newVornet->v_c = vornet->v_c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x48(%rdi), %rsi
leaq 0x48(%rbx), %rdi
callq 0x673a2
movq 0x60(%r14), %rbp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x68(%r14), %rax
cmpq %rax, %rbp
je 0x55f56
movq %rsp, %r12
leaq 0x20(%rsp), %r13
movq (%r15), %rcx
movq 0x8(%r15), %rdx
subq %rcx, %rdx
je 0x55f0b
sarq $0x2, %rdx
movl (%rbp), %esi
xorl %edi, %edi
xorl %r8d, %r8d
movl (%rcx,%rdi,4), %r9d
cmpl %r9d, %esi
je 0x55ef8
cmpl %r9d, 0x4(%rbp)
jne 0x55efb
incl %r8d
incq %rdi
movl %edi, %r9d
cmpq %r9, %rdx
ja 0x55ee9
testl %r8d, %r8d
jne 0x55f49
movq (%rbp), %rax
movq %rax, 0x20(%rsp)
movsd 0x8(%rbp), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x10(%rbp), %rax
movq %rax, 0x30(%rsp)
movl 0x18(%rbp), %eax
movl %eax, 0x38(%rsp)
movsd 0x20(%rbp), %xmm0
movsd %xmm0, 0x40(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0xea2c
movq 0x68(%r14), %rax
addq $0x28, %rbp
cmpq %rax, %rbp
jne 0x55ed1
leaq 0x60(%rbx), %rdi
movq %rsp, %rsi
callq 0x67218
movq 0x10(%r14), %rax
movq %rax, 0x10(%rbx)
movups (%r14), %xmm0
movups %xmm0, (%rbx)
movq 0x28(%r14), %rax
movq %rax, 0x28(%rbx)
movups 0x18(%r14), %xmm0
movups %xmm0, 0x18(%rbx)
movq 0x40(%r14), %rax
movq %rax, 0x40(%rbx)
movups 0x30(%r14), %xmm0
movups %xmm0, 0x30(%rbx)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x55fa9
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x55fba
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x55fd3
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780