LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: 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:
subq $0xe8, %rsp
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movl $0x0, 0xd4(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x88(%rsp), %rdi
movsd 0x92c01(%rip), %xmm0    # 0x135c40
movsd 0x92c01(%rip), %xmm1    # 0x135c48
callq 0xc3c30
movq 0x18(%rsp), %rsi
leaq 0x98(%rsp), %rdi
leaq 0x88(%rsp), %rdx
xorl %ecx, %ecx
callq 0xc23b0
movl $0x0, 0x84(%rsp)
movl 0x84(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0xe0(%rsp), %rdi
callq 0xa3810
movl %eax, %ecx
movl 0x14(%rsp), %eax
cmpl %ecx, %eax
jge 0xa3153
movq 0xe0(%rsp), %rdi
movl 0x84(%rsp), %esi
callq 0xa3820
movq %rax, 0x78(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
movq 0xe0(%rsp), %rdi
callq 0xa3810
movq 0x8(%rsp), %rdi
movl %eax, %ecx
movl 0x10(%rsp), %eax
cltd
idivl %ecx
movl %edx, %esi
callq 0xa3820
movq %rax, 0x70(%rsp)
movq 0x78(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq 0x20(%rsp), %rdi
callq 0xc1470
leaq 0x98(%rsp), %rdi
leaq 0x20(%rsp), %rsi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0xa4360
cmpl $0x0, %eax
je 0xa313b
movl 0xd4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd4(%rsp)
jmp 0xa313d
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0xa3073
movl 0xd4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
addq $0xe8, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Point const&, gaps::R2Ray const&, double*)
RNClassID R2Intersects(const R2Point& point, const R2Ray& ray, RNScalar *hit_t)
{
    // Check if ray contains point
    if (R2Contains(ray, point)) {
	// Point lies on ray
	if (hit_t) *hit_t = ray.T(point);
	return R2_POINT_CLASS_ID;
    }
    else {
	// Point is not on ray
	return RN_NULL_CLASS_ID;
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xa1d20
cmpl $0x0, %eax
je 0xa39a1
cmpq $0x0, 0x8(%rsp)
je 0xa3997
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xc2530
movq 0x8(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x24(%rsp)
jmp 0xa39a9
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xa1ff0
cmpl $0x0, %eax
je 0xa3a11
cmpq $0x0, 0x8(%rsp)
je 0xa3a07
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xa5af0
movq 0x8(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x24(%rsp)
jmp 0xa3a19
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Line const&, gaps::R2Line const&, gaps::R2Point*)
RNClassID R2Intersects(const R2Line& line1, const R2Line& line2, 
    R2Point *hit_point)
{
    // Get variables in more convenient form
    RNScalar a1 = line1.A();
    RNScalar b1 = line1.B();
    RNScalar c1 = line1.C();
    RNScalar a2 = line2.A();
    RNScalar b2 = line2.B();
    RNScalar c2 = line2.C();

    // Check if line and ray are parallel
    RNScalar denom = a2*b1 - a1*b2;
    if (RNIsZero(denom)) {
	// Check if lines are coincident
	if (R2Contains(line1, line2.Point())) {
	    // Lines are coincident
	    return R2_LINE_CLASS_ID;
	}
	else {
	    // Lines are parallel and do not intersect
	    return RN_NULL_CLASS_ID;
	}
    }
    else {
	// Find hit point
        if (hit_point) {
	    (*hit_point)[0] = (b2*c1 - b1*c2) / denom;
	    (*hit_point)[1] = (a1*c2 - a2*c1) / denom;
	}
	return R2_POINT_CLASS_ID;
    }
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq 0x78(%rsp), %rdi
callq 0xa5b20
movsd %xmm0, 0x60(%rsp)
movq 0x78(%rsp), %rdi
callq 0xa5b40
movsd %xmm0, 0x58(%rsp)
movq 0x78(%rsp), %rdi
callq 0xa3550
movsd %xmm0, 0x50(%rsp)
movq 0x70(%rsp), %rdi
callq 0xa5b20
movsd %xmm0, 0x48(%rsp)
movq 0x70(%rsp), %rdi
callq 0xa5b40
movsd %xmm0, 0x40(%rsp)
movq 0x70(%rsp), %rdi
callq 0xa3550
movsd %xmm0, 0x38(%rsp)
movsd 0x48(%rsp), %xmm0
movsd 0x58(%rsp), %xmm2
movsd 0x60(%rsp), %xmm1
mulsd 0x40(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
leaq 0xd4930(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm1
callq 0x36b80
cmpl $0x0, %eax
je 0xa3c0b
movq 0x78(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0xa3630
movq 0x18(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xa1a10
cmpl $0x0, %eax
je 0xa3bfb
movl $0x2, 0x84(%rsp)
jmp 0xa3cd7
movl $0x0, 0x84(%rsp)
jmp 0xa3cd7
cmpq $0x0, 0x68(%rsp)
je 0xa3ccc
movsd 0x40(%rsp), %xmm0
movsd 0x50(%rsp), %xmm2
movsd 0x58(%rsp), %xmm1
mulsd 0x38(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x68(%rsp), %rdi
xorl %esi, %esi
callq 0xa5b60
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x60(%rsp), %xmm0
movsd 0x38(%rsp), %xmm2
movsd 0x48(%rsp), %xmm1
mulsd 0x50(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
divsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x68(%rsp), %rdi
movl $0x1, %esi
callq 0xa5b60
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movl $0x1, 0x84(%rsp)
movl 0x84(%rsp), %eax
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x88, %rsp
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq 0x78(%rsp), %rdi
callq 0xa38c0
movq %rax, 0x58(%rsp)
movq 0x78(%rsp), %rdi
callq 0xa3550
movsd %xmm0, 0x50(%rsp)
movq 0x70(%rsp), %rdi
callq 0xa3560
movq %rax, %rsi
leaq 0x40(%rsp), %rdi
callq 0xa5b80
movq 0x70(%rsp), %rdi
callq 0xa35c0
movq %rax, 0x38(%rsp)
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0xc3f40
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
leaq 0xd476e(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm1
callq 0x36b80
cmpl $0x0, %eax
je 0xa3dc6
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rdi
callq 0xa3560
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0xa1a10
cmpl $0x0, %eax
je 0xa3db6
movl $0x3, 0x84(%rsp)
jmp 0xa3e8b
movl $0x0, 0x84(%rsp)
jmp 0xa3e8b
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x58(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xc3f40
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd 0x30(%rsp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x28(%rsp), %xmm0
leaq 0xd46be(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm1
callq 0x3a5d0
cmpl $0x0, %eax
je 0xa3e80
cmpq $0x0, 0x68(%rsp)
je 0xa3e5c
movq 0x70(%rsp), %rsi
movsd 0x28(%rsp), %xmm0
leaq 0x18(%rsp), %rdi
callq 0xc24c0
movq 0x68(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xc33e0
cmpq $0x0, 0x60(%rsp)
je 0xa3e73
movsd 0x28(%rsp), %xmm0
movq 0x60(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x84(%rsp)
jmp 0xa3e8b
movl $0x0, 0x84(%rsp)
movl 0x84(%rsp), %eax
addq $0x88, %rsp
retq
nopw (%rax,%rax)
// File: 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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
callq 0xa5bc0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movq 0x28(%rsp), %rdx
leaq 0x18(%rsp), %rcx
callq 0xa3cf0
movl %eax, %ecx
movl %ecx, 0x14(%rsp)
testl %eax, %eax
je 0xa3f05
jmp 0xa3eef
movl 0x14(%rsp), %eax
subl $0x1, %eax
je 0xa3f1f
jmp 0xa3efa
movl 0x14(%rsp), %eax
subl $0x3, %eax
je 0xa3f12
jmp 0xa3f7c
movl $0x0, 0x44(%rsp)
jmp 0xa3fa0
movl $0x4, 0x44(%rsp)
jmp 0xa3fa0
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x30(%rsp), %rdi
callq 0xa5bd0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
leaq 0xd459d(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xa3f5b
movl $0x0, 0x44(%rsp)
jmp 0xa3fa0
cmpq $0x0, 0x20(%rsp)
je 0xa3f72
movsd 0x18(%rsp), %xmm0
movq 0x20(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x44(%rsp)
jmp 0xa3fa0
leaq 0x919f1(%rip), %rdi     # 0x135974
movb $0x0, %al
callq 0xd4e20
leaq 0x919f8(%rip), %rdi     # 0x135989
movb $0x0, %al
callq 0xd4e20
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax)
// File: 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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rdi
callq 0xa5bc0
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0xa4040
movl %eax, %ecx
movl %ecx, 0x1c(%rsp)
testl %eax, %eax
je 0xa43cf
jmp 0xa43b9
movl 0x1c(%rsp), %eax
subl $0x1, %eax
je 0xa43e9
jmp 0xa43c4
movl 0x1c(%rsp), %eax
subl $0x3, %eax
je 0xa43dc
jmp 0xa4448
movl $0x0, 0x54(%rsp)
jmp 0xa446c
movl $0x4, 0x54(%rsp)
jmp 0xa446c
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x40(%rsp), %rdi
callq 0xa5bd0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
leaq 0xd40d1(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xa4427
movl $0x0, 0x54(%rsp)
jmp 0xa446c
cmpq $0x0, 0x28(%rsp)
je 0xa443e
movsd 0x20(%rsp), %xmm0
movq 0x28(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x54(%rsp)
jmp 0xa446c
leaq 0x91525(%rip), %rdi     # 0x135974
movb $0x0, %al
callq 0xd4e20
leaq 0x9152c(%rip), %rdi     # 0x135989
movb $0x0, %al
callq 0xd4e20
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x50(%rsp), %rdi
callq 0xa5bc0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
movq 0x48(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0x28(%rsp), %r8
callq 0xa5c70
movl %eax, %ecx
movl %ecx, 0x24(%rsp)
testl %eax, %eax
je 0xa4f96
jmp 0xa4f79
movl 0x24(%rsp), %eax
subl $0x1, %eax
je 0xa5009
jmp 0xa4f88
movl 0x24(%rsp), %eax
subl $0x4, %eax
je 0xa4fa3
jmp 0xa507d
movl $0x0, 0x64(%rsp)
jmp 0xa50a1
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x58(%rsp), %rdi
callq 0xa3500
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0xa1ff0
cmpl $0x0, %eax
jne 0xa4fef
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rdi
callq 0xa3510
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0xa1ff0
cmpl $0x0, %eax
je 0xa4ffc
movl $0x4, 0x64(%rsp)
jmp 0xa50a1
movl $0x0, 0x64(%rsp)
jmp 0xa50a1
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x58(%rsp), %rdi
callq 0xa5bd0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
leaq 0xd34b3(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xa5045
movl $0x0, 0x64(%rsp)
jmp 0xa50a1
cmpq $0x0, 0x40(%rsp)
je 0xa505c
movsd 0x30(%rsp), %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, (%rax)
cmpq $0x0, 0x38(%rsp)
je 0xa5073
movsd 0x28(%rsp), %xmm0
movq 0x38(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x64(%rsp)
jmp 0xa50a1
leaq 0x908f0(%rip), %rdi     # 0x135974
movb $0x0, %al
callq 0xd4e20
leaq 0x908f7(%rip), %rdi     # 0x135989
movb $0x0, %al
callq 0xd4e20
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Isect.cpp
// Function: gaps::R2Intersects(gaps::R2Span const&, gaps::R2Halfspace const&, gaps::R2Point*, double*)
RNClassID R2Intersects(const R2Span& span, const R2Halfspace& halfspace, 
    R2Point *hit_point, RNScalar *hit_t)
{
    // Intersect halfspace with span's ray
    RNScalar s;
    switch (R2Intersects(halfspace, span.Ray(), hit_point, &s)) {
    case RN_NULL_CLASS_ID:
	// Span and halfspace do not intersect
	return RN_NULL_CLASS_ID;

    case R2_RAY_CLASS_ID:
    case R2_SPAN_CLASS_ID:
	// Halfspace 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 halfspace beyond span endpoint
	    return RN_NULL_CLASS_ID;
	}
	else {
	    // Span and halfspace 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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rdi
callq 0xa5bc0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movq 0x28(%rsp), %rdx
leaq 0x18(%rsp), %rcx
callq 0xa5cb0
movl %eax, %ecx
movl %ecx, 0x14(%rsp)
testl %eax, %eax
je 0xa5118
jmp 0xa50ff
movl 0x14(%rsp), %eax
subl $0x1, %eax
je 0xa5132
jmp 0xa510a
movl 0x14(%rsp), %eax
addl $-0x3, %eax
subl $0x2, %eax
jb 0xa5125
jmp 0xa518f
movl $0x0, 0x44(%rsp)
jmp 0xa51b3
movl $0x4, 0x44(%rsp)
jmp 0xa51b3
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x38(%rsp), %rdi
callq 0xa5bd0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
leaq 0xd338a(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xa516e
movl $0x0, 0x44(%rsp)
jmp 0xa51b3
cmpq $0x0, 0x20(%rsp)
je 0xa5185
movsd 0x18(%rsp), %xmm0
movq 0x20(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x44(%rsp)
jmp 0xa51b3
leaq 0x907de(%rip), %rdi     # 0x135974
movb $0x0, %al
callq 0xd4e20
leaq 0x907e5(%rip), %rdi     # 0x135989
movb $0x0, %al
callq 0xd4e20
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax)
// File: 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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rdi
callq 0xa5bc0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
movq 0x38(%rsp), %rdx
xorl %eax, %eax
movl %eax, %ecx
leaq 0x28(%rsp), %r8
callq 0xa5cf0
movl %eax, %ecx
movl %ecx, 0x24(%rsp)
testl %eax, %eax
je 0xa522c
jmp 0xa5213
movl 0x24(%rsp), %eax
subl $0x1, %eax
je 0xa5287
jmp 0xa521e
movl 0x24(%rsp), %eax
subl $0x4, %eax
je 0xa5239
jmp 0xa52e6
movl $0x0, 0x54(%rsp)
jmp 0xa530a
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x48(%rsp), %rdi
callq 0xa5bd0
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
leaq 0xd3281(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xa527a
movl $0x0, 0x54(%rsp)
jmp 0xa530a
movl $0x4, 0x54(%rsp)
jmp 0xa530a
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x48(%rsp), %rdi
callq 0xa5bd0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
leaq 0xd3233(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xa52c5
movl $0x0, 0x54(%rsp)
jmp 0xa530a
cmpq $0x0, 0x30(%rsp)
je 0xa52dc
movsd 0x28(%rsp), %xmm0
movq 0x30(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x54(%rsp)
jmp 0xa530a
leaq 0x90687(%rip), %rdi     # 0x135974
movb $0x0, %al
callq 0xd4e20
leaq 0x9068e(%rip), %rdi     # 0x135989
movb $0x0, %al
callq 0xd4e20
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rdi
callq 0xa5bc0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movq 0x28(%rsp), %rdx
xorl %eax, %eax
movl %eax, %ecx
leaq 0x18(%rsp), %r8
callq 0xa5d30
movl %eax, %ecx
movl %ecx, 0x14(%rsp)
testl %eax, %eax
je 0xa5389
jmp 0xa5373
movl 0x14(%rsp), %eax
subl $0x1, %eax
je 0xa53a3
jmp 0xa537e
movl 0x14(%rsp), %eax
subl $0x4, %eax
je 0xa5396
jmp 0xa5400
movl $0x0, 0x44(%rsp)
jmp 0xa5424
movl $0x4, 0x44(%rsp)
jmp 0xa5424
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x38(%rsp), %rdi
callq 0xa5bd0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
leaq 0xd3119(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xa53df
movl $0x0, 0x44(%rsp)
jmp 0xa5424
cmpq $0x0, 0x20(%rsp)
je 0xa53f6
movsd 0x18(%rsp), %xmm0
movq 0x20(%rsp), %rax
movsd %xmm0, (%rax)
movl $0x1, 0x44(%rsp)
jmp 0xa5424
leaq 0x9056d(%rip), %rdi     # 0x135974
movb $0x0, %al
callq 0xd4e20
leaq 0x90574(%rip), %rdi     # 0x135989
movb $0x0, %al
callq 0xd4e20
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax)
// File: 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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0xa3620
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
callq 0xa3530
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0xcb900
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rdi
callq 0xa36b0
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq 0xd2f29(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x39630
cmpl $0x0, %eax
je 0xa55cf
movl $0x0, 0x34(%rsp)
jmp 0xa562a
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x20(%rsp), %rdi
callq 0xa36b0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq 0xd2ed6(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x37170
cmpl $0x0, %eax
je 0xa5622
movl $0x1, 0x34(%rsp)
jmp 0xa562a
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq 0x58(%rsp), %rdi
callq 0xa3530
movq %rax, (%rsp)
movq 0x50(%rsp), %rdi
callq 0xa3530
movq (%rsp), %rsi
movq %rax, %rdx
leaq 0x40(%rsp), %rdi
callq 0xc3830
leaq 0x40(%rsp), %rdi
callq 0x78aa0
movsd %xmm0, 0x18(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x78aa0
movsd %xmm0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x78ab0
movsd %xmm0, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x78ab0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movaps %xmm0, %xmm3
movsd 0x18(%rsp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x58(%rsp), %rdi
callq 0xa36b0
movsd %xmm0, 0x20(%rsp)
movq 0x50(%rsp), %rdi
callq 0xa36b0
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x38(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
leaq 0xd2a46(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xa5ab2
movl $0x0, 0x64(%rsp)
jmp 0xa5ae5
movsd 0x38(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
leaq 0xd2a1b(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x37170
cmpl $0x0, %eax
je 0xa5add
movl $0x1, 0x64(%rsp)
jmp 0xa5ae5
movl $0xffffffff, 0x64(%rsp) # imm = 0xFFFFFFFF
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nop
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Parall.cpp
// Function: gaps::R2Parallel(gaps::R2Vector const&, gaps::R2Vector const&)
RNBoolean R2Parallel(const R2Vector& vector1, const R2Vector& vector2)
{
    // Return whether two vectors are coincident (or anti-coincident)
    if ((RNIsEqual(vector1.X(), vector2.X())) &&
        (RNIsEqual(vector1.Y(), vector2.Y()))) return TRUE;
    if ((RNIsEqual(vector1.X(), -vector2.X())) &&
        (RNIsEqual(vector1.Y(), -vector2.Y()))) return TRUE;
    return FALSE;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0x78aa0
movsd %xmm0, 0x18(%rsp)
movq 0x20(%rsp), %rdi
callq 0x78aa0
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
leaq 0xd2668(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x37170
cmpl $0x0, %eax
je 0xa5ecb
movq 0x28(%rsp), %rdi
callq 0x78ab0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rdi
callq 0x78ab0
movaps %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
leaq 0xd2630(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x37170
cmpl $0x0, %eax
je 0xa5ecb
movl $0x1, 0x34(%rsp)
jmp 0xa5f79
movq 0x28(%rsp), %rdi
callq 0x78aa0
movsd %xmm0, 0x8(%rsp)
movq 0x20(%rsp), %rdi
callq 0x78aa0
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq 0xd25d4(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x37170
cmpl $0x0, %eax
je 0xa5f71
movq 0x28(%rsp), %rdi
callq 0x78ab0
movsd %xmm0, (%rsp)
movq 0x20(%rsp), %rdi
callq 0x78ab0
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
leaq 0xd2587(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x37170
cmpl $0x0, %eax
je 0xa5f71
movl $0x1, 0x34(%rsp)
jmp 0xa5f79
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl %esi, 0x3c(%rsp)
movl %edx, 0x38(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, 0x18(%rsp)
movq %rdi, %rax
movq %rax, 0x10(%rsp)
callq 0xbed00
movq 0x18(%rsp), %rdi
addq $0x58, %rdi
movq %rdi, 0x20(%rsp)
callq 0xbed00
jmp 0xa621d
movq 0x10(%rsp), %rax
movl 0x3c(%rsp), %ecx
movl %ecx, 0xc0(%rax)
movl 0x38(%rsp), %ecx
movl %ecx, 0xc4(%rax)
movl 0x3c(%rsp), %ecx
movl %ecx, 0xc8(%rax)
movl 0xc8(%rax), %ecx
imull 0x38(%rsp), %ecx
movl %ecx, 0xcc(%rax)
cmpl $0x0, 0xcc(%rax)
jne 0xa627f
movq 0x10(%rsp), %rax
movq $0x0, 0xb8(%rax)
jmp 0xa62dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
jmp 0xa6360
movq 0x10(%rsp), %rax
movslq 0xcc(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0xf030
movq %rax, 0x8(%rsp)
jmp 0xa62ad
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, 0xb8(%rax)
jmp 0xa62dd
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x30(%rsp)
movl %eax, 0x2c(%rsp)
callq 0xb9250
jmp 0xa6360
movl $0x0, 0x28(%rsp)
movq 0x10(%rsp), %rcx
movl 0x28(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa631c
movq 0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x28(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0xa62e5
movq 0x10(%rsp), %rdi
leaq 0x4d4740(%rip), %rsi    # 0x57aa68
callq 0xb9200
jmp 0xa632f
movq 0x10(%rsp), %rdi
addq $0x58, %rdi
leaq 0x4d4729(%rip), %rsi    # 0x57aa68
callq 0xb9200
jmp 0xa6346
movq 0x10(%rsp), %rax
movsd 0x8ccb5(%rip), %xmm0    # 0x133008
movsd %xmm0, 0xb0(%rax)
addq $0x48, %rsp
retq
movq 0x18(%rsp), %rdi
callq 0xb9250
movq 0x30(%rsp), %rdi
callq 0xf890
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl %esi, 0x3c(%rsp)
movl %edx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movq %rdi, %rax
movq %rax, 0x8(%rsp)
callq 0xbed00
movq 0x10(%rsp), %rdi
addq $0x58, %rdi
movq %rdi, 0x18(%rsp)
callq 0xbed00
jmp 0xa63c2
movq 0x8(%rsp), %rax
movl 0x3c(%rsp), %ecx
movl %ecx, 0xc0(%rax)
movl 0x38(%rsp), %ecx
movl %ecx, 0xc4(%rax)
movl 0x3c(%rsp), %ecx
movl %ecx, 0xc8(%rax)
movl 0xc8(%rax), %ecx
imull 0x38(%rsp), %ecx
movl %ecx, 0xcc(%rax)
cmpl $0x0, 0xcc(%rax)
jne 0xa6424
movq 0x8(%rsp), %rax
movq $0x0, 0xb8(%rax)
jmp 0xa647d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
jmp 0xa64d2
movq 0x8(%rsp), %rax
movslq 0xcc(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0xf030
movq %rax, (%rsp)
jmp 0xa6451
movq 0x8(%rsp), %rax
movq (%rsp), %rcx
movq %rcx, 0xb8(%rax)
jmp 0xa647d
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
callq 0xb9250
jmp 0xa64d2
movl $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rcx
movl 0x20(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa64bc
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x20(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0xa6485
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xa64f0
jmp 0xa64cd
addq $0x48, %rsp
retq
movq 0x10(%rsp), %rdi
callq 0xb9250
movq 0x28(%rsp), %rdi
callq 0xf890
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl %esi, 0x3c(%rsp)
movl %edx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movq %rdi, %rax
movq %rax, 0x8(%rsp)
callq 0xbed00
movq 0x10(%rsp), %rdi
addq $0x58, %rdi
movq %rdi, 0x18(%rsp)
callq 0xbed00
jmp 0xa6882
movq 0x8(%rsp), %rax
movl 0x3c(%rsp), %ecx
movl %ecx, 0xc0(%rax)
movl 0x38(%rsp), %ecx
movl %ecx, 0xc4(%rax)
movl 0x3c(%rsp), %ecx
movl %ecx, 0xc8(%rax)
movl 0xc8(%rax), %ecx
imull 0x38(%rsp), %ecx
movl %ecx, 0xcc(%rax)
cmpl $0x0, 0xcc(%rax)
jne 0xa68e4
movq 0x8(%rsp), %rax
movq $0x0, 0xb8(%rax)
jmp 0xa693d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
jmp 0xa6992
movq 0x8(%rsp), %rax
movslq 0xcc(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0xf030
movq %rax, (%rsp)
jmp 0xa6911
movq 0x8(%rsp), %rax
movq (%rsp), %rcx
movq %rcx, 0xb8(%rax)
jmp 0xa693d
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
callq 0xb9250
jmp 0xa6992
movl $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rcx
movl 0x20(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa697c
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x20(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0xa6945
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0xa69b0
jmp 0xa698d
addq $0x48, %rsp
retq
movq 0x10(%rsp), %rdi
callq 0xb9250
movq 0x28(%rsp), %rdi
callq 0xf890
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq 0x80(%rsp), %rdi
movq %rdi, (%rsp)
movq 0x78(%rsp), %rsi
addq $0x58, %rdi
callq 0xb9200
movq 0x78(%rsp), %rsi
leaq 0x20(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xb9310
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xb9200
jmp 0xa6a02
leaq 0x20(%rsp), %rdi
callq 0xb9250
movq 0x78(%rsp), %rdi
callq 0xbee10
movq (%rsp), %rax
movsd %xmm0, 0xb0(%rax)
addq $0x88, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x18(%rsp)
movl %eax, 0x14(%rsp)
leaq 0x20(%rsp), %rdi
callq 0xb9250
movq 0x18(%rsp), %rdi
callq 0xf890
nopl (%rax)
// File: 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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rcx
movl 0xc0(%rcx), %ecx
movl %ecx, 0xc0(%rax)
movq 0x18(%rsp), %rcx
movl 0xc4(%rcx), %ecx
movl %ecx, 0xc4(%rax)
movq 0x18(%rsp), %rcx
movl 0xc8(%rcx), %ecx
movl %ecx, 0xc8(%rax)
movq 0x18(%rsp), %rcx
movl 0xcc(%rcx), %ecx
movl %ecx, 0xcc(%rax)
cmpq $0x0, 0xb8(%rax)
je 0xa72a7
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0xa72a5
movq (%rsp), %rdi
callq 0xf670
jmp 0xa72a7
movq 0x8(%rsp), %rax
cmpl $0x0, 0xcc(%rax)
jne 0xa72c7
movq 0x8(%rsp), %rax
movq $0x0, 0xb8(%rax)
jmp 0xa7303
movq 0x8(%rsp), %rax
movslq 0xcc(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xf030
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xb8(%rax)
movl $0x0, 0x14(%rsp)
movq 0x8(%rsp), %rcx
movl 0x14(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa7355
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
movq 0xb8(%rcx), %rcx
movslq 0x14(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0xb8(%rax), %rax
movslq 0x14(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xa730b
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xb9200
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x58, %rsi
addq $0x58, %rdi
callq 0xb9200
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
movsd 0xb0(%rcx), %xmm0
movsd %xmm0, 0xb0(%rax)
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: 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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movsd %xmm0, 0x30(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0xcc(%rax)
jne 0xa7830
xorps %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
jmp 0xa796d
movq 0x8(%rsp), %rax
movl $0x0, 0x2c(%rsp)
movslq 0xcc(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xf030
movq %rax, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movq 0x8(%rsp), %rcx
movl 0x1c(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa78ea
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x8c60f(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa78ab
jp 0xa78ab
jmp 0xa78db
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x20(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x2c(%rsp)
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0xa78dd
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xa7872
cmpl $0x0, 0x2c(%rsp)
jne 0xa7901
movsd 0x8c5b7(%rip), %xmm0    # 0x133eb0
movsd %xmm0, 0x40(%rsp)
jmp 0xa796d
movq 0x20(%rsp), %rdi
movslq 0x2c(%rsp), %rsi
movl $0x8, %edx
leaq 0x2ce19(%rip), %rcx     # 0xd4730
callq 0xf950
movsd 0x30(%rsp), %xmm0
cvtsi2sdl 0x2c(%rsp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0xa7961
movq (%rsp), %rdi
callq 0xf670
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x40(%rsp), %xmm0
addq $0x48, %rsp
retq
nopl (%rax,%rax)
// File: 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:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x20(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x10(%rsp)
movl $0x0, -0x14(%rsp)
movq -0x20(%rsp), %rcx
movl -0x14(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa7a0a
movq -0x20(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x14(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x8c4e1(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa79d9
jp 0xa79d9
jmp 0xa79fb
movq -0x20(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x14(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x10(%rsp), %xmm0
movsd %xmm0, -0x10(%rsp)
jmp 0xa79fd
movl -0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rsp)
jmp 0xa79a0
movsd -0x10(%rsp), %xmm0
retq
nopw %cs:(%rax,%rax)
// File: 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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movq (%rsp), %rcx
movl 0x14(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa7ac7
movq (%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x14(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x8c440(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa7a7a
jp 0xa7a7a
jmp 0xa7ab5
movq (%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x14(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movsd 0x8(%rsp), %xmm2
movsd 0x18(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0xa7ab7
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xa7a43
movsd 0x18(%rsp), %xmm0
callq 0xf390
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: 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:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x18(%rsp)
movl $0x0, -0xc(%rsp)
movl $0x0, -0x10(%rsp)
movq -0x18(%rsp), %rcx
movl -0x10(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa7b77
movq -0x18(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x10(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x8c382(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa7b38
jp 0xa7b38
jmp 0xa7b68
movq -0x18(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x10(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xa7b5b
jp 0xa7b5b
jmp 0xa7b66
movl -0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rsp)
jmp 0xa7b68
jmp 0xa7b6a
movl -0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rsp)
jmp 0xa7aff
movl -0xc(%rsp), %eax
retq
nopl (%rax)
// File: 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:
movq %rdi, -0x10(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x30(%rsp)
movl $0x0, -0x14(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rsp)
movl $0x0, -0x24(%rsp)
movq -0x30(%rsp), %rcx
movl -0x24(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xa7c1d
movq -0x30(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x24(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x8c2d9(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xa7be1
jp 0xa7be1
jmp 0xa7c0e
movq -0x30(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x24(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x20(%rsp), %xmm0
movsd %xmm0, -0x20(%rsp)
movl -0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rsp)
jmp 0xa7c10
movl -0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rsp)
jmp 0xa7ba8
cmpl $0x0, -0x14(%rsp)
jne 0xa7c2f
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rsp)
jmp 0xa7c45
movsd -0x20(%rsp), %xmm0
cvtsi2sdl -0x14(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rsp)
movsd -0x8(%rsp), %xmm0
retq
nopl (%rax)