LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Point const&, gaps::R3Line const&)
RNLength R3Distance(const R3Point& point, const R3Line& line)
{
    // Return distance from point to line (Riddle p. 904)
    R3Vector v = line.Vector();
    v.Cross(line.Point() - point);
    return v.Length();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
addq $0x18, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x3831c
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x37d29
movq %r15, %rdi
movq %r12, %rsi
callq 0x38680
movq %r15, %rdi
callq 0x38412
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Point const&, gaps::R3Ray const&)
RNLength R3Distance(const R3Point& point, const R3Ray& ray)
{
    // Check if start point is closest
    R3Vector v = point - ray.Start();
    RNScalar dir = v.Dot(ray.Vector());
    if (RNIsNegative(dir)) return v.Length();

    // Return distance from point to ray line
    return R3Distance(point, ray.Line());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x37d29
leaq 0x18(%rbx), %rsi
movq %r15, %rdi
callq 0x38586
leaq 0x978df(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm1
xorpd 0x4fd5b(%rip), %xmm1    # 0x93030
ucomisd %xmm0, %xmm1
ja 0x432e8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x43240
jmp 0x432f2
leaq 0x8(%rsp), %rdi
callq 0x38412
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Point const&, gaps::R3Span const&)
RNLength R3Distance(const R3Point& point, const R3Span& span)
{
    // Check if span has zero length
    if (RNIsZero(span.Length())) return R3Distance(point, span.Start());

    // Check if start point is closest
    R3Vector v1 = point - span.Start();
    RNScalar dir1 = v1.Dot(span.Vector());
    if (RNIsNegative(dir1)) return v1.Length();

    // Check if end point is closest
    R3Vector v2 = point - span.End();
    RNScalar dir2 = v2.Dot(span.Vector());
    if (RNIsPositive(dir2)) return v2.Length();

    // Return distance from point to span line
    return R3Distance(point, span.Line());
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x48(%rsi), %xmm0
leaq 0x9788d(%rip), %r13     # 0xdaba8
movsd (%r13), %xmm1
movapd 0x4fd07(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jb 0x43351
ucomisd %xmm0, %xmm1
jb 0x43351
movq %r14, %rdi
movq %rbx, %rsi
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4321a
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x37d29
leaq 0x18(%rbx), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x38586
movsd (%r13), %xmm1
xorpd 0x4fcaf(%rip), %xmm1    # 0x93030
ucomisd %xmm0, %xmm1
ja 0x433b9
leaq 0x30(%rbx), %rdx
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x37d29
movq %r12, %rdi
movq %r15, %rsi
callq 0x38586
ucomisd (%r13), %xmm0
ja 0x433c0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x43240
jmp 0x433c8
leaq 0x18(%rsp), %rdi
jmp 0x433c3
movq %rsp, %rdi
callq 0x38412
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Point const&, gaps::R3Plane const&)
RNLength R3Distance(const R3Point& point, const R3Plane& plane)
{
    // Return distance from point to plane
    RNScalar d = R3SignedDistance(plane, point);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x43420
leaq 0x977bc(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x43416
xorpd 0x4fc32(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x4341a
movapd 0x4fc20(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
jmp 0x4341a
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Point const&, gaps::R3Halfspace const&)
RNLength R3Distance(const R3Point& point, const R3Halfspace& halfspace)
{
    // Return distance from point to halfspace
    RNScalar d = R3SignedDistance(halfspace.Plane(), point);
    if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x43420
leaq 0x97748(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm1
movapd 0x4fbc4(%rip), %xmm2    # 0x93030
xorpd %xmm2, %xmm1
xorpd %xmm0, %xmm2
cmpnltsd %xmm1, %xmm0
andnpd %xmm2, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Point const&, gaps::R3Box const&)
RNLength R3Distance(const R3Point& point, const R3Box& box)
{
    // Check if box is empty
    if (box.IsEmpty()) return FLT_MAX;

    // Find axial distances from point to box
    RNLength dx, dy, dz;
    if (RNIsGreater(point.X(), box.XMax())) dx = point.X() - box.XMax();
    else if (RNIsLess(point.X(), box.XMin())) dx = box.XMin()- point.X();
    else dx = 0.0;
    if (RNIsGreater(point.Y(), box.YMax())) dy = point.Y() - box.YMax();
    else if (RNIsLess(point.Y(), box.YMin())) dy = box.YMin()- point.Y();
    else dy = 0.0;
    if (RNIsGreater(point.Z(), box.ZMax())) dz = point.Z() - box.ZMax();
    else if (RNIsLess(point.Z(), box.ZMin())) dz = box.ZMin()- point.Z();
    else dz = 0.0;
    
    // Return distance between point and closest point in box 
    if ((dy == 0.0) && (dz == 0.0)) return dx;
    else if ((dx == 0.0) && (dz == 0.0)) return dy;
    else if ((dx == 0.0) && (dy == 0.0)) return dz;
    else return sqrt(dx*dx + dy*dy + dz*dz);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x257ce
testl %eax, %eax
je 0x434a2
movsd 0x4fb7b(%rip), %xmm0    # 0x93018
jmp 0x435c0
movsd (%r14), %xmm1
leaq 0x976fa(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
movapd %xmm1, %xmm0
subsd 0x20(%rbx), %xmm0
ucomisd %xmm2, %xmm0
ja 0x434ec
movsd 0x8(%rbx), %xmm3
movapd %xmm1, %xmm4
subsd %xmm3, %xmm4
movapd 0x4fb5a(%rip), %xmm5    # 0x93030
xorpd %xmm2, %xmm5
xorpd %xmm0, %xmm0
ucomisd %xmm4, %xmm5
jbe 0x434ec
subsd %xmm1, %xmm3
movapd %xmm3, %xmm0
movsd 0x8(%r14), %xmm3
movapd %xmm3, %xmm1
subsd 0x28(%rbx), %xmm1
ucomisd %xmm2, %xmm1
ja 0x4352c
movsd 0x10(%rbx), %xmm4
movapd %xmm3, %xmm5
subsd %xmm4, %xmm5
movapd 0x4fb1a(%rip), %xmm6    # 0x93030
xorpd %xmm2, %xmm6
xorpd %xmm1, %xmm1
ucomisd %xmm5, %xmm6
jbe 0x4352c
subsd %xmm3, %xmm4
movapd %xmm4, %xmm1
movsd 0x10(%r14), %xmm4
movapd %xmm4, %xmm3
subsd 0x30(%rbx), %xmm3
ucomisd %xmm2, %xmm3
ja 0x43568
movsd 0x18(%rbx), %xmm5
movapd %xmm4, %xmm6
xorpd 0x4fade(%rip), %xmm2    # 0x93030
subsd %xmm5, %xmm6
xorpd %xmm3, %xmm3
ucomisd %xmm6, %xmm2
jbe 0x43568
subsd %xmm4, %xmm5
movapd %xmm5, %xmm3
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jne 0x4357c
jp 0x4357c
ucomisd %xmm2, %xmm3
jne 0x4357c
jnp 0x435c0
ucomisd %xmm2, %xmm0
jne 0x43592
jp 0x43592
ucomisd %xmm2, %xmm3
jne 0x43592
jp 0x43592
movapd %xmm1, %xmm0
jmp 0x435c0
ucomisd %xmm2, %xmm0
jne 0x435a8
jp 0x435a8
ucomisd %xmm2, %xmm1
jne 0x435a8
jp 0x435a8
movapd %xmm3, %xmm0
jmp 0x435c0
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
mulsd %xmm3, %xmm3
addsd %xmm0, %xmm3
sqrtsd %xmm3, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Point const&, gaps::R3OrientedBox const&)
RNLength R3Distance(const R3Point& point, const R3OrientedBox& box)
{
    // Check if box is empty
    if (box.IsEmpty()) return FLT_MAX;

    // Transform point into std coordinate system
    R3Point transformed_point = point;
    R3Affine cs_to_std_xform(box.CoordSystem().InverseMatrix());
    transformed_point.Transform(cs_to_std_xform);

    // Return distance in std coordinate system
    R3Box axis_aligned_box(-box.Radius(0), -box.Radius(1), -box.Radius(2), box.Radius(0), box.Radius(1), box.Radius(2));
    return R3Distance(transformed_point, axis_aligned_box);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x22b76
testl %eax, %eax
je 0x435f5
movsd 0x4fa28(%rip), %xmm0    # 0x93018
jmp 0x43697
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x37b5c
leaq 0x8(%rbx), %rsi
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x27e20
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x276a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x38192
movsd 0x68(%rbx), %xmm3
movsd 0x70(%rbx), %xmm4
movaps 0x4f9e9(%rip), %xmm2    # 0x93030
movaps %xmm3, %xmm0
xorps %xmm2, %xmm0
movaps %xmm4, %xmm1
xorps %xmm2, %xmm1
movsd 0x78(%rbx), %xmm5
xorps %xmm5, %xmm2
leaq 0x28(%rsp), %rdi
callq 0x24bde
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x4347f
movsd %xmm0, 0x8(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x25832
leaq 0xa8(%rsp), %rdi
callq 0x276ee
movsd 0x8(%rsp), %xmm0
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x25832
jmp 0x436ba
jmp 0x436b7
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x276ee
movq %rbx, %rdi
callq 0xe810
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Point const&, gaps::R3Cone const&)
RNLength R3Distance(const R3Point& point, const R3Cone& cone)
{
    // Return distance from point to sphere
    RNScalar t = cone.Axis().T(point);
    if (RNIsNegativeOrZero(t)) {
        RNAbort("Not implemented");
        return 0.0;
    }
    else if (RNIsGreater(t, cone.Axis().Length())) {
        return R3Distance(point, cone.Apex());
    }
    else {
        // Get distance between axis and point
        R3Point p = cone.Axis().Point(t);
	RNLength r = (1.0 - t / cone.Axis().Length()) * cone.Radius();
	RNLength d = R3Distance(p, point) - r;
	if (RNIsNegativeOrZero(d)) return 0.0;
	else return d;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsi), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x37276
leaq 0x97494(%rip), %r13     # 0xdaba8
movsd (%r13), %xmm2
ucomisd %xmm0, %xmm2
jae 0x4378c
movapd %xmm0, %xmm1
subsd 0x50(%r14), %xmm1
ucomisd %xmm2, %xmm1
ja 0x437ac
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movsd %xmm0, (%rsp)
callq 0x37180
movsd (%rsp), %xmm1
divsd 0x50(%r14), %xmm1
movsd 0x4f8b0(%rip), %xmm0    # 0x93008
subsd %xmm1, %xmm0
mulsd 0x78(%r14), %xmm0
movsd %xmm0, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4321a
movapd %xmm0, %xmm1
subsd (%rsp), %xmm1
movapd %xmm1, %xmm0
cmpnlesd (%r13), %xmm0
andpd %xmm1, %xmm0
jmp 0x4379e
leaq 0x4fb3f(%rip), %rdi     # 0x932d2
xorl %eax, %eax
callq 0x680f0
xorpd %xmm0, %xmm0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
addq $0x38, %r14
movq %rbx, %rdi
movq %r14, %rsi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4321a
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Line const&, gaps::R3Line const&)
RNLength R3Distance(const R3Line& line1, const R3Line& line2)
{
    // Return distance from line to line (Riddle p. 905)
    R3Vector v = line1.Vector();
    v.Cross(line2.Vector());
    RNLength vlength = v.Length();
    if (vlength == 0.0) return R3Distance(line1.Point(), line2);
    else v /= vlength;
    return fabs(v.Dot(line1.Point() - line2.Point()));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rdi), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3831c
leaq 0x18(%rbx), %rsi
movq %r15, %rdi
callq 0x38680
movq %r15, %rdi
callq 0x38412
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x43858
jp 0x43858
movq %r14, %rdi
movq %rbx, %rsi
callq 0x43240
jmp 0x4388b
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x38c0a
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x37d29
movq %r15, %rdi
movq %r12, %rsi
callq 0x38586
andpd 0x4f9e5(%rip), %xmm0    # 0x93270
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Line const&, gaps::R3Plane const&)
RNLength R3Distance(const R3Line& line, const R3Plane& plane)
{
    // Return distance from line to plane
    RNScalar d = R3SignedDistance(plane, line);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x43d14
leaq 0x96ec8(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x43d0a
xorpd 0x4f33e(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x43d0e
movapd 0x4f32c(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
jmp 0x43d0e
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Line const&, gaps::R3Halfspace const&)
RNLength R3Distance(const R3Line& line, const R3Halfspace& halfspace)
{
    // Return distance from line to halfspace
    RNScalar d = R3SignedDistance(halfspace.Plane(), line);
    if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x43d14
leaq 0x96e48(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm1
movapd 0x4f2c4(%rip), %xmm2    # 0x93030
xorpd %xmm2, %xmm1
xorpd %xmm0, %xmm2
cmpnltsd %xmm1, %xmm0
andnpd %xmm2, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Line const&, gaps::R3OrientedBox const&)
RNLength R3Distance(const R3Line& line, const R3OrientedBox& box)
{
    // Check if box is empty
    if (box.IsEmpty()) return FLT_MAX;

    // Transform line into std coordinate system
    R3Line transformed_line = line;
    R3Affine cs_to_std_xform(box.CoordSystem().InverseMatrix());
    transformed_line.Transform(cs_to_std_xform);

    // Return distance in std coordinate system
    R3Box axis_aligned_box(-box.Radius(0), -box.Radius(1), -box.Radius(2), box.Radius(0), box.Radius(1), box.Radius(2));
    return R3Distance(transformed_line, axis_aligned_box);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x22b76
testl %eax, %eax
je 0x43dc0
movsd 0x4f25d(%rip), %xmm0    # 0x93018
jmp 0x43e5b
leaq 0x88(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x3783c
leaq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x27e20
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x276a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x37a4a
movsd 0x68(%rbx), %xmm3
movsd 0x70(%rbx), %xmm4
movaps 0x4f21b(%rip), %xmm2    # 0x93030
movaps %xmm3, %xmm0
xorps %xmm2, %xmm0
movaps %xmm4, %xmm1
xorps %xmm2, %xmm1
movsd 0x78(%rbx), %xmm5
xorps %xmm5, %xmm2
leaq 0x8(%rsp), %rdi
callq 0x24bde
leaq 0x4f498(%rip), %rdi     # 0x932d2
xorl %eax, %eax
callq 0x680f0
leaq 0x8(%rsp), %rdi
callq 0x25832
leaq 0xb8(%rsp), %rdi
callq 0x276ee
xorps %xmm0, %xmm0
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x25832
jmp 0x43e7e
jmp 0x43e7b
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x276ee
movq %rbx, %rdi
callq 0xe810
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Ray const&, gaps::R3Plane const&)
RNLength R3Distance(const R3Ray& ray, const R3Plane& plane)
{
    // Return distance from ray to plane
    RNScalar d = R3SignedDistance(plane, ray);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x4414d
leaq 0x96a8f(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x44143
xorpd 0x4ef05(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x44147
movapd 0x4eef3(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
jmp 0x44147
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3SignedDistance(gaps::R3Plane const&, gaps::R3Ray const&)
RNLength R3SignedDistance(const R3Plane& plane, const R3Ray& ray)
{
    // Return signed distance from plane to ray
    RNLength d1 = R3SignedDistance(plane, ray.Start());
    if (RNIsPositive(d1)) {
	// Start point is above plane
	RNScalar dot = ray.Vector().Dot(plane.Normal());
	if (RNIsNegative(dot)) return 0.0;
	else return d1;
    }
    else if (RNIsNegative(d1)) {
	// Start point is below plane
	RNScalar dot = ray.Vector().Dot(plane.Normal());
	if (RNIsPositive(dot)) return 0.0;
	else return d1;
    }
    else {
	// Start point is on plane
	return 0.0;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x43420
movapd %xmm0, %xmm2
leaq 0x96a3c(%rip), %r15     # 0xdaba8
movsd (%r15), %xmm1
ucomisd %xmm1, %xmm0
ja 0x441a8
xorpd 0x4eeb1(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm0
ucomisd %xmm2, %xmm1
jbe 0x441d3
addq $0x18, %r14
movq %r14, %rdi
movq %rbx, %rsi
movapd %xmm2, (%rsp)
callq 0x38586
movapd %xmm0, %xmm1
movsd (%r15), %xmm0
jmp 0x441c9
addq $0x18, %r14
movq %r14, %rdi
movq %rbx, %rsi
movapd %xmm2, (%rsp)
callq 0x38586
movsd (%r15), %xmm1
xorpd 0x4ee67(%rip), %xmm1    # 0x93030
cmpnltsd %xmm1, %xmm0
andpd (%rsp), %xmm0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Ray const&, gaps::R3Halfspace const&)
RNLength R3Distance(const R3Ray& ray, const R3Halfspace& halfspace)
{
    // Return distance from ray to halfspace
    RNScalar d = R3SignedDistance(halfspace.Plane(), ray);
    if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x4414d
leaq 0x969b5(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm1
movapd 0x4ee31(%rip), %xmm2    # 0x93030
xorpd %xmm2, %xmm1
xorpd %xmm0, %xmm2
cmpnltsd %xmm1, %xmm0
andnpd %xmm2, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Ray const&, gaps::R3OrientedBox const&)
RNLength R3Distance(const R3Ray& ray, const R3OrientedBox& box)
{
    // Check if box is empty
    if (box.IsEmpty()) return FLT_MAX;

    // Transform ray into std coordinate system
    R3Ray transformed_ray = ray;
    R3Affine cs_to_std_xform(box.CoordSystem().InverseMatrix());
    transformed_ray.Transform(cs_to_std_xform);

    // Return distance in std coordinate system
    R3Box axis_aligned_box(-box.Radius(0), -box.Radius(1), -box.Radius(2), box.Radius(0), box.Radius(1), box.Radius(2));
    return R3Distance(transformed_ray, axis_aligned_box);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x22b76
testl %eax, %eax
je 0x44253
movsd 0x4edca(%rip), %xmm0    # 0x93018
jmp 0x442ee
leaq 0x88(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x37758
leaq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x27e20
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x276a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x37812
movsd 0x68(%rbx), %xmm3
movsd 0x70(%rbx), %xmm4
movaps 0x4ed88(%rip), %xmm2    # 0x93030
movaps %xmm3, %xmm0
xorps %xmm2, %xmm0
movaps %xmm4, %xmm1
xorps %xmm2, %xmm1
movsd 0x78(%rbx), %xmm5
xorps %xmm5, %xmm2
leaq 0x8(%rsp), %rdi
callq 0x24bde
leaq 0x4f005(%rip), %rdi     # 0x932d2
xorl %eax, %eax
callq 0x680f0
leaq 0x8(%rsp), %rdi
callq 0x25832
leaq 0xb8(%rsp), %rdi
callq 0x276ee
xorps %xmm0, %xmm0
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x25832
jmp 0x44311
jmp 0x4430e
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x276ee
movq %rbx, %rdi
callq 0xe810
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Span const&, gaps::R3Plane const&)
RNLength R3Distance(const R3Span& span, const R3Plane& plane)
{
    // Return distance from span to plane
    RNScalar d = R3SignedDistance(plane, span);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x446fb
leaq 0x964e1(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x446f1
xorpd 0x4e957(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x446f5
movapd 0x4e945(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
jmp 0x446f5
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3SignedDistance(gaps::R3Plane const&, gaps::R3Span const&)
RNLength R3SignedDistance(const R3Plane& plane, const R3Span& span)
{
    // Return signed distance from plane to span
    RNLength d1 = R3SignedDistance(plane, span.Start());
    if (RNIsPositive(d1)) {
	// Start point is above plane
	RNLength d2 = R3SignedDistance(plane, span.End());
	if (RNIsPositive(d2)) return ((d1 > d2) ? d2 : d1);
	else return 0.0;
    }
    else if (RNIsNegative(d1)) {
	// Start point is below plane
	RNLength d2 = R3SignedDistance(plane, span.End());
	if (RNIsNegative(d2)) return ((d1 > d2) ? d1 : d2);
	else return 0.0;
    }
    else {
	// Start point is on plane
	return 0.0;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x43420
movapd %xmm0, %xmm2
leaq 0x96490(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm1
ucomisd %xmm1, %xmm0
ja 0x44764
xorpd 0x4e906(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm0
ucomisd %xmm2, %xmm1
jbe 0x44796
addq $0x30, %rbx
movq %r14, %rdi
movq %rbx, %rsi
movapd %xmm1, 0x10(%rsp)
movapd %xmm2, (%rsp)
callq 0x43420
movapd (%rsp), %xmm1
maxsd %xmm0, %xmm1
cmpnltsd 0x10(%rsp), %xmm0
andnpd %xmm1, %xmm0
jmp 0x44796
addq $0x30, %rbx
movq %r14, %rdi
movq %rbx, %rsi
movapd %xmm1, 0x10(%rsp)
movapd %xmm2, (%rsp)
callq 0x43420
movapd 0x10(%rsp), %xmm1
cmpnltsd %xmm0, %xmm1
minsd (%rsp), %xmm0
andnpd %xmm0, %xmm1
movapd %xmm1, %xmm0
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Span const&, gaps::R3Halfspace const&)
RNLength R3Distance(const R3Span& span, const R3Halfspace& halfspace)
{
    // Return distance from span to halfspace
    RNScalar d = R3SignedDistance(halfspace.Plane(), span);
    if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x446fb
leaq 0x963f4(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm1
movapd 0x4e870(%rip), %xmm2    # 0x93030
xorpd %xmm2, %xmm1
xorpd %xmm0, %xmm2
cmpnltsd %xmm1, %xmm0
andnpd %xmm2, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Span const&, gaps::R3OrientedBox const&)
RNLength R3Distance(const R3Span& span, const R3OrientedBox& box)
{
    // Check if box is empty
    if (box.IsEmpty()) return FLT_MAX;

    // Transform span into std coordinate system
    R3Span transformed_span = span;
    R3Affine cs_to_std_xform(box.CoordSystem().InverseMatrix());
    transformed_span.Transform(cs_to_std_xform);

    // Return distance in std coordinate system
    R3Box axis_aligned_box(-box.Radius(0), -box.Radius(1), -box.Radius(2), box.Radius(0), box.Radius(1), box.Radius(2));
    return R3Distance(transformed_span, axis_aligned_box);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x22b76
testl %eax, %eax
je 0x44814
movsd 0x4e809(%rip), %xmm0    # 0x93018
jmp 0x448af
leaq 0x88(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x36f48
leaq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x27e20
leaq 0xd8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x276a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x3739a
movsd 0x68(%rbx), %xmm3
movsd 0x70(%rbx), %xmm4
movaps 0x4e7c7(%rip), %xmm2    # 0x93030
movaps %xmm3, %xmm0
xorps %xmm2, %xmm0
movaps %xmm4, %xmm1
xorps %xmm2, %xmm1
movsd 0x78(%rbx), %xmm5
xorps %xmm5, %xmm2
leaq 0x8(%rsp), %rdi
callq 0x24bde
leaq 0x4ea44(%rip), %rdi     # 0x932d2
xorl %eax, %eax
callq 0x680f0
leaq 0x8(%rsp), %rdi
callq 0x25832
leaq 0xd8(%rsp), %rdi
callq 0x276ee
xorps %xmm0, %xmm0
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x25832
jmp 0x448d2
jmp 0x448cf
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x276ee
movq %rbx, %rdi
callq 0xe810
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Plane const&, gaps::R3Plane const&)
RNLength R3Distance(const R3Plane& plane1, const R3Plane& plane2)
{
    // Return distance from plane to plane
    RNScalar d = R3SignedDistance(plane1, plane2);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
callq 0x4495c
leaq 0x96280(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x44952
xorpd 0x4e6f6(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x44956
movapd 0x4e6e4(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
jmp 0x44956
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3SignedDistance(gaps::R3Plane const&, gaps::R3Plane const&)
RNLength R3SignedDistance(const R3Plane& plane1, const R3Plane& plane2)
{
    // Return signed distance from plane to plane
    RNScalar dot = plane1.Normal().Dot(plane2.Normal());
    if (RNIsEqual(dot, 1.0)) return (plane1.D() - plane2.D());
    else if (RNIsEqual(dot, -1.0)) return (plane1.D() + plane2.D());
    else return 0.0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x38586
leaq 0x96236(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
movsd 0x4e6a2(%rip), %xmm3    # 0x93020
addsd %xmm0, %xmm3
movapd 0x4e6a6(%rip), %xmm1    # 0x93030
xorpd %xmm2, %xmm1
ucomisd %xmm1, %xmm3
jb 0x449a7
ucomisd %xmm3, %xmm2
jb 0x449a7
movsd 0x18(%r14), %xmm1
subsd 0x18(%rbx), %xmm1
jmp 0x449ca
addsd 0x4e659(%rip), %xmm0    # 0x93008
ucomisd %xmm1, %xmm0
xorpd %xmm1, %xmm1
jb 0x449ca
ucomisd %xmm0, %xmm2
jb 0x449ca
movsd 0x18(%r14), %xmm1
addsd 0x18(%rbx), %xmm1
movapd %xmm1, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Plane const&, gaps::R3Halfspace const&)
RNLength R3Distance(const R3Plane& plane, const R3Halfspace& halfspace)
{
    // Return distance from plane to halfspace
    RNScalar d = R3SignedDistance(halfspace.Plane(), plane);
    if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x4495c
leaq 0x961bc(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm1
movapd 0x4e638(%rip), %xmm2    # 0x93030
xorpd %xmm2, %xmm1
xorpd %xmm0, %xmm2
cmpnltsd %xmm1, %xmm0
andnpd %xmm2, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Plane const&, gaps::R3Box const&)
RNLength R3Distance(const R3Plane& plane, const R3Box& box)
{
    // Return distance from plane to box
    RNScalar d = R3SignedDistance(plane, box);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
callq 0x44a4c
leaq 0x96190(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x44a42
xorpd 0x4e606(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x44a46
movapd 0x4e5f4(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
jmp 0x44a46
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3SignedDistance(gaps::R3Plane const&, gaps::R3Box const&)
RNLength R3SignedDistance(const R3Plane& plane, const R3Box& box)
{
    // Check if box is empty
    if (box.IsEmpty()) return FLT_MAX;

    // Return signed distance from plane to box
    RNOctant octant = plane.Normal().Octant();
    RNScalar d1 = R3SignedDistance(plane, box.Corner(~octant & 0x7));
    if (RNIsPositiveOrZero(d1)) return d1;
    RNScalar d2 = R3SignedDistance(plane, box.Corner(octant));
    if (RNIsNegative(d2)) return d2;
    else return 0.0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x257ce
testl %eax, %eax
je 0x44a77
movsd 0x4e5a6(%rip), %xmm0    # 0x93018
jmp 0x44b38
movq %rbx, %rdi
callq 0x3852c
movl %eax, %ebp
movl %eax, %edx
notl %edx
andl $0x7, %edx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x24db6
movsd 0x8(%r15), %xmm0
mulsd 0x8(%rbx), %xmm0
movsd (%r15), %xmm1
mulsd (%rbx), %xmm1
addsd %xmm0, %xmm1
movsd 0x10(%r15), %xmm0
mulsd 0x10(%rbx), %xmm0
addsd %xmm1, %xmm0
addsd 0x18(%rbx), %xmm0
leaq 0x960dd(%rip), %r12     # 0xdaba8
movsd (%r12), %xmm1
xorpd 0x4e557(%rip), %xmm1    # 0x93030
ucomisd %xmm1, %xmm0
jae 0x44b38
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x24db6
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
mulsd 0x8(%rbx), %xmm1
mulsd (%rbx), %xmm0
movsd 0x10(%r15), %xmm2
mulsd 0x10(%rbx), %xmm2
addsd %xmm1, %xmm0
addsd %xmm0, %xmm2
addsd 0x18(%rbx), %xmm2
movsd (%r12), %xmm1
xorpd 0x4e505(%rip), %xmm1    # 0x93030
movapd %xmm2, %xmm0
cmpnltsd %xmm1, %xmm0
andnpd %xmm2, %xmm0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Plane const&, gaps::R3OrientedBox const&)
RNLength R3Distance(const R3Plane& plane, const R3OrientedBox& box)
{
    // Return distance from plane to box
    RNScalar d = R3SignedDistance(plane, box);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
callq 0x44b86
leaq 0x96056(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x44b7c
xorpd 0x4e4cc(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x44b80
movapd 0x4e4ba(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
jmp 0x44b80
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3SignedDistance(gaps::R3Plane const&, gaps::R3OrientedBox const&)
RNLength R3SignedDistance(const R3Plane& plane, const R3OrientedBox& box)
{
    // Check if box is empty
    if (box.IsEmpty()) return FLT_MAX;

    // Transform plane into std coordinate system
    R3Plane transformed_plane = plane;
    R3Affine cs_to_std_xform(box.CoordSystem().InverseMatrix());
    transformed_plane.Transform(cs_to_std_xform);

    // Return distance in std coordinate system
    R3Box axis_aligned_box(-box.Radius(0), -box.Radius(1), -box.Radius(2), box.Radius(0), box.Radius(1), box.Radius(2));
    return R3SignedDistance(transformed_plane, axis_aligned_box);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x22b76
testl %eax, %eax
je 0x44bb3
movsd 0x4e46a(%rip), %xmm0    # 0x93018
jmp 0x44c53
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x36720
leaq 0x8(%rbx), %rsi
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x27e20
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x276a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x36dde
movsd 0x68(%rbx), %xmm3
movsd 0x70(%rbx), %xmm4
movaps 0x4e42b(%rip), %xmm2    # 0x93030
movaps %xmm3, %xmm0
xorps %xmm2, %xmm0
movaps %xmm4, %xmm1
xorps %xmm2, %xmm1
movsd 0x78(%rbx), %xmm5
xorps %xmm5, %xmm2
leaq 0x28(%rsp), %rdi
callq 0x24bde
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x44a4c
movsd %xmm0, (%rsp)
leaq 0x28(%rsp), %rdi
callq 0x25832
leaq 0xa8(%rsp), %rdi
callq 0x276ee
movsd (%rsp), %xmm0
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x25832
jmp 0x44c76
jmp 0x44c73
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x276ee
movq %rbx, %rdi
callq 0xe810
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Plane const&, gaps::R3Sphere const&)
RNLength R3Distance(const R3Plane& plane, const R3Sphere& sphere)
{
    // Return distance from plane to sphere
    RNScalar d = R3SignedDistance(plane, sphere);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
callq 0x44ccc
leaq 0x95f10(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x44cc2
xorpd 0x4e386(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x44cc6
movapd 0x4e374(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
jmp 0x44cc6
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3SignedDistance(gaps::R3Plane const&, gaps::R3Sphere const&)
RNLength R3SignedDistance(const R3Plane& plane, const R3Sphere& sphere)
{
    RNLength d = R3SignedDistance(plane, sphere.Center());
    if (d < 0.0) {
	d += sphere.Radius();
	if (d > 0.0) return 0.0;
    }
    else if (d > 0.0) {
	d -= sphere.Radius();
	if (d < 0.0) return 0.0;
    }
    return d;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
addq $0x8, %rsi
callq 0x43420
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x44cf4
movsd 0x20(%rbx), %xmm2
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x44d0d
jmp 0x44d11
ucomisd %xmm1, %xmm0
jbe 0x44d0d
movsd 0x20(%rbx), %xmm1
subsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x44d11
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3SignedDistance(gaps::R3Plane const&, gaps::R3Triangle const&)
RNLength R3SignedDistance(const R3Plane& plane, const R3Triangle& triangle)
{
    // Compute signed distance from plane to triangle
    RNLength max_distance = -FLT_MAX;
    RNLength min_distance = FLT_MAX;
    for (int i = 0; i < 3; i++) {
        RNLength distance = R3SignedDistance(plane, triangle.Vertex(i)->Position());
	if (distance < min_distance) min_distance = distance;
	if (distance > max_distance) max_distance = distance;
	if ((min_distance < 0.0) && (max_distance > 0.0)) return 0.0;
    }
    
    // Return signed distance
    if (min_distance > 0.0) return min_distance;
    else if (max_distance < 0.0) return max_distance;
    else return 0.0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x4e2d5(%rip), %xmm4    # 0x93018
movsd 0x4ef1d(%rip), %xmm3    # 0x93c68
pushq $0x1
popq %r15
cmpq $0x4, %r15
je 0x44da8
movq (%rbx,%r15,8), %rsi
movq %r14, %rdi
movsd %xmm3, 0x8(%rsp)
movsd %xmm4, (%rsp)
callq 0x43420
movapd %xmm0, %xmm1
movapd %xmm0, %xmm2
minsd (%rsp), %xmm2
maxsd 0x8(%rsp), %xmm1
incq %r15
xorpd %xmm0, %xmm0
ucomisd %xmm2, %xmm0
movapd %xmm1, %xmm3
movapd %xmm2, %xmm4
jbe 0x44d4f
ucomisd 0x4e44c(%rip), %xmm1    # 0x931e8
movapd %xmm1, %xmm3
movapd %xmm2, %xmm4
jbe 0x44d4f
jmp 0x44dbe
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm4
movapd %xmm4, %xmm0
ja 0x44dbe
minsd %xmm1, %xmm3
movapd %xmm3, %xmm0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Halfspace const&, gaps::R3Box const&)
RNLength R3Distance(const R3Halfspace& halfspace, const R3Box& box)
{
    // Return distance between halfspace and box
    if (box.IsEmpty()) return RN_INFINITY;
    RNOctant octant = -(halfspace.Normal()).Octant();
    R3Point corner = box.Corner(~octant & 0x7);
    RNScalar d = R3SignedDistance(halfspace.Plane(), corner);
    if (d < 0) return 0.0;
    return d;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x257ce
testl %eax, %eax
je 0x44e91
leaq 0x95d2d(%rip), %rax     # 0xdabb8
movsd (%rax), %xmm0
jmp 0x44ee3
movq %rbx, %rdi
callq 0x3852c
leal -0x1(%rax), %edx
andl $0x7, %edx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x24db6
movsd 0x8(%r15), %xmm0
mulsd 0x8(%rbx), %xmm0
movsd (%r15), %xmm1
mulsd (%rbx), %xmm1
addsd %xmm0, %xmm1
movsd 0x10(%r15), %xmm2
mulsd 0x10(%rbx), %xmm2
addsd %xmm1, %xmm2
addsd 0x18(%rbx), %xmm2
xorpd %xmm0, %xmm0
maxsd %xmm2, %xmm0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Halfspace const&, gaps::R3OrientedBox const&)
RNLength R3Distance(const R3Halfspace& halfspace, const R3OrientedBox& box)
{
    // Check distance from halfspace to corners of oriented box
    RNScalar min_d = RN_INFINITY;
    for (int i = 0; i < 8; i++) {
        R3Point corner = box.Corner(i);
        RNScalar d = R3SignedDistance(halfspace.Plane(), corner);
        if (d <= 0.0) return 0;
        if (d < min_d) min_d = d;
    }

    // Return distance to closest corner
    return min_d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x95cb4(%rip), %rax     # 0xdabb8
movsd (%rax), %xmm1
xorl %ebp, %ebp
leaq 0x10(%rsp), %r15
cmpl $0x8, %ebp
je 0x44f6c
movsd %xmm1, 0x8(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x221da
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
mulsd 0x8(%r14), %xmm2
mulsd (%r14), %xmm0
movsd 0x20(%rsp), %xmm1
mulsd 0x10(%r14), %xmm1
addsd %xmm2, %xmm0
addsd %xmm0, %xmm1
addsd 0x18(%r14), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jae 0x44f70
minsd 0x8(%rsp), %xmm1
incl %ebp
jmp 0x44f0f
movapd %xmm1, %xmm0
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3Box const&, gaps::R3Box const&)
RNLength R3Distance(const R3Box& box1, const R3Box& box2)
{
    // Check if either box is empty
    if (box1.IsEmpty()) return FLT_MAX;
    if (box2.IsEmpty()) return FLT_MAX;

    // Find axial distances from box1 to box2
    RNLength dx, dy, dz;
    if (RNIsGreater(box1.XMin(), box2.XMax())) dx = box1.XMin() - box2.XMax();
    else if (RNIsGreater(box2.XMin(), box1.XMax())) dx = box2.XMin() - box1.XMax();
    else dx = 0.0;
    if (RNIsGreater(box1.YMin(), box2.YMax())) dy = box1.YMin() - box2.YMax();
    else if (RNIsGreater(box2.YMin(), box1.YMax())) dy = box2.YMin() - box1.YMax();
    else dy = 0.0;
    if (RNIsGreater(box1.ZMin(), box2.ZMax())) dz = box1.ZMin() - box2.ZMax();
    else if (RNIsGreater(box2.ZMin(), box1.ZMax())) dz = box2.ZMin() - box1.ZMax();
    else dz = 0.0;
    
    // Return distance between point and closest point in box 
    if ((dy == 0.0) && (dz == 0.0)) return dx;
    else if ((dx == 0.0) && (dz == 0.0)) return dy;
    else if ((dx == 0.0) && (dy == 0.0)) return dz;
    else return sqrt(dx*dx + dy*dy + dz*dz);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x257ce
movsd 0x4e052(%rip), %xmm0    # 0x93018
testl %eax, %eax
jne 0x450c7
movq %r14, %rdi
callq 0x257ce
movsd 0x4e03a(%rip), %xmm0    # 0x93018
testl %eax, %eax
jne 0x450c7
movsd 0x8(%rbx), %xmm0
leaq 0x95bb6(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm2
subsd 0x20(%r14), %xmm0
ucomisd %xmm2, %xmm0
ja 0x4501b
movsd 0x8(%r14), %xmm1
subsd 0x20(%rbx), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm2, %xmm1
jbe 0x4501b
movapd %xmm1, %xmm0
movsd 0x10(%rbx), %xmm4
subsd 0x28(%r14), %xmm4
ucomisd %xmm2, %xmm4
ja 0x45045
movsd 0x10(%r14), %xmm1
subsd 0x28(%rbx), %xmm1
xorpd %xmm4, %xmm4
ucomisd %xmm2, %xmm1
jbe 0x45045
movapd %xmm1, %xmm4
movsd 0x18(%rbx), %xmm1
subsd 0x30(%r14), %xmm1
ucomisd %xmm2, %xmm1
ja 0x4506f
movsd 0x18(%r14), %xmm3
subsd 0x30(%rbx), %xmm3
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm3
jbe 0x4506f
movapd %xmm3, %xmm1
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm4
jne 0x45083
jp 0x45083
ucomisd %xmm2, %xmm1
jne 0x45083
jnp 0x450c7
ucomisd %xmm2, %xmm0
jne 0x45099
jp 0x45099
ucomisd %xmm2, %xmm1
jne 0x45099
jp 0x45099
movapd %xmm4, %xmm0
jmp 0x450c7
ucomisd %xmm2, %xmm0
jne 0x450af
jp 0x450af
ucomisd %xmm2, %xmm4
jne 0x450af
jp 0x450af
movapd %xmm1, %xmm0
jmp 0x450c7
mulsd %xmm4, %xmm4
mulsd %xmm0, %xmm0
addsd %xmm4, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
sqrtsd %xmm1, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Dist.cpp
// Function: gaps::R3Distance(gaps::R3OrientedBox const&, gaps::R3Sphere const&)
RNLength R3Distance(const R3OrientedBox& box, const R3Sphere& sphere)
{
    // Check if box is empty
    if (box.IsEmpty()) return FLT_MAX;

    // Transform sphere into std coordinate system
    R3Sphere transformed_sphere = sphere;
    R3Affine cs_to_std_xform(box.CoordSystem().InverseMatrix());
    transformed_sphere.Transform(cs_to_std_xform);

    // Return distance in std coordinate system
    R3Box axis_aligned_box(-box.Radius(0), -box.Radius(1), -box.Radius(2), box.Radius(0), box.Radius(1), box.Radius(2));
    return R3Distance(transformed_sphere, axis_aligned_box);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %r14
movq %rdi, %rbx
callq 0x22b76
testl %eax, %eax
je 0x45151
movsd 0x4decc(%rip), %xmm0    # 0x93018
jmp 0x451fd
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x246c8
leaq 0x8(%rbx), %rsi
leaq 0x38(%rsp), %rdi
callq 0x27e20
leaq 0xb8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
xorl %edx, %edx
callq 0x276a0
leaq 0x10(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x24a34
movsd 0x68(%rbx), %xmm3
movsd 0x70(%rbx), %xmm4
movaps 0x4de8d(%rip), %xmm2    # 0x93030
movaps %xmm3, %xmm0
xorps %xmm2, %xmm0
movaps %xmm4, %xmm1
xorps %xmm2, %xmm1
movsd 0x78(%rbx), %xmm5
xorps %xmm5, %xmm2
leaq 0x38(%rsp), %rdi
callq 0x24bde
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x450e3
movsd %xmm0, 0x8(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x25832
leaq 0xb8(%rsp), %rdi
callq 0x276ee
leaq 0x10(%rsp), %rdi
callq 0x25832
movsd 0x8(%rsp), %xmm0
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x25832
jmp 0x4521c
jmp 0x45219
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x276ee
jmp 0x4522e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x25832
movq %rbx, %rdi
callq 0xe810
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Relate.cpp
// Function: gaps::R3Interpolate(gaps::R3Point const&, gaps::R3Point const&, double, double, double)
R3Point 
R3Interpolate(const R3Point& point1, const R3Point& point2, RNScalar t1, RNScalar t2, RNScalar t)
{
  // Check boundary cases
  if (RNIsEqual(t, t1)) return point1;
  if (RNIsEqual(t, t2)) return point2;
  RNScalar denom = t1 - t2;
  if (RNIsZero(denom)) return point1;

  // Interpolate points
  RNScalar mu = (t - t1) / (t2 - t1);
  R3Vector vector = point2 - point1;
  R3Point point = point1 + mu * vector;
  return point;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x956f8(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm3
movapd %xmm2, %xmm5
subsd %xmm0, %xmm5
movapd 0x4db6c(%rip), %xmm4    # 0x93030
xorpd %xmm3, %xmm4
ucomisd %xmm4, %xmm5
jb 0x454dc
ucomisd %xmm5, %xmm3
jb 0x454dc
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x454f2
subsd %xmm1, %xmm2
ucomisd %xmm4, %xmm2
jb 0x45506
ucomisd %xmm2, %xmm3
jb 0x45506
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x37b5c
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
ucomisd %xmm4, %xmm2
jb 0x4551a
ucomisd %xmm2, %xmm3
jae 0x454d4
subsd %xmm0, %xmm1
divsd %xmm1, %xmm5
movsd %xmm5, (%rsp)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x37d29
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x38a02
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x37e13
jmp 0x454f7
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Relate.cpp
// Function: gaps::R3InteriorAngle(gaps::R3Vector const&, gaps::R3Vector const&)
RNAngle 
R3InteriorAngle(const R3Vector& vector1, const R3Vector& vector2)
{
    // Return angle between vectors
    RNScalar d1 = vector1.Length();
    if (RNIsZero(d1)) return 0.0;
    RNScalar d2 = vector2.Length();
    if (RNIsZero(d2)) return 0.0;
    RNScalar cosine = vector1.Dot(vector2) / (d1 * d2);
    if (cosine >= 1.0) return 0.0;
    else if (cosine <= -1.0) return RN_PI;
    else return acos(cosine); 
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x38412
leaq 0x9562e(%rip), %r15     # 0xdaba8
movsd (%r15), %xmm2
movapd 0x4daa9(%rip), %xmm1    # 0x93030
xorpd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
xorpd %xmm1, %xmm1
jb 0x4559f
ucomisd %xmm0, %xmm2
jae 0x45624
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x38412
movsd (%r15), %xmm2
movapd 0x4da76(%rip), %xmm1    # 0x93030
xorpd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jb 0x455d0
ucomisd %xmm0, %xmm2
jb 0x455d0
xorpd %xmm1, %xmm1
jmp 0x45624
movq %r14, %rdi
movq %rbx, %rsi
movsd %xmm0, (%rsp)
callq 0x38586
movsd 0x8(%rsp), %xmm1
mulsd (%rsp), %xmm1
divsd %xmm1, %xmm0
ucomisd 0x4da11(%rip), %xmm0    # 0x93008
xorpd %xmm1, %xmm1
jae 0x45624
movsd 0x4da1b(%rip), %xmm1    # 0x93020
ucomisd %xmm0, %xmm1
jae 0x45619
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xe400
leaq 0x55928(%rip), %rax     # 0x9af48
movsd (%rax), %xmm1
movapd %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq