// File: 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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdx, -0x90(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rsi
addq $0x48, %rsi
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
callq 0xaeac0
movq -0x8(%rbp), %rdi
addq $0x60, %rdi
callq 0x263c0
movq %rax, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xae670
movq -0x8(%rbp), %rdi
addq $0x60, %rdi
callq 0x26230
movq %rax, -0x40(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x59a50
testb $0x1, %al
jne 0x9ae04
jmp 0x9af8f
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x90(%rbp), %rdi
movl -0x48(%rbp), %eax
movq %rax, -0x98(%rbp)
callq 0x10090
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jae 0x9aeaf
leaq -0x20(%rbp), %rdi
callq 0x59a90
movq -0x90(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0xed60
movq %rax, %rcx
movl -0x9c(%rbp), %eax
cmpl (%rcx), %eax
je 0x9ae96
leaq -0x20(%rbp), %rdi
callq 0x59a90
movq -0x90(%rbp), %rdi
movl 0x4(%rax), %eax
movl %eax, -0xa0(%rbp)
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0xed60
movq %rax, %rcx
movl -0xa0(%rbp), %eax
cmpl (%rcx), %eax
jne 0x9ae9f
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x9aea1
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x9ae12
cmpl $0x0, -0x44(%rbp)
jne 0x9af78
leaq -0x70(%rbp), %rdi
callq 0x99a20
jmp 0x9aec4
leaq -0x20(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x59a90
movq -0xa8(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x70(%rbp)
callq 0x59a90
movq -0xa8(%rbp), %rdi
movl 0x4(%rax), %eax
movl %eax, -0x6c(%rbp)
callq 0x59a90
movq -0xa8(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
callq 0x59a90
movq -0xa8(%rbp), %rdi
movl 0x10(%rax), %eax
movl %eax, -0x60(%rbp)
callq 0x59a90
movq -0xa8(%rbp), %rdi
movl 0x14(%rax), %eax
movl %eax, -0x5c(%rbp)
callq 0x59a90
movq -0xa8(%rbp), %rdi
movl 0x18(%rax), %eax
movl %eax, -0x58(%rbp)
callq 0x59a90
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xf5e0
jmp 0x9af5c
jmp 0x9af78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x11b80
jmp 0x9b012
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x59ab0
movq %rax, -0x88(%rbp)
jmp 0x9addd
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
leaq -0x38(%rbp), %rsi
callq 0xae870
jmp 0x9afa2
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq 0x20(%rcx), %rdx
movq %rdx, 0x20(%rax)
movq 0x28(%rcx), %rcx
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x30(%rcx), %rdx
movq %rdx, 0x30(%rax)
movq 0x38(%rcx), %rdx
movq %rdx, 0x38(%rax)
movq 0x40(%rcx), %rcx
movq %rcx, 0x40(%rax)
leaq -0x38(%rbp), %rdi
callq 0x11b80
addq $0xb0, %rsp
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x58f0
nopl (%rax,%rax)