// File: 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
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x150(%rbp)
movq %rdi, %rax
movq %rax, -0x148(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xf6b0
leaq -0x60(%rbp), %rdi
callq 0xae650
movl $0x0, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
callq 0x94da0
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
callq 0x94e30
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x94df0
testb $0x1, %al
jne 0x9a281
jmp 0x9a341
leaq -0x70(%rbp), %rdi
callq 0x59b70
movsd 0x18(%rax), %xmm0
ucomisd -0x18(%rbp), %xmm0
jbe 0x9a31f
leaq -0x70(%rbp), %rdi
callq 0xaed10
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0xf440
jmp 0x9a2b1
leaq -0x8c(%rbp), %rdi
leaq -0x64(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0xf590
jmp 0x9a2c7
leaq -0x48(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
callq 0xf550
movb %dl, -0x159(%rbp)
movq %rax, -0x158(%rbp)
jmp 0x9a2e6
movb -0x159(%rbp), %al
movq -0x158(%rbp), %rcx
movq %rcx, -0xa0(%rbp)
movb %al, -0x98(%rbp)
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x9a31f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x9a676
jmp 0x9a321
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
callq 0x59b90
movq %rax, -0xa8(%rbp)
jmp 0x9a25a
leaq -0xc0(%rbp), %rdi
callq 0xae670
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
callq 0x94ed0
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
callq 0x94f40
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x94f00
testb $0x1, %al
jne 0x9a391
jmp 0x9a61d
leaq -0xc8(%rbp), %rdi
callq 0x94f70
movsd 0x8(%rax), %xmm0
xorl %eax, %eax
ucomisd -0x18(%rbp), %xmm0
movb %al, -0x15a(%rbp)
jbe 0x9a474
leaq -0xc8(%rbp), %rdi
callq 0x94f70
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x102e0
movq %rax, -0x168(%rbp)
jmp 0x9a3d6
movq -0x168(%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, -0x15a(%rbp)
jne 0x9a418
jmp 0x9a474
leaq -0xc8(%rbp), %rdi
callq 0x94f70
movq %rax, %rsi
addq $0x4, %rsi
leaq -0x48(%rbp), %rdi
callq 0x102e0
movq %rax, -0x170(%rbp)
jmp 0x9a43d
movq -0x170(%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, -0x15a(%rbp)
movb -0x15a(%rbp), %al
testb $0x1, %al
jne 0x9a483
jmp 0x9a601
leaq -0xc8(%rbp), %rdi
callq 0x94f70
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x102e0
movq %rax, -0x178(%rbp)
jmp 0x9a4a4
movq -0x178(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x10350
movl 0x4(%rax), %eax
movl %eax, -0xf4(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x94f70
movq %rax, %rsi
addq $0x4, %rsi
leaq -0x48(%rbp), %rdi
callq 0x102e0
movq %rax, -0x180(%rbp)
jmp 0x9a4ec
movq -0x180(%rbp), %rax
movq %rax, -0x110(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x10350
movl 0x4(%rax), %eax
movl %eax, -0x104(%rbp)
movl -0xf4(%rbp), %eax
movl %eax, -0x1a0(%rbp)
movl -0x104(%rbp), %eax
movl %eax, -0x19c(%rbp)
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x94f70
movq -0x1a8(%rbp), %rdi
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x198(%rbp)
callq 0x94f70
movq -0x1a8(%rbp), %rdi
movl 0x10(%rax), %eax
movl %eax, -0x18c(%rbp)
callq 0x94f70
movq -0x1a8(%rbp), %rdi
movl 0x14(%rax), %eax
movl %eax, -0x188(%rbp)
callq 0x94f70
movq -0x1a8(%rbp), %rdi
movl 0x18(%rax), %eax
movl %eax, -0x184(%rbp)
callq 0x94f70
movl -0x1a0(%rbp), %esi
movl -0x19c(%rbp), %edx
movsd -0x198(%rbp), %xmm0
movl -0x18c(%rbp), %ecx
movl -0x188(%rbp), %r8d
movl -0x184(%rbp), %r9d
movsd 0x20(%rax), %xmm1
leaq -0x138(%rbp), %rdi
callq 0x99a30
jmp 0x9a5cd
leaq -0xc0(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xaed60
jmp 0x9a5e2
jmp 0x9a601
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x11b80
jmp 0x9a676
jmp 0x9a603
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
callq 0x94f90
movq %rax, -0x140(%rbp)
jmp 0x9a361
movq -0x150(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq %rsi, %rdx
addq $0x18, %rdx
movq %rsi, %rcx
addq $0x30, %rcx
leaq -0x60(%rbp), %r8
leaq -0xc0(%rbp), %r9
callq 0x99c10
jmp 0x9a648
leaq -0xc0(%rbp), %rdi
callq 0x11b80
leaq -0x60(%rbp), %rdi
callq 0x11be0
leaq -0x48(%rbp), %rdi
callq 0xf860
movq -0x148(%rbp), %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x11be0
leaq -0x48(%rbp), %rdi
callq 0xf860
movq -0x80(%rbp), %rdi
callq 0x58f0
nopw %cs:(%rax,%rax)