// File: /workspace/github_cpp_makefile_star2_O3/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 %rdi, 0x48(%rsp)
leaq 0x80(%rsp), %rax
movl $0x0, (%rax)
xorl %ebx, %ebx
movq %rbx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rbx, 0x20(%rax)
movq %rbx, 0x40(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq 0x48(%rsi), %r15
movq %rsi, (%rsp)
movq 0x50(%rsi), %rax
cmpq %rax, %r15
je 0x55790
leaq 0x30(%rsp), %r12
leaq 0x78(%rsp), %r13
leaq 0x50(%rsp), %rbp
xorl %r14d, %r14d
movsd 0x18(%r15), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x55785
movq %r12, %rdi
movq %r15, %rsi
callq 0xe9d4
movl %ebx, 0x50(%rsp)
movl %r14d, 0x54(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x135ee
incl %r14d
movq (%rsp), %rax
movq 0x50(%rax), %rax
incl %ebx
addq $0x40, %r15
cmpq %rax, %r15
jne 0x5574d
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rsp), %rax
movq 0x60(%rax), %r13
movq 0x68(%rax), %rcx
cmpq %rcx, %r13
leaq 0x80(%rsp), %rbx
je 0x55953
leaq 0x10(%rsp), %r15
leaq 0x50(%rsp), %r12
movsd 0x8(%r13), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x55946
movq 0x88(%rsp), %rax
testq %rax, %rax
je 0x55946
movl (%r13), %esi
movq %rax, %r10
movq %rbx, %r9
movq %r9, %rdx
movq %r10, %rdi
movl 0x20(%r10), %r8d
xorl %r10d, %r10d
cmpl %esi, %r8d
setl %r10b
movq %rdi, %r9
cmovlq %rdx, %r9
movq 0x10(%rdi,%r10,8), %r10
testq %r10, %r10
jne 0x557f7
cmpq %rbx, %r9
je 0x55946
cmpl %esi, %r8d
cmovlq %rdx, %rdi
cmpl 0x20(%rdi), %esi
jl 0x55946
movl 0x4(%r13), %edx
movq %rax, %r11
movq %rbx, %r10
movq %r10, %rdi
movq %r11, %r8
movl 0x20(%r11), %r9d
xorl %r11d, %r11d
cmpl %edx, %r9d
setl %r11b
movq %r8, %r10
cmovlq %rdi, %r10
movq 0x10(%r8,%r11,8), %r11
testq %r11, %r11
jne 0x5583f
cmpq %rbx, %r10
je 0x55946
cmpl %edx, %r9d
cmovlq %rdi, %r8
cmpl 0x20(%r8), %edx
jl 0x55946
movq %rax, %r10
movq %rbx, %r8
movq %r8, %rcx
movq %r10, %rdi
movl 0x20(%r10), %r9d
xorl %r10d, %r10d
cmpl %esi, %r9d
setl %r10b
movq %rdi, %r8
cmovlq %rcx, %r8
movq 0x10(%rdi,%r10,8), %r10
testq %r10, %r10
jne 0x55884
movq %rbx, %r10
cmpq %rbx, %r8
je 0x558c2
cmpl %esi, %r9d
cmovlq %rcx, %rdi
cmpl 0x20(%rdi), %esi
cmovlq %rbx, %r8
movq %r8, %r10
movl 0x24(%r10), %ecx
movq %rbx, %r8
movq %r8, %rsi
movq %rax, %rdi
movl 0x20(%rax), %r9d
xorl %eax, %eax
cmpl %edx, %r9d
setl %al
movq %rdi, %r8
cmovlq %rsi, %r8
movq 0x10(%rdi,%rax,8), %rax
testq %rax, %rax
jne 0x558c9
movq %rbx, %rax
cmpq %rbx, %r8
je 0x55905
cmpl %edx, %r9d
cmovlq %rsi, %rdi
cmpl 0x20(%rdi), %edx
cmovlq %rbx, %r8
movq %r8, %rax
movl 0x24(%rax), %eax
movl 0x18(%r13), %edx
movsd 0x20(%r13), %xmm1
movl %ecx, 0x50(%rsp)
movl %eax, 0x54(%rsp)
movsd %xmm0, 0x58(%rsp)
movq 0x10(%r13), %rax
movq %rax, 0x60(%rsp)
movl %edx, 0x68(%rsp)
movsd %xmm1, 0x70(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x687be
movq (%rsp), %rax
movq 0x68(%rax), %rcx
addq $0x28, %r13
cmpq %rcx, %r13
jne 0x557ca
movq (%rsp), %rsi
leaq 0x18(%rsi), %rdx
leaq 0x30(%rsi), %rcx
leaq 0x30(%rsp), %r8
leaq 0x10(%rsp), %r9
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x552d0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5598d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
leaq 0x30(%rsp), %rdi
callq 0xf256
leaq 0x78(%rsp), %rdi
callq 0xf1b6
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x559b8
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x559d9
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
jmp 0x559d9
jmp 0x559d6
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xf256
leaq 0x78(%rsp), %rdi
callq 0xf1b6
movq %rbx, %rdi
callq 0x4780