LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Point const&, gaps::R2Box const&)
RNBoolean R2Contains(const R2Point& point, const R2Box& box)
{
    // Return whether point contains box
    if (!box.IsPoint()) return FALSE;
    if (!R2Contains(point, box.Min())) return FALSE;
    return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x18(%rax)
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x56e54
movsd (%r14), %xmm2
leaq 0x8ed8e(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm0
subsd 0x8(%rbx), %xmm2
movapd 0x4b205(%rip), %xmm1    # 0xa2020
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jb 0x56e52
ucomisd %xmm2, %xmm0
jb 0x56e52
movsd 0x8(%r14), %xmm2
subsd 0x10(%rbx), %xmm2
cmpnlepd %xmm2, %xmm1
cmpnlepd %xmm0, %xmm2
orpd %xmm1, %xmm2
movd %xmm2, %ecx
movl $0x1, %eax
testb $0x1, %cl
je 0x56e54
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Point const&, gaps::R2Circle const&)
RNBoolean R2Contains(const R2Point& point, const R2Circle& circle)
{
    // Return whether point contains circle
    if (!circle.IsPoint()) return FALSE;
    if (!R2Contains(point, circle.Center())) return FALSE;
    return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x18(%rax)
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x56ecd
movsd (%r14), %xmm2
leaq 0x8ed15(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm0
subsd 0x8(%rbx), %xmm2
movapd 0x4b18c(%rip), %xmm1    # 0xa2020
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jb 0x56ecb
ucomisd %xmm2, %xmm0
jb 0x56ecb
movsd 0x8(%r14), %xmm2
subsd 0x10(%rbx), %xmm2
cmpnlepd %xmm2, %xmm1
cmpnlepd %xmm0, %xmm2
orpd %xmm1, %xmm2
movd %xmm2, %ecx
movl $0x1, %eax
testb $0x1, %cl
je 0x56ecd
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Line const&, gaps::R2Box const&)
RNBoolean R2Contains(const R2Line& line, const R2Box& box)
{
    // Return whether line contains box 
    if (!box.IsLinear()) return FALSE;
    if (!R2Contains(line, box.Min())) return FALSE;
    if (!R2Contains(line, box.Max())) return FALSE;
    return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x20(%rax)
xorl %ebp, %ebp
testl %eax, %eax
je 0x570d2
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x6c745
leaq 0x8eb18(%rip), %r15     # 0xe5b98
movsd (%r15), %xmm1
movapd 0x4af93(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jb 0x570d2
ucomisd %xmm0, %xmm1
jb 0x570d2
addq $0x18, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6c745
movsd (%r15), %xmm1
movapd 0x4af67(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
cmplepd %xmm0, %xmm2
cmplepd %xmm1, %xmm0
andpd %xmm2, %xmm0
movd %xmm0, %ebp
andl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Line const&, gaps::R2Circle const&)
RNBoolean R2Contains(const R2Line& line, const R2Circle& circle)
{
    // Return whether line contains circle 
    if (!circle.IsPoint()) return FALSE;
    if (!R2Contains(line, circle.Center())) return FALSE;
    return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x18(%rax)
testl %eax, %eax
je 0x57133
addq $0x8, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6c745
leaq 0x8ea8c(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm1
movapd 0x4af08(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
cmplepd %xmm0, %xmm2
cmplepd %xmm1, %xmm0
andpd %xmm2, %xmm0
movd %xmm0, %eax
andl $0x1, %eax
jmp 0x57135
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Span const&, gaps::R2Box const&)
RNBoolean R2Contains(const R2Span& span, const R2Box& box)
{
    // Return whether span contains box
    if (!R2Contains(span.Line(), box)) return FALSE;
    if (!R2Contains(span, box.Min())) return FALSE;
    if (!R2Contains(span, box.Max())) return FALSE;
    return TRUE;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x57051
xorl %ebp, %ebp
testl %eax, %eax
je 0x57414
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x572f1
testl %eax, %eax
je 0x57414
addq $0x18, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x572f1
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Halfspace const&, gaps::R2Halfspace const&)
RNBoolean R2Contains(const R2Halfspace& halfspace1, const R2Halfspace& halfspace2)
{
    // Return whether halfspace1 contains halfspace2
    RNScalar dot = halfspace1.Normal().Dot(halfspace2.Normal());
    if (RNIsEqual(dot, 1.0)) {
	// Halfspaces are parallel ???
	return RNIsLessOrEqual(halfspace1.Line().C(), halfspace2.Line().C());
    }
    else {
	// Halfspaces are not parallel
	return FALSE;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x10, %rdi
addq $0x10, %rsi
callq 0x68540
leaq 0x8e5b3(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm1
addsd 0x4aa57(%rip), %xmm0    # 0xa2048
movapd 0x4aa27(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
xorl %eax, %eax
ucomisd %xmm2, %xmm0
jb 0x5761f
ucomisd %xmm0, %xmm1
jb 0x5761f
movsd 0x20(%r14), %xmm0
subsd 0x20(%rbx), %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setae %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Box const&, gaps::R2Span const&)
RNBoolean R2Contains(const R2Box& box, const R2Span& span)
{
    // Return whether box contains span
    if (!R2Contains(box, span.Start())) return FALSE;
    if (!R2Contains(box, span.End())) return FALSE;
    return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x28, %rsi
callq 0x576c8
testl %eax, %eax
je 0x577a3
addq $0x38, %rbx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x576c8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Box const&, gaps::R2Halfspace const&)
RNBoolean R2Contains(const R2Box& box, const R2Halfspace& halfspace)
{
    // Return whether box contains halfspace
    RNQuadrant quadrant = halfspace.Normal().Quadrant();
    R2Point corner = box.Corner(quadrant);
    if (!RNIsFinite(corner.X())) return FALSE;
    if (!RNIsFinite(corner.Y())) return FALSE;
    RNAbort("Not Implemented");
    return FALSE;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x10(%rsi), %rdi
callq 0x68516
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x65530
movsd (%r14), %xmm2
leaq 0x8e3ca(%rip), %rax     # 0xe5ba8
movsd (%rax), %xmm0
movapd 0x4a836(%rip), %xmm1    # 0xa2020
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jbe 0x5781a
ucomisd %xmm2, %xmm0
jbe 0x5781a
movsd 0x10(%rsp), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x5781a
ucomisd %xmm2, %xmm0
jbe 0x5781a
leaq 0x4b50a(%rip), %rdi     # 0xa2d1d
xorl %eax, %eax
callq 0x718f6
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Circle const&, gaps::R2Point const&)
RNBoolean R2Contains(const R2Circle& circle, const R2Point& point)
{
    // Return whether circle contains point
    RNScalar radius_squared = circle.Radius() * circle.Radius();
    R2Vector v = circle.Center() - point;
    RNScalar distance_squared = v.X() * v.X() + v.Y() * v.Y();
    return RNIsLessOrEqual(distance_squared, radius_squared);
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rdx
movsd 0x18(%rdi), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x8(%rdi), %rsi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x682e3
movsd (%rbx), %xmm0
movsd 0x8(%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
subsd 0x8(%rsp), %xmm0
leaq 0x8e1ce(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setae %al
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Circle const&, gaps::R2Span const&)
RNBoolean R2Contains(const R2Circle& circle, const R2Span& span)
{
    // Return whether circle contains span
    if (!R2Contains(circle, span.Start())) return FALSE;
    if (!R2Contains(circle, span.End())) return FALSE;
    return TRUE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x28(%rsi), %rdx
movsd 0x18(%rdi), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, (%rsp)
leaq 0x8(%rdi), %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x682e3
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
subsd (%rsp), %xmm0
leaq 0x8e0fb(%rip), %r12     # 0xe5b98
movsd (%r12), %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
jb 0x57afc
addq $0x38, %rbx
movsd 0x18(%r15), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, (%rsp)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x682e3
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
subsd (%rsp), %xmm0
movsd (%r12), %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setae %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Circle const&, gaps::R2Box const&)
RNBoolean R2Contains(const R2Circle& circle, const R2Box& box)
{
    // Return whether circle contains box 
    R2Vector v = box.Centroid() - circle.Center();
    R2Point corner = box.Corner(v.Quadrant());
    return R2Contains(circle, corner);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x65688
leaq 0x8(%r14), %r12
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x682e3
movq %r13, %rdi
callq 0x68516
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x65530
movsd 0x18(%r14), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x682e3
movsd (%rbx), %xmm0
movsd 0x8(%rbx), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
subsd 0x8(%rsp), %xmm0
leaq 0x8dfc8(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setae %al
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Polygon const&, gaps::R2Point const&)
RNBoolean R2Contains(const R2Polygon& polygon, const R2Point& point)
{
    // Return whether polygon contains point
    int ncrossings = 0;
    R2Ray ray(point, R2Vector(0.12345, 0.9923508));
    for (int i = 0; i < polygon.NPoints(); i++) {
        const R2Point& p0 = polygon.Point(i);
        const R2Point& p1 = polygon.Point((i+1)%polygon.NPoints());
        if (R2Intersects(ray, R2Span(p0, p1))) ncrossings++;
    }

    // Check odd-crossing rule
    return (ncrossings % 2) ? TRUE : FALSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x38(%rsp), %r15
movsd 0x51668(%rip), %xmm0    # 0xa92d0
movsd 0x51668(%rip), %xmm1    # 0xa92d8
movq %r15, %rdi
callq 0x683d2
movq %rsp, %rdi
xorl %ebp, %ebp
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x678f8
movl 0x10(%rbx), %ecx
testl %ecx, %ecx
jle 0x57ce9
xorl %r13d, %r13d
leaq 0x38(%rsp), %r14
movq %rsp, %r15
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8(%rbx), %rdi
leaq (%rdi,%r13), %rsi
incq %r12
movl %r12d, %eax
cltd
idivl %ecx
shlq $0x4, %rdx
addq %rdi, %rdx
movq %r14, %rdi
callq 0x67056
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x583d8
cmpl $0x1, %eax
sbbl $-0x1, %ebp
movslq 0x10(%rbx), %rcx
addq $0x10, %r13
cmpq %rcx, %r12
jl 0x57ca1
andl $0x1, %ebp
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Cont.cpp
// Function: gaps::R2Contains(gaps::R2Polygon const&, gaps::R2Span const&)
RNBoolean R2Contains(const R2Polygon& polygon, const R2Span& span)
{
    // Return whether polygon contains span (this is not right, because polygon can be concave)
    if (!R2Contains(polygon, span.Start())) return FALSE;
    if (!R2Contains(polygon, span.End())) return FALSE;
    return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x28, %rsi
callq 0x57c44
testl %eax, %eax
je 0x57d54
addq $0x38, %rbx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x57c44
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Point const&, gaps::R2Span const&, double*)
RNClassID R2Intersects(const R2Point& point, const R2Span& span, RNScalar *hit_t)
{
    // Check if span contains point
    if (R2Contains(span, point)) {
	// Point lies on span
	if (hit_t) *hit_t = span.T(point);
	return R2_POINT_CLASS_ID;
    }
    else {
	// Point is not on span
	return RN_NULL_CLASS_ID;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
movq %r14, %rsi
callq 0x572f1
testl %eax, %eax
je 0x57f06
movl $0x1, %ebp
testq %rbx, %rbx
je 0x57f08
movq %r15, %rdi
movq %r14, %rsi
callq 0x679ae
movsd %xmm0, (%rbx)
jmp 0x57f08
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Line const&, gaps::R2Ray const&, gaps::R2Point*, double*)
RNClassID R2Intersects(const R2Line& line, const R2Ray& ray, 
    R2Point *hit_point, RNScalar *hit_t)
{
    // Get variables in more convenient form
    const R2Vector& n1 = line.Normal();
    const RNScalar c1 = line.C();
    const R2Vector p2 = ray.Start().Vector();
    const R2Vector& v2 = ray.Vector();

    // Check if line and ray are parallel
    RNScalar denom = n1.Dot(v2);
    if (RNIsZero(denom)) {
	// Check if line and ray are coincident
	if (R2Contains(line, ray.Start())) {
	    // Line and ray are coincident
	    return R2_RAY_CLASS_ID;
	}
	else {
	    // Lines are parallel and do not intersect
	    return RN_NULL_CLASS_ID;
	}
    }
    else {
	// Find parametric value on ray of intersection point between lines
        RNScalar t = (c1 + n1.Dot(p2)) / -denom;

	// Check if intersection point is on ray
	if (RNIsPositiveOrZero(t)) {
	    if (hit_point) *hit_point = ray.Point(t);
	    if (hit_t) *hit_t = t;
	    return R2_POINT_CLASS_ID;
	}
	else {
	    // Line and ray do not intersect
	    return RN_NULL_CLASS_ID;
	}
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x10(%rdi), %r13
movsd 0x20(%rdi), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x28(%rsi), %xmm0
movsd 0x30(%rsi), %xmm1
leaq 0x28(%rsp), %rdi
callq 0x683d2
movq %r13, %rdi
movq %r15, %rsi
callq 0x68540
leaq 0x8db04(%rip), %rbp     # 0xe5b98
movsd (%rbp), %xmm2
movapd 0x49f7f(%rip), %xmm1    # 0xa2020
xorpd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jb 0x580cf
ucomisd %xmm0, %xmm2
jb 0x580cf
addq $0x28, %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x56ee8
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
leal (%rcx,%rcx,2), %eax
jmp 0x58151
leaq 0x28(%rsp), %rsi
movq %r13, %rdi
movapd %xmm0, 0x10(%rsp)
callq 0x68540
movsd 0x8(%rsp), %xmm2
addsd %xmm0, %xmm2
movapd 0x49f2c(%rip), %xmm0    # 0xa2020
movapd 0x10(%rsp), %xmm1
xorpd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd (%rbp), %xmm1
xorpd %xmm0, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm2
jb 0x58151
testq %r14, %r14
je 0x58143
leaq 0x38(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movapd %xmm2, %xmm0
movsd %xmm2, 0x8(%rsp)
callq 0x67978
movq %r14, %rdi
movq %r12, %rsi
callq 0x681de
movsd 0x8(%rsp), %xmm2
movl $0x1, %eax
testq %rbx, %rbx
je 0x58151
movsd %xmm2, (%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Line const&, gaps::R2Span const&, gaps::R2Point*, double*)
RNClassID R2Intersects(const R2Line& line, const R2Span& span, 
    R2Point *hit_point, RNScalar *hit_t)
{
    // Intersect line with span's ray
    RNScalar s;
    switch (R2Intersects(line, span.Ray(), hit_point, &s)) {
    case RN_NULL_CLASS_ID:
	// Span and line do not intersect
	return RN_NULL_CLASS_ID;

    case R2_RAY_CLASS_ID:
	// Line contains span
	return R2_SPAN_CLASS_ID;

    case R2_POINT_CLASS_ID: 
	// Check if intersection point is on span
	if (RNIsGreater(s, span.Length())) {
	    // Span's ray intersects line beyond span endpoint
	    return RN_NULL_CLASS_ID;
	}
	else {
	    // Span and line intersect at point
	    if (hit_t) *hit_t = s;
	    return R2_POINT_CLASS_ID;
	}
	break;

    default:
	RNAbort("Illegal intersection");
	break;
    }

    // Should never get here
    RNAbort("Should never get here");
    return RN_NULL_CLASS_ID;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rsi, %r15
leaq 0x8(%rsp), %rcx
callq 0x58045
movl %eax, %ebx
movl %eax, %eax
leaq 0x5115c(%rip), %rcx     # 0xa92e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsd 0x8(%rsp), %xmm0
leaq 0x8d9fe(%rip), %rax     # 0xe5b98
movapd %xmm0, %xmm1
subsd 0x48(%r15), %xmm1
xorl %ebx, %ebx
ucomisd (%rax), %xmm1
ja 0x581e2
movl $0x1, %ebx
testq %r14, %r14
je 0x581e2
movsd %xmm0, (%r14)
jmp 0x581e2
leaq 0x50e08(%rip), %rdi     # 0xa8fcc
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x718f6
leaq 0x50e0d(%rip), %rdi     # 0xa8fe1
xorl %eax, %eax
callq 0x718f6
jmp 0x581e2
movl $0x4, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Ray const&, gaps::R2Span const&, gaps::R2Point*, double*, double*)
RNClassID R2Intersects(const R2Ray& ray, const R2Span& span, 
    R2Point *hit_point, RNScalar *hit_tray, RNScalar *hit_tspan)
{
    // Intersect ray with span's ray
    RNScalar s;
    switch (R2Intersects(ray, span.Ray(), hit_point, hit_tray, &s)) {
    case RN_NULL_CLASS_ID:
	// Span and ray do not intersect
	return RN_NULL_CLASS_ID;

    case R2_RAY_CLASS_ID:
	// Ray contains span
	return R2_SPAN_CLASS_ID;

    case R2_POINT_CLASS_ID: 
	// Check if intersection point is on span
	if (RNIsGreater(s, span.Length())) {
	    // Span's ray intersects ray beyond span endpoint
	    return RN_NULL_CLASS_ID;
	}
	else {
	    // Span and ray intersect at point
	    if (hit_tspan) *hit_tspan = s;
	    return R2_POINT_CLASS_ID;
	}
	break;

    default:
	RNAbort("Illegal intersection");
	break;
    }

    // Should never get here
    RNAbort("Should never get here");
    return RN_NULL_CLASS_ID;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %r8, %r14
movq %rsi, %r15
leaq 0x8(%rsp), %r8
callq 0x58227
movl %eax, %ebx
testl %eax, %eax
je 0x58456
cmpl $0x1, %ebx
je 0x58408
cmpl $0x3, %ebx
jne 0x58438
movl $0x4, %ebx
jmp 0x58456
movsd 0x8(%rsp), %xmm0
leaq 0x8d783(%rip), %rax     # 0xe5b98
movapd %xmm0, %xmm1
subsd 0x48(%r15), %xmm1
xorl %ebx, %ebx
ucomisd (%rax), %xmm1
ja 0x58456
movl $0x1, %ebx
testq %r14, %r14
je 0x58456
movsd %xmm0, (%r14)
jmp 0x58456
leaq 0x50b8d(%rip), %rdi     # 0xa8fcc
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x718f6
leaq 0x50b92(%rip), %rdi     # 0xa8fe1
xorl %eax, %eax
callq 0x718f6
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Span const&, gaps::R2Span const&, gaps::R2Point*, double*, double*)
RNClassID R2Intersects(const R2Span& span1, const R2Span& span2, 
    R2Point *hit_point, RNScalar *hit_t1, RNScalar *hit_t2)
{
    // Intersect span1 with span2's ray
    RNScalar s1, s2;
    switch (R2Intersects(span1, span2.Ray(), hit_point, &s1, &s2)) {
    case RN_NULL_CLASS_ID:
	// Spans do not intersect
	return RN_NULL_CLASS_ID;

    case R2_SPAN_CLASS_ID:
	// Span1 lies on span2's ray -- check if they overlap ???
	if ((R2Contains(span2, span1.Start())) || (R2Contains(span2, span1.End()))) {
	    // Spans are on same line, and overlap
	    return R2_SPAN_CLASS_ID;
	}
	else {
	    // Spans are on same line, but do not overlap
	    return RN_NULL_CLASS_ID;
	}
	break;

    case R2_POINT_CLASS_ID: 
	// Check if intersection point is on span
	if (RNIsGreater(s1, span1.Length())) {
	    // Span's ray intersects plane beyond span endpoint
	    return RN_NULL_CLASS_ID;
	}
	else {
	    // Spans intersect at point
	    if (hit_t1) *hit_t1 = s1;
	    if (hit_t2) *hit_t2 = s2;
	    return R2_POINT_CLASS_ID;
	}
	break;

    default:
	RNAbort("Illegal intersection");
	break;
    }

    // Should never get here
    RNAbort("Should never get here");
    return RN_NULL_CLASS_ID;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %r15
movq %rcx, %r13
movq %rsi, %r12
movq %rdi, %r14
movq %rsp, %rcx
leaq 0x8(%rsp), %r8
movq %rsi, %rdi
movq %r14, %rsi
callq 0x583d8
movl %eax, %ebx
testl %eax, %eax
je 0x58a0e
cmpl $0x1, %ebx
je 0x589b0
cmpl $0x4, %ebx
jne 0x589f0
leaq 0x28(%r14), %rsi
movq %r12, %rdi
callq 0x572f1
movl $0x4, %ebx
testl %eax, %eax
jne 0x58a0e
addq $0x38, %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x572f1
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
shll $0x2, %ebx
jmp 0x58a0e
movsd 0x8(%rsp), %xmm0
leaq 0x8d1db(%rip), %rax     # 0xe5b98
movapd %xmm0, %xmm1
subsd 0x48(%r14), %xmm1
xorl %ebx, %ebx
ucomisd (%rax), %xmm1
ja 0x58a0e
testq %r13, %r13
je 0x589da
movsd %xmm0, (%r13)
movl $0x1, %ebx
testq %r15, %r15
je 0x58a0e
movsd (%rsp), %xmm0
movsd %xmm0, (%r15)
jmp 0x58a0e
leaq 0x505d5(%rip), %rdi     # 0xa8fcc
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x718f6
leaq 0x505da(%rip), %rdi     # 0xa8fe1
xorl %eax, %eax
callq 0x718f6
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Span const&, gaps::R2Box const&, gaps::R2Point*, double*)
RNClassID R2Intersects(const R2Span& span, const R2Box& box, 
    R2Point *hit_point, RNScalar *hit_t)
{
    // Intersect box with span's ray
    RNScalar s;
    switch (R2Intersects(box, span.Ray(), hit_point, NULL, &s)) {
    case RN_NULL_CLASS_ID:
	// Span and box do not intersect
	return RN_NULL_CLASS_ID;

    case R2_SPAN_CLASS_ID:
	// Box contains span
        if (RNIsGreater(s, span.Length()))
            return RN_NULL_CLASS_ID;
        else
            return R2_SPAN_CLASS_ID;

    case R2_POINT_CLASS_ID: 
	// Check if intersection point is on span
	if (RNIsGreater(s, span.Length())) {
	    // Span's ray intersects box beyond span endpoint
	    return RN_NULL_CLASS_ID;
	}
	else {
	    // Span and box intersect at point
	    if (hit_t) *hit_t = s;
	    return R2_POINT_CLASS_ID;
	}
	break;

    default:
	RNAbort("Illegal intersection");
	break;
    }

    // Should never get here
    RNAbort("Should never get here");
    return RN_NULL_CLASS_ID;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdi, %r15
leaq 0x8(%rsp), %r8
xorl %ecx, %ecx
callq 0x58475
movl %eax, %ebx
testl %eax, %eax
je 0x58acb
cmpl $0x1, %ebx
je 0x58a7d
cmpl $0x4, %ebx
jne 0x58aad
movsd 0x8(%rsp), %xmm0
leaq 0x8d12f(%rip), %rax     # 0xe5b98
subsd 0x48(%r15), %xmm0
xorl %ebx, %ebx
ucomisd (%rax), %xmm0
setbe %bl
shll $0x2, %ebx
jmp 0x58acb
movsd 0x8(%rsp), %xmm0
leaq 0x8d10e(%rip), %rax     # 0xe5b98
movapd %xmm0, %xmm1
subsd 0x48(%r15), %xmm1
xorl %ebx, %ebx
ucomisd (%rax), %xmm1
ja 0x58acb
movl $0x1, %ebx
testq %r14, %r14
je 0x58acb
movsd %xmm0, (%r14)
jmp 0x58acb
leaq 0x50518(%rip), %rdi     # 0xa8fcc
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x718f6
leaq 0x5051d(%rip), %rdi     # 0xa8fe1
xorl %eax, %eax
callq 0x718f6
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Span const&, gaps::R2Circle const&, gaps::R2Point*, double*)
RNClassID R2Intersects(const R2Span& span, const R2Circle& circle, 
    R2Point *hit_point, RNScalar *hit_t)
{
    // Intersect circle with span's ray
    RNScalar s;
    switch (R2Intersects(circle, span.Ray(), hit_point, NULL, &s)) {
    case RN_NULL_CLASS_ID:
	// Span and circle do not intersect
	return RN_NULL_CLASS_ID;

    case R2_SPAN_CLASS_ID:
	// Circle contains span
	return R2_SPAN_CLASS_ID;

    case R2_POINT_CLASS_ID: 
	// Check if intersection point is on span
	if (RNIsGreater(s, span.Length())) {
	    // Span's ray intersects circle beyond span endpoint
	    return RN_NULL_CLASS_ID;
	}
	else {
	    // Span and circle intersect at point
	    if (hit_t) *hit_t = s;
	    return R2_POINT_CLASS_ID;
	}
	break;

    default:
	RNAbort("Illegal intersection");
	break;
    }

    // Should never get here
    RNAbort("Should never get here");
    return RN_NULL_CLASS_ID;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdi, %r14
leaq 0x8(%rsp), %r8
xorl %ecx, %ecx
callq 0x586af
movl %eax, %ebp
testl %eax, %eax
je 0x58b4e
cmpl $0x4, %ebp
je 0x58b4e
cmpl $0x1, %ebp
jne 0x58b30
movsd 0x8(%rsp), %xmm0
leaq 0x8d08a(%rip), %rax     # 0xe5b98
movapd %xmm0, %xmm1
subsd 0x48(%r14), %xmm1
xorl %ebp, %ebp
ucomisd (%rax), %xmm1
ja 0x58b4e
movl $0x1, %ebp
testq %rbx, %rbx
je 0x58b4e
movsd %xmm0, (%rbx)
jmp 0x58b4e
leaq 0x50495(%rip), %rdi     # 0xa8fcc
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x718f6
leaq 0x5049a(%rip), %rdi     # 0xa8fe1
xorl %eax, %eax
callq 0x718f6
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Halfspace const&, gaps::R2Halfspace const&)
RNClassID R2Intersects(const R2Halfspace& halfspace1, const R2Halfspace& halfspace2)
{
    // Check halfspace directions
    if (R2Contains(halfspace1.Normal(), -(halfspace2.Normal()))) {
	// Halfspace normals point in opposite directions
	return R2Intersects(halfspace1, halfspace2.Line().Point());
    }
    else { 
	// Halfspaces are not anti-parallel -- they must intersect
	return RN_UNKNOWN_CLASS_ID;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %r12
leaq 0x10(%rsi), %r14
movq %rsp, %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x6887f
movq %r12, %rdi
movq %r13, %rsi
callq 0x56cc8
testl %eax, %eax
je 0x58bd9
movsd 0x20(%r15), %xmm0
xorps 0x49482(%rip), %xmm0    # 0xa2020
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6870c
leaq 0x48f6cd(%rip), %rsi    # 0x4e8280
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
callq 0x682cf
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57469
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x58bde
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Halfspace const&, gaps::R2Circle const&)
RNClassID R2Intersects(const R2Halfspace& halfspace, const R2Circle& circle)
{
    // Return whether circle intersects halfspace
    RNScalar d = R2SignedDistance(halfspace.Line(), circle.Center());
    if (RNIsLess(d, -(circle.Radius()))) return RN_NULL_CLASS_ID;
    else if (RNIsEqual(d, -(circle.Radius()))) return R2_POINT_CLASS_ID;
    else return RN_UNKNOWN_CLASS_ID;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
addq $0x8, %rsi
callq 0x6c745
leaq 0x8cf53(%rip), %rax     # 0xe5b98
addsd 0x18(%rbx), %xmm0
movsd (%rax), %xmm1
movapd 0x493ca(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
movapd %xmm0, %xmm3
cmpnlepd %xmm1, %xmm3
movapd %xmm2, %xmm1
cmpnlepd %xmm0, %xmm1
orpd %xmm3, %xmm1
movd %xmm1, %ecx
orl $0x1, %ecx
xorl %eax, %eax
ucomisd %xmm0, %xmm2
cmovbel %ecx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Box const&, gaps::R2Box const&, gaps::R2Box*)
RNClassID R2Intersects(const R2Point& point, const R2Circle& circle)
{
    // Check whether circle contains point
    if (R2Contains(circle, point)) {
	// Point lies in circle
	return R2_POINT_CLASS_ID;
    }
    else {
	// Point does not lie in circle
	return RN_NULL_CLASS_ID;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movsd 0x8(%rdi), %xmm4
movsd 0x18(%rsi), %xmm2
leaq 0x8cefe(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm6
movapd %xmm4, %xmm0
subsd %xmm2, %xmm0
xorl %ebx, %ebx
ucomisd %xmm6, %xmm0
ja 0x58d4f
movsd 0x10(%rdi), %xmm5
movsd 0x20(%rsi), %xmm3
movapd %xmm5, %xmm0
subsd %xmm3, %xmm0
ucomisd %xmm6, %xmm0
ja 0x58d4f
movsd 0x8(%rsi), %xmm0
movsd 0x18(%rdi), %xmm7
movapd %xmm0, %xmm1
subsd %xmm7, %xmm1
ucomisd %xmm6, %xmm1
ja 0x58d4f
movsd 0x10(%rsi), %xmm1
movsd 0x20(%rdi), %xmm8
movapd %xmm1, %xmm9
subsd %xmm8, %xmm9
ucomisd %xmm6, %xmm9
ja 0x58d4f
movq %rdx, %r14
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdx, %rdx
je 0x58d4f
maxsd %xmm4, %xmm0
maxsd %xmm5, %xmm1
minsd %xmm7, %xmm2
minsd %xmm8, %xmm3
movq %rsp, %rdi
callq 0x6539c
leaq 0x8(%r14), %rdi
leaq 0x8(%rsp), %rsi
callq 0x681de
addq $0x18, %r14
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x681de
movq %rsp, %rdi
callq 0x65c14
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x65c14
movq %rbx, %rdi
callq 0xe7e0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Circle const&, gaps::R2Circle const&)
RNClassID R2Intersects(const R2Circle& circle1, const R2Circle& circle2)
{
    // Return whether circle intersects circle
    R2Vector v = circle1.Center() - circle2.Center();
    RNScalar distance_squared = v.X() * v.X() + v.Y() * v.Y();
    RNScalar radius_sum = circle1.Radius() + circle2.Radius();
    RNScalar radius_sum_squared = radius_sum * radius_sum;
    if (RNIsGreater(distance_squared, radius_sum_squared)) return RN_NULL_CLASS_ID;
    else if (RNIsEqual(distance_squared, radius_sum_squared)) return R2_POINT_CLASS_ID;
    else return RN_UNKNOWN_CLASS_ID;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rdi), %rsi
leaq 0x8(%rbx), %rdx
movq %rsp, %r15
movq %r15, %rdi
callq 0x682e3
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
movsd 0x18(%r14), %xmm2
addsd 0x18(%rbx), %xmm2
addsd %xmm1, %xmm0
mulsd %xmm2, %xmm2
leaq 0x8cda9(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm1
subsd %xmm2, %xmm0
xorl %eax, %eax
ucomisd %xmm1, %xmm0
ja 0x58e20
movapd %xmm0, %xmm2
cmpnlepd %xmm1, %xmm2
xorpd 0x49210(%rip), %xmm1    # 0xa2020
cmpnlepd %xmm0, %xmm1
orpd %xmm2, %xmm1
movd %xmm1, %eax
orl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::R2Grid(int, int)
R2Grid::
R2Grid(int xresolution, int yresolution)
{
  // Set grid resolution
  grid_resolution[0] = xresolution;
  grid_resolution[1] = yresolution;
  grid_row_size = xresolution;
  grid_size = grid_row_size * yresolution;

  // Allocate grid values
  if (grid_size == 0) grid_values = NULL;
  else grid_values = new RNScalar [ grid_size ];
  assert(!grid_size || grid_values);

  // Set all values to zero
  for (int i = 0; i < grid_size; i++) grid_values[i] = 0;

  // Set transformations
  grid_to_world_transform = R2identity_affine;
  world_to_grid_transform = R2identity_affine;
  world_to_grid_scale_factor = 1.0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %rbx
callq 0x65c28
leaq 0x58(%rbx), %r14
movq %r14, %rdi
callq 0x65c28
movl %r15d, 0xc0(%rbx)
movl %ebp, 0xc4(%rbx)
movl %r15d, 0xc8(%rbx)
imull %r15d, %ebp
movl %ebp, 0xcc(%rbx)
testl %ebp, %ebp
je 0x58f56
movl %ebp, %r15d
leaq (,%r15,8), %rax
testl %ebp, %ebp
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0xe030
movq %rax, 0xb8(%rbx)
testl %ebp, %ebp
jle 0x58f61
shlq $0x3, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0xe260
jmp 0x58f61
movq $0x0, 0xb8(%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x48efec(%rip), %r12    # 0x4e7f58
leaq 0x8(%r12), %r15
movq %r15, %rsi
callq 0x66bbc
movl 0x50(%r12), %eax
movl %eax, 0x50(%rbx)
leaq 0x60(%rbx), %rdi
movq %r15, %rsi
callq 0x66bbc
movl 0x50(%r12), %eax
movl %eax, 0xa8(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xb0(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x58fc2
movq %rax, %r15
movq %r14, %rdi
callq 0x65f5c
movq %rbx, %rdi
callq 0x65f5c
movq %r15, %rdi
callq 0xe7e0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::R2Grid(int, int, gaps::R2Box const&)
R2Grid::
R2Grid(int xresolution, int yresolution, const R2Box& bbox)
{
  // Set grid resolution
  grid_resolution[0] = xresolution;
  grid_resolution[1] = yresolution;
  grid_row_size = xresolution;
  grid_size = grid_row_size * yresolution;

  // Allocate grid values
  if (grid_size == 0) grid_values = NULL;
  else grid_values = new RNScalar [ grid_size ];
  assert(!grid_size || grid_values);

  // Set all values to zero
  for (int i = 0; i < grid_size; i++) grid_values[i] = 0;

  // Set transformation
  SetWorldToGridTransformation(bbox);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %rbx
callq 0x65c28
leaq 0x58(%rbx), %r14
movq %r14, %rdi
callq 0x65c28
movl %r12d, 0xc0(%rbx)
movl %ebp, 0xc4(%rbx)
movl %r12d, 0xc8(%rbx)
imull %r12d, %ebp
movl %ebp, 0xcc(%rbx)
testl %ebp, %ebp
je 0x59053
movl %ebp, %r12d
leaq (,%r12,8), %rax
testl %ebp, %ebp
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0xe030
movq %rax, 0xb8(%rbx)
testl %ebp, %ebp
jle 0x5905e
shlq $0x3, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0xe260
jmp 0x5905e
movq $0x0, 0xb8(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x59092
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x59082
movq %rax, %r15
movq %r14, %rdi
callq 0x65f5c
movq %rbx, %rdi
callq 0x65f5c
movq %r15, %rdi
callq 0xe7e0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::R2Grid(int, int, gaps::R2Affine const&)
R2Grid::
R2Grid(int xresolution, int yresolution, const R2Affine& world_to_grid)
{
  // Set grid resolution
  grid_resolution[0] = xresolution;
  grid_resolution[1] = yresolution;
  grid_row_size = xresolution;
  grid_size = grid_row_size * yresolution;

  // Allocate grid values
  if (grid_size == 0) grid_values = NULL;
  else grid_values = new RNScalar [ grid_size ];
  assert(!grid_size || grid_values);

  // Set all values to zero
  for (int i = 0; i < grid_size; i++) grid_values[i] = 0;

  // Set transformation
  SetWorldToGridTransformation(world_to_grid);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %rbx
callq 0x65c28
leaq 0x58(%rbx), %r14
movq %r14, %rdi
callq 0x65c28
movl %r12d, 0xc0(%rbx)
movl %ebp, 0xc4(%rbx)
movl %r12d, 0xc8(%rbx)
imull %r12d, %ebp
movl %ebp, 0xcc(%rbx)
testl %ebp, %ebp
je 0x59323
movl %ebp, %r12d
leaq (,%r12,8), %rax
testl %ebp, %ebp
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0xe030
movq %rax, 0xb8(%rbx)
testl %ebp, %ebp
jle 0x5932e
shlq $0x3, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0xe260
jmp 0x5932e
movq $0x0, 0xb8(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x59362
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x59352
movq %rax, %r15
movq %r14, %rdi
callq 0x65f5c
movq %rbx, %rdi
callq 0x65f5c
movq %r15, %rdi
callq 0xe7e0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::SetWorldToGridTransformation(gaps::R2Affine const&)
void R2Grid::
SetWorldToGridTransformation(const R2Affine& affine)
{
  // Set transformations
  world_to_grid_transform = affine;
  grid_to_world_transform = affine.Inverse();
  world_to_grid_scale_factor = affine.ScaleFactor();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x60, %rdi
leaq 0x8(%rsi), %r15
movq %r15, %rsi
callq 0x66bbc
movl 0x50(%r14), %eax
movl %eax, 0xa8(%rbx)
leaq 0x60(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x6654c
movl 0x50(%r14), %edx
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x65c5e
leaq 0x8(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x66bbc
leaq 0x8(%rsp), %rdi
movl 0x50(%rdi), %eax
movl %eax, 0x50(%rbx)
callq 0x65f5c
movq %r14, %rdi
callq 0x65ca6
movsd %xmm0, 0xb0(%rbx)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x65f5c
movq %rbx, %rdi
callq 0xe7e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::operator=(gaps::R2Grid const&)
R2Grid& R2Grid::
operator=(const R2Grid& grid) 
{
  // Copy grid resolution
  grid_resolution[0] = grid.grid_resolution[0];
  grid_resolution[1] = grid.grid_resolution[1];
  grid_row_size = grid.grid_row_size;
  grid_size = grid.grid_size;

  // Copy grid values
  if (grid_values) delete [] grid_values;
  if (grid_size == 0) grid_values = NULL;
  else grid_values = new RNScalar [ grid_size ];
  assert(!grid_size || grid_values);
  for (int i = 0; i < grid_size; i++) {
    grid_values[i] = grid.grid_values[i];
  }

  // Copy transforms
  grid_to_world_transform = grid.grid_to_world_transform;
  world_to_grid_transform = grid.world_to_grid_transform;
  world_to_grid_scale_factor = grid.world_to_grid_scale_factor;

  // Return this
  return *this;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0xc0(%rsi), %eax
movl %eax, 0xc0(%rdi)
movl 0xc4(%rsi), %eax
movl %eax, 0xc4(%rdi)
movl 0xc8(%rsi), %eax
movl %eax, 0xc8(%rdi)
movl 0xcc(%rsi), %ebp
movl %ebp, 0xcc(%rdi)
movq 0xb8(%rdi), %rdi
testq %rdi, %rdi
je 0x5989b
callq 0xe5b0
movl 0xcc(%rbx), %ebp
testl %ebp, %ebp
je 0x598e2
movslq %ebp, %rax
shlq $0x3, %rax
testl %ebp, %ebp
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0xe030
movq %rax, 0xb8(%rbx)
testl %ebp, %ebp
jle 0x598ed
movq 0xb8(%r14), %rcx
movl %ebp, %edx
xorl %esi, %esi
movsd (%rcx,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
incq %rsi
cmpq %rsi, %rdx
jne 0x598ce
jmp 0x598ed
movq $0x0, 0xb8(%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x8(%r14), %rsi
callq 0x66bbc
movl 0x50(%r14), %eax
movl %eax, 0x50(%rbx)
leaq 0x60(%rbx), %rdi
leaq 0x60(%r14), %rsi
callq 0x66bbc
movl 0xa8(%r14), %eax
movl %eax, 0xa8(%rbx)
movsd 0xb0(%r14), %xmm0
movsd %xmm0, 0xb0(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::R2Grid(gaps::R2Image const&, int)
R2Grid::
R2Grid(const R2Image& image, int dummy)
  : grid_values(NULL)
{
  // Determine grid resolution
  grid_resolution[0] = image.Width();
  grid_resolution[1] = image.Height();
  grid_row_size = grid_resolution[0];
  grid_size = grid_row_size * grid_resolution[1];

  // Allocate grid values
  if (grid_size <= 0) grid_values = NULL;
  else grid_values = new RNScalar [ grid_size ];
  assert(!grid_size || grid_values);

  // Copy grid values
  for (int j = 0; j < grid_resolution[1]; j++) {
    for (int i = 0; i < grid_resolution[0]; i++) {
      RNRgb rgb = image.PixelRGB(i, j);
      SetGridValue(i, j, rgb.Luminance());
    }
  }

  // Set transformations
  grid_to_world_transform = R2identity_affine;
  world_to_grid_transform = R2identity_affine;
  world_to_grid_scale_factor = 1.0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbx
callq 0x65c28
leaq 0x58(%rbx), %rdi
movq %rdi, 0x8(%rsp)
callq 0x65c28
movq $0x0, 0xb8(%rbx)
movl (%r15), %r14d
movl %r14d, 0xc0(%rbx)
movl 0x4(%r15), %ebp
movl %ebp, 0xc4(%rbx)
movl %r14d, 0xc8(%rbx)
movl %ebp, %eax
imull %r14d, %eax
movl %eax, 0xcc(%rbx)
testl %eax, %eax
jle 0x599f6
movl %eax, %edi
shlq $0x3, %rdi
callq 0xe030
jmp 0x599f8
xorl %eax, %eax
movq %rax, 0xb8(%rbx)
testl %ebp, %ebp
jle 0x59a93
xorl %r12d, %r12d
testl %r14d, %r14d
jle 0x59a87
movslq %r12d, %r13
xorl %ebp, %ebp
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movl %ebp, %edx
movl %r12d, %ecx
callq 0x68ec2
movsd 0x18(%rsp), %xmm0
mulsd 0x4f8bc(%rip), %xmm0    # 0xa92f0
movsd 0x10(%rsp), %xmm1
mulsd 0x4f8b6(%rip), %xmm1    # 0xa92f8
addsd %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
mulsd 0x4f8ac(%rip), %xmm0    # 0xa9300
addsd %xmm1, %xmm0
movq 0xb8(%rbx), %rax
movslq 0xc8(%rbx), %rcx
imulq %r13, %rcx
addq %rbp, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0xc0(%rbx), %r14d
incq %rbp
cmpl %r14d, %ebp
jl 0x59a14
movl 0xc4(%rbx), %ebp
incl %r12d
cmpl %ebp, %r12d
jl 0x59a0a
leaq 0x8(%rbx), %rdi
leaq 0x48e4ba(%rip), %r14    # 0x4e7f58
leaq 0x8(%r14), %r15
movq %r15, %rsi
callq 0x66bbc
movl 0x50(%r14), %eax
movl %eax, 0x50(%rbx)
leaq 0x60(%rbx), %rdi
movq %r15, %rsi
callq 0x66bbc
movl 0x50(%r14), %eax
movl %eax, 0xa8(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xb0(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x59afb
jmp 0x59aee
movq %rax, %r15
movq 0x8(%rsp), %rdi
callq 0x65f5c
movq %rbx, %rdi
callq 0x65f5c
movq %r15, %rdi
callq 0xe7e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::Percentile(double) const
RNScalar R2Grid::
Percentile(RNScalar percentile) const
{
  // Return value at given percentile
  if (grid_size == 0) return 0.0;
  int tmp_count = 0;
  RNScalar *tmp_values = new RNScalar [ grid_size ];
  for (int i = 0; i < grid_size; i++) {
    if (grid_values[i] != R2_GRID_UNKNOWN_VALUE) {
      tmp_values[tmp_count++] = grid_values[i];
    }
  }
  if (tmp_count == 0) return R2_GRID_UNKNOWN_VALUE;
  qsort(tmp_values, tmp_count, sizeof(RNScalar), RNCompareScalars);
  int percentile_index = percentile * tmp_count;
  RNScalar value = tmp_values[percentile_index];
  delete [] tmp_values;
  return value;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movslq 0xcc(%rdi), %r15
testq %r15, %r15
je 0x59c74
movq %rdi, %r14
movsd %xmm0, (%rsp)
leaq (,%r15,8), %rax
testl %r15d, %r15d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0xe030
testl %r15d, %r15d
jle 0x59c7a
movq %rax, %rbx
movq 0xb8(%r14), %rax
xorl %ecx, %ecx
movsd 0x493ab(%rip), %xmm0    # 0xa2fb8
xorl %ebp, %ebp
movsd (%rax,%rcx,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x59c1c
jnp 0x59c26
movslq %ebp, %rdx
incl %ebp
movsd %xmm1, (%rbx,%rdx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x59c0f
testl %ebp, %ebp
je 0x59c82
movslq %ebp, %rsi
leaq 0x179e5(%rip), %rcx     # 0x71621
movl $0x8, %edx
movq %rbx, %rdi
callq 0xe880
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd (%rsp), %xmm0
cvttsd2si %xmm0, %eax
cltq
movsd (%rbx,%rax,8), %xmm0
movsd %xmm0, (%rsp)
movq %rbx, %rdi
callq 0xe5b0
movsd (%rsp), %xmm0
jmp 0x59c82
xorpd %xmm0, %xmm0
jmp 0x59c82
movsd 0x49336(%rip), %xmm0    # 0xa2fb8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::L1Norm() const
RNScalar R2Grid::
L1Norm(void) const
{
  // Return L1 norm of grid
  RNScalar sum = 0.0;
  for (int i = 0; i < grid_size; i++) {
    if (grid_values[i] != R2_GRID_UNKNOWN_VALUE) {
      sum += grid_values[i];
    }
  }
  return sum;
}

// Assembly:
movslq 0xcc(%rdi), %rax
testq %rax, %rax
jle 0x59cda
movq 0xb8(%rdi), %rcx
xorpd %xmm2, %xmm2
xorl %edx, %edx
movsd 0x49309(%rip), %xmm1    # 0xa2fb8
movsd (%rcx,%rdx,8), %xmm0
movapd %xmm2, %xmm3
addsd %xmm0, %xmm3
cmpneqsd %xmm1, %xmm0
andpd %xmm0, %xmm3
andnpd %xmm2, %xmm0
orpd %xmm3, %xmm0
incq %rdx
movapd %xmm0, %xmm2
cmpq %rdx, %rax
jne 0x59caf
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::L2Norm() const
RNScalar R2Grid::
L2Norm(void) const
{
  // Return L2 norm of grid
  RNScalar sum = 0.0;
  for (int i = 0; i < grid_size; i++) {
    if (grid_values[i] != R2_GRID_UNKNOWN_VALUE) {
      RNScalar value = grid_values[i];
      sum += value * value;
    }
  }
  return sqrt(sum);
}

// Assembly:
movslq 0xcc(%rdi), %rax
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
testq %rax, %rax
jle 0x59d35
movq 0xb8(%rdi), %rcx
xorpd %xmm3, %xmm3
xorl %edx, %edx
movsd 0x492b1(%rip), %xmm2    # 0xa2fb8
movsd (%rcx,%rdx,8), %xmm0
movapd %xmm0, %xmm4
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
cmpneqsd %xmm2, %xmm0
andpd %xmm0, %xmm4
andnpd %xmm3, %xmm0
orpd %xmm4, %xmm0
incq %rdx
movapd %xmm0, %xmm3
cmpq %rdx, %rax
jne 0x59d07
ucomisd %xmm1, %xmm0
jb 0xe340
sqrtsd %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::Cardinality() const
int R2Grid::
Cardinality(void) const
{
  // Return number of non-zero grid values
  int count = 0;
  for (int i = 0; i < grid_size; i++) {
    if (grid_values[i] != R2_GRID_UNKNOWN_VALUE) {
      if (grid_values[i] != 0) count++;
    }
  }
  return count;
}

// Assembly:
movslq 0xcc(%rdi), %rcx
testq %rcx, %rcx
jle 0x59d8d
movq 0xb8(%rdi), %rdx
xorl %esi, %esi
xorpd %xmm0, %xmm0
movsd 0x49253(%rip), %xmm1    # 0xa2fb8
xorl %eax, %eax
movsd (%rdx,%rsi,8), %xmm2
movapd %xmm2, %xmm3
cmpneqpd %xmm0, %xmm3
cmpneqpd %xmm1, %xmm2
andpd %xmm3, %xmm2
movd %xmm2, %edi
subl %edi, %eax
incq %rsi
cmpq %rsi, %rcx
jne 0x59d67
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::Mean() const
RNScalar R2Grid::
Mean(void) const
{
  // Sum values
  int count = 0;
  RNScalar sum = 0;
  for (int i = 0; i < grid_size; i++) {
    if (grid_values[i] != R2_GRID_UNKNOWN_VALUE) {
      sum += grid_values[i];
      count++;
    }
  }

  // Return mean
  if (count == 0) return 0.0;
  else return sum / count;
}

// Assembly:
movslq 0xcc(%rdi), %rax
testq %rax, %rax
jle 0x59df0
movq 0xb8(%rdi), %rcx
xorl %edx, %edx
xorpd %xmm0, %xmm0
movsd 0x49207(%rip), %xmm1    # 0xa2fb8
xorl %esi, %esi
movapd %xmm0, %xmm3
movsd (%rcx,%rdx,8), %xmm2
ucomisd %xmm1, %xmm2
addsd %xmm2, %xmm0
jne 0x59dcc
jp 0x59dcc
movapd %xmm3, %xmm0
cmpneqsd %xmm1, %xmm2
movq %xmm2, %rdi
subl %edi, %esi
incq %rdx
cmpq %rdx, %rax
jne 0x59db3
testl %esi, %esi
je 0x59df0
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
divsd %xmm1, %xmm0
retq
xorpd %xmm0, %xmm0
retq
nop