// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movsd %xmm0, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
leaq 0x80(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %rdi, %r14
movq 0x48(%rdi), %r15
xorpd %xmm0, %xmm0
leaq 0x60(%rsp), %r12
movapd %xmm0, (%r12)
andq $0x0, 0x10(%r12)
xorl %ebx, %ebx
leaq 0x18(%rsp), %rbp
xorl %r13d, %r13d
cmpq 0x50(%r14), %r15
je 0x40f20
movsd 0x18(%r15), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x40f17
movq %r12, %rdi
movq %r15, %rsi
callq 0xa89e
movl %r13d, 0x18(%rsp)
movl %ebx, 0x1c(%rsp)
leaq 0x78(%rsp), %rdi
movq %rbp, %rsi
callq 0xf6e0
incl %ebx
incl %r13d
addq $0x40, %r15
jmp 0x40ee0
movq 0x10(%rsp), %rbx
leaq 0x48(%rbx), %rdi
leaq 0x60(%rsp), %rsi
callq 0x4b88c
movq 0x60(%r14), %r15
leaq 0x40(%rsp), %r12
andq $0x0, 0x10(%r12)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r12)
leaq 0x78(%rsp), %r13
cmpq 0x68(%r14), %r15
je 0x41004
movsd 0x8(%r15), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x40ffb
movq %r13, %rdi
movq %r15, %rsi
callq 0x10996
leaq 0x80(%rsp), %rcx
cmpq %rcx, %rax
je 0x40ffb
leaq 0x4(%r15), %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x10996
leaq 0x80(%rsp), %rcx
cmpq %rcx, %rax
je 0x40ffb
movq %r13, %rdi
movq %r15, %rsi
callq 0x10996
movl 0x24(%rax), %eax
movl %eax, 0x18(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x10996
movl 0x24(%rax), %eax
movl %eax, 0x1c(%rsp)
movsd 0x8(%r15), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x28(%rsp)
movl 0x18(%r15), %eax
movl %eax, 0x30(%rsp)
movsd 0x20(%r15), %xmm0
movsd %xmm0, 0x38(%rsp)
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0xa8ca
addq $0x28, %r15
jmp 0x40f51
leaq 0x60(%rbx), %rdi
leaq 0x40(%rsp), %rsi
callq 0x4b7c6
movq 0x10(%r14), %rax
movq %rax, 0x10(%rbx)
movups (%r14), %xmm0
movups %xmm0, (%rbx)
movups 0x18(%r14), %xmm0
movups %xmm0, 0x18(%rbx)
movq 0x28(%r14), %rax
movq %rax, 0x28(%rbx)
movups 0x30(%r14), %xmm0
movups %xmm0, 0x30(%rbx)
movq 0x40(%r14), %rax
movq %rax, 0x40(%rbx)
leaq 0x40(%rsp), %rdi
callq 0xb038
leaq 0x60(%rsp), %rdi
callq 0xb016
leaq 0x78(%rsp), %rdi
callq 0xaf66
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4107f
jmp 0x41090
jmp 0x4107f
jmp 0x4107f
jmp 0x4107f
jmp 0x4107f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xb038
jmp 0x41093
jmp 0x41090
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xb016
leaq 0x78(%rsp), %rdi
callq 0xaf66
movq %rbx, %rdi
callq 0x4780
nop