// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/networkstorage.cc
// Function: getNodeID(Point, ATOM_NETWORK*, VORONOI_NETWORK*)
int getNodeID(Point pt, ATOM_NETWORK *atmnet, VORONOI_NETWORK *vornet){
    double minDist = DBL_MAX;
    int minID = -1;
    for(unsigned int i = 0; i < vornet->nodes.size(); i++){
        VOR_NODE curNode = vornet->nodes.at(i);
        double dist = atmnet->calcDistanceXYZ(pt[0], pt[1], pt[2], curNode.x, curNode.y, curNode.z);
        if(dist < threshold)
            return i;
        else {
            if(dist < minDist){
                minDist = dist;
                minID = i;
            }
        }
    }
    
    cerr << "Warning : When identifying Voronoi node, the distance exceeded the threshold of " << threshold << "\n"
    << "Occurred during analysis of " << atmnet->name << "\n"
    << "Closest node was within " << minDist << "\n"
    << "Proceeding with analysis" << "\n";
    return minID;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
movq 0x48(%rsi), %rax
cmpq %rax, 0x50(%rsi)
setne %r12b
je 0x5a042
movq %rsi, %r14
leaq 0xb0(%rsp), %r15
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movsd 0xfa7c7(%rip), %xmm0    # 0x1546d0
movsd %xmm0, 0x10(%rsp)
movl $0x1, %ebp
xorl %ecx, %ecx
shlq $0x6, %rcx
leaq (%rax,%rcx), %r13
addq $0x20, %r13
movupd -0x20(%r13), %xmm0
movupd -0x10(%r13), %xmm1
movapd %xmm1, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0xe886
movb 0x18(%r13), %al
movb %al, 0x68(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x85478
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %r15, %rdi
movl $0x1, %esi
callq 0x85478
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r15, %rdi
movl $0x2, %esi
callq 0x85478
movsd (%rax), %xmm2
movsd 0x30(%rsp), %xmm3
movsd 0x38(%rsp), %xmm4
movsd 0x40(%rsp), %xmm5
movq %rbx, %rdi
movsd 0x18(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0x5394a
movapd %xmm0, %xmm2
leal -0x1(%rbp), %eax
movsd 0xfa208(%rip), %xmm0    # 0x1541c8
ucomisd %xmm2, %xmm0
ja 0x59feb
movsd 0x10(%rsp), %xmm1
ucomisd %xmm2, %xmm1
movl 0xc(%rsp), %ecx
cmoval %eax, %ecx
movl %ecx, 0xc(%rsp)
movapd %xmm2, %xmm0
minsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0x59fef
movl %eax, 0x24(%rsp)
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5a012
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
movsd %xmm2, 0x18(%rsp)
callq 0x4470
movsd 0x18(%rsp), %xmm2
movsd 0xfa1ae(%rip), %xmm0    # 0x1541c8
ucomisd %xmm2, %xmm0
ja 0x5a058
movl %ebp, %ecx
movq 0x48(%r14), %rax
movq 0x50(%r14), %rdx
subq %rax, %rdx
sarq $0x6, %rdx
incl %ebp
cmpq %rcx, %rdx
seta %r12b
ja 0x59f16
jmp 0x5a058
movsd 0xfa686(%rip), %xmm0    # 0x1546d0
movsd %xmm0, 0x10(%rsp)
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
testb $0x1, %r12b
movl 0x24(%rsp), %eax
jne 0x5a145
movq 0x13cf83(%rip), %r14    # 0x196ff0
leaq 0xfb08b(%rip), %rsi     # 0x1550ff
movl $0x50, %edx
movq %r14, %rdi
callq 0x44e0
movsd 0xfa13f(%rip), %xmm0    # 0x1541c8
movq %r14, %rdi
callq 0x46b0
movq %rax, %r15
leaq 0xfb493(%rip), %r14     # 0x15552e
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
leaq 0xfb09e(%rip), %rsi     # 0x155150
movl $0x1c, %edx
movq %r15, %rdi
callq 0x44e0
movq 0x320(%rbx), %rsi
movq 0x328(%rbx), %rdx
movq %r15, %rdi
callq 0x44e0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
leaq 0xfb07e(%rip), %rsi     # 0x15516d
movl $0x18, %edx
movq %rbx, %rdi
callq 0x44e0
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x46b0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x44e0
leaq 0xfb062(%rip), %rsi     # 0x155186
movl $0x18, %edx
movq %rbx, %rdi
callq 0x44e0
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44e0
movl 0xc(%rsp), %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5a16e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780