// File: Luthaf[P]zeopp/networkstorage.cc
// Function: filterVoronoiNetwork(VORONOI_NETWORK*, VORONOI_NETWORK*, double)
void filterVoronoiNetwork(VORONOI_NETWORK *vornet, VORONOI_NETWORK *newVornet, double minRadius){
    map<int,int> idMappings;
    vector<VOR_NODE>::iterator nodeIter = vornet->nodes.begin();
    vector<VOR_NODE> newNodes;
    int i = 0;
    int idCount = 0;
    
    // Add all nodes whose radius is greater than the provided minimum to a list
    while(nodeIter != vornet->nodes.end()){
        if(nodeIter->rad_stat_sphere > minRadius){
            newNodes.push_back(*nodeIter);
            idMappings.insert(pair<int,int> (i, idCount));
            idCount++;
        }
        i++;
        nodeIter++;
    }
    
    // Copy nodes that met requirement
    newVornet->nodes = newNodes;
    
    vector<VOR_EDGE>::iterator edgeIter = vornet->edges.begin();
    vector<VOR_EDGE> newEdges;
    
    // Add all edges whose radius is greater than the provided minimum to a list
    while(edgeIter != vornet->edges.end()){
        if((edgeIter->rad_moving_sphere > minRadius) && (
                                                         idMappings.find(edgeIter->from) != idMappings.end()) && (
                                                                                                                  idMappings.find(edgeIter->to) != idMappings.end())){
            VOR_EDGE newEdge;
            newEdge.from = idMappings.find(edgeIter->from)->second;
            newEdge.to   = idMappings.find(edgeIter->to)->second;
            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++;
    }
    
    // Copy edges that met requirement
    newVornet->edges = newEdges;
    
    // Copy unitcell vectors to new network
    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 $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xf6b0
movq -0x8(%rbp), %rdi
addq $0x48, %rdi
callq 0x25230
movq %rax, -0x50(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xae650
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movq -0x8(%rbp), %rdi
addq $0x48, %rdi
callq 0x250b0
movq %rax, -0x78(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x599b0
testb $0x1, %al
jne 0x9a710
jmp 0x9a7ce
leaq -0x50(%rbp), %rdi
callq 0x599f0
movsd 0x18(%rax), %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x9a7ae
leaq -0x50(%rbp), %rdi
callq 0xaed90
movq %rax, %rsi
leaq -0x68(%rbp), %rdi
callq 0xf440
jmp 0x9a740
leaq -0x8c(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0xf590
jmp 0x9a756
leaq -0x48(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
callq 0xf550
movb %dl, -0x139(%rbp)
movq %rax, -0x138(%rbp)
jmp 0x9a775
movb -0x139(%rbp), %al
movq -0x138(%rbp), %rcx
movq %rcx, -0xa0(%rbp)
movb %al, -0x98(%rbp)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x9a7ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x9ab21
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x59a10
movq %rax, -0xa8(%rbp)
jmp 0x9a6e9
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
leaq -0x68(%rbp), %rsi
callq 0xaeac0
jmp 0x9a7e1
movq -0x8(%rbp), %rdi
addq $0x60, %rdi
callq 0x263c0
movq %rax, -0xb0(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xae670
movq -0x8(%rbp), %rdi
addq $0x60, %rdi
callq 0x26230
movq %rax, -0xd0(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x59a50
testb $0x1, %al
jne 0x9a831
jmp 0x9aa86
leaq -0xb0(%rbp), %rdi
callq 0x59a90
movsd 0x8(%rax), %xmm0
xorl %eax, %eax
ucomisd -0x18(%rbp), %xmm0
movb %al, -0x13a(%rbp)
jbe 0x9a914
leaq -0xb0(%rbp), %rdi
callq 0x59a90
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x102e0
movq %rax, -0x148(%rbp)
jmp 0x9a876
movq -0x148(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x658c0
movq %rax, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xaed30
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x13a(%rbp)
jne 0x9a8b8
jmp 0x9a914
leaq -0xb0(%rbp), %rdi
callq 0x59a90
movq %rax, %rsi
addq $0x4, %rsi
leaq -0x48(%rbp), %rdi
callq 0x102e0
movq %rax, -0x150(%rbp)
jmp 0x9a8dd
movq -0x150(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x658c0
movq %rax, -0xf0(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xaed30
movb %al, -0x13a(%rbp)
movb -0x13a(%rbp), %al
testb $0x1, %al
jne 0x9a923
jmp 0x9aa6c
leaq -0x118(%rbp), %rdi
callq 0x99a20
jmp 0x9a931
leaq -0xb0(%rbp), %rdi
callq 0x59a90
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x102e0
movq %rax, -0x158(%rbp)
jmp 0x9a952
movq -0x158(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x10350
movl 0x4(%rax), %eax
movl %eax, -0x118(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x59a90
movq %rax, %rsi
addq $0x4, %rsi
leaq -0x48(%rbp), %rdi
callq 0x102e0
movq %rax, -0x160(%rbp)
jmp 0x9a99a
movq -0x160(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x10350
movl 0x4(%rax), %eax
movl %eax, -0x114(%rbp)
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x59a90
movq -0x168(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x110(%rbp)
callq 0x59a90
movq -0x168(%rbp), %rdi
movl 0x10(%rax), %eax
movl %eax, -0x108(%rbp)
callq 0x59a90
movq -0x168(%rbp), %rdi
movl 0x14(%rax), %eax
movl %eax, -0x104(%rbp)
callq 0x59a90
movq -0x168(%rbp), %rdi
movl 0x18(%rax), %eax
movl %eax, -0x100(%rbp)
callq 0x59a90
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0xf8(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0xf5e0
jmp 0x9aa4a
jmp 0x9aa6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x11b80
jmp 0x9ab21
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
callq 0x59ab0
movq %rax, -0x130(%rbp)
jmp 0x9a801
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
leaq -0xc8(%rbp), %rsi
callq 0xae870
jmp 0x9aa9c
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 -0xc8(%rbp), %rdi
callq 0x11b80
leaq -0x68(%rbp), %rdi
callq 0x11be0
leaq -0x48(%rbp), %rdi
callq 0xf860
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
leaq -0x68(%rbp), %rdi
callq 0x11be0
leaq -0x48(%rbp), %rdi
callq 0xf860
movq -0x80(%rbp), %rdi
callq 0x58f0
nopl (%rax)