LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Dist.cpp
// Function: gaps::R2Distance(gaps::R2Point const&, gaps::R2Span const&)
RNLength R2Distance(const R2Point& point, const R2Span& span)
{
    // Check span
    if (RNIsZero(span.Length())) return R2Distance(point, span.Start());

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

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

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x48(%rsi), %xmm0
leaq 0x787bc(%rip), %r12     # 0xe5b98
movsd (%r12), %xmm1
movapd 0x34c36(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jb 0x6d419
ucomisd %xmm0, %xmm1
jb 0x6d419
addq $0x28, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x6906b
movq %r15, %rdi
jmp 0x6d4af
leaq 0x28(%rbx), %rdx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6906b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x692f6
movsd (%r12), %xmm1
xorpd 0x34bda(%rip), %xmm1    # 0xa2020
ucomisd %xmm0, %xmm1
ja 0x6d4a3
leaq 0x38(%rbx), %rdx
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6906b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x692f6
ucomisd (%r12), %xmm0
ja 0x6d4aa
movsd (%r14), %xmm1
movsd 0x8(%r14), %xmm0
mulsd 0x18(%rbx), %xmm0
mulsd 0x10(%rbx), %xmm1
addsd %xmm0, %xmm1
addsd 0x20(%rbx), %xmm1
movapd 0x34b87(%rip), %xmm0    # 0xa2020
xorpd %xmm1, %xmm0
maxsd %xmm1, %xmm0
jmp 0x6d4b4
leaq 0x8(%rsp), %rdi
jmp 0x6d4af
leaq 0x18(%rsp), %rdi
callq 0x691fe
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Dist.cpp
// Function: gaps::R2Distance(gaps::R2Point const&, gaps::R2Polyline const&)
RNLength R2Distance(const R2Point& point, const R2Polyline& polyline)
{
    // Compute distance to each segment
    // This could be a lot faster
    RNLength closest_distance = FLT_MAX;
    for (int i = 1; i < polyline.NPoints(); i++) {
        const R2Point& p0 = polyline.Point(i-1);
        const R2Point& p1 = polyline.Point(i);
        R2Span span(p0, p1);
        RNLength d = R2Distance(span, point);
        if (d < closest_distance) closest_distance = d;
    }

    // Return distance
    return closest_distance;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x60, %rsp
cmpl $0x2, 0x10(%rsi)
jl 0x6d64a
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x34a48(%rip), %xmm1    # 0xa2040
movl $0x1, %r12d
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
movsd %xmm1, 0x8(%rsp)
movq 0x8(%rbx), %rsi
leaq (%rsi,%r13), %rdx
addq $0x10, %rdx
addq %r13, %rsi
movq %r15, %rdi
callq 0x67dde
movq %r14, %rdi
movq %r15, %rsi
callq 0x6d3bf
minsd 0x8(%rsp), %xmm0
incq %r12
movslq 0x10(%rbx), %rax
addq $0x10, %r13
movapd %xmm0, %xmm1
cmpq %rax, %r12
jl 0x6d606
jmp 0x6d652
movsd 0x349ee(%rip), %xmm0    # 0xa2040
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Dist.cpp
// Function: gaps::R2Distance(gaps::R2Point const&, gaps::R2Polygon const&)
RNLength R2Distance(const R2Point& point, const R2Polygon& polygon)
{
    // Check if polygon contains point
    if (R2Contains(polygon, point)) return 0;
  
    // Compute distance to each segment
    // This could be a lot faster
    RNLength closest_distance = FLT_MAX;
    for (int i = 0; i < polygon.NPoints(); i++) {
        const R2Point& p0 = polygon.Point(i);
        const R2Point& p1 = polygon.Point((i+1)%polygon.NPoints());
        R2Span span(p0, p1);
        RNLength d = R2Distance(span, point);
        if (d < closest_distance) closest_distance = d;
    }

    // Return distance
    return closest_distance;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movq %r14, %rsi
callq 0x588f3
xorpd %xmm0, %xmm0
testl %eax, %eax
jne 0x6d6f2
movl 0x10(%rbx), %ecx
testl %ecx, %ecx
jle 0x6d6ea
movsd 0x349ab(%rip), %xmm1    # 0xa2040
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
xorl %r12d, %r12d
movsd %xmm1, 0x8(%rsp)
movq 0x8(%rbx), %rdi
leaq (%rdi,%r13), %rsi
incq %r12
movl %r12d, %eax
cltd
idivl %ecx
shlq $0x4, %rdx
addq %rdi, %rdx
movq %r15, %rdi
callq 0x67dde
movq %r14, %rdi
movq %r15, %rsi
callq 0x6d3bf
minsd 0x8(%rsp), %xmm0
movslq 0x10(%rbx), %rcx
addq $0x10, %r13
movapd %xmm0, %xmm1
cmpq %rcx, %r12
jl 0x6d6a0
jmp 0x6d6f2
movsd 0x3494e(%rip), %xmm0    # 0xa2040
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Dist.cpp
// Function: gaps::R2Distance(gaps::R2Line const&, gaps::R2Span const&)
RNLength R2Distance(const R2Line& line, const R2Span& span)
{
    // Return distance from span to line
    RNScalar d = R2SignedDistance(line, span);
    if (RNIsPositive(d)) return d;
    else if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
callq 0x6d977
leaq 0x78255(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm2
ucomisd %xmm2, %xmm0
ja 0x6d96d
xorpd 0x346cb(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jbe 0x6d971
movapd 0x346b9(%rip), %xmm1    # 0xa2020
xorpd %xmm0, %xmm1
jmp 0x6d971
movapd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Dist.cpp
// Function: gaps::R2SignedDistance(gaps::R2Line const&, gaps::R2Line const&)
RNLength R2SignedDistance(const R2Line& line1, const R2Line& line2)
{
    // Return signed distance from line to line
    RNScalar dot = line1.Vector().Dot(line2.Vector());
    if (RNIsEqual(dot, 1.0)) return (line1.C() - line2.C());
    else if (RNIsEqual(dot, -1.0)) return (line1.C() + line2.C());
    else return 0.0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x692f6
leaq 0x78114(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm2
movsd 0x345b8(%rip), %xmm3    # 0xa2048
addsd %xmm0, %xmm3
movapd 0x34584(%rip), %xmm1    # 0xa2020
xorpd %xmm2, %xmm1
ucomisd %xmm1, %xmm3
jb 0x6dab9
ucomisd %xmm3, %xmm2
jb 0x6dab9
movsd 0x20(%r14), %xmm1
subsd 0x20(%rbx), %xmm1
jmp 0x6dadc
addsd 0x34577(%rip), %xmm0    # 0xa2038
ucomisd %xmm1, %xmm0
xorpd %xmm1, %xmm1
jb 0x6dadc
ucomisd %xmm0, %xmm2
jb 0x6dadc
movsd 0x20(%r14), %xmm1
addsd 0x20(%rbx), %xmm1
movapd %xmm1, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Dist.cpp
// Function: gaps::R2SignedDistance(gaps::R2Line const&, gaps::R2Box const&)
RNLength R2SignedDistance(const R2Line& line, const R2Box& box)
{
    // Return signed distance from line to box
    RNQuadrant quadrant = line.Normal().Quadrant();
    RNScalar d1 = R2SignedDistance(line, box.Corner(~quadrant & 0x3));
    if (RNIsPositiveOrZero(d1)) return d1;
    RNScalar d2 = R2SignedDistance(line, box.Corner(quadrant));
    if (RNIsNegative(d2)) return d2;
    else return 0.0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x10, %rdi
callq 0x692cc
movl %eax, %ebp
movl %eax, %edx
notl %edx
andl $0x3, %edx
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x662b6
movsd 0x8(%r15), %xmm1
mulsd 0x18(%rbx), %xmm1
movsd (%r15), %xmm0
mulsd 0x10(%rbx), %xmm0
addsd %xmm1, %xmm0
addsd 0x20(%rbx), %xmm0
leaq 0x78031(%rip), %r12     # 0xe5b98
movsd (%r12), %xmm1
xorpd 0x344ab(%rip), %xmm1    # 0xa2020
ucomisd %xmm1, %xmm0
jae 0x6dbc4
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x662b6
movsd (%r15), %xmm1
movsd 0x8(%r15), %xmm0
mulsd 0x18(%rbx), %xmm0
mulsd 0x10(%rbx), %xmm1
addsd %xmm0, %xmm1
addsd 0x20(%rbx), %xmm1
movsd (%r12), %xmm2
xorpd 0x34469(%rip), %xmm2    # 0xa2020
movapd %xmm1, %xmm0
cmpnltsd %xmm2, %xmm0
andnpd %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Dist.cpp
// Function: gaps::R2Distance(gaps::R2Span const&, gaps::R2Halfspace const&)
RNLength R2Distance(const R2Span& span, const R2Halfspace& halfspace)
{
    // Return distance from span to halfspace
    RNScalar d = R2SignedDistance(halfspace.Line(), span);
    if (RNIsNegative(d)) return -d;
    else return 0.0;
}

// Assembly:
pushq %rax
movq %rdi, %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x6d977
leaq 0x77ec8(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm1
movapd 0x34344(%rip), %xmm2    # 0xa2020
xorpd %xmm2, %xmm1
xorpd %xmm0, %xmm2
cmpnltsd %xmm1, %xmm0
andnpd %xmm2, %xmm0
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Relate.cpp
// Function: gaps::R2InteriorAngle(gaps::R2Vector const&, gaps::R2Vector const&)
RNAngle 
R2InteriorAngle(const R2Vector& vector1, const R2Vector& vector2)
{
    // Return angle between vectors
    RNScalar d1 = vector1.Length();
    if (RNIsZero(d1)) return 0.0;
    RNScalar d2 = vector2.Length();
    if (RNIsZero(d2)) return 0.0;
    RNScalar cosine = vector1.Dot(vector2) / (d1 * d2);
    assert(RNIsGreaterOrEqual(cosine, -1.0) && RNIsLessOrEqual(cosine, 1.0));
    if (cosine >= 1.0) return 0.0;
    else if (cosine <= -1.0) return RN_PI;
    else return acos(cosine); 
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x691fe
leaq 0x77ce9(%rip), %r15     # 0xe5b98
movsd (%r15), %xmm2
movapd 0x34164(%rip), %xmm1    # 0xa2020
xorpd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
xorpd %xmm1, %xmm1
jb 0x6ded4
ucomisd %xmm0, %xmm2
jae 0x6df59
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x691fe
movsd (%r15), %xmm2
movapd 0x34131(%rip), %xmm1    # 0xa2020
xorpd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jb 0x6df05
ucomisd %xmm0, %xmm2
jb 0x6df05
xorpd %xmm1, %xmm1
jmp 0x6df59
movq %r14, %rdi
movq %rbx, %rsi
movsd %xmm0, (%rsp)
callq 0x692f6
movsd 0x8(%rsp), %xmm1
mulsd (%rsp), %xmm1
divsd %xmm1, %xmm0
ucomisd 0x3410c(%rip), %xmm0    # 0xa2038
xorpd %xmm1, %xmm1
jae 0x6df59
movsd 0x3410e(%rip), %xmm1    # 0xa2048
ucomisd %xmm0, %xmm1
jae 0x6df4e
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xe3f0
leaq 0x3c053(%rip), %rax     # 0xa9fa8
movsd (%rax), %xmm1
movapd %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Relate.cpp
// Function: gaps::R2IntersectionArea(gaps::R2Box const&, gaps::R2Box const&)
RNArea 
R2IntersectionArea(const R2Box& box1, const R2Box& box2)
{
  R2Box intersection(box1);
  intersection.Intersect(box2);
  if (intersection.IsEmpty()) return 0;
  return intersection.Area();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x65ff8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x667f4
movsd 0x18(%rsp), %xmm0
ucomisd 0x28(%rsp), %xmm0
xorpd %xmm0, %xmm0
ja 0x6dfc5
movsd 0x20(%rsp), %xmm1
ucomisd 0x30(%rsp), %xmm1
ja 0x6dfc5
leaq 0x10(%rsp), %rdi
callq 0x66530
movsd %xmm0, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x6699c
movsd 0x8(%rsp), %xmm0
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6699c
movq %rbx, %rdi
callq 0xe7e0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Relate.cpp
// Function: gaps::R2Abuts(gaps::R2Box const&, gaps::R2Box const&)
RNBoolean 
R2Abuts(const R2Box& box1, const R2Box& box2) 
{
    // Return whether box1 abuts box2
    if (!R2Intersects(box1, box2)) return FALSE;
    if (RNIsEqual(box1.XMin(), box2.XMax())) return TRUE;
    if (RNIsEqual(box1.XMax(), box2.XMin())) return TRUE;
    if (RNIsEqual(box1.YMin(), box2.YMax())) return TRUE;
    if (RNIsEqual(box1.YMax(), box2.YMin())) return TRUE;
    return FALSE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x599a0
testl %eax, %eax
je 0x6e295
movsd 0x8(%r14), %xmm2
leaq 0x7797a(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm0
subsd 0x18(%rbx), %xmm2
movapd 0x33df1(%rip), %xmm1    # 0xa2020
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
movl $0x1, %r15d
jb 0x6e245
ucomisd %xmm2, %xmm0
jae 0x6e295
movsd 0x18(%r14), %xmm2
subsd 0x8(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jb 0x6e25c
ucomisd %xmm2, %xmm0
jae 0x6e295
movsd 0x10(%r14), %xmm2
subsd 0x20(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jb 0x6e273
ucomisd %xmm2, %xmm0
jae 0x6e295
movsd 0x20(%r14), %xmm2
subsd 0x10(%rbx), %xmm2
cmplepd %xmm2, %xmm1
cmplepd %xmm0, %xmm2
andpd %xmm1, %xmm2
movd %xmm2, %r15d
andl $0x1, %r15d
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Relate.cpp
// Function: gaps::R2Splits(gaps::R2Line const&, gaps::R2Span const&)
int 
R2Splits(const R2Line& line, const R2Span& span)
{
    // This is just a simple version 

    // Classify span
    // Result values: 0 = on, 1 = below, 2 = above, 3 = crossing
    RNScalar d1 = R2SignedDistance(line, span.Start());
    RNScalar d2 = R2SignedDistance(line, span.End());
    if (RNIsNegative(d1)) {
        if (RNIsPositive(d2)) return 3;
	else return 1;
    }
    else if (RNIsPositive(d1)) {
        if (RNIsNegative(d2)) return 3;
	else return 2;
    }
    else {
        if (RNIsNegative(d2)) return 1;
        else if (RNIsPositive(d2)) return 2;
	else return 0;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x28, %rsi
callq 0x6d501
movsd %xmm0, (%rsp)
addq $0x38, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6d501
movsd (%rsp), %xmm3
leaq 0x778c7(%rip), %rax     # 0xe5b98
movsd (%rax), %xmm1
movapd 0x33d43(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
ucomisd %xmm3, %xmm2
ja 0x6e305
ucomisd %xmm1, %xmm3
ja 0x6e317
movl $0x1, %eax
ucomisd %xmm0, %xmm2
ja 0x6e323
xorl %eax, %eax
ucomisd %xmm1, %xmm0
seta %al
addl %eax, %eax
jmp 0x6e323
xorl %eax, %eax
ucomisd %xmm1, %xmm0
seta %al
leal 0x1(,%rax,2), %eax
jmp 0x6e323
xorl %eax, %eax
ucomisd %xmm0, %xmm2
setbe %al
xorl $0x3, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Align.cpp
// Function: gaps::R2Centroid(gaps::RNArray<gaps::R2Point*> const&, double const*)
R2Point 
R2Centroid(const RNArray<R2Point *>& points, const RNScalar *weights)
{
  // Compute center of mass
  R2Point centroid(0.0, 0.0);
  RNScalar total_weight = 0;
  for (int i = 0; i < points.NEntries(); i++) {
    RNScalar weight = (weights) ? weights[i] : 1;
    R2Point *point = points[i];
    centroid += *point * weight;
    total_weight += weight;
  }

  // Compute average
  if (total_weight > 0) centroid /= total_weight;

  // Return center of mass
  return centroid;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x68e2e
cmpl $0x0, 0xc(%r15)
xorpd %xmm0, %xmm0
jle 0x6e73c
xorl %r13d, %r13d
leaq 0x10(%rsp), %r12
movsd %xmm0, 0x8(%rsp)
movsd 0x3393d(%rip), %xmm0    # 0xa2038
testq %r14, %r14
je 0x6e706
movsd (%r14,%r13,8), %xmm0
movq (%r15), %rax
movq (%rax,%r13,8), %rsi
movq %r12, %rdi
movsd %xmm0, (%rsp)
callq 0x690d5
movq %rbx, %rdi
movq %r12, %rsi
callq 0x68f7c
movsd 0x8(%rsp), %xmm0
addsd (%rsp), %xmm0
incq %r13
movslq 0xc(%r15), %rax
cmpq %rax, %r13
jl 0x6e6ed
ucomisd 0x33aa4(%rip), %xmm0    # 0xa21e8
jbe 0x6e74e
movq %rbx, %rdi
callq 0x69014
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Align.cpp
// Function: gaps::R2AverageDistance(gaps::R2Point const&, gaps::RNArray<gaps::R2Point*> const&, double const*)
RNLength
R2AverageDistance(const R2Point& center, const RNArray<R2Point *>& points, const RNScalar *weights)
{
  // Compute sum of distances between a position on the surface and a center point
  RNScalar distance = 0.0;
  RNScalar total_weight = 0;
  for (int i = 0; i < points.NEntries(); i++) {
    RNScalar weight = (weights) ? weights[i] : 1;
    R2Point *point = points[i];
    distance += weight * R2Distance(*point, center);
    total_weight += weight;
  }

  // Compute average distance
  if (total_weight > 0) distance /= total_weight;

  // Return average distance
  return distance;
}

// Assembly:
cmpl $0x0, 0xc(%rsi)
xorpd %xmm3, %xmm3
xorpd %xmm2, %xmm2
jle 0x6eac4
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorpd %xmm2, %xmm2
xorl %r12d, %r12d
xorpd %xmm3, %xmm3
movapd %xmm3, 0x10(%rsp)
movapd %xmm2, 0x20(%rsp)
movsd 0x335c9(%rip), %xmm0    # 0xa2038
testq %rbx, %rbx
je 0x6ea7a
movsd (%rbx,%r12,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movq (%r14), %rax
movq (%rax,%r12,8), %rdi
movq %r15, %rsi
callq 0x6d2e7
movsd 0x8(%rsp), %xmm1
mulsd %xmm1, %xmm0
movapd 0x20(%rsp), %xmm2
addsd %xmm0, %xmm2
movapd 0x10(%rsp), %xmm3
addsd %xmm1, %xmm3
incq %r12
movslq 0xc(%r14), %rax
cmpq %rax, %r12
jl 0x6ea5b
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
movapd %xmm2, %xmm1
divsd %xmm3, %xmm1
xorpd %xmm0, %xmm0
cmpltsd %xmm3, %xmm0
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Align.cpp
// Function: gaps::R2AlignError(gaps::RNArray<gaps::R2Point*> const&, gaps::RNArray<gaps::R2Point*> const&, gaps::R3Matrix const&, double const*)
RNScalar 
R2AlignError(const RNArray<R2Point *>& points1, const RNArray<R2Point *>& points2, 
  const R3Matrix& matrix, const RNScalar* weights)
{
  // Get number of points
  int count = points1.NEntries();
  if (points2.NEntries() < count) count = points2.NEntries();
  if (count == 0) return -1;

  // Compute sum of squared distances
  RNScalar ssd = 0;
  RNScalar total_weight = 0;
  for (int i = 0; i < count; i++) {
    RNScalar weight = (weights) ? weights[i] : 1;
    R2Point *point1 = points1[i];
    R2Point point2 = *(points2[i]);
    point2 = matrix * point2;
    R2Vector v = *point1 - point2;
    ssd += weight * v.Dot(v);
    total_weight += weight;
  }

  // Return RMSD
  if (total_weight == 0) return -1;
  else return sqrt(ssd / total_weight);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %rbx
movq %rdx, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
movl 0xc(%rdi), %eax
movq %rsi, 0x10(%rsp)
movl 0xc(%rsi), %ecx
cmpl %eax, %ecx
cmovll %ecx, %eax
movsd 0x332b9(%rip), %xmm0    # 0xa2048
testl %eax, %eax
je 0x6ee8c
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
jle 0x6ee58
movl %eax, %r15d
xorl %r12d, %r12d
leaq 0x48(%rsp), %r13
leaq 0x38(%rsp), %rbp
movsd %xmm2, 0x28(%rsp)
movsd %xmm1, 0x30(%rsp)
movsd 0x3326f(%rip), %xmm0    # 0xa2038
testq %rbx, %rbx
je 0x6edd4
movsd (%rbx,%r12,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %r14
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %rsi
movq %r13, %rdi
callq 0x68e38
movq %rbp, %rdi
movq 0x18(%rsp), %rsi
movq %r13, %rdx
callq 0x67c20
movq %r13, %rdi
movq %rbp, %rsi
callq 0x68f66
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x6906b
movq %rbp, %rdi
movq %rbp, %rsi
callq 0x692f6
movsd 0x20(%rsp), %xmm3
mulsd %xmm3, %xmm0
movsd 0x30(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd 0x28(%rsp), %xmm2
addsd %xmm3, %xmm2
incq %r12
cmpq %r12, %r15
jne 0x6edb5
ucomisd 0x33388(%rip), %xmm2    # 0xa21e8
movsd 0x331e0(%rip), %xmm0    # 0xa2048
jne 0x6ee6c
jnp 0x6ee8c
divsd %xmm2, %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0x6ee83
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0x6ee8c
movapd %xmm1, %xmm0
callq 0xe340
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Arc.cpp
// Function: gaps::R2Arc::R2Arc(gaps::R2Point const&, double, double, double)
R2Arc::
R2Arc(const R2Point& center, RNLength radius, RNAngle theta1, RNAngle theta2)
    : circle(center, radius),
      start(theta1),
      stop(theta2)
{
    // Needed because don't know if RN_TWO_PI is initialized
    RNScalar TWO_PI = 2.0 * 3.14159265358979323846;
    while (start >= TWO_PI) start -= TWO_PI;
    while (start < 0.0) start += TWO_PI;
    while (stop >= (start + TWO_PI)) stop -= TWO_PI;
    while (stop < start) stop += TWO_PI;
    assert((0.0 <= start) && (start <= TWO_PI));
    assert((start <= stop) && (stop <= (start + TWO_PI)));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movsd %xmm2, (%rsp)
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
callq 0x6fd30
leaq 0x74e7e(%rip), %rax     # 0xe4698
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
movq %r14, %rsi
movsd 0x10(%rsp), %xmm0
callq 0x6fe70
movsd 0x8(%rsp), %xmm2
movsd %xmm2, 0x28(%rbx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rbx)
ucomisd 0x3a68c(%rip), %xmm2    # 0xa9ed8
jb 0x6f86d
movsd 0x3a68a(%rip), %xmm0    # 0xa9ee0
movsd 0x3a67a(%rip), %xmm1    # 0xa9ed8
addsd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
jae 0x6f85e
movsd %xmm2, 0x28(%rbx)
movsd 0x28(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x6f893
movsd 0x3a654(%rip), %xmm2    # 0xa9ed8
addsd %xmm2, %xmm0
ucomisd %xmm0, %xmm1
ja 0x6f884
movsd %xmm0, 0x28(%rbx)
movsd 0x3a63d(%rip), %xmm1    # 0xa9ed8
addsd %xmm0, %xmm1
movsd 0x30(%rbx), %xmm2
ucomisd %xmm1, %xmm2
jb 0x6f8c1
movsd 0x3a62e(%rip), %xmm3    # 0xa9ee0
addsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
jae 0x6f8b2
movsd %xmm2, 0x30(%rbx)
movsd 0x30(%rbx), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x6f8e3
movsd 0x3a604(%rip), %xmm2    # 0xa9ed8
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
ja 0x6f8d4
movsd %xmm1, 0x30(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x6fd3c
movq %r14, %rdi
callq 0xe7e0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Arc.cpp
// Function: gaps::R2Arc::BBox() const
const R2Box R2Arc::
BBox(void) const
{
    // Return bounding box of arc ???
    R2Box bbox(R2null_box);
    bbox.Union(StartPoint());
    bbox.Union(StopPoint());
    if ((start < 0.0) && (stop > 0.0)) bbox.Union(Center() + R2posx_point * Radius());
    if ((start < RN_PI_OVER_TWO) && (stop > RN_PI_OVER_TWO)) bbox.Union(Center() + R2posy_point * Radius());
    if ((start < RN_PI) && (stop > RN_PI)) bbox.Union(Center() + R2negx_point * Radius());
    if ((start < RN_THREE_PI_OVER_TWO) && (stop > RN_THREE_PI_OVER_TWO)) bbox.Union(Center() + R2negy_point * Radius());
    return bbox;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4784ec(%rip), %rsi    # 0x4e7ed8
callq 0x65ff8
movsd 0x28(%r14), %xmm0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x6f936
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x66714
movsd 0x30(%r14), %xmm0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x6f936
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x66714
xorpd %xmm0, %xmm0
ucomisd 0x28(%r14), %xmm0
jbe 0x6fa80
movsd 0x30(%r14), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x6fa80
movsd 0x20(%r14), %xmm0
leaq 0x47884a(%rip), %rsi    # 0x4e82a0
leaq 0x18(%rsp), %rdi
callq 0x690d5
leaq 0x10(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x69043
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x66714
leaq 0x3a531(%rip), %rax     # 0xa9fb8
movsd (%rax), %xmm0
ucomisd 0x28(%r14), %xmm0
jbe 0x6fad6
movsd 0x30(%r14), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x6fad6
movsd 0x20(%r14), %xmm0
leaq 0x478804(%rip), %rsi    # 0x4e82b0
leaq 0x18(%rsp), %rdi
callq 0x690d5
leaq 0x10(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x69043
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x66714
leaq 0x3a4cb(%rip), %rax     # 0xa9fa8
movsd (%rax), %xmm0
ucomisd 0x28(%r14), %xmm0
jbe 0x6fb2c
movsd 0x30(%r14), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x6fb2c
movsd 0x20(%r14), %xmm0
leaq 0x4787be(%rip), %rsi    # 0x4e82c0
leaq 0x18(%rsp), %rdi
callq 0x690d5
leaq 0x10(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x69043
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x66714
leaq 0x3a48d(%rip), %rax     # 0xa9fc0
movsd (%rax), %xmm0
ucomisd 0x28(%r14), %xmm0
jbe 0x6fb85
movsd 0x30(%r14), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x6fb85
movsd 0x20(%r14), %xmm0
leaq 0x478778(%rip), %rsi    # 0x4e82d0
leaq 0x18(%rsp), %rdi
callq 0x690d5
addq $0x10, %r14
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r14, %rsi
callq 0x69043
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x66714
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
jmp 0x6fb9a
jmp 0x6fb9a
jmp 0x6fb9a
jmp 0x6fb9a
jmp 0x6fb9a
movq %rax, %r14
movq %rbx, %rdi
callq 0x6699c
movq %r14, %rdi
callq 0xe7e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Arc.cpp
// Function: gaps::R2Arc::SetStartAngle(double)
void R2Arc::
SetStartAngle(RNAngle theta)
{
    // Set arc start angle
    start = theta;
    while (start >= RN_TWO_PI) start -= RN_TWO_PI;
    while (start < 0.0) start += RN_TWO_PI;
    while (stop >= (start + RN_TWO_PI)) { stop -= RN_TWO_PI; }
    while (stop < start) { stop += RN_TWO_PI; }
    assert((0.0 <= start) && (start <= RN_TWO_PI));
    assert((start <= stop) && (stop <= (start + RN_TWO_PI)));
}

// Assembly:
leaq 0x3a3b5(%rip), %rax     # 0xa9fc8
movsd (%rax), %xmm1
ucomisd %xmm1, %xmm0
jb 0x6fc23
subsd %xmm1, %xmm0
jmp 0x6fc17
movsd %xmm0, 0x28(%rdi)
xorpd %xmm2, %xmm2
ucomisd %xmm0, %xmm2
jbe 0x6fc41
addsd %xmm1, %xmm0
ucomisd %xmm0, %xmm2
ja 0x6fc32
movsd %xmm0, 0x28(%rdi)
movapd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd 0x30(%rdi), %xmm3
ucomisd %xmm2, %xmm3
jb 0x6fc63
subsd %xmm1, %xmm3
ucomisd %xmm2, %xmm3
jae 0x6fc54
movsd %xmm3, 0x30(%rdi)
movsd 0x30(%rdi), %xmm2
ucomisd %xmm2, %xmm0
jbe 0x6fc7d
addsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
ja 0x6fc6e
movsd %xmm2, 0x30(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Circle.cpp
// Function: gaps::R2InitCircle()
int 
R2InitCircle()
{
    // Initialize circle angles and points 
    for (int i = 0; i < R2circle_npoints; i++) {
        R2circle_angles[i] = ((RNScalar) i * RN_TWO_PI) / (RNScalar) R2circle_npoints;
        R2circle_points[i] = R2Point(cos(R2circle_angles[i]), sin(R2circle_angles[i]));
    }

    /* Return success */
    return TRUE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x3a26e(%rip), %rax     # 0xa9fc8
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x478785(%rip), %rbx    # 0x4e84f0
leaq 0x47867e(%rip), %r15    # 0x4e83f0
xorl %r12d, %r12d
leaq 0x18(%rsp), %r14
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
mulsd 0x8(%rsp), %xmm0
mulsd 0x39378(%rip), %xmm0    # 0xa9108
movsd %xmm0, (%r15)
callq 0xe860
movsd %xmm0, 0x10(%rsp)
movsd (%r15), %xmm0
callq 0xe0f0
movaps %xmm0, %xmm1
movq %r14, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x68e2e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x68f66
incq %r12
addq $0x10, %rbx
addq $0x8, %r15
cmpq $0x20, %r12
jne 0x6fd7a
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Circle.cpp
// Function: gaps::R2Circle::Transform(gaps::R2Transformation const&)
void R2Circle::
Transform (const R2Transformation& transformation)
{
    // Transform center 
    center.Transform(transformation);

    // Scale radius 
    if (!transformation.IsIsotropic()) RNWarning("Circle transformed by anisotropic transformation");
    R2Vector v(R2ones_vector);
    v.Transform(transformation);
    radius *= v.Length() / RN_SQRT_TWO;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rdi
callq 0x68f42
movq (%r14), %rax
movq %r14, %rdi
callq *0x28(%rax)
testl %eax, %eax
jne 0x6ffe3
leaq 0x39152(%rip), %rdi     # 0xa912e
xorl %eax, %eax
callq 0x72ad9
leaq 0x39a3e(%rip), %rsi     # 0xa9a28
movq %rsp, %r15
movq %r15, %rdi
callq 0x69164
movq %r15, %rdi
movq %r14, %rsi
callq 0x6957a
movq %r15, %rdi
callq 0x691fe
leaq 0x39fc9(%rip), %rax     # 0xa9fd8
divsd (%rax), %xmm0
mulsd 0x18(%rbx), %xmm0
movsd %xmm0, 0x18(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNGrfx.cpp
// Function: gaps::DecodePickColor(unsigned char*, unsigned int*, unsigned char*)
void
DecodePickColor(unsigned char color[4], unsigned int *index, unsigned char *alpha)
{
  // Unpack index (and then subtract one)
  unsigned int k = 0;
  k |= color[0] << 0;
  k |= color[1] << 8;
  k |= color[2] << 16;
  if (alpha) *alpha = color[4];
  if (index) *index = k - 1;
}

// Assembly:
movzwl (%rdi), %eax
movzbl 0x2(%rdi), %ecx
testq %rdx, %rdx
je 0x7019b
movb 0x4(%rdi), %dil
movb %dil, (%rdx)
testq %rsi, %rsi
je 0x701a9
shll $0x10, %ecx
orl %ecx, %eax
decl %eax
movl %eax, (%rsi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNGrfx.cpp
// Function: gaps::R2SetViewport(int, int, int, int)
void 
R2SetViewport(int xmin, int ymin, int xmax, int ymax)
{
    /* Update viewport */
    RNgrfx_viewport_xmin = xmin;
    RNgrfx_viewport_ymin = ymin;
    RNgrfx_viewport_xmax = xmax;
    RNgrfx_viewport_ymax = ymax;
    RNgrfx_viewport_xcenter = (RNgrfx_viewport_xmax + RNgrfx_viewport_xmin) / 2;
    RNgrfx_viewport_ycenter = (RNgrfx_viewport_ymax + RNgrfx_viewport_ymin) / 2;
    RNgrfx_viewport_width = RNgrfx_viewport_xmax - RNgrfx_viewport_xmin;
    RNgrfx_viewport_height = RNgrfx_viewport_ymax - RNgrfx_viewport_ymin;

    /* Update scale */
    RNgrfx_window_xscale = RNgrfx_viewport_width / RNgrfx_window_width;
    RNgrfx_window_yscale = RNgrfx_viewport_height / RNgrfx_window_height;
}

// Assembly:
movl %edi, 0x478548(%rip)    # 0x4e86f8
movl %esi, 0x478546(%rip)    # 0x4e86fc
movl %edx, 0x75908(%rip)     # 0xe5ac4
movl %ecx, 0x75906(%rip)     # 0xe5ac8
leal (%rdx,%rdi), %eax
movl %eax, %r8d
shrl $0x1f, %r8d
addl %eax, %r8d
sarl %r8d
movl %r8d, 0x758e3(%rip)     # 0xe5abc
leal (%rcx,%rsi), %eax
movl %eax, %r8d
shrl $0x1f, %r8d
addl %eax, %r8d
sarl %r8d
movl %r8d, 0x758d0(%rip)     # 0xe5ac0
subl %edi, %edx
cvtsi2ss %edx, %xmm0
movl %edx, 0x758b8(%rip)     # 0xe5ab4
subl %esi, %ecx
divss 0x75896(%rip), %xmm0    # 0xe5a9c
movss %xmm0, 0x75886(%rip)    # 0xe5a94
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movl %ecx, 0x7589d(%rip)     # 0xe5ab8
divss 0x7587d(%rip), %xmm0    # 0xe5aa0
movss %xmm0, 0x7586d(%rip)    # 0xe5a98
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNGrfx.cpp
// Function: gaps::R2SetWindow(float, float, float, float)
void 
R2SetWindow(float xmin, float ymin, float xmax, float ymax)
{
    /* Update window */
    RNgrfx_window_xmin = xmin;
    RNgrfx_window_ymin = ymin;
    RNgrfx_window_xmax = xmax;
    RNgrfx_window_ymax = ymax;
    RNgrfx_window_xcenter = (RNgrfx_window_xmax + RNgrfx_window_xmin) / 2.0;
    RNgrfx_window_ycenter = (RNgrfx_window_ymax + RNgrfx_window_ymin) / 2.0;
    RNgrfx_window_width = RNgrfx_window_xmax - RNgrfx_window_xmin;
    RNgrfx_window_height = RNgrfx_window_ymax - RNgrfx_window_ymin;

    /* Update scale */
    RNgrfx_window_xscale = RNgrfx_viewport_width / RNgrfx_window_width;
    RNgrfx_window_yscale = RNgrfx_viewport_height / RNgrfx_window_height;
}

// Assembly:
movss %xmm0, 0x4784bc(%rip)   # 0x4e86f0
movss %xmm1, 0x4784b8(%rip)   # 0x4e86f4
movss %xmm2, 0x75868(%rip)    # 0xe5aac
movss %xmm3, 0x75864(%rip)    # 0xe5ab0
movaps %xmm0, %xmm4
addss %xmm2, %xmm4
movss 0x39cfd(%rip), %xmm5    # 0xa9f58
mulss %xmm5, %xmm4
movss %xmm4, 0x7583d(%rip)    # 0xe5aa4
movaps %xmm1, %xmm4
addss %xmm3, %xmm4
mulss %xmm5, %xmm4
movss %xmm4, 0x7582e(%rip)    # 0xe5aa8
subss %xmm0, %xmm2
movss %xmm2, 0x75816(%rip)    # 0xe5a9c
subss %xmm1, %xmm3
xorps %xmm0, %xmm0
cvtsi2ssl 0x7581f(%rip), %xmm0 # 0xe5ab4
movss %xmm3, 0x75803(%rip)    # 0xe5aa0
xorps %xmm1, %xmm1
cvtsi2ssl 0x75810(%rip), %xmm1 # 0xe5ab8
divss %xmm2, %xmm0
movss %xmm0, 0x757e0(%rip)    # 0xe5a94
divss %xmm3, %xmm1
movss %xmm1, 0x757d8(%rip)    # 0xe5a98
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNGrfx.cpp
// Function: gaps::R2ScaleWindow(float, float)
void 
R2ScaleWindow(float xscale, float yscale)
{
    /* Update window */
    RNgrfx_window_xmin = RNgrfx_window_xcenter - 0.5 * xscale * RNgrfx_window_width;
    RNgrfx_window_ymin = RNgrfx_window_ycenter - 0.5 * yscale * RNgrfx_window_height;
    RNgrfx_window_xmax = RNgrfx_window_xcenter + 0.5 * xscale * RNgrfx_window_width;
    RNgrfx_window_ymax = RNgrfx_window_ycenter + 0.5 * yscale * RNgrfx_window_height;
    RNgrfx_window_width = RNgrfx_window_xmax - RNgrfx_window_xmin;
    RNgrfx_window_height = RNgrfx_window_ymax - RNgrfx_window_ymin;

    /* Update scale */
    RNgrfx_window_xscale = RNgrfx_viewport_width / RNgrfx_window_width;
    RNgrfx_window_yscale = RNgrfx_viewport_height / RNgrfx_window_height;
}

// Assembly:
cvtss2sd 0x757db(%rip), %xmm3    # 0xe5aa4
cvtss2sd %xmm0, %xmm0
movsd 0x31d5b(%rip), %xmm4    # 0xa2030
mulsd %xmm4, %xmm0
cvtss2sd 0x757bb(%rip), %xmm5    # 0xe5a9c
movapd 0x31d37(%rip), %xmm6    # 0xa2020
movapd %xmm0, %xmm7
xorpd %xmm6, %xmm7
cvtss2sd 0x757af(%rip), %xmm2    # 0xe5aa8
cvtss2sd %xmm1, %xmm1
mulsd %xmm4, %xmm1
xorps %xmm4, %xmm4
cvtss2sd 0x75794(%rip), %xmm4    # 0xe5aa0
xorpd %xmm1, %xmm6
unpcklpd %xmm7, %xmm0            # xmm0 = xmm0[0],xmm7[0]
movlhps %xmm5, %xmm5            # xmm5 = xmm5[0,0]
mulpd %xmm0, %xmm5
movlhps %xmm3, %xmm3            # xmm3 = xmm3[0,0]
addpd %xmm5, %xmm3
cvtpd2ps %xmm3, %xmm0
movapd %xmm0, %xmm3
shufps $0x55, %xmm0, %xmm3     # xmm3 = xmm3[1,1],xmm0[1,1]
movss %xmm3, 0x4783ba(%rip)   # 0x4e86f0
movss %xmm0, 0x7576e(%rip)    # 0xe5aac
unpcklpd %xmm6, %xmm1            # xmm1 = xmm1[0],xmm6[0]
movlhps %xmm4, %xmm4            # xmm4 = xmm4[0,0]
mulpd %xmm1, %xmm4
movlhps %xmm2, %xmm2            # xmm2 = xmm2[0,0]
addpd %xmm4, %xmm2
cvtpd2ps %xmm2, %xmm1
movapd %xmm1, %xmm2
shufps $0x55, %xmm1, %xmm2     # xmm2 = xmm2[1,1],xmm1[1,1]
movss %xmm2, 0x478390(%rip)   # 0x4e86f4
movss %xmm1, 0x75744(%rip)    # 0xe5ab0
subss %xmm3, %xmm0
movss %xmm0, 0x75724(%rip)    # 0xe5a9c
subss %xmm2, %xmm1
xorps %xmm2, %xmm2
cvtsi2ssl 0x7572d(%rip), %xmm2 # 0xe5ab4
movss %xmm1, 0x75711(%rip)    # 0xe5aa0
xorps %xmm3, %xmm3
cvtsi2ssl 0x7571e(%rip), %xmm3 # 0xe5ab8
divss %xmm0, %xmm2
movss %xmm2, 0x756ee(%rip)    # 0xe5a94
divss %xmm1, %xmm3
movss %xmm3, 0x756e6(%rip)    # 0xe5a98
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNGrfx.cpp
// Function: gaps::R2TranslateWindow(float, float)
void 
R2TranslateWindow(float xtranslate, float ytranslate)
{
    /* Update window */
    RNgrfx_window_xmin += xtranslate;
    RNgrfx_window_ymin += ytranslate;
    RNgrfx_window_xmax += xtranslate;
    RNgrfx_window_ymax += ytranslate;
    RNgrfx_window_xcenter = (RNgrfx_window_xmax + RNgrfx_window_xmin) / 2.0;
    RNgrfx_window_ycenter = (RNgrfx_window_ymax + RNgrfx_window_ymin) / 2.0;
}

// Assembly:
movss 0x478335(%rip), %xmm2   # 0x4e86f0
addss %xmm0, %xmm2
movss %xmm2, 0x478329(%rip)   # 0x4e86f0
movss 0x478325(%rip), %xmm3   # 0x4e86f4
addss %xmm1, %xmm3
addss 0x756d1(%rip), %xmm0    # 0xe5aac
movss %xmm3, 0x478311(%rip)   # 0x4e86f4
movss %xmm0, 0x756c1(%rip)    # 0xe5aac
addss 0x756bd(%rip), %xmm1    # 0xe5ab0
movss %xmm1, 0x756b5(%rip)    # 0xe5ab0
addss %xmm2, %xmm0
movss 0x39b51(%rip), %xmm2    # 0xa9f58
mulss %xmm2, %xmm0
movss %xmm0, 0x75691(%rip)    # 0xe5aa4
addss %xmm3, %xmm1
mulss %xmm2, %xmm1
movss %xmm1, 0x75685(%rip)    # 0xe5aa8
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::operator=(gaps::RNVArray const&)
RNVArray& RNVArray::
operator=(const RNVArray& array)
{
    // Empty array
    Empty();

    // Copy array of entries
    if (array.nentries > 0) {
	// Allocate memory for entries
	Resize(array.nentries);
	
	// Copy entries from array
	for (int i = 0; i < array.nentries; i++) 
            entries[i] = array.entries[i];

	// Update number of entries
	nentries = array.nentries;
    }

    // Return array
    return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0xc(%rdi)
jle 0x70617
movl $0x0, 0xc(%rbx)
movl 0xc(%r14), %esi
testl %esi, %esi
jle 0x7064b
movq %rbx, %rdi
callq 0x706e0
movslq 0xc(%r14), %rax
testq %rax, %rax
jle 0x70648
xorl %ecx, %ecx
movq (%r14), %rdx
movq (%rdx,%rcx,8), %rdx
movq (%rbx), %rsi
movq %rdx, (%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x70632
movl %eax, 0xc(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::InternalInsert(void*, int)
RNArrayEntry *RNVArray::
InternalInsert(void *data, int k)
{
    // Make sure there is enough storage for new entry
    Resize(nentries+1);

    // Increment number of entries
    nentries++;

    // Shift entries up one notch 
    if (k < (nentries-1)) Shift(k, 0, 1);

    // Copy data into kth entry
    entries[k] = data;

    // Return entry
    return &entries[k];
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl 0xc(%rdi), %esi
incl %esi
callq 0x706e0
movslq 0xc(%rbx), %rcx
leal 0x1(%rcx), %eax
movl %eax, 0xc(%rbx)
movl %ecx, %eax
subl %ebp, %eax
setle %dl
testl %eax, %eax
setle %al
orb %dl, %al
movslq %ebp, %rax
jne 0x706cd
movq (%rbx), %rdx
movq -0x8(%rdx,%rcx,8), %rsi
movq %rsi, (%rdx,%rcx,8)
leaq -0x1(%rcx), %rdx
movq %rdx, %rcx
cmpq %rax, %rdx
jg 0x706b5
movq (%rbx), %rcx
movq %r14, (%rcx,%rax,8)
shlq $0x3, %rax
addq (%rbx), %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::Resize(int)
void RNVArray::
Resize(int length)
{
    // Check if length is valid
    assert(length >= nentries);
    assert(nentries <= nallocated);

    // Check if are growing array
    if (length > nallocated) {
	// Adjust length to be next greater power of 2
	int tmplength = RN_ARRAY_MIN_ALLOCATED;
	while (tmplength < length) tmplength *= 2;
	length = tmplength;

	// Allocate new entries
	RNArrayEntry *newentries = NULL;
	if (length > 0) {
	    newentries = (RNArrayEntry *) malloc(length * sizeof(RNArrayEntry));
	    assert(newentries);
	}

	// Copy old entries into new entries
	if (nentries > 0) {
	    assert(entries);
	    assert(newentries);
	    for (int i = 0; i < nentries; i++)
                newentries[i] = entries[i];
	}
 
	// Zero remaining new entries
	if (nentries < length) {
	    assert(newentries);
	    for (int i = nentries; i < length; i++)
                newentries[i] = NULL;
	}

	// Replace entries
	if (entries) free(entries);
	entries = newentries;

	// Update nallocated
	nallocated = length;
    }
}

// Assembly:
cmpl %esi, 0x8(%rdi)
jge 0x70761
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x1, %eax
movl %eax, %r15d
leal (%r15,%r15), %eax
cmpl %esi, %r15d
jl 0x706f2
movl %r15d, %edi
shlq $0x3, %rdi
callq 0xe5e0
movq %rax, %r14
movslq 0xc(%rbx), %rax
testq %rax, %rax
jle 0x7072b
movq (%rbx), %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movq %rsi, (%r14,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x7071b
cmpl %r15d, %eax
jge 0x70748
leaq (%r14,%rax,8), %rdi
notl %eax
addl %r15d, %eax
leaq 0x8(,%rax,8), %rdx
xorl %esi, %esi
callq 0xe260
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x70755
callq 0xe540
movq %r14, (%rbx)
movl %r15d, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::Shift(int, int, int)
void RNVArray::
Shift(int start, int length, int delta)
{
    /* Compute number of entries to shift */
    if ((delta < 0) && (start < -delta)) start = -delta;
    int nshift = nentries - start;
    if (delta > 0) nshift -= delta;
    if (nshift <= 0) return;
    if ((length > 0) && (length < nshift)) nshift = length;

    /* Shift array entries */
    if (delta < 0) {
        for (int i = start; i < (start + nshift); i++) {
	    entries[i+delta]=entries[i];
	}
    }
    else if (delta > 0) {
        for (int i = (start + nshift - 1); i >= start; i--) {
	    entries[i+delta]=entries[i];
	}
    }
}

// Assembly:
movl %ecx, %eax
negl %eax
cmpl %esi, %eax
cmovlel %esi, %eax
xorl %r9d, %r9d
testl %ecx, %ecx
cmovnsl %esi, %eax
cmovgl %ecx, %r9d
movl 0xc(%rdi), %r8d
addl %eax, %r9d
subl %r9d, %r8d
testl %r8d, %r8d
jle 0x707f4
cmpl %edx, %r8d
movl %edx, %esi
cmovll %r8d, %esi
testl %edx, %edx
cmovlel %r8d, %esi
testl %ecx, %ecx
js 0x707cb
jle 0x707f4
testl %esi, %esi
jle 0x707f4
addl %eax, %esi
movslq %esi, %rdx
movl %ecx, %ecx
cltq
shlq $0x3, %rcx
movq (%rdi), %rsi
leaq (%rsi,%rdx,8), %r8
movq -0x8(%rsi,%rdx,8), %rsi
leaq -0x1(%rdx), %r9
movq %rsi, -0x8(%rcx,%r8)
movq %r9, %rdx
cmpq %rax, %r9
jg 0x707ac
jmp 0x707f4
testl %esi, %esi
jle 0x707f4
addl %eax, %esi
cltq
movslq %ecx, %rcx
movslq %esi, %rdx
shlq $0x3, %rcx
movq (%rdi), %rsi
leaq (%rsi,%rax,8), %r8
movq (%rsi,%rax,8), %rsi
movq %rsi, (%rcx,%r8)
incq %rax
cmpq %rdx, %rax
jl 0x707dd
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::InternalRemove(int)
void RNVArray::
InternalRemove(int k) 
{
    // Shift entries down one notch
    if (k < (nentries-1)) Shift(k+1, 0, -1);

    // Decrement number of entries
    nentries--;
}

// Assembly:
movslq 0xc(%rdi), %rax
leal -0x1(%rax), %ecx
cmpl %esi, %ecx
jle 0x70828
xorl %edx, %edx
testl %esi, %esi
cmovgl %esi, %edx
incl %edx
movl %eax, %esi
subl %edx, %esi
testl %esi, %esi
jle 0x70828
movl %edx, %edx
movq (%rdi), %rsi
movq (%rsi,%rdx,8), %r8
movq %r8, -0x8(%rsi,%rdx,8)
incq %rdx
cmpq %rax, %rdx
jl 0x70814
movl %ecx, 0xc(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::Empty(int)
void RNVArray::
Empty(RNBoolean deallocate)
{
    // Remove all entries from array
    Truncate(0);

    // Deallocate memory
    if (deallocate) {
        if (entries) delete entries;
        entries = NULL;
        nallocated = 0;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0xc(%rdi)
jle 0x7083d
movl $0x0, 0xc(%rbx)
testl %esi, %esi
je 0x70861
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x70853
movl $0x8, %esi
callq 0xe450
movq $0x0, (%rbx)
movl $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::Reverse(int, int)
void RNVArray::
Reverse(int start, int length)
{
    /* Compute number of entries to reverse */
    int nreverse = nentries - start;
    if (nreverse <= 0) return;
    if ((length > 0) && (length < nreverse)) nreverse = length;
    if (nreverse <= 0) return;

    // Reverse length at start
    int i, j;
    for (i = start, j = start + nreverse - 1; i < j; i++, j--) {
        Swap(i, j);
    }
}

// Assembly:
movl 0xc(%rdi), %eax
subl %esi, %eax
jle 0x708fd
cmpl %edx, %eax
movl %edx, %ecx
cmovll %eax, %ecx
testl %edx, %edx
cmovlel %eax, %ecx
leal (%rcx,%rsi), %eax
decl %eax
cmpl %esi, %eax
jle 0x708fd
cltq
movslq %esi, %rcx
decq %rax
movq (%rdi), %rdx
movq (%rdx,%rcx,8), %rsi
movq 0x8(%rdx,%rax,8), %r8
movq %r8, (%rdx,%rcx,8)
movq (%rdi), %rdx
movq %rsi, 0x8(%rdx,%rax,8)
incq %rcx
leaq -0x1(%rax), %rdx
cmpq %rax, %rcx
movq %rdx, %rax
jl 0x708d6
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::Append(gaps::RNVArray const&)
void RNVArray::
Append(const RNVArray& array)
{
    // Resize first
    Resize(NEntries() + array.NEntries());

    // Insert entries of array
    for (int i = 0; i < array.NEntries(); i++)
	Insert(array.Kth(i));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0xc(%rsi), %esi
addl 0xc(%rdi), %esi
callq 0x706e0
cmpl $0x0, 0xc(%rbx)
jle 0x7095a
xorl %r15d, %r15d
movq (%rbx), %rax
movq (%rax,%r15,8), %rsi
movl 0xc(%r14), %edx
movq %r14, %rdi
callq 0x70682
incq %r15
movslq 0xc(%rbx), %rax
cmpq %rax, %r15
jl 0x7093b
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNArray.cpp
// Function: gaps::RNVArray::BubbleSort(int (*)(void*, void*, void*), void*)
void RNVArray::
BubbleSort(int (*compare)(void *data1, void *data2, void *appl), void *appl)
{
    // Sort vector entries
    for (int i = 0; i < NEntries(); i++) {
	for (int j = i+1; j < NEntries(); j++) {
	    if ((*compare)(entries[j], entries[i], appl) < 0) {
	        Swap(i, j);
	    }
	}
    }
}

// Assembly:
cmpl $0x0, 0xc(%rdi)
jle 0x70a04
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %r13d
xorl %ebp, %ebp
leaq 0x1(%rbp), %rcx
movslq 0xc(%r15), %rax
movq %rcx, (%rsp)
cmpq %rax, %rcx
jge 0x709e6
movq %r13, %r12
movq (%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rax,%rbp,8), %rsi
movq %rbx, %rdx
callq *%r14
testl %eax, %eax
jns 0x709dd
movq (%r15), %rax
movq (%rax,%rbp,8), %rcx
movq (%rax,%r12,8), %rdx
movq %rdx, (%rax,%rbp,8)
movq (%r15), %rax
movq %rcx, (%rax,%r12,8)
incq %r12
cmpl %r12d, 0xc(%r15)
jg 0x709b2
movslq 0xc(%r15), %rax
incq %r13
movq (%rsp), %rbp
cmpq %rax, %rbp
jl 0x7099e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNSvd.cpp
// Function: gaps::rotate_cols(int, int, double, double, double*, int, int, int, int)
void rotate_cols(int i,int j,RNScalar cos,RNScalar sin,RNScalar* a,int start,int n,int mm,int nn)
{
    int end = start+n, k;
    RNScalar x,y;
    for (k=start; k<end; k++) {
	x = REF2D(a,mm,nn,k,i);
	y = REF2D(a,mm,nn,k,j);
	REF2D(a,mm,nn,k,i) =  cos*x + sin*y;
	REF2D(a,mm,nn,k,j) = -sin*x + cos*y;
    }
}

// Assembly:
testl %r8d, %r8d
jle 0x710d9
addl %ecx, %r8d
movapd 0x30faa(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
movslq %ecx, %rax
movslq 0x8(%rsp), %rcx
movslq %edi, %rdi
movslq %esi, %rsi
movslq %r8d, %r8
movq %rcx, %r9
imulq %rax, %r9
leaq (%rdx,%r9,8), %rdx
shlq $0x3, %rcx
movsd (%rdx,%rdi,8), %xmm3
movsd (%rdx,%rsi,8), %xmm4
movapd %xmm4, %xmm5
mulsd %xmm1, %xmm5
movapd %xmm0, %xmm6
mulsd %xmm3, %xmm6
addsd %xmm5, %xmm6
movsd %xmm6, (%rdx,%rdi,8)
mulsd %xmm0, %xmm4
mulsd %xmm2, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rdx,%rsi,8)
incq %rax
addq %rcx, %rdx
cmpq %r8, %rax
jl 0x7109a
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/RNSvd.cpp
// Function: gaps::rotate_rows(int, int, double, double, double*, int, int, int, int)
void rotate_rows(int i,int j, RNScalar cos,RNScalar sin,RNScalar* a,int start,int n,int mm,int nn)
{
    int end = start+n, k;
    RNScalar x,y;
    for (k=start; k<end; k++) {
	x = REF2D(a,mm,nn,i,k);
	y = REF2D(a,mm,nn,j,k);
	REF2D(a,mm,nn,i,k) =  cos*x + sin*y;
	REF2D(a,mm,nn,j,k) = -sin*x + cos*y;
    }
}

// Assembly:
testl %r8d, %r8d
jle 0x71148
movl 0x8(%rsp), %eax
addl %ecx, %r8d
imull %eax, %edi
imull %eax, %esi
movapd 0x30f2c(%rip), %xmm2    # 0xa2020
xorpd %xmm1, %xmm2
movslq %ecx, %rax
movslq %edi, %rdi
movslq %esi, %r9
movslq %r8d, %rcx
leaq (%rdx,%rdi,8), %rsi
leaq (%rdx,%r9,8), %rdx
movsd (%rsi,%rax,8), %xmm3
movsd (%rdx,%rax,8), %xmm4
movapd %xmm4, %xmm5
mulsd %xmm1, %xmm5
movapd %xmm0, %xmm6
mulsd %xmm3, %xmm6
addsd %xmm5, %xmm6
movsd %xmm6, (%rsi,%rax,8)
mulsd %xmm0, %xmm4
mulsd %xmm2, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, (%rdx,%rax,8)
incq %rax
cmpq %rcx, %rax
jl 0x7110c
retq