// File: Luthaf[P]zeopp/networkstorage.cc
// Function: ATOM_NETWORK::minimizePointDistance(Point, double, double, double)
const Point ATOM_NETWORK::minimizePointDistance(Point origPoint, double dx, double dy, double dz){
    Point abc_one  = xyz_to_abc(origPoint);
    Point abc_two  = xyz_to_abc(dx, dy, dz);
    
    double minDa = DBL_MAX, minDb = DBL_MAX, minDc = DBL_MAX, best_a = DBL_MAX, best_b = DBL_MAX, best_c = DBL_MAX;
    getDistCalc().closest_periodic_image(abc_two[0], abc_two[1], abc_two[2], abc_one[0], abc_one[1], abc_one[2],
                                         minDa, minDb, minDc, best_a, best_b, best_c);
    return abc_to_xyz(best_a, best_b, best_c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x148(%rbp)
movq %rdi, -0x140(%rbp)
leaq 0x10(%rbp), %rax
movq %rsi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movsd %xmm2, -0x20(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x138(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x40(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x50(%rbp)
movq -0x40(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x50(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x38(%rbp), %rdi
callq 0x96150
movq -0x138(%rbp), %rsi
movsd -0x10(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movsd -0x20(%rbp), %xmm2
leaq -0x68(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x97360
movq -0x138(%rbp), %rsi
movabsq $0x7fefffffffffffff, %rax # imm = 0x7FEFFFFFFFFFFFFF
movq %rax, -0x70(%rbp)
movq %rax, -0x78(%rbp)
movq %rax, -0x80(%rbp)
movq %rax, -0x88(%rbp)
movq %rax, -0x90(%rbp)
movq %rax, -0x98(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x96bf0
movq -0x130(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0x128(%rbp)
jmp 0x980f0
movq -0x128(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x158(%rbp)
leaq -0x68(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0x150(%rbp)
jmp 0x9811a
movq -0x150(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x168(%rbp)
leaq -0x68(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0x160(%rbp)
jmp 0x98144
movq -0x160(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x178(%rbp)
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0x170(%rbp)
jmp 0x9816b
movq -0x170(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x188(%rbp)
leaq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0x180(%rbp)
jmp 0x98195
movq -0x180(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x198(%rbp)
leaq -0x38(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0x190(%rbp)
jmp 0x981bf
movsd -0x198(%rbp), %xmm4
movsd -0x188(%rbp), %xmm3
movsd -0x178(%rbp), %xmm2
movsd -0x168(%rbp), %xmm1
movsd -0x158(%rbp), %xmm0
movq -0x190(%rbp), %rax
movsd (%rax), %xmm5
movq %rsp, %rax
leaq -0x98(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x110(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rcx
leaq -0x88(%rbp), %r8
leaq -0x90(%rbp), %r9
callq 0xd7980
jmp 0x98227
leaq -0x110(%rbp), %rdi
callq 0x122d0
movq -0x148(%rbp), %rdi
movq -0x138(%rbp), %rsi
movsd -0x88(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
movsd -0x98(%rbp), %xmm2
callq 0x97170
movq -0x140(%rbp), %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x118(%rbp)
movl %eax, -0x11c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x122d0
movq -0x118(%rbp), %rdi
callq 0x58f0
nopl (%rax,%rax)