// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/networkstorage.cc
// Function: filterVoronoiNetwork(VORONOI_NETWORK const*, double)
VORONOI_NETWORK filterVoronoiNetwork(const VORONOI_NETWORK* vornet, double minRadius)
{
    // Add all nodes whose radius is greater than the provided minimum to a list
    map<int,int> idMappings;
    vector<VOR_NODE> newNodes;
    
    int i = 0;
    int idCount = 0;
    vector<VOR_NODE>::const_iterator nodeIter = vornet->nodes.begin();
    for(;nodeIter != vornet->nodes.end(); i++, nodeIter++)
        if(nodeIter->rad_stat_sphere > minRadius){
            newNodes.push_back(*nodeIter);
            idMappings.insert(pair<int,int> (i, idCount));
            idCount++;
        }
    
    // Add all edges whose radius is greater than the provided minimum to a list
    vector<VOR_EDGE> newEdges;
    
    vector<VOR_EDGE>::const_iterator edgeIter = vornet->edges.begin();
    for(;edgeIter != vornet->edges.end(); edgeIter++)
        if((edgeIter->rad_moving_sphere > minRadius) && 
                    (idMappings.find(edgeIter->from) != idMappings.end()) && 
                    (idMappings.find(edgeIter->to) != idMappings.end())){
            int from = idMappings.find(edgeIter->from)->second;
            int to = idMappings.find(edgeIter->to)->second;
            newEdges.push_back(
                               VOR_EDGE(from, to, edgeIter->rad_moving_sphere,
                                        edgeIter->delta_uc_x, edgeIter->delta_uc_y,
                                        edgeIter->delta_uc_z, edgeIter->length)
                              );
        }
    
    return VORONOI_NETWORK(vornet->v_a, vornet->v_b, vornet->v_c, newNodes, newEdges);
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movsd %xmm0, 0x8(%rsp)
movq %rsi, %r14
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, 0x10(%rsp)
xorpd %xmm0, %xmm0
leaq 0x60(%rsp), %r15
movapd %xmm0, (%r15)
andq $0x0, 0x10(%r15)
movq 0x48(%rsi), %r12
xorl %ebx, %ebx
leaq 0x18(%rsp), %rbp
xorl %r13d, %r13d
cmpq 0x50(%r14), %r12
je 0x40d1d
movsd 0x18(%r12), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x40d14
movq %r15, %rdi
movq %r12, %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, %r12
jmp 0x40cdc
xorpd %xmm0, %xmm0
leaq 0x40(%rsp), %r15
andq $0x0, 0x10(%r15)
movapd %xmm0, (%r15)
movq 0x60(%r14), %r12
leaq 0x78(%rsp), %r13
leaq 0x80(%rsp), %rbp
cmpq 0x68(%r14), %r12
je 0x40df2
movsd 0x8(%r12), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x40de9
movq %r13, %rdi
movq %r12, %rsi
callq 0x10996
cmpq %rbp, %rax
je 0x40de9
leaq 0x4(%r12), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x10996
cmpq %rbp, %rax
je 0x40de9
movq %r13, %rdi
movq %r12, %rsi
callq 0x10996
movl 0x24(%rax), %ebp
movq %r13, %rdi
movq %rbx, %rsi
callq 0x10996
movl 0x24(%rax), %eax
movsd 0x8(%r12), %xmm0
movl 0x18(%r12), %ecx
movsd 0x20(%r12), %xmm1
movl %ebp, 0x18(%rsp)
movl %eax, 0x1c(%rsp)
movsd %xmm0, 0x20(%rsp)
movq 0x10(%r12), %rax
movq %rax, 0x28(%rsp)
movl %ecx, 0x30(%rsp)
movsd %xmm1, 0x38(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
callq 0x4cc46
leaq 0x80(%rsp), %rbp
addq $0x28, %r12
jmp 0x40d41
leaq 0x18(%r14), %rdx
leaq 0x30(%r14), %rcx
leaq 0x60(%rsp), %r8
leaq 0x40(%rsp), %r9
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x40956
leaq 0x40(%rsp), %rdi
callq 0xb038
leaq 0x60(%rsp), %rdi
callq 0xb016
leaq 0x78(%rsp), %rdi
callq 0xaf66
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40e51
jmp 0x40e51
jmp 0x40e51
jmp 0x40e51
jmp 0x40e51
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xb038
jmp 0x40e65
jmp 0x40e62
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xb016
leaq 0x78(%rsp), %rdi
callq 0xaf66
movq %rbx, %rdi
callq 0x4780