LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movl $0x1701, %edi           # imm = 0x1701
callq 0xe620
callq 0xe740
callq 0xe5c0
cvtsi2sdl 0xc0(%rbx), %xmm1
cvtsi2sdl 0xc4(%rbx), %xmm3
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
callq 0xe2b0
movl $0x1700, %edi           # imm = 0x1700
callq 0xe620
callq 0xe740
callq 0xe5c0
movl %r14d, %edi
movl %ebp, %esi
callq 0xe180
movslq 0xcc(%rbx), %r15
leaq (,%r15,4), %rax
testq %r15, %r15
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0xe030
movq %rax, %r14
testq %r15, %r15
jle 0x61271
movq 0xb8(%rbx), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cvtsd2ss (%rax,%rcx,8), %xmm0
movss %xmm0, (%r14,%rcx,4)
incq %rcx
cmpq %rcx, %r15
jne 0x6125b
movl 0xc0(%rbx), %edi
movl 0xc4(%rbx), %esi
movl $0x1909, %edx           # imm = 0x1909
movl $0x1406, %ecx           # imm = 0x1406
movq %r14, %r8
callq 0xe350
movq %r14, %rdi
callq 0xe5b0
movl $0x1701, %edi           # imm = 0x1701
callq 0xe620
callq 0xe850
movl $0x1700, %edi           # imm = 0x1700
callq 0xe620
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe850
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movsd %xmm0, 0x8(%rsp)
movq %rdi, %r14
movslq 0xcc(%rdi), %r15
leaq (,%r15,4), %rax
testq %r15, %r15
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0xe030
movq %rax, %rbx
movq %r14, %rdi
movsd 0x8(%rsp), %xmm0
movl %r15d, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rax, %r8
callq 0x6158e
testl %eax, %eax
jle 0x6157c
movslq 0xcc(%r14), %rax
testq %rax, %rax
jle 0x6157c
movq 0xb8(%r14), %rcx
xorl %edx, %edx
movsd 0x41a5e(%rip), %xmm0    # 0xa2fb8
movsd (%rcx,%rdx,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x61567
jnp 0x61574
xorps %xmm1, %xmm1
cvtsi2sdl (%rbx,%rdx,4), %xmm1
movsd %xmm1, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x6155a
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xe5b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
movq %rdi, %r15
movslq 0xcc(%rdi), %r12
leaq (,%r12,4), %rax
testq %r12, %r12
movq $-0x1, %r14
cmovnsq %rax, %r14
movq %r14, %rdi
callq 0xe030
movq %rax, %rbx
movq %r14, %rdi
callq 0xe030
movq %rax, %r14
movq %r15, %rdi
movsd (%rsp), %xmm0
movl %r12d, %esi
xorl %edx, %edx
movq %rbx, %rcx
movq %rax, %r8
callq 0x6158e
testl %eax, %eax
jle 0x61b56
movslq 0xcc(%r15), %rcx
testq %rcx, %rcx
jle 0x61b56
movq 0xb8(%r15), %rdx
xorl %esi, %esi
movsd 0x41490(%rip), %xmm0    # 0xa2fb8
movsd (%rdx,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x61b35
jnp 0x61b4e
movl (%r14,%rsi,4), %edi
xorpd %xmm1, %xmm1
cmpl %eax, %edi
jae 0x61b49
xorps %xmm1, %xmm1
cvtsi2sdl (%rbx,%rdi,4), %xmm1
movsd %xmm1, (%rdx,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x61b28
movq %r14, %rdi
callq 0xe5b0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe5b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0xe4c0
testq %rax, %rax
je 0x621a6
movq %rax, %r15
leaq 0x45699(%rip), %rsi     # 0xa77ba
movl $0x4, %edx
movq %rax, %rdi
callq 0xe210
testl %eax, %eax
je 0x621bc
leaq 0x472ad(%rip), %rsi     # 0xa93ea
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x621cc
leaq 0x4729a(%rip), %rsi     # 0xa93ef
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x621dc
leaq 0x47287(%rip), %rsi     # 0xa93f4
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x621ec
leaq 0x45618(%rip), %rsi     # 0xa779d
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
movq %r14, %rdi
movq %rbx, %rsi
testl %eax, %eax
je 0x621fc
popq %rbx
popq %r14
popq %r15
jmp 0x62d54
leaq 0x47212(%rip), %rdi     # 0xa93bf
xorl %eax, %eax
callq 0x72a1e
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x62206
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x62476
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x628b4
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x62c94
popq %rbx
popq %r14
popq %r15
jmp 0x62ce8
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x3f908(%rip), %rsi     # 0xa25ae
movq %rbx, %rdi
callq 0xe530
testq %rax, %rax
je 0x62ccf
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x638b2
movl %eax, %ebx
movq %r15, %rdi
callq 0xe430
movl %ebx, %eax
jmp 0x62ce2
leaq 0x46ab9(%rip), %rdi     # 0xa978f
movq %rbx, %rsi
xorl %eax, %eax
callq 0x72a1e
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x62d24
movq %rsi, %r14
leaq 0x3f8af(%rip), %rsi     # 0xa25ae
movq %r14, %rdi
callq 0xe530
movq %rax, %r15
testq %rax, %rax
jne 0x62d2e
leaq 0x3f6a7(%rip), %rdi     # 0xa23bd
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x72a1e
jmp 0x62d4b
movq 0x82275(%rip), %rax     # 0xe4fa0
movq (%rax), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6351c
testl %eax, %eax
je 0x62d49
movl %eax, %ebx
movq %r15, %rdi
callq 0xe430
jmp 0x62d4b
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::ReadImageFile(char const*)
int R2Grid::
ReadImageFile(const char *filename)
{
  // Allocate image
  R2Image *image = new R2Image();
  if (!image) {
    RNFail("Unable to allocate image for %s\n", filename);
    return 0;
  }

  // Read image
  if (!image->Read(filename)) { 
    // RNFail("Unable to read image from %s\n", filename);
    delete image; 
    return 0; 
  }

  // Fill in grid info
  grid_resolution[0] = image->Width();
  grid_resolution[1] = image->Height();
  grid_row_size = image->Width();
  grid_size = image->Width() * image->Height();
  world_to_grid_scale_factor = 1;
  world_to_grid_transform = R2identity_affine;
  grid_to_world_transform = R2identity_affine;
  if (grid_values) delete [] grid_values;
  grid_values = new RNScalar [ grid_size ];
  for (int j = 0; j < image->Height(); j++) {
    for (int i = 0; i < image->Width(); i++) {
      SetGridValue(i, j, image->PixelRGB(i, j).Luminance());
    }
  }

  // Delete image
  delete image;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movq %rdi, %r14
movl $0x18, %edi
callq 0xe440
movq %rax, %rbx
movq %rax, %rdi
callq 0x69724
movq %rbx, %rdi
movq %r15, %rsi
callq 0x69748
testl %eax, %eax
je 0x62ed9
movl (%rbx), %eax
movl %eax, 0xc0(%r14)
movl 0x4(%rbx), %ecx
movl %ecx, 0xc4(%r14)
movl %eax, 0xc8(%r14)
imull %eax, %ecx
movl %ecx, 0xcc(%r14)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xb0(%r14)
leaq 0x60(%r14), %rdi
leaq 0x485188(%rip), %r12    # 0x4e7f58
leaq 0x8(%r12), %r15
movq %r15, %rsi
callq 0x67944
movl 0x50(%r12), %eax
movl %eax, 0xa8(%r14)
leaq 0x8(%r14), %rdi
movq %r15, %rsi
callq 0x67944
movl 0x50(%r12), %eax
movl %eax, 0x50(%r14)
movq 0xb8(%r14), %rdi
testq %rdi, %rdi
je 0x62e0f
callq 0xe5b0
movslq 0xcc(%r14), %rax
leaq (,%rax,8), %rcx
testq %rax, %rax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0xe030
movq %rax, 0xb8(%r14)
movl $0x1, %ebp
cmpl $0x0, 0x4(%rbx)
jle 0x62edb
xorl %ebp, %ebp
movq %rsp, %r15
cmpl $0x0, (%rbx)
jle 0x62ec7
movslq %ebp, %r12
xorl %r13d, %r13d
movq %r15, %rdi
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
callq 0x69cbc
movsd 0x46488(%rip), %xmm2    # 0xa92f8
movsd 0x46478(%rip), %xmm1    # 0xa92f0
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd (%rsp), %xmm1
mulsd %xmm2, %xmm1
movsd 0x4646d(%rip), %xmm2    # 0xa9300
addsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0xb8(%r14), %rax
movslq 0xc8(%r14), %rcx
imulq %r12, %rcx
addq %r13, %rcx
movsd %xmm0, (%rax,%rcx,8)
incq %r13
cmpl (%rbx), %r13d
jl 0x62e57
incl %ebp
cmpl 0x4(%rbx), %ebp
jl 0x62e4c
movl $0x1, %ebp
jmp 0x62edb
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x69cae
movl $0x18, %esi
movq %rbx, %rdi
callq 0xe450
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x18, %esi
movq %rbx, %rdi
callq 0xe450
movq %r14, %rdi
callq 0xe7e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0xe4c0
testq %rax, %rax
je 0x62faa
movq %rax, %r15
leaq 0x44879(%rip), %rsi     # 0xa77ba
movl $0x4, %edx
movq %rax, %rdi
callq 0xe210
testl %eax, %eax
je 0x62fc0
leaq 0x46491(%rip), %rsi     # 0xa93ea
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x62fd0
leaq 0x46483(%rip), %rsi     # 0xa93f4
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x62fe0
leaq 0x44814(%rip), %rsi     # 0xa779d
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
movq %r14, %rdi
movq %rbx, %rsi
testl %eax, %eax
je 0x62ff0
popq %rbx
popq %r14
popq %r15
jmp 0x63366
leaq 0x46448(%rip), %rdi     # 0xa93f9
xorl %eax, %eax
callq 0x72a1e
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x62ffa
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x63150
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x632a6
popq %rbx
popq %r14
popq %r15
jmp 0x632fa
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Grid.cpp
// Function: gaps::R2Grid::WriteRAWFile(char const*) const
int R2Grid::
WriteRAWFile(const char *filename) const
{
  // Open file
  FILE *fp = fopen(filename, "wb");
  if (!fp) {
    RNFail("Unable to open raw image file %s", filename);
    return 0;
  }

  // Write header
  const unsigned int magic = 54321;
  unsigned int xres = (unsigned int) grid_resolution[0];
  unsigned int yres = (unsigned int) grid_resolution[1];
  unsigned int header[4] = { magic, xres, yres, 1 };
  if (fwrite(header, sizeof(unsigned int), 4, fp) != 4) {
    RNFail("Unable to header to raw image file %s", filename);
    return -1;
  }

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

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

  // Delete pixels
  delete [] pixels;

  // Close file
  fclose(fp);

  // Return success
  return grid_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x3fa6f(%rip), %rsi     # 0xa2a84
movq %rbx, %rdi
callq 0xe530
testq %rax, %rax
je 0x6310b
movq %rax, %r15
movq %rsp, %rdi
movl $0xd431, (%rdi)         # imm = 0xD431
movq 0xc0(%r14), %rax
movq %rax, 0x4(%rdi)
movl $0x1, 0xc(%rdi)
movl $0x4, %esi
movl $0x4, %edx
movq %r15, %rcx
callq 0xe8b0
cmpq $0x4, %rax
jne 0x63114
movslq 0xc8(%r14), %rax
leaq (,%rax,4), %rcx
testq %rax, %rax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0xe030
movq %rax, %r12
cmpl $0x0, 0xc4(%r14)
jle 0x630f2
xorl %r13d, %r13d
movslq 0xc0(%r14), %rdx
testq %rdx, %rdx
jle 0x630ca
movq 0xb8(%r14), %rax
movl %edx, %ecx
imull %r13d, %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cvtsd2ss (%rax,%rcx,8), %xmm0
movss %xmm0, (%r12,%rcx,4)
incq %rcx
cmpq %rcx, %rdx
jne 0x630b4
movl $0x4, %esi
movq %r12, %rdi
movq %r15, %rcx
callq 0xe8b0
movl 0xc0(%r14), %ecx
cmpq %rcx, %rax
jne 0x6312c
incl %r13d
cmpl 0xc4(%r14), %r13d
jl 0x63092
movq %r12, %rdi
callq 0xe5b0
movq %r15, %rdi
callq 0xe430
movl 0xcc(%r14), %ebp
jmp 0x6313f
leaq 0x46313(%rip), %rdi     # 0xa9425
jmp 0x63133
leaq 0x4632b(%rip), %rdi     # 0xa9446
movq %rbx, %rsi
xorl %eax, %eax
callq 0x72a1e
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x6313f
leaq 0x463b0(%rip), %rdi     # 0xa94e3
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x72a1e
movl %ebp, %eax
addq $0x18, %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/R2Grid.cpp
// Function: gaps::R2Grid::WritePFMFile(char const*) const
int R2Grid::
WritePFMFile(const char *filename) const
{
  // Open file
  FILE *fp = fopen(filename, "wb");
  if (!fp) {
    RNFail("Unable to open pfm image file %s", filename);
    return 0;
  }

  // Write header
  fprintf(fp, "Pf\n");
  fprintf(fp, "%d %d\n", grid_resolution[0], grid_resolution[1]);
  fprintf(fp, "-1.0\n");

  // Allocate pixels
  float *pixels = new float [ grid_resolution[0] ];

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

  // Delete pixels
  delete [] pixels;

  // Close file
  fclose(fp);

  // Return success
  return grid_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x3f91c(%rip), %rsi     # 0xa2a84
movq %rbx, %rdi
callq 0xe530
testq %rax, %rax
je 0x63278
movq %rax, %r15
leaq 0x46514(%rip), %rdi     # 0xa9697
movl $0x3, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0xe8b0
movl 0xc0(%r14), %edx
movl 0xc4(%r14), %ecx
leaq 0x3f890(%rip), %rsi     # 0xa2a3a
xorl %r13d, %r13d
movq %r15, %rdi
xorl %eax, %eax
callq 0xe670
leaq 0x464dd(%rip), %rdi     # 0xa969b
movl $0x5, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0xe8b0
movslq 0xc0(%r14), %rax
leaq (,%rax,4), %rcx
testq %rax, %rax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0xe030
movq %rax, %r12
cmpl $0x0, 0xc4(%r14)
jle 0x6325f
movslq 0xc0(%r14), %rdx
testq %rdx, %rdx
jle 0x63237
movq 0xb8(%r14), %rax
movl %edx, %ecx
imull %r13d, %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,8), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cvtsd2ss (%rax,%rcx,8), %xmm0
movss %xmm0, (%r12,%rcx,4)
incq %rcx
cmpq %rcx, %rdx
jne 0x63221
movl $0x4, %esi
movq %r12, %rdi
movq %r15, %rcx
callq 0xe8b0
movl 0xc0(%r14), %ecx
cmpq %rcx, %rax
jne 0x63281
incl %r13d
cmpl 0xc4(%r14), %r13d
jl 0x631ff
movq %r12, %rdi
callq 0xe5b0
movq %r15, %rdi
callq 0xe430
movl 0xcc(%r14), %ebp
jmp 0x63294
leaq 0x463f7(%rip), %rdi     # 0xa9676
jmp 0x63288
leaq 0x4625b(%rip), %rdi     # 0xa94e3
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x72a1e
movl %ebp, %eax
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/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:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x3f7cc(%rip), %rsi     # 0xa2a84
movq %rbx, %rdi
callq 0xe530
testq %rax, %rax
je 0x632e1
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x63dbc
movl %eax, %ebx
movq %r15, %rdi
callq 0xe430
movl %ebx, %eax
jmp 0x632f4
leaq 0x464a7(%rip), %rdi     # 0xa978f
movq %rbx, %rsi
xorl %eax, %eax
callq 0x72a1e
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x63336
movq %rsi, %r14
leaq 0x3f773(%rip), %rsi     # 0xa2a84
movq %r14, %rdi
callq 0xe530
movq %rax, %r15
testq %rax, %rax
jne 0x63340
leaq 0x3f095(%rip), %rdi     # 0xa23bd
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x72a1e
jmp 0x6335d
movq 0x81c33(%rip), %rax     # 0xe4f70
movq (%rax), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6374c
testl %eax, %eax
je 0x6335b
movl %eax, %ebx
movq %r15, %rdi
callq 0xe430
jmp 0x6335d
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
addq $0xc0, %rdi
movl $0x4, %esi
movl $0x2, %edx
movq %r14, %rcx
callq 0xe8b0
cmpq $0x2, %rax
jne 0x637df
leaq 0x60(%rbx), %rdi
movl $0x8, %esi
movl $0x9, %edx
movq %r14, %rcx
callq 0xe8b0
cmpq $0x9, %rax
jne 0x637e8
cmpl $0x0, 0xc4(%rbx)
jle 0x637d7
xorl %ebp, %ebp
movslq 0xc0(%rbx), %rdx
movslq %ebp, %rdi
imulq %rdx, %rdi
shlq $0x3, %rdi
addq 0xb8(%rbx), %rdi
movl $0x8, %esi
movq %r14, %rcx
callq 0xe8b0
movl 0xc0(%rbx), %ecx
cmpq %rcx, %rax
jne 0x637f1
incl %ebp
cmpl 0xc4(%rbx), %ebp
jl 0x6379c
movl 0xcc(%rbx), %ebx
jmp 0x63801
leaq 0x440dc(%rip), %rdi     # 0xa78c2
jmp 0x637f8
leaq 0x45f2b(%rip), %rdi     # 0xa971a
jmp 0x637f8
leaq 0x45f50(%rip), %rdi     # 0xa9748
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x72a1e
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x4857d(%rip), %rax     # 0xabd93
movq %rsi, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0xe8a0
testq %rax, %rax
je 0x63848
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6351c
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movq %r14, %rdi
callq 0xe430
jmp 0x63858
leaq 0x45f1e(%rip), %rdi     # 0xa976d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x72a1e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
callq 0xe490
testq %rax, %rax
je 0x63898
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6374c
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movq %r14, %rdi
callq 0xe430
jmp 0x638a8
leaq 0x45ece(%rip), %rdi     # 0xa976d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x72a1e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x47cf9(%rip), %rax     # 0xabd93
movq %rsi, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0xe8a0
testq %rax, %rax
je 0x640c9
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x638b2
movl %eax, %ebx
movq %r14, %rdi
callq 0xe430
movl %ebx, %eax
jmp 0x640d9
leaq 0x456db(%rip), %rdi     # 0xa97ab
xorl %eax, %eax
callq 0x72a1e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
callq 0xe490
testq %rax, %rax
je 0x64115
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x63dbc
movl %eax, %ebx
movq %r14, %rdi
callq 0xe430
movl %ebx, %eax
jmp 0x64125
leaq 0x4568f(%rip), %rdi     # 0xa97ab
xorl %eax, %eax
callq 0x72a1e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
testq %rsi, %rsi
jne 0x6414e
movq 0x80e25(%rip), %rax     # 0xe4f70
movq (%rax), %r14
cmpl $0x0, 0xc4(%rbx)
jle 0x641ba
xorl %r12d, %r12d
leaq 0x443e6(%rip), %r15     # 0xa8547
cmpl $0x0, 0xc0(%rbx)
jle 0x641a1
movslq %r12d, %r13
xorl %ebp, %ebp
movq 0xb8(%rbx), %rax
movslq 0xc8(%rbx), %rcx
imulq %r13, %rcx
addq %rbp, %rcx
movsd (%rax,%rcx,8), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0xe670
incq %rbp
cmpl 0xc0(%rbx), %ebp
jl 0x6416f
movl $0xa, %edi
movq %r14, %rsi
callq 0xe5a0
incl %r12d
cmpl 0xc4(%rbx), %r12d
jl 0x64161
movl 0xcc(%rbx), %eax
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/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::R2Polygon(gaps::R2Polygon const&)
R2Polygon::
R2Polygon(const R2Polygon& polygon) 
  : points(NULL),
    npoints(polygon.npoints),
    bbox(polygon.bbox),
    clockwise(polygon.clockwise)
{
  // Copy points
  if (polygon.npoints > 0) {
    points = new R2Point [ npoints ];
    for (int i = 0; i < npoints; i++) {
      points[i] = polygon.points[i];
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
callq 0x66990
leaq 0x800c3(%rip), %rax     # 0xe4310
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movl 0x10(%r15), %eax
movl %eax, 0x10(%rbx)
leaq 0x18(%rbx), %rdi
leaq 0x18(%r15), %rsi
movq %rdi, (%rsp)
callq 0x65ff8
movl 0x40(%r15), %eax
movl %eax, 0x40(%rbx)
cmpl $0x0, 0x10(%r15)
jle 0x642ef
movslq 0x10(%rbx), %r14
movq %r14, %rbp
shlq $0x4, %rbp
testq %r14, %r14
movq $-0x1, %r12
cmovnsq %rbp, %r12
movq %r12, %rdi
callq 0xe030
movq %rax, %r13
testl %r14d, %r14d
je 0x642bc
xorl %r14d, %r14d
leaq (%r14,%r13), %rdi
callq 0x68e2c
addq $0x10, %r14
cmpq %r14, %rbp
jne 0x642aa
movq %r13, 0x8(%rbx)
cmpl $0x0, 0x10(%rbx)
jle 0x642ef
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x8(%r15), %rsi
addq %r12, %rsi
movq 0x8(%rbx), %rdi
addq %r12, %rdi
callq 0x68f66
incq %r13
movslq 0x10(%rbx), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x642cc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x64305
movq %rax, %r15
jmp 0x64321
movq %rax, %r15
jmp 0x64318
movq %rax, %r15
movq %r13, %rdi
movq %r12, %rsi
callq 0xe8c0
movq (%rsp), %rdi
callq 0x6699c
movq %rbx, %rdi
callq 0x6699c
movq %r15, %rdi
callq 0xe7e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::R2Polygon(gaps::RNArray<gaps::R2Point*> const&, int)
R2Polygon::
R2Polygon(const RNArray<R2Point *>& p, RNBoolean clockwise)
  : points(NULL),
    npoints(p.NEntries()),
    bbox(R2null_box),
    clockwise(clockwise)
{
  // Copy points
  if (npoints > 0) {
    points = new R2Point [ npoints ];
    for (int i = 0; i < npoints; i++) {
      points[i] = *(p[i]);
      bbox.Union(*(p[i]));
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
callq 0x66990
leaq 0x7ffbf(%rip), %rax     # 0xe4310
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movl 0xc(%r15), %eax
movl %eax, 0x10(%rbx)
leaq 0x18(%rbx), %r14
leaq 0x483b6a(%rip), %rsi    # 0x4e7ed8
movq %r14, %rdi
callq 0x65ff8
movl %ebp, 0x40(%rbx)
movslq 0x10(%rbx), %r12
testq %r12, %r12
jle 0x643e9
shlq $0x4, %r12
movq %r12, %rdi
callq 0xe030
movq %rax, %r13
xorl %ebp, %ebp
movq %r13, %rdi
addq %rbp, %rdi
callq 0x68e2c
addq $0x10, %rbp
cmpq %rbp, %r12
jne 0x64393
movq %r13, 0x8(%rbx)
cmpl $0x0, 0x10(%rbx)
jle 0x643e9
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%r15), %rax
movq (%rax,%r13,8), %rsi
movq 0x8(%rbx), %rdi
addq %r12, %rdi
callq 0x68f66
movq (%r15), %rax
movq (%rax,%r13,8), %rsi
movq %r14, %rdi
callq 0x66714
incq %r13
movslq 0x10(%rbx), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x643b7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6440f
movq %rax, %r15
jmp 0x6441a
movq %rax, %r15
movq %r13, %rdi
movq %r12, %rsi
callq 0xe8c0
jmp 0x64412
movq %rax, %r15
movq %r14, %rdi
callq 0x6699c
movq %rbx, %rdi
callq 0x6699c
movq %r15, %rdi
callq 0xe7e0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::R2Polygon(gaps::R2Point const*, int, int)
R2Polygon::
R2Polygon(const R2Point *p, int np, RNBoolean clockwise)
  : points(NULL),
    npoints(np),
    bbox(R2null_box),
    clockwise(clockwise)
{
  // Copy points
  if (npoints > 0) {
    points = new R2Point [ npoints ];
    for (int i = 0; i < npoints; i++) {
      points[i] = p[i];
      bbox.Union(p[i]);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
callq 0x66990
leaq 0x7fec4(%rip), %rax     # 0xe4310
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movl %r14d, 0x10(%rbx)
leaq 0x18(%rbx), %r14
leaq 0x483a72(%rip), %rsi    # 0x4e7ed8
movq %r14, %rdi
callq 0x65ff8
movl %ebp, 0x40(%rbx)
movslq 0x10(%rbx), %r12
testq %r12, %r12
jle 0x644dc
shlq $0x4, %r12
movq %r12, %rdi
callq 0xe030
movq %rax, %r13
xorl %ebp, %ebp
movq %r13, %rdi
addq %rbp, %rdi
callq 0x68e2c
addq $0x10, %rbp
cmpq %rbp, %r12
jne 0x6448b
movq %r13, 0x8(%rbx)
cmpl $0x0, 0x10(%rbx)
jle 0x644dc
xorl %r13d, %r13d
xorl %ebp, %ebp
leaq (%r15,%r13), %r12
movq 0x8(%rbx), %rdi
addq %r13, %rdi
movq %r12, %rsi
callq 0x68f66
movq %r14, %rdi
movq %r12, %rsi
callq 0x66714
incq %rbp
movslq 0x10(%rbx), %rax
addq $0x10, %r13
cmpq %rax, %rbp
jl 0x644ae
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x64502
movq %rax, %r15
jmp 0x6450d
movq %rax, %r15
movq %r13, %rdi
movq %r12, %rsi
callq 0xe8c0
jmp 0x64505
movq %rax, %r15
movq %r14, %rdi
callq 0x6699c
movq %rbx, %rdi
callq 0x6699c
movq %r15, %rdi
callq 0xe7e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::ClosestPoint(gaps::R2Point const&) const
const R2Point R2Polygon::
ClosestPoint(const R2Point& point) const
{
  // Return closest point on polygon
  R2Point closest_point(0,0);
  RNLength closest_squared_distance = FLT_MAX;
  for (int i = 0; i < npoints; i++) {
    const R2Point& position = points[i];
    RNLength squared_distance = R2SquaredDistance(point, position);
    if (squared_distance < closest_squared_distance) {
      closest_point = position;
      closest_squared_distance = squared_distance;
    }
  }

  // Return closest point
  return closest_point;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0x68e2e
cmpl $0x0, 0x10(%r15)
jle 0x645df
movsd 0x3daac(%rip), %xmm0    # 0xa2040
movsd %xmm0, (%rsp)
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x8(%r15), %r12
addq %r13, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6d8e7
movapd %xmm0, %xmm1
movsd (%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x645cf
movq %r14, %rdi
movq %r12, %rsi
movsd %xmm1, (%rsp)
callq 0x68f66
incq %rbp
movslq 0x10(%r15), %rax
addq $0x10, %r13
cmpq %rax, %rbp
jl 0x6459e
movq %r14, %rax
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/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::Area() const
const RNArea R2Polygon::
Area(void) const
{
  // Check number of points
  if (npoints < 3) return 0;

  // Compute twicearea by sum of cross products
  RNLength sum = 0;
  R2Point *p1 = &points[npoints-1];
  for (int i = 0; i < npoints; i++) {
    R2Point *p2 = &points[i];
    sum += p1->X()*p2->Y() - p2->X()*p1->Y();
    p1 = p2;
  }

  // Compute area
  RNArea area = 0.5 * sum;

  // Flip if clockwise
  if (clockwise) area = -area;

  // Return area
  return area;
}

// Assembly:
movslq 0x10(%rdi), %rax
xorpd %xmm0, %xmm0
cmpq $0x3, %rax
jl 0x64676
movq 0x8(%rdi), %rdx
movq %rax, %rcx
shlq $0x4, %rcx
addq %rdx, %rcx
addq $-0x10, %rcx
movsd 0x8(%rcx), %xmm1
mulsd (%rdx), %xmm1
movsd (%rcx), %xmm2
mulsd 0x8(%rdx), %xmm2
subsd %xmm1, %xmm2
addsd %xmm2, %xmm0
movq %rdx, %rcx
addq $0x10, %rdx
decq %rax
jne 0x6463a
mulsd 0x3d9c8(%rip), %xmm0    # 0xa2030
cmpl $0x0, 0x40(%rdi)
je 0x64676
xorpd 0x3d9aa(%rip), %xmm0    # 0xa2020
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::Convexity() const
const RNArea R2Polygon::
Convexity(void) const
{
  // Check number of points
  if (npoints < 3) return 0;

  // Compute area
  RNArea area = Area();

  // Compute area of convex hull
  R2Polygon convex_hull = ConvexHull();
  RNArea convex_hull_area = convex_hull.Area();
  if (convex_hull_area == 0) return 0;

  // Return ratio of areas
  return area / convex_hull_area;
}

// Assembly:
xorpd %xmm0, %xmm0
cmpl $0x3, 0x10(%rdi)
jl 0x646df
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x30(%rax)
movapd %xmm0, (%rsp)
movq (%rbx), %rax
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq *0x68(%rax)
movq %r14, %rdi
callq 0x6461a
movapd (%rsp), %xmm1
divsd %xmm0, %xmm1
xorpd %xmm2, %xmm2
cmpeqsd %xmm0, %xmm2
andnpd %xmm1, %xmm2
movapd %xmm2, (%rsp)
movq %r14, %rdi
callq 0x6451e
movapd (%rsp), %xmm0
addq $0x58, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::Perimeter() const
const RNLength R2Polygon::
Perimeter(void) const
{
  // Check number of points
  if (npoints < 2) return 0;

  // Compute perimeter
  RNLength sum = 0;
  R2Point *p1 = &points[npoints-1];
  for (int i = 0; i < npoints; i++) {
    R2Point *p2 = &points[i];
    sum += R2Distance(*p1, *p2);
    p1 = p2;
  }

  // Return perimeter
  return sum;
}

// Assembly:
movslq 0x10(%rdi), %rax
xorpd %xmm0, %xmm0
cmpq $0x2, %rax
jl 0x6475e
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x10(%rdi)
jle 0x64753
movq 0x8(%rbx), %rcx
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
addq $-0x10, %rdi
xorpd %xmm0, %xmm0
xorl %r15d, %r15d
xorl %r12d, %r12d
movsd %xmm0, (%rsp)
movq 0x8(%rbx), %r14
addq %r15, %r14
movq %r14, %rsi
callq 0x6d2e7
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r12
movslq 0x10(%rbx), %rax
addq $0x10, %r15
movq %r14, %rdi
cmpq %rax, %r12
jl 0x64719
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::Centroid() const
const R2Point R2Polygon::
Centroid(void) const
{
  // Check number of points
  if (npoints == 0) return R2zero_point;

  // Return centroid
  R2Point sum = R2zero_point;
  for (int i = 0; i < npoints; i++) sum += points[i];
  return sum / npoints;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x10(%rsi)
je 0x647c9
movq %rsi, %r14
leaq 0x483b00(%rip), %rsi    # 0x4e8280
movq %rsp, %rdi
callq 0x68e38
movl 0x10(%r14), %eax
testl %eax, %eax
jle 0x647b8
xorl %r12d, %r12d
movq %rsp, %r15
xorl %r13d, %r13d
movq 0x8(%r14), %rsi
addq %r12, %rsi
movq %r15, %rdi
callq 0x68f7c
incq %r13
movslq 0x10(%r14), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x64799
cvtsi2sd %eax, %xmm0
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x690e9
jmp 0x647d8
leaq 0x483ab0(%rip), %rsi    # 0x4e8280
movq %rbx, %rdi
callq 0x68e38
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::Empty()
void R2Polygon::
Empty(void)
{
    // Empty polygon
    if (points) delete [] points;
    points = NULL;
    npoints = 0;
    bbox = R2null_box;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x65537
callq 0xe5b0
movq $0x0, 0x8(%rbx)
movl $0x0, 0x10(%rbx)
leaq 0x20(%rbx), %rdi
leaq 0x482987(%rip), %r14    # 0x4e7ed8
leaq 0x8(%r14), %rsi
callq 0x68f66
addq $0x30, %rbx
addq $0x18, %r14
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x68f66
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::RemovePoint(int)
void R2Polygon::
RemovePoint(int k)
{
    // Copy points down one
    npoints--;
    for (int i = k; k < npoints; i++) {
      points[i] = points[i+1];
    }

    // Update bounding box
    bbox = R2null_box;
    for (int i = 0; i < npoints; i++) {
        bbox.Union(points[i]);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0x10(%rdi), %eax
decl %eax
movl %eax, 0x10(%rdi)
cmpl %esi, %eax
jle 0x655b1
movl %esi, %ebp
movslq %esi, %r14
shlq $0x4, %r14
movq 0x8(%rbx), %rdi
leaq (%rdi,%r14), %rsi
addq $0x10, %rsi
addq %r14, %rdi
callq 0x68f66
addq $0x10, %r14
cmpl %ebp, 0x10(%rbx)
jg 0x65594
leaq 0x20(%rbx), %rdi
leaq 0x48291c(%rip), %r14    # 0x4e7ed8
leaq 0x8(%r14), %rsi
callq 0x68f66
leaq 0x30(%rbx), %rdi
addq $0x18, %r14
movq %r14, %rsi
callq 0x68f66
cmpl $0x0, 0x10(%rbx)
jle 0x65604
leaq 0x18(%rbx), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x8(%rbx), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x66714
incq %r12
movslq 0x10(%rbx), %rax
addq $0x10, %r15
cmpq %rax, %r12
jl 0x655e5
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::InsertPoint(int, gaps::R2Point const&)
void R2Polygon::
InsertPoint(int k, const R2Point& position)
{
    // Add point in position k, moving others starting at k+1 up to make room
    R2Point *p = new R2Point [npoints+1];
    for (int i = 0; i < k; i++) p[i] = points[i];
    p[k] = position;
    for (int i = k; i < npoints; i++) p[i+1] = points[i];
    if (points) delete [] points;
    points = p;
    npoints++;
    
    // Update bounding box
    bbox.Union(position);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
movl %esi, %ebp
movq %rdi, %r14
movl 0x10(%rdi), %ebx
leal 0x1(%rbx), %eax
movslq %eax, %r13
shlq $0x4, %r13
cmpl $-0x1, %ebx
movq $-0x1, %r12
cmovgeq %r13, %r12
movq %r12, %rdi
callq 0xe030
movq %rax, %r15
incl %ebx
je 0x65660
xorl %ebx, %ebx
leaq (%r15,%rbx), %rdi
callq 0x68e2c
addq $0x10, %rbx
cmpq %rbx, %r13
jne 0x6564e
testl %ebp, %ebp
jle 0x65687
movl %ebp, %r12d
shlq $0x4, %r12
xorl %r13d, %r13d
movq 0x8(%r14), %rsi
addq %r13, %rsi
leaq (%r15,%r13), %rdi
callq 0x68f66
addq $0x10, %r13
cmpq %r13, %r12
jne 0x6566e
movslq %ebp, %r12
movq %r12, %r13
shlq $0x4, %r13
leaq (%r15,%r13), %rdi
movq (%rsp), %rbx
movq %rbx, %rsi
callq 0x68f66
cmpl %ebp, 0x10(%r14)
jle 0x656d0
movq %r15, %rbp
addq $0x10, %rbp
movq 0x8(%r14), %rsi
addq %r13, %rsi
incq %r12
movq %rbp, %rdi
addq %r13, %rdi
callq 0x68f66
movslq 0x10(%r14), %rax
addq $0x10, %r13
cmpq %rax, %r12
jl 0x656ae
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x656de
callq 0xe5b0
movq %r15, 0x8(%r14)
incl 0x10(%r14)
addq $0x18, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x66714
movq %rax, %rbx
movq %r15, %rdi
movq %r12, %rsi
callq 0xe8c0
movq %rbx, %rdi
callq 0xe7e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::SetPoint(int, gaps::R2Point const&)
void R2Polygon::
SetPoint(int k, const R2Point& position)
{
    // Set point
    points[k] = position;

    // Update bounding box
    bbox = R2null_box;
    for (int i = 0; i < npoints; i++) {
        bbox.Union(points[i]);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq %esi, %rdi
shlq $0x4, %rdi
addq 0x8(%rbx), %rdi
movq %rdx, %rsi
callq 0x68f66
leaq 0x20(%rbx), %rdi
leaq 0x482795(%rip), %r14    # 0x4e7ed8
leaq 0x8(%r14), %rsi
callq 0x68f66
leaq 0x30(%rbx), %rdi
addq $0x18, %r14
movq %r14, %rsi
callq 0x68f66
cmpl $0x0, 0x10(%rbx)
jle 0x6578b
leaq 0x18(%rbx), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x8(%rbx), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x66714
incq %r12
movslq 0x10(%rbx), %rax
addq $0x10, %r15
cmpq %rax, %r12
jl 0x6576c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::Clip(gaps::R2Box const&)
void R2Polygon::
Clip(const R2Box& box) 
{
  // Clip to each side of box
  if (npoints == 0) return;
  Clip(R2Line(1, 0, -(box.XMin())));
  if (npoints == 0) return;
  Clip(R2Line(-1, 0, box.XMax()));
  if (npoints == 0) return;
  Clip(R2Line(0, 1, -(box.YMin())));
  if (npoints == 0) return;
  Clip(R2Line(0, -1, box.YMax()));
}

// Assembly:
cmpl $0x0, 0x10(%rdi)
je 0x65c57
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movsd 0x8(%rsi), %xmm2
xorps 0x3c491(%rip), %xmm2    # 0xa2020
leaq 0x8(%rsp), %r15
movsd 0x3c49c(%rip), %xmm0    # 0xa2038
xorps %xmm1, %xmm1
movq %r15, %rdi
callq 0x68896
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *0x78(%rax)
cmpl $0x0, 0x10(%rbx)
je 0x65c4e
movsd 0x18(%r14), %xmm2
leaq 0x8(%rsp), %r15
movsd 0x3c478(%rip), %xmm0    # 0xa2048
xorps %xmm1, %xmm1
movq %r15, %rdi
callq 0x68896
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *0x78(%rax)
cmpl $0x0, 0x10(%rbx)
je 0x65c4e
movsd 0x10(%r14), %xmm2
xorps 0x3c426(%rip), %xmm2    # 0xa2020
leaq 0x8(%rsp), %r15
movsd 0x3c431(%rip), %xmm1    # 0xa2038
xorps %xmm0, %xmm0
movq %r15, %rdi
callq 0x68896
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *0x78(%rax)
cmpl $0x0, 0x10(%rbx)
je 0x65c4e
movsd 0x20(%r14), %xmm2
leaq 0x8(%rsp), %r14
movsd 0x3c411(%rip), %xmm1    # 0xa2048
xorps %xmm0, %xmm0
movq %r14, %rdi
callq 0x68896
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x78(%rax)
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2Polygon.cpp
// Function: gaps::R2Polygon::Transform(gaps::R2Transformation const&)
void R2Polygon::
Transform(const R2Transformation& transformation) 
{
  // Transform points
  bbox = R2null_box;
  for (int i = 0; i < npoints; i++) {
    points[i].Transform(transformation);
    bbox.Union(points[i]);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
addq $0x20, %rdi
leaq 0x482266(%rip), %r15    # 0x4e7ed8
leaq 0x8(%r15), %rsi
callq 0x68f66
leaq 0x30(%r14), %rdi
addq $0x18, %r15
movq %r15, %rsi
callq 0x68f66
cmpl $0x0, 0x10(%r14)
jle 0x65cca
leaq 0x18(%r14), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x8(%r14), %rdi
addq %r12, %rdi
movq %rbx, %rsi
callq 0x68f42
movq 0x8(%r14), %rsi
addq %r12, %rsi
movq %r15, %rdi
callq 0x66714
incq %r13
movslq 0x10(%r14), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x65c9c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq