Here are some logic notes for this code.

lc is a compile time count of the number of small curve segments that compose a loop.
A value of type v is a 3D vector. It locates a point on a loop as an offset from the origin.
sp: R×vv is the vector product of a scalar and vector.
det: v×v×vR is the determinant of the components of 3 vectors, which is also the triple product of those vectors.
vd: v×vv is the vector difference of two vectors.
va: v×vv is the vector sum of two vectors.
dcir: v×v×v → Row v computes an elliptic loop that it stores into an array provided by its first argument. The first vector argument locates the loop’s center and last the two vectors are independent and define two points on the loop relative to the center. The first and last element of the array are identical.
l1, l2: Row v are the two linked or unlinked loops.
rm: R is the square of the minimum distance between points on the two links. If it is too small accuracy may suffer.