LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::Gauss(double, int)
void R2Grid::
Gauss(RNLength sigma, RNBoolean square)
{
  // Check sigma
  if (sigma == 0.0) return;    

  // Replace each grid value with Gaussian of what was there before
  RNScalar fac = 1.0 / (2.0 * sigma * sigma);
  RNScalar denom = -2.0 * sigma * sigma;
  if (RNIsZero(denom, 1.0E-6)) return;
  for (int i = 0; i < grid_size; i++) {
    RNScalar value = grid_values[i];
    if (square) value *= value;
    grid_values[i] = fac * exp( value / denom );
  }
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movsd 0x38(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xafd83
jp 0xafd83
jmp 0xafe80
movsd 0x83475(%rip), %xmm1    # 0x133200
mulsd 0x38(%rsp), %xmm1
mulsd 0x38(%rsp), %xmm1
movsd 0x83269(%rip), %xmm0    # 0x133008
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x83457(%rip), %xmm0    # 0x133208
mulsd 0x38(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x20(%rsp), %xmm0
movsd 0x83417(%rip), %xmm1    # 0x1331e8
callq 0x36b80
cmpl $0x0, %eax
je 0xafde0
jmp 0xafe80
movl $0x0, 0x1c(%rsp)
movq 0x8(%rsp), %rcx
movl 0x1c(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xafe80
movq 0x8(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
cmpl $0x0, 0x34(%rsp)
je 0xafe32
movsd 0x10(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x10(%rsp), %xmm0
divsd 0x20(%rsp), %xmm0
callq 0xf8c0
movq 0x8(%rsp), %rax
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
mulsd %xmm1, %xmm0
movq 0xb8(%rax), %rax
movslq 0x1c(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xafde8
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::RasterizeGridValue(int, int, double, int)
void R2Grid::
RasterizeGridValue(int ix, int iy, RNScalar value, int operation)
{
  // Check if within bounds
  if ((ix < 0) || (ix > grid_resolution[0]-1)) return;
  if ((iy < 0) || (iy > grid_resolution[1]-1)) return;

  // Update grid based on operation
  if (operation == R2_GRID_ADD_OPERATION) AddGridValue(ix, iy, value);
  else if (operation == R2_GRID_SUBTRACT_OPERATION) AddGridValue(ix, iy, -value);
  else if (operation == R2_GRID_REPLACE_OPERATION) SetGridValue(ix, iy, value);
  else RNAbort("Unrecognized grid rasterization operation\n");
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movl %ecx, 0xc(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
cmpl $0x0, 0x1c(%rsp)
jl 0xb0590
movq (%rsp), %rcx
movl 0x1c(%rsp), %eax
movl 0xc0(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xb0595
jmp 0xb063f
cmpl $0x0, 0x18(%rsp)
jl 0xb05b1
movq (%rsp), %rcx
movl 0x18(%rsp), %eax
movl 0xc4(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xb05b6
jmp 0xb063f
cmpl $0x0, 0xc(%rsp)
jne 0xb05d6
movq (%rsp), %rdi
movl 0x1c(%rsp), %esi
movl 0x18(%rsp), %edx
movsd 0x10(%rsp), %xmm0
callq 0xb9590
jmp 0xb063f
cmpl $0x1, 0xc(%rsp)
jne 0xb060d
movq (%rsp), %rdi
movl 0x1c(%rsp), %esi
movl 0x18(%rsp), %edx
movsd 0x10(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
callq 0xb9590
jmp 0xb063d
cmpl $0x2, 0xc(%rsp)
jne 0xb062d
movq (%rsp), %rdi
movl 0x1c(%rsp), %esi
movl 0x18(%rsp), %edx
movsd 0x10(%rsp), %xmm0
callq 0x6bc00
jmp 0xb063b
leaq 0x83c74(%rip), %rdi     # 0x1342a8
movb $0x0, %al
callq 0xd4e20
jmp 0xb063d
jmp 0xb063f
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::RasterizeGridPoint(double, double, double, int)
void R2Grid::
RasterizeGridPoint(RNScalar x, RNScalar y, RNScalar value, int operation)
{
  // Check if within bounds
  if ((x < 0) || (x > grid_resolution[0]-1)) return;
  if ((y < 0) || (y > grid_resolution[1]-1)) return;

  // Bilinear interpolation
  int ix1 = (int) x;
  int iy1 = (int) y;
  int ix2 = ix1 + 1;
  int iy2 = iy1 + 1;
  if (ix2 >= grid_resolution[0]) ix2 = ix1;
  if (iy2 >= grid_resolution[1]) iy2 = iy1;
  RNScalar dx = x - ix1;
  RNScalar dy = y - iy1;
  RasterizeGridValue(ix1, iy1, value * (1.0-dx) * (1.0-dy), operation);
  RasterizeGridValue(ix1, iy2, value * (1.0-dx) * dy, operation);
  RasterizeGridValue(ix2, iy1, value * dx * (1.0-dy), operation);
  RasterizeGridValue(ix2, iy2, value * dx * dy, operation);
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movsd %xmm0, 0x48(%rsp)
movsd %xmm1, 0x40(%rsp)
movsd %xmm2, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
ucomisd 0x48(%rsp), %xmm0
ja 0xb06a2
movq 0x8(%rsp), %rax
movsd 0x48(%rsp), %xmm0
movl 0xc0(%rax), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xb06a7
jmp 0xb082d
xorps %xmm0, %xmm0
ucomisd 0x40(%rsp), %xmm0
ja 0xb06d0
movq 0x8(%rsp), %rax
movsd 0x40(%rsp), %xmm0
movl 0xc4(%rax), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xb06d5
jmp 0xb082d
movq 0x8(%rsp), %rcx
cvttsd2si 0x48(%rsp), %eax
movl %eax, 0x30(%rsp)
cvttsd2si 0x40(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl 0x28(%rsp), %eax
cmpl 0xc0(%rcx), %eax
jl 0xb0718
movl 0x30(%rsp), %eax
movl %eax, 0x28(%rsp)
movq 0x8(%rsp), %rcx
movl 0x24(%rsp), %eax
cmpl 0xc4(%rcx), %eax
jl 0xb0731
movl 0x2c(%rsp), %eax
movl %eax, 0x24(%rsp)
movq 0x8(%rsp), %rdi
movsd 0x48(%rsp), %xmm0
cvtsi2sdl 0x30(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x40(%rsp), %xmm0
cvtsi2sdl 0x2c(%rsp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x30(%rsp), %esi
movl 0x2c(%rsp), %edx
movsd 0x38(%rsp), %xmm0
movsd 0x82890(%rip), %xmm1    # 0x133008
subsd 0x18(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x8287e(%rip), %xmm1    # 0x133008
subsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm0
movl 0x34(%rsp), %ecx
callq 0xb0550
movq 0x8(%rsp), %rdi
movl 0x30(%rsp), %esi
movl 0x24(%rsp), %edx
movsd 0x38(%rsp), %xmm0
movsd 0x82850(%rip), %xmm1    # 0x133008
subsd 0x18(%rsp), %xmm1
mulsd %xmm1, %xmm0
mulsd 0x10(%rsp), %xmm0
movl 0x34(%rsp), %ecx
callq 0xb0550
movq 0x8(%rsp), %rdi
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
movsd 0x38(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd 0x82816(%rip), %xmm1    # 0x133008
subsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm0
movl 0x34(%rsp), %ecx
callq 0xb0550
movq 0x8(%rsp), %rdi
movl 0x28(%rsp), %esi
movl 0x24(%rsp), %edx
movsd 0x38(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movl 0x34(%rsp), %ecx
callq 0xb0550
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::RasterizeGridSpan(gaps::R2Point const&, gaps::R2Point const&, double, double, int)
void R2Grid::
RasterizeGridSpan(const R2Point& p1, const R2Point& p2, RNScalar value1, RNScalar value2, int operation)
{
  // Splat value everywhere along span
  R2Vector vector = p2 - p1;
  RNLength length = vector.Length();
  int nsteps = length + 1;
  R2Vector dp = vector / nsteps;
  RNLength dv = (value2 - value1) / nsteps;
  for (int i = 0; i <= nsteps; i++) {
    RNScalar v = value1 + i*dv;
    gaps::R2Point p = p1 + i*dp;
    RasterizeGridPoint(p, v);
  }
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movsd %xmm0, 0x88(%rsp)
movsd %xmm1, 0x80(%rsp)
movl %ecx, 0x7c(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
leaq 0x68(%rsp), %rdi
callq 0xc3830
leaq 0x68(%rsp), %rdi
callq 0xc3d60
movsd %xmm0, 0x60(%rsp)
movsd 0x82754(%rip), %xmm0    # 0x133008
addsd 0x60(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x5c(%rsp)
cvtsi2sdl 0x5c(%rsp), %xmm0
leaq 0x48(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0xc49d0
movsd 0x80(%rsp), %xmm0
subsd 0x88(%rsp), %xmm0
cvtsi2sdl 0x5c(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x5c(%rsp), %eax
jg 0xb0989
movsd 0x88(%rsp), %xmm1
cvtsi2sdl 0x3c(%rsp), %xmm0
movsd 0x40(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x98(%rsp), %rax
movq %rax, (%rsp)
cvtsi2sdl 0x3c(%rsp), %xmm0
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xa5c30
movq (%rsp), %rsi
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xc37a0
movq 0x8(%rsp), %rdi
movsd 0x30(%rsp), %xmm0
leaq 0x20(%rsp), %rsi
xorl %edx, %edx
callq 0xb9630
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0xb0901
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::RasterizeGridBox(int const*, int const*, double, int)
void R2Grid::
RasterizeGridBox(const int p1[2], const int p2[2], RNScalar value, int operation)
{
  // Check value
  if (value == R2_GRID_UNKNOWN_VALUE) return;

  // Clip box
  int x1 = p1[0];
  if (x1 < 0) x1 = 0;
  if (x1 > XResolution()-1) return;
  int x2 = p2[0];
  if (x2 < 0) return;
  if (x2 > XResolution()-1) x2 = XResolution()-1;
  int y1 = p1[1];
  if (y1 < 0) y1 = 0;
  if (y1 > YResolution()-1) return;
  int y2 = p2[1];
  if (y2 < 0) return;
  if (y2 > YResolution()-1) y2 = YResolution()-1;

  // Rasterize box
  for (int ix = x1; ix <= x2; ix++) {
    for (int iy = y1; iy <= y2; iy++) {
      RasterizeGridValue(ix, iy, value, operation);
    }
  }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movl %ecx, 0x34(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movsd 0x38(%rsp), %xmm0
movsd 0x8321b(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb0ca2
jp 0xb0ca2
jmp 0xb0e08
movq 0x48(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x30(%rsp)
cmpl $0x0, 0x30(%rsp)
jge 0xb0cbc
movl $0x0, 0x30(%rsp)
movq 0x10(%rsp), %rdi
movl 0x30(%rsp), %eax
movl %eax, 0xc(%rsp)
callq 0xb9260
movl %eax, %ecx
movl 0xc(%rsp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xb0ce0
jmp 0xb0e08
movq 0x40(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
cmpl $0x0, 0x2c(%rsp)
jge 0xb0cf7
jmp 0xb0e08
movq 0x10(%rsp), %rdi
movl 0x2c(%rsp), %eax
movl %eax, 0x8(%rsp)
callq 0xb9260
movl %eax, %ecx
movl 0x8(%rsp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xb0d27
movq 0x10(%rsp), %rdi
callq 0xb9260
subl $0x1, %eax
movl %eax, 0x2c(%rsp)
movq 0x48(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x28(%rsp)
cmpl $0x0, 0x28(%rsp)
jge 0xb0d42
movl $0x0, 0x28(%rsp)
movq 0x10(%rsp), %rdi
movl 0x28(%rsp), %eax
movl %eax, 0x4(%rsp)
callq 0xb9280
movl %eax, %ecx
movl 0x4(%rsp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xb0d66
jmp 0xb0e08
movq 0x40(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jge 0xb0d7e
jmp 0xb0e08
movq 0x10(%rsp), %rdi
movl 0x24(%rsp), %eax
movl %eax, (%rsp)
callq 0xb9280
movl %eax, %ecx
movl (%rsp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0xb0dac
movq 0x10(%rsp), %rdi
callq 0xb9280
subl $0x1, %eax
movl %eax, 0x24(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jg 0xb0e08
movl 0x28(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x24(%rsp), %eax
jg 0xb0df9
movq 0x10(%rsp), %rdi
movl 0x20(%rsp), %esi
movl 0x1c(%rsp), %edx
movsd 0x38(%rsp), %xmm0
movl 0x34(%rsp), %ecx
callq 0xb0550
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xb0dc6
jmp 0xb0dfb
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0xb0db4
addq $0x58, %rsp
retq
nopl (%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::CompareScanLineCrossings(void const*, void const*)
static int CompareScanLineCrossings(const void *data1, const void *data2)
{
  ScanLineCrossing *crossing1 = (ScanLineCrossing *) data1;
  ScanLineCrossing *crossing2 = (ScanLineCrossing *) data2;
  if (RNIsLess(crossing1->x, crossing2->x)) return -1;
  else if (RNIsGreater(crossing1->x, crossing2->x)) return 1;
  else if (crossing1->side < crossing2->side) return -1;
  else if (crossing1->side > crossing2->side) return 1;
  else return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rax
movsd (%rax), %xmm0
movq (%rsp), %rax
movsd (%rax), %xmm1
leaq 0xc6127(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x39630
cmpl $0x0, %eax
je 0xb23d1
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xb243f
movq 0x8(%rsp), %rax
movsd (%rax), %xmm0
movq (%rsp), %rax
movsd (%rax), %xmm1
leaq 0xc60f7(%rip), %rax     # 0x1784e0
movsd (%rax), %xmm2
callq 0x3c090
cmpl $0x0, %eax
je 0xb2401
movl $0x1, 0x24(%rsp)
jmp 0xb243f
movq 0x8(%rsp), %rax
movl 0x8(%rax), %eax
movq (%rsp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xb241c
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
jmp 0xb243f
movq 0x8(%rsp), %rax
movl 0x8(%rax), %eax
movq (%rsp), %rcx
cmpl 0x8(%rcx), %eax
jle 0xb2437
movl $0x1, 0x24(%rsp)
jmp 0xb243f
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::RasterizeWorldPolygon(gaps::R2Polygon const&, double, int)
void R2Grid::
RasterizeWorldPolygon(const R2Polygon& polygon, RNScalar value, int operation) 
{
  // Rasterize polygon into grid coordinates
  R2Polygon transformed_polygon(polygon);
  transformed_polygon.Transform(WorldToGridTransformation());
  RasterizeGridPolygon(transformed_polygon, value, operation);
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movsd %xmm0, 0x70(%rsp)
movl %edx, 0x6c(%rsp)
movq 0x80(%rsp), %rax
movq %rax, (%rsp)
movq 0x78(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0xb9ab0
movq (%rsp), %rdi
callq 0xb94e0
movq %rax, 0x8(%rsp)
jmp 0xb2499
movq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0xbcc40
jmp 0xb24aa
movq (%rsp), %rdi
movsd 0x70(%rsp), %xmm0
movl 0x6c(%rsp), %edx
leaq 0x20(%rsp), %rsi
callq 0xb1ae0
jmp 0xb24c4
leaq 0x20(%rsp), %rdi
callq 0xba090
addq $0x88, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x18(%rsp)
movl %eax, 0x14(%rsp)
leaq 0x20(%rsp), %rdi
callq 0xba090
movq 0x18(%rsp), %rdi
callq 0xf890
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::Dot(gaps::R2Grid const&) const
RNScalar R2Grid::
Dot(const R2Grid& grid) const
{
  // Resolutions and transforms must be the same (for now)
  assert(grid_resolution[0] == grid.grid_resolution[0]);
  assert(grid_resolution[1] == grid.grid_resolution[1]);

  // Compute dot product between this and grid
  RNScalar dot = 0.0;
  for (int i = 0; i < grid_size; i++) {
    if (grid_values[i] == R2_GRID_UNKNOWN_VALUE) continue;
    if (grid.grid_values[i] == R2_GRID_UNKNOWN_VALUE) continue;
    dot += grid_values[i] * grid.grid_values[i];
  }
  return dot;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x28(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rsp)
movl $0x0, -0x1c(%rsp)
movq -0x28(%rsp), %rcx
movl -0x1c(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xb25da
movq -0x28(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x81958(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb2562
jp 0xb2562
jmp 0xb25ca
movq -0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x81930(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb258a
jp 0xb258a
jmp 0xb25ca
movq -0x28(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm2
movsd -0x18(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rsp)
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0xb2525
movsd -0x18(%rsp), %xmm0
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::L1Distance(gaps::R2Grid const&) const
RNScalar R2Grid::
L1Distance(const R2Grid& grid) const
{
  // Compute distance between this and grid
  RNScalar distance = 0.0;
  for (int i = 0; i < grid_size; i++) {
    if (grid_values[i] == R2_GRID_UNKNOWN_VALUE) continue;
    if (grid.grid_values[i] == R2_GRID_UNKNOWN_VALUE) continue;
    distance += fabs(grid_values[i] - grid.grid_values[i]);
  }
  return distance;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x28(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rsp)
movl $0x0, -0x1c(%rsp)
movq -0x28(%rsp), %rcx
movl -0x1c(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xb393d
movq -0x28(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x805f8(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb38c2
jp 0xb38c2
jmp 0xb392d
movq -0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x805d0(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb38ea
jp 0xb38ea
jmp 0xb392d
movq -0x28(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movaps 0x7f953(%rip), %xmm1    # 0x133270
pand %xmm1, %xmm0
addsd -0x18(%rsp), %xmm0
movsd %xmm0, -0x18(%rsp)
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0xb3885
movsd -0x18(%rsp), %xmm0
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::L2DistanceSquared(gaps::R2Grid const&) const
RNScalar R2Grid::
L2DistanceSquared(const R2Grid& grid) const
{
  // Compute distance between this and grid
  RNScalar distance_squared = 0.0;
  for (int i = 0; i < grid_size; i++) {
    if (grid_values[i] == R2_GRID_UNKNOWN_VALUE) continue;
    if (grid.grid_values[i] == R2_GRID_UNKNOWN_VALUE) continue;
    RNScalar delta = (grid_values[i] - grid.grid_values[i]);
    distance_squared += delta * delta;
  }

  // Return result
  return distance_squared;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x30(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rsp)
movl $0x0, -0x1c(%rsp)
movq -0x30(%rsp), %rcx
movl -0x1c(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xb3a3c
movq -0x30(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x80508(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb39b2
jp 0xb39b2
jmp 0xb3a2c
movq -0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x804e0(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb39da
jp 0xb39da
jmp 0xb3a2c
movq -0x30(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq -0x1c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x28(%rsp)
movsd -0x28(%rsp), %xmm0
movsd -0x28(%rsp), %xmm2
movsd -0x18(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rsp)
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0xb3975
movsd -0x18(%rsp), %xmm0
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::Capture()
void R2Grid::
Capture(void)
{
  // Check image size
  GLint viewport[4];
  glGetIntegerv(GL_VIEWPORT, viewport);
  assert(grid_resolution[0] >= viewport[2]);
  assert(grid_resolution[1] >= viewport[3]);
  assert(grid_values);

  // Allocate pixels
  float *pixels = new float [ grid_size ];

  // Read pixels from frame buffer 
  glReadPixels(0, 0, grid_resolution[0], grid_resolution[1], GL_LUMINANCE, GL_FLOAT, pixels); 

  // Copy pixels
  for (int i = 0; i < grid_size; i++) grid_values[i] = pixels[i];

  // Delete pixels
  delete [] pixels;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x30(%rsp), %rsi
movl $0xba2, %edi            # imm = 0xBA2
callq 0xf480
movq 0x18(%rsp), %rax
movslq 0xcc(%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xf030
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x28(%rsp)
movl 0xc0(%rax), %edx
movl 0xc4(%rax), %ecx
movq 0x28(%rsp), %rax
xorl %esi, %esi
movl $0x1909, %r8d           # imm = 0x1909
movl $0x1406, %r9d           # imm = 0x1406
movl %esi, %edi
movq %rax, (%rsp)
callq 0xf220
movl $0x0, 0x24(%rsp)
movq 0x18(%rsp), %rcx
movl 0x24(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xb3e75
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movslq 0x24(%rsp), %rdx
movss (%rcx,%rdx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq 0xb8(%rax), %rax
movslq 0x24(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0xb3e2e
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0xb3e8f
movq 0x10(%rsp), %rdi
callq 0xf670
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::DrawMesh() const
void R2Grid::
DrawMesh(void) const
{
  // Push transformation
  grid_to_world_transform.Push();

  // Draw triangle strip
  for (int j = 1; j < grid_resolution[1]; j++) {
    RNGrfxBegin(RN_GRFX_TRIANGLE_STRIP);
    for (int i = 0; i < grid_resolution[0]; i++) {
      R3LoadPoint((double) i, (double) j,     GridValue(i, j));
      R3LoadPoint((double) i, (double) (j-1), GridValue(i, j-1));
    }
    RNGrfxEnd();
  }

  // Pop transformation
  grid_to_world_transform.Pop();
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xcab50
movl $0x1, 0x2c(%rsp)
movq 0x20(%rsp), %rcx
movl 0x2c(%rsp), %eax
cmpl 0xc4(%rcx), %eax
jge 0xb3fa3
movl $0x5, %edi
callq 0x38df0
movl $0x0, 0x28(%rsp)
movq 0x20(%rsp), %rcx
movl 0x28(%rsp), %eax
cmpl 0xc0(%rcx), %eax
jge 0xb3f8e
movq 0x20(%rsp), %rdi
cvtsi2sdl 0x28(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
cvtsi2sdl 0x2c(%rsp), %xmm0
movsd %xmm0, (%rsp)
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
callq 0xb92a0
movsd (%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x8(%rsp), %xmm0
callq 0x6bfc0
movq 0x20(%rsp), %rdi
cvtsi2sdl 0x28(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movl 0x2c(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
subl $0x1, %edx
callq 0xb92a0
movsd 0x10(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x18(%rsp), %xmm0
callq 0x6bfc0
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0xb3ee7
callq 0x3c060
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0xb3ec0
movq 0x20(%rsp), %rdi
callq 0xcab90
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::DrawImage(int, int) const
void R2Grid::
DrawImage(int x, int y) const
{
  // Set projection matrix
  glMatrixMode(GL_PROJECTION);  
  glPushMatrix();
  glLoadIdentity();
  gluOrtho2D(0, grid_resolution[0], 0, grid_resolution[1]);

  // Set model view matrix
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();

  // Set position for image
  glRasterPos2i(x, y);

  // Allocate pixels
  float *pixels = new float [ grid_size ];

  // Copy pixels
  for (int i = 0; i < grid_size; i++) pixels[i] = (float) grid_values[i];

  // Draw pixels
  glDrawPixels(grid_resolution[0], grid_resolution[1], GL_LUMINANCE, GL_FLOAT, pixels); 

  // Delete pixels
  delete [] pixels;

  // Reset projection matrix
  glMatrixMode(GL_PROJECTION);
  glPopMatrix();

  // Reset model view matrix
  glMatrixMode(GL_MODELVIEW);
  glPopMatrix();
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movl %edx, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x1701, %edi           # imm = 0x1701
callq 0xf6e0
callq 0xf7f0
callq 0xf680
movq 0x10(%rsp), %rax
cvtsi2sdl 0xc0(%rax), %xmm1
cvtsi2sdl 0xc4(%rax), %xmm3
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
callq 0xf2e0
movl $0x1700, %edi           # imm = 0x1700
callq 0xf6e0
callq 0xf7f0
callq 0xf680
movl 0x2c(%rsp), %edi
movl 0x28(%rsp), %esi
callq 0xf190
movq 0x10(%rsp), %rax
movslq 0xcc(%rax), %rax
movl $0x4, %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 0x10(%rsp), %rcx
movl 0x1c(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xb40b1
movq 0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0xb406a
movq 0x10(%rsp), %rax
movl 0xc0(%rax), %edi
movl 0xc4(%rax), %esi
movq 0x20(%rsp), %r8
movl $0x1909, %edx           # imm = 0x1909
movl $0x1406, %ecx           # imm = 0x1406
callq 0xf3b0
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0xb40f0
movq 0x8(%rsp), %rdi
callq 0xf670
movl $0x1701, %edi           # imm = 0x1701
callq 0xf6e0
callq 0xf920
movl $0x1700, %edi           # imm = 0x1700
callq 0xf6e0
callq 0xf920
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::ConnectedComponentLabelFilter(double)
void R2Grid::
ConnectedComponentLabelFilter(RNScalar isolevel)
{
  // Compute connected components
  int *components = new int [ grid_size ];
  int ncomponents = ConnectedComponents(isolevel, grid_size, NULL, NULL, components);

  // Assign component labels to grid elements
  if (ncomponents > 0) {
    // Assign component labels
    for (int i = 0; i < grid_size; i++) {
      if (grid_values[i] == R2_GRID_UNKNOWN_VALUE) continue;
      grid_values[i] = components[i];
    }
  }

  // Delete temporary memory
  delete [] components;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movsd %xmm0, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movslq 0xcc(%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xf030
movq 0x10(%rsp), %rdi
movq %rax, 0x20(%rsp)
movsd 0x28(%rsp), %xmm0
movl 0xcc(%rdi), %esi
movq 0x20(%rsp), %r8
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0xb45c0
movl %eax, 0x1c(%rsp)
cmpl $0x0, 0x1c(%rsp)
jle 0xb4598
movl $0x0, 0x18(%rsp)
movq 0x10(%rsp), %rcx
movl 0x18(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xb4596
movq 0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x7f956(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb4564
jp 0xb4564
jmp 0xb4589
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
movslq 0x18(%rsp), %rdx
cvtsi2sdl (%rcx,%rdx,4), %xmm0
movq 0xb8(%rax), %rax
movslq 0x18(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0xb452b
jmp 0xb4598
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0xb45b2
movq 0x8(%rsp), %rdi
callq 0xf670
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::ConnectedComponentSizeFilter(double)
void R2Grid::
ConnectedComponentSizeFilter(RNScalar isolevel)
{
  // Compute connected components
  int *sizes = new int [ grid_size ];
  int *components = new int [ grid_size ];
  int ncomponents = ConnectedComponents(isolevel, grid_size, NULL, sizes, components);

  // Assign component sizes to grid elements
  if (ncomponents > 0) {
    for (int i = 0; i < grid_size; i++) {
      if (grid_values[i] == R2_GRID_UNKNOWN_VALUE) continue;
      int component = components[i];
      if ((component < 0) || (component >= ncomponents)) grid_values[i] = 0;
      else grid_values[i] = sizes[component];
    }
  }

  // Delete temporary memory
  delete [] components;
  delete [] sizes;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movslq 0xcc(%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xf030
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x30(%rsp)
movslq 0xcc(%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xf030
movq 0x10(%rsp), %rdi
movq %rax, 0x28(%rsp)
movsd 0x38(%rsp), %xmm0
movl 0xcc(%rdi), %esi
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0xb45c0
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jle 0xb52b9
movl $0x0, 0x20(%rsp)
movq 0x10(%rsp), %rcx
movl 0x20(%rsp), %eax
cmpl 0xcc(%rcx), %eax
jge 0xb52b7
movq 0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x20(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x7ec77(%rip), %xmm1    # 0x133eb0
ucomisd %xmm1, %xmm0
jne 0xb5243
jp 0xb5243
jmp 0xb52a7
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x1c(%rsp)
cmpl $0x0, 0x1c(%rsp)
jl 0xb5265
movl 0x1c(%rsp), %eax
cmpl 0x24(%rsp), %eax
jl 0xb5280
movq 0x10(%rsp), %rax
movq 0xb8(%rax), %rax
movslq 0x20(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0xb52a5
movq 0x10(%rsp), %rax
movq 0x30(%rsp), %rcx
movslq 0x1c(%rsp), %rdx
cvtsi2sdl (%rcx,%rdx,4), %xmm0
movq 0xb8(%rax), %rax
movslq 0x20(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0xb52a7
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0xb5206
jmp 0xb52b9
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0xb52d3
movq 0x8(%rsp), %rdi
callq 0xf670
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0xb52eb
movq (%rsp), %rdi
callq 0xf670
addq $0x48, %rsp
retq
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::ReadFile(char const*)
int R2Grid::
ReadFile(const char *filename)
{
  // Parse input filename extension
  const char *input_extension;
  if (!(input_extension = strrchr(filename, '.'))) {
    RNFail("Input file has no extension (e.g., .pfm).\n");
    return 0;
  }
  
  // Read file of appropriate type
  if (!strncmp(input_extension, ".raw", 4)) return ReadRAWFile(filename);
  else if (!strncmp(input_extension, ".pfm", 4)) return ReadPFMFile(filename);
  else if (!strncmp(input_extension, ".pnm", 4)) return ReadPNMFile(filename);
  else if (!strncmp(input_extension, ".png", 4)) return ReadPNGFile(filename);
  else if (!strncmp(input_extension, ".grd", 4)) return ReadGridFile(filename);
  else  return ReadImageFile(filename);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
movl $0x2e, %esi
callq 0xf580
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
jne 0xb5dbc
leaq 0x7fef7(%rip), %rdi     # 0x135c9f
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x24(%rsp)
jmp 0xb5ebf
movq 0x8(%rsp), %rdi
leaq 0x7e528(%rip), %rsi     # 0x1342f0
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb5dee
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb5ed0
movl %eax, 0x24(%rsp)
jmp 0xb5ebf
movq 0x8(%rsp), %rdi
leaq 0x7fed0(%rip), %rsi     # 0x135cca
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb5e20
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb6260
movl %eax, 0x24(%rsp)
jmp 0xb5ebf
movq 0x8(%rsp), %rdi
leaq 0x7fea3(%rip), %rsi     # 0x135ccf
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb5e4f
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb6a40
movl %eax, 0x24(%rsp)
jmp 0xb5ebf
movq 0x8(%rsp), %rdi
leaq 0x7fe79(%rip), %rsi     # 0x135cd4
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb5e7e
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb7250
movl %eax, 0x24(%rsp)
jmp 0xb5ebf
movq 0x8(%rsp), %rdi
leaq 0x7e449(%rip), %rsi     # 0x1342d3
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb5ead
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb72f0
movl %eax, 0x24(%rsp)
jmp 0xb5ebf
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb73a0
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::ReadPNGFile(char const*)
int R2Grid::
ReadPNGFile(const char *filename)
{
  // Open file
  FILE *fp = fopen(filename, "rb");
  if (!fp) {
    RNFail("Unable to open PNG file %s\n", filename);
    return 0;
   }

  // Read file
  if (!ReadPNGStream(fp)) {
    fclose(fp);
    return 0;
  }

  // Close the file 
  fclose(fp);

  // Return success 
  return 1;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
leaq 0x7c366(%rip), %rsi     # 0x1335d9
callq 0xf5e0
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0xb72a2
movq 0x10(%rsp), %rsi
leaq 0x7ee75(%rip), %rdi     # 0x136106
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x24(%rsp)
jmp 0xb72db
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xb86e0
cmpl $0x0, %eax
jne 0xb72c9
movq 0x8(%rsp), %rdi
callq 0xf4b0
movl $0x0, 0x24(%rsp)
jmp 0xb72db
movq 0x8(%rsp), %rdi
callq 0xf4b0
movl $0x1, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::ReadGridFile(char const*)
int R2Grid::
ReadGridFile(const char *filename)
{
  // Open file
  FILE *fp = stdin;
  if (filename) {
    fp = fopen(filename, "rb");
    if (!fp) {
      RNFail("Unable to open file %s", filename);
      return 0;
    }
  }

  // Read file
  int status = ReadGridStream(fp);
  if (!status) return 0;

  // Close file
  fclose(fp);

  // Return number of grid values read
  return status;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xb7ca9(%rip), %rax     # 0x16efb8
movq (%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0xb735c
movq 0x20(%rsp), %rdi
leaq 0x7c2ae(%rip), %rsi     # 0x1335d9
callq 0xf5e0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0xb735a
movq 0x20(%rsp), %rsi
leaq 0x7c097(%rip), %rdi     # 0x1333e0
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb7392
jmp 0xb735c
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xb8130
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
jne 0xb7380
movl $0x0, 0x34(%rsp)
jmp 0xb7392
movq 0x18(%rsp), %rdi
callq 0xf4b0
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::WriteFile(char const*) const
int R2Grid::
WriteFile(const char *filename) const
{
  // Parse input filename extension
  const char *input_extension;
  if (!(input_extension = strrchr(filename, '.'))) {
    RNFail("Output file has no extension (e.g., .pfm).\n");
    return 0;
  }
  
  // Write file of appropriate type
  if (!strncmp(input_extension, ".raw", 4)) return WriteRAWFile(filename);
  else if (!strncmp(input_extension, ".pfm", 4)) return WritePFMFile(filename);
  else if (!strncmp(input_extension, ".png", 4)) return WritePNGFile(filename);
  else if (!strncmp(input_extension, ".grd", 4)) return WriteGridFile(filename);
  else return WriteImageFile(filename);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
movl $0x2e, %esi
callq 0xf580
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
jne 0xb76ec
leaq 0x7e601(%rip), %rdi     # 0x135cd9
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x24(%rsp)
jmp 0xb77bd
movq 0x8(%rsp), %rdi
leaq 0x7cbf8(%rip), %rsi     # 0x1342f0
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb771e
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb77d0
movl %eax, 0x24(%rsp)
jmp 0xb77bd
movq 0x8(%rsp), %rdi
leaq 0x7e5a0(%rip), %rsi     # 0x135cca
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb774d
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb7a00
movl %eax, 0x24(%rsp)
jmp 0xb77bd
movq 0x8(%rsp), %rdi
leaq 0x7e57b(%rip), %rsi     # 0x135cd4
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb777c
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb7c00
movl %eax, 0x24(%rsp)
jmp 0xb77bd
movq 0x8(%rsp), %rdi
leaq 0x7cb4b(%rip), %rsi     # 0x1342d3
movl $0x4, %edx
callq 0xf230
cmpl $0x0, %eax
jne 0xb77ab
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb7ca0
movl %eax, 0x24(%rsp)
jmp 0xb77bd
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb7d50
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::WritePNGFile(char const*) const
int R2Grid::
WritePNGFile(const char *filename) const
{
  // Open the file 
  FILE *fp = fopen(filename, "wb");
  if (fp == NULL) {
    RNFail("Unable to open PNG file %s\n", filename);
    return 0;
  }
  
  // Write the file
  if (!WritePNGStream(fp)) {
    fclose(fp);
    return 0;
  }

  // Close the file 
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
leaq 0x7be97(%rip), %rsi     # 0x133aba
callq 0xf5e0
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0xb7c52
movq 0x10(%rsp), %rsi
leaq 0x7e4c5(%rip), %rdi     # 0x136106
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x24(%rsp)
jmp 0xb7c8b
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0xb8cc0
cmpl $0x0, %eax
jne 0xb7c79
movq 0x8(%rsp), %rdi
callq 0xf4b0
movl $0x0, 0x24(%rsp)
jmp 0xb7c8b
movq 0x8(%rsp), %rdi
callq 0xf4b0
movl $0x1, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::WriteGridFile(char const*) const
int R2Grid::
WriteGridFile(const char *filename) const
{
  // Open file
  FILE *fp = stdout;
  if (filename) {
    fp = fopen(filename, "wb");
    if (!fp) {
      RNFail("Unable to open file %s", filename);
      return 0;
    }
  }

  // Write file
  int status = WriteGridStream(fp);
  if (!status) return 0;

  // Close file
  fclose(fp);

  // Return number of grid values written
  return status;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xb72d1(%rip), %rax     # 0x16ef90
movq (%rax), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0xb7d0c
movq 0x20(%rsp), %rdi
leaq 0x7bddf(%rip), %rsi     # 0x133aba
callq 0xf5e0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0xb7d0a
movq 0x20(%rsp), %rsi
leaq 0x7b6e7(%rip), %rdi     # 0x1333e0
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb7d42
jmp 0xb7d0c
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xb8440
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
jne 0xb7d30
movl $0x0, 0x34(%rsp)
jmp 0xb7d42
movq 0x18(%rsp), %rdi
callq 0xf4b0
movl 0x14(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::WriteGridStream(_IO_FILE*) const
int R2Grid::
WriteGridStream(FILE *fp) const
{
  // Write grid resolution from file
  if (fwrite(&grid_resolution, sizeof(int), 2, fp) != 2) {
    RNFail("Unable to write resolution to file");
    return 0;
  }

  // Write world_to_grid transformation to file
  const RNScalar *m = &(world_to_grid_transform.Matrix()[0][0]);
  if (fwrite(m, sizeof(RNScalar), 9, fp) != 9) {
    RNFail("Unable to write transformation matrix to file");
    return 0;
  }

  // Write grid values (row by row to avoid large buffers)
  for (int i = 0; i < grid_resolution[1]; i++) {
    RNScalar *row_values = &grid_values[i * grid_resolution[0]];
    if (fwrite(row_values, sizeof(RNScalar), grid_resolution[0], fp) != (unsigned int) grid_resolution[0]) {
      RNFail("Unable to write grid values to grid\n");
      return 0;
    }
  }

  // Return number of grid values written
  return grid_size;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rdi
movq %rdi, (%rsp)
addq $0xc0, %rdi
movq 0x20(%rsp), %rcx
movl $0x4, %esi
movl $0x2, %edx
callq 0xf980
cmpq $0x2, %rax
je 0xb8493
leaq 0x7bf79(%rip), %rdi     # 0x1343f8
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb8588
movq (%rsp), %rdi
addq $0x58, %rdi
callq 0xb9850
movq %rax, %rdi
xorl %esi, %esi
callq 0xb9860
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rcx
movl $0x8, %esi
movl $0x9, %edx
callq 0xf980
cmpq $0x9, %rax
je 0xb84e9
leaq 0x7dbbc(%rip), %rdi     # 0x136091
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb8588
movl $0x0, 0x14(%rsp)
movq (%rsp), %rcx
movl 0x14(%rsp), %eax
cmpl 0xc4(%rcx), %eax
jge 0xb857a
movq (%rsp), %rax
movq 0xb8(%rax), %rcx
movl 0x14(%rsp), %edx
imull 0xc0(%rax), %edx
movslq %edx, %rdx
shlq $0x3, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rsp)
movq 0x8(%rsp), %rdi
movslq 0xc0(%rax), %rdx
movq 0x20(%rsp), %rcx
movl $0x8, %esi
callq 0xf980
movq (%rsp), %rcx
movl 0xc0(%rcx), %ecx
cmpq %rcx, %rax
je 0xb8568
leaq 0x7db68(%rip), %rdi     # 0x1360bf
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb8588
jmp 0xb856a
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0xb84f1
movq (%rsp), %rax
movl 0xcc(%rax), %eax
movl %eax, 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::ReadGridBuffer(char*, unsigned long)
int R2Grid::
ReadGridBuffer(char *buffer, size_t buffer_length)
{
  // Open stream
  FILE *fp = fmemopen((void *) buffer, buffer_length, "r");
  if (!fp) {
    RNFail("Unable to open Grid stream\n");
    return 0;
   }

  // Read file
  if (!ReadGridStream(fp)) {
    fclose(fp);
    return 0;
  }

  // Close the file 
  fclose(fp);

  // Return success 
  return 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq 0x800a5(%rip), %rdx     # 0x138673
callq 0xf970
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xb85f8
leaq 0x7dafd(%rip), %rdi     # 0x1360e4
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb8632
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb8130
cmpl $0x0, %eax
jne 0xb8620
movq 0x10(%rsp), %rdi
callq 0xf4b0
movl $0x0, 0x34(%rsp)
jmp 0xb8632
movq 0x10(%rsp), %rdi
callq 0xf4b0
movl $0x1, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::WriteGridBuffer(char**, unsigned long*) const
int R2Grid::
WriteGridBuffer(char **buffer, size_t *buffer_length) const
{
  // Open the file 
  FILE *fp = open_memstream(buffer, buffer_length);
  if (fp == NULL) {
    RNFail("Unable to open Grid stream\n");
    return 0;
  }
  
  // Write the file
  if (!WriteGridStream(fp)) {
    fclose(fp);
    return 0;
  }

  // Close the file 
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xf520
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xb8691
leaq 0x7da64(%rip), %rdi     # 0x1360e4
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb86cb
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb8440
cmpl $0x0, %eax
jne 0xb86b9
movq 0x10(%rsp), %rdi
callq 0xf4b0
movl $0x0, 0x34(%rsp)
jmp 0xb86cb
movq 0x10(%rsp), %rdi
callq 0xf4b0
movl $0x1, 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::ReadPNGBuffer(char*, unsigned long)
int R2Grid::
ReadPNGBuffer(char *buffer, size_t buffer_length)
{
  // Open stream
  FILE *fp = fmemopen((void *) buffer, buffer_length, "r");
  if (!fp) {
    RNFail("Unable to open PNG stream\n");
    return 0;
   }

  // Read file
  if (!ReadPNGStream(fp)) {
    fclose(fp);
    return 0;
  }

  // Close the file 
  fclose(fp);

  // Return success 
  return 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq 0x7f675(%rip), %rdx     # 0x138673
callq 0xf970
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xb9028
leaq 0x7d10b(%rip), %rdi     # 0x136122
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb9062
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb86e0
cmpl $0x0, %eax
jne 0xb9050
movq 0x10(%rsp), %rdi
callq 0xf4b0
movl $0x0, 0x34(%rsp)
jmp 0xb9062
movq 0x10(%rsp), %rdi
callq 0xf4b0
movl $0x1, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::WritePNGBuffer(char**, unsigned long*) const
int R2Grid::
WritePNGBuffer(char **buffer, size_t *buffer_length) const
{
  // Open the file 
  FILE *fp = open_memstream(buffer, buffer_length);
  if (fp == NULL) {
    RNFail("Unable to open PNG stream\n");
    return 0;
  }
  
  // Write the file
  if (!WritePNGStream(fp)) {
    fclose(fp);
    return 0;
  }

  // Close the file 
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xf520
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xb90c1
leaq 0x7d072(%rip), %rdi     # 0x136122
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x34(%rsp)
jmp 0xb90fb
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0xb8cc0
cmpl $0x0, %eax
jne 0xb90e9
movq 0x10(%rsp), %rdi
callq 0xf4b0
movl $0x0, 0x34(%rsp)
jmp 0xb90fb
movq 0x10(%rsp), %rdi
callq 0xf4b0
movl $0x1, 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::Print(_IO_FILE*) const
int R2Grid::
Print(FILE *fp) const
{
  // Check file
  if (!fp) fp = stdout;

  // Print values
  for (int j = 0; j < YResolution(); j++) {
    for (int i = 0; i < XResolution(); i++) {
      fprintf(fp, "%g ", GridValue(i, j));
    }
    fprintf(fp, "\n");
  }

  // Return number of grid values written
  return grid_size;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0xb913f
movq 0xb5e59(%rip), %rax     # 0x16ef90
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movq 0x18(%rsp), %rdi
movl 0x24(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0xb9280
movl %eax, %ecx
movl 0x14(%rsp), %eax
cmpl %ecx, %eax
jge 0xb91ea
movl $0x0, 0x20(%rsp)
movq 0x18(%rsp), %rdi
movl 0x20(%rsp), %eax
movl %eax, 0x10(%rsp)
callq 0xb9260
movl %eax, %ecx
movl 0x10(%rsp), %eax
cmpl %ecx, %eax
jge 0xb91c7
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x20(%rsp), %esi
movl 0x24(%rsp), %edx
callq 0xb92a0
movq 0x8(%rsp), %rdi
leaq 0x7bece(%rip), %rsi     # 0x135081
movb $0x1, %al
callq 0xf730
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0xb916f
movq 0x28(%rsp), %rdi
leaq 0x7f83f(%rip), %rsi     # 0x138a12
movb $0x0, %al
callq 0xf730
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0xb9147
movq 0x18(%rsp), %rax
movl 0xcc(%rax), %eax
addq $0x38, %rsp
retq
nopw (%rax,%rax)