// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdi, 0x48(%rsp)
leaq 0x80(%rsp), %rbx
movl $0x0, (%rbx)
xorl %r12d, %r12d
movq %r12, 0x8(%rbx)
movq %rbx, 0x10(%rbx)
movq %rbx, 0x18(%rbx)
movq %r12, 0x20(%rbx)
movq %r12, 0x40(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq 0x48(%rsi), %r15
cmpq 0x50(%rsi), %r15
je 0x55af0
leaq 0x50(%rsp), %rbp
xorl %r13d, %r13d
movsd 0x18(%r15), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x55ae3
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0xe962
movl %r12d, 0x50(%rsp)
movl %r13d, 0x54(%rsp)
leaq 0x78(%rsp), %rdi
movq %rbp, %rsi
callq 0x13690
incl %r13d
incl %r12d
addq $0x40, %r15
cmpq 0x50(%r14), %r15
jne 0x55aae
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x60(%r14), %r13
cmpq 0x68(%r14), %r13
je 0x55c90
leaq 0x10(%rsp), %r15
leaq 0x50(%rsp), %r12
movsd 0x8(%r13), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x55c82
movq 0x88(%rsp), %rax
movq %rbx, %rcx
testq %rax, %rax
je 0x55b5e
movl (%r13), %edx
movq %rax, %rsi
movq %rbx, %rcx
xorl %edi, %edi
cmpl %edx, 0x20(%rsi)
setl %dil
cmovgeq %rsi, %rcx
movq 0x10(%rsi,%rdi,8), %rsi
testq %rsi, %rsi
jne 0x55b47
movq %rbx, %rdx
cmpq %rbx, %rcx
je 0x55b74
movl (%r13), %edx
cmpl 0x20(%rcx), %edx
cmovlq %rbx, %rcx
movq %rcx, %rdx
cmpq %rbx, %rdx
je 0x55c82
movq %rbx, %rcx
testq %rax, %rax
je 0x55ba6
movl 0x4(%r13), %edx
movq %rax, %rsi
movq %rbx, %rcx
xorl %edi, %edi
cmpl %edx, 0x20(%rsi)
setl %dil
cmovgeq %rsi, %rcx
movq 0x10(%rsi,%rdi,8), %rsi
testq %rsi, %rsi
jne 0x55b8f
movq %rbx, %rdx
cmpq %rbx, %rcx
je 0x55bbc
movl 0x4(%r13), %edx
cmpl 0x20(%rcx), %edx
cmovlq %rbx, %rcx
movq %rcx, %rdx
cmpq %rbx, %rdx
je 0x55c82
movq %rbx, %rdx
testq %rax, %rax
je 0x55bee
movl (%r13), %ecx
movq %rax, %rsi
movq %rbx, %rdx
xorl %edi, %edi
cmpl %ecx, 0x20(%rsi)
setl %dil
cmovgeq %rsi, %rdx
movq 0x10(%rsi,%rdi,8), %rsi
testq %rsi, %rsi
jne 0x55bd7
movq %rbx, %rcx
cmpq %rbx, %rdx
je 0x55c04
movl (%r13), %ecx
cmpl 0x20(%rdx), %ecx
cmovlq %rbx, %rdx
movq %rdx, %rcx
movq %rbx, %rdx
testq %rax, %rax
je 0x55c2a
movl 0x4(%r13), %esi
movq %rbx, %rdx
xorl %edi, %edi
cmpl %esi, 0x20(%rax)
setl %dil
cmovgeq %rax, %rdx
movq 0x10(%rax,%rdi,8), %rax
testq %rax, %rax
jne 0x55c13
movq %rbx, %rax
cmpq %rbx, %rdx
je 0x55c40
movl 0x4(%r13), %eax
cmpl 0x20(%rdx), %eax
cmovlq %rbx, %rdx
movq %rdx, %rax
movl 0x24(%rcx), %ecx
movl 0x24(%rax), %eax
movsd 0x8(%r13), %xmm0
movq 0x10(%r13), %rdx
movl 0x18(%r13), %esi
movsd 0x20(%r13), %xmm1
movl %ecx, 0x50(%rsp)
movl %eax, 0x54(%rsp)
movsd %xmm0, 0x58(%rsp)
movq %rdx, 0x60(%rsp)
movl %esi, 0x68(%rsp)
movsd %xmm1, 0x70(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x69134
addq $0x28, %r13
cmpq 0x68(%r14), %r13
jne 0x55b1b
leaq 0x18(%r14), %rdx
leaq 0x30(%r14), %rcx
leaq 0x30(%rsp), %r8
leaq 0x10(%rsp), %r9
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x55608
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x55cc9
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x30(%rsp), %rdi
callq 0xf1b8
leaq 0x78(%rsp), %rdi
callq 0xf118
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x55cf4
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x55d15
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x55d15
jmp 0x55d12
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xf1b8
leaq 0x78(%rsp), %rdi
callq 0xf118
movq %rbx, %rdi
callq 0x4780