LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::GLVertexTextureCoordBufferObject() const
unsigned int R3Mesh::
GLVertexTextureCoordBufferObject(void) const
{
  // Check if nothing to be done
  if (NVertices() == 0) return 0;

  // Update texcoord buffer
  if (vbo_vertex_texcoord_buffer == 0) {
    glGenBuffers(1, (GLuint *) &vbo_vertex_texcoord_buffer);
    if (vbo_vertex_texcoord_buffer > 0) {
      std::vector<GLfloat> texcoords;
      for (int i = 0; i < NVertices(); i++) {
        R3MeshVertex *vertex = Vertex(i);
        const R2Point& texcoord = VertexTextureCoords(vertex);
        texcoords.push_back(texcoord.X());
        texcoords.push_back(texcoord.Y());
      }
      glBindBuffer(GL_ARRAY_BUFFER, vbo_vertex_texcoord_buffer);
      glBufferData(GL_ARRAY_BUFFER, texcoords.size() * sizeof(GLfloat), &texcoords[0], GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER, 0);
    }
  }

  // Return texcoord buffer identifier
  return vbo_vertex_texcoord_buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %eax, %eax
cmpl $0x0, 0x14(%rdi)
je 0x17d13
movq %rdi, %r14
movl 0x6c(%rdi), %eax
testl %eax, %eax
jne 0x17d13
leaq 0x6c(%r14), %rbx
movq 0xc233d(%rip), %rax     # 0xd9f98
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq *(%rax)
cmpl $0x0, (%rbx)
movl $0x0, %eax
je 0x17d13
leaq 0x10(%rsp), %r15
andq $0x0, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
xorl %r13d, %r13d
leaq 0xc(%rsp), %r12
movslq 0x14(%r14), %rax
cmpq %rax, %r13
jge 0x17ccc
movq 0x8(%r14), %rax
movq (%rax,%r13,8), %rbp
cvtsd2ss 0x48(%rbp), %xmm0
movss %xmm0, 0xc(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x231c6
cvtsd2ss 0x50(%rbp), %xmm0
movss %xmm0, 0xc(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x231c6
incq %r13
jmp 0x17c8a
movq 0xc22dd(%rip), %r14     # 0xd9fb0
movl (%rbx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *(%r14)
movq 0xc22e4(%rip), %rax     # 0xd9fc8
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rsi
subq %rdx, %rsi
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e4, %ecx           # imm = 0x88E4
callq *(%rax)
movl $0x8892, %edi           # imm = 0x8892
xorl %esi, %esi
callq *(%r14)
leaq 0x10(%rsp), %rdi
callq 0x23192
movl (%rbx), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17d26
jmp 0x17d26
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x23192
movq %rbx, %rdi
callq 0xe810
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::GLVertexRgbColorBufferObject() const
unsigned int R3Mesh::
GLVertexRgbColorBufferObject(void) const
{
  // Check if nothing to be done
  if (NVertices() == 0) return 0;

  // Update rgb color buffer
  if (vbo_vertex_rgb_color_buffer == 0) {
    glGenBuffers(1, (GLuint *) &vbo_vertex_rgb_color_buffer);
    if (vbo_vertex_rgb_color_buffer > 0) {
      std::vector<GLubyte> rgb_colors;
      for (int i = 0; i < NVertices(); i++) {
        R3MeshVertex *vertex = Vertex(i);
        const RNRgb& rgb_color = VertexColor(vertex);
        rgb_colors.push_back(255.0 * rgb_color.R());
        rgb_colors.push_back(255.0 * rgb_color.G());
        rgb_colors.push_back(255.0 * rgb_color.B());
        rgb_colors.push_back(255);
      }
      glBindBuffer(GL_ARRAY_BUFFER, vbo_vertex_rgb_color_buffer);
      glBufferData(GL_ARRAY_BUFFER, rgb_colors.size() * sizeof(GLubyte), &rgb_colors[0], GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER, 0);
    }
  }

  // Return rgb color buffer identifier
  return vbo_vertex_rgb_color_buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %eax, %eax
cmpl $0x0, 0x14(%rdi)
je 0x17e80
movq %rdi, %r14
movl 0x70(%rdi), %eax
testl %eax, %eax
jne 0x17e80
leaq 0x70(%r14), %rbx
movq 0xc2229(%rip), %rax     # 0xd9f98
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq *(%rax)
cmpl $0x0, (%rbx)
movl $0x0, %eax
je 0x17e80
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %r15
andq $0x0, 0x10(%r15)
movapd %xmm0, (%r15)
xorl %r13d, %r13d
movsd 0x7b475(%rip), %xmm1    # 0x93218
leaq 0xf(%rsp), %r12
movslq 0x14(%r14), %rax
cmpq %rax, %r13
jge 0x17e39
movq 0x8(%r14), %rax
movq (%rax,%r13,8), %rbp
movsd 0x58(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movb %al, 0xf(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x23370
movsd 0x60(%rbp), %xmm0
mulsd 0x7b432(%rip), %xmm0    # 0x93218
cvttsd2si %xmm0, %eax
movb %al, 0xf(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x23370
movsd 0x68(%rbp), %xmm0
mulsd 0x7b412(%rip), %xmm0    # 0x93218
cvttsd2si %xmm0, %eax
movb %al, 0xf(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x23370
movb $-0x1, 0xf(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x23370
incq %r13
movsd 0x7b3e4(%rip), %xmm1    # 0x93218
jmp 0x17da8
movq 0xc2170(%rip), %r14     # 0xd9fb0
movl (%rbx), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *(%r14)
movq 0xc2177(%rip), %rax     # 0xd9fc8
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rsi
subq %rdx, %rsi
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e4, %ecx           # imm = 0x88E4
callq *(%rax)
movl $0x8892, %edi           # imm = 0x8892
xorl %esi, %esi
callq *(%r14)
leaq 0x10(%rsp), %rdi
callq 0x23344
movl (%rbx), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17e97
jmp 0x17e97
jmp 0x17e97
jmp 0x17e97
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x23344
movq %rbx, %rdi
callq 0xe810
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::GLVertexPickColorBufferObject() const
unsigned int R3Mesh::
GLVertexPickColorBufferObject(void) const
{
  // Check if nothing to be done
  if (NVertices() == 0) return 0;

  // Update pick color buffer
  if (vbo_vertex_pick_color_buffer == 0) {
    glGenBuffers(1, (GLuint *) &vbo_vertex_pick_color_buffer);
    if (vbo_vertex_pick_color_buffer > 0) {
      std::vector<GLubyte> pick_colors;
      for (int i = 0; i < NVertices(); i++) {
        unsigned char pick_color[4];
        EncodePickColor(i, 255, pick_color);
        pick_colors.push_back(pick_color[0]);
        pick_colors.push_back(pick_color[1]);
        pick_colors.push_back(pick_color[2]);
        pick_colors.push_back(pick_color[3]);
      }
      glBindBuffer(GL_ARRAY_BUFFER, vbo_vertex_pick_color_buffer);
      glBufferData(GL_ARRAY_BUFFER, pick_colors.size() * sizeof(GLubyte), &pick_colors[0], GL_STATIC_DRAW);
      glBindBuffer(GL_ARRAY_BUFFER, 0);
    }
  }

  // Return pick color buffer identifier
  return vbo_vertex_pick_color_buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %eax, %eax
cmpl $0x0, 0x14(%rdi)
je 0x17fb2
movq %rdi, %r14
movl 0x74(%rdi), %eax
testl %eax, %eax
jne 0x17fb2
leaq 0x74(%r14), %rbx
movq 0xc20b9(%rip), %rax     # 0xd9f98
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq *(%rax)
movq %rbx, 0x8(%rsp)
cmpl $0x0, (%rbx)
movl $0x0, %eax
je 0x17fb2
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x6(%rsp), %r13
xorl %ebp, %ebp
leaq 0x7(%rsp), %rbx
leaq 0x4(%rsp), %r12
cmpl 0x14(%r14), %ebp
jge 0x17f63
movl %ebp, %edi
movl $0xff, %esi
movq %r12, %rdx
callq 0x65eb6
movq %r15, %rdi
movq %r12, %rsi
callq 0x21c1e
movq %r15, %rdi
leaq 0x5(%rsp), %rsi
callq 0x21c1e
movq %r15, %rdi
movq %r13, %rsi
callq 0x21c1e
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21c1e
incl %ebp
jmp 0x17f1c
movq 0xc2046(%rip), %rbx     # 0xd9fb0
movq 0x8(%rsp), %rax
movl (%rax), %esi
movl $0x8892, %edi           # imm = 0x8892
callq *(%rbx)
movq 0xc2049(%rip), %rax     # 0xd9fc8
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rsi
subq %rdx, %rsi
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e4, %ecx           # imm = 0x88E4
callq *(%rax)
movl $0x8892, %edi           # imm = 0x8892
xorl %esi, %esi
callq *(%rbx)
leaq 0x10(%rsp), %rdi
callq 0x23344
movq 0x8(%rsp), %rax
movl (%rax), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17fc3
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x23344
movq %rbx, %rdi
callq 0xe810
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::InvalidateGLBufferObjects()
void R3Mesh::
InvalidateGLBufferObjects(void)
{
  // Delete face buffers
  if (vbo_face_position_buffer > 0) glDeleteBuffers(1, &vbo_face_position_buffer);
  if (vbo_face_normal_buffer > 0) glDeleteBuffers(1, &vbo_face_normal_buffer);
  if (vbo_face_texcoord_buffer > 0) glDeleteBuffers(1, &vbo_face_texcoord_buffer);
  if (vbo_face_rgb_color_buffer > 0) glDeleteBuffers(1, &vbo_face_rgb_color_buffer);
  if (vbo_face_pick_color_buffer > 0) glDeleteBuffers(1, &vbo_face_pick_color_buffer);

  // Delete vertex buffers
  if (vbo_vertex_position_buffer > 0) glDeleteBuffers(1, &vbo_vertex_position_buffer);
  if (vbo_vertex_normal_buffer > 0) glDeleteBuffers(1, &vbo_vertex_normal_buffer);
  if (vbo_vertex_texcoord_buffer > 0) glDeleteBuffers(1, &vbo_vertex_texcoord_buffer);
  if (vbo_vertex_rgb_color_buffer > 0) glDeleteBuffers(1, &vbo_vertex_rgb_color_buffer);
  if (vbo_vertex_pick_color_buffer > 0) glDeleteBuffers(1, &vbo_vertex_pick_color_buffer);

  // Zero out face buffer identifiers
  vbo_face_position_buffer = 0;
  vbo_face_normal_buffer = 0;
  vbo_face_texcoord_buffer = 0;
  vbo_face_rgb_color_buffer = 0;
  vbo_face_pick_color_buffer = 0;

  // Zero out vertex buffer identifiers
  vbo_vertex_position_buffer = 0;
  vbo_vertex_normal_buffer = 0;
  vbo_vertex_texcoord_buffer = 0;
  vbo_vertex_rgb_color_buffer = 0;
  vbo_vertex_pick_color_buffer = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x50(%rdi), %rbx
cmpl $0x0, 0x50(%rdi)
je 0x17ff8
movq 0xc1fe8(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq *(%rax)
cmpl $0x0, 0x54(%r14)
je 0x1800f
leaq 0x54(%r14), %rsi
movq 0xc1fce(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
callq *(%rax)
cmpl $0x0, 0x58(%r14)
je 0x18026
leaq 0x58(%r14), %rsi
movq 0xc1fb7(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
callq *(%rax)
cmpl $0x0, 0x5c(%r14)
je 0x1803d
leaq 0x5c(%r14), %rsi
movq 0xc1fa0(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
callq *(%rax)
cmpl $0x0, 0x60(%r14)
je 0x18054
leaq 0x60(%r14), %rsi
movq 0xc1f89(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
callq *(%rax)
cmpl $0x0, 0x64(%r14)
je 0x1806b
leaq 0x64(%r14), %rsi
movq 0xc1f72(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
callq *(%rax)
cmpl $0x0, 0x68(%r14)
je 0x18082
leaq 0x68(%r14), %rsi
movq 0xc1f5b(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
callq *(%rax)
cmpl $0x0, 0x6c(%r14)
je 0x18099
leaq 0x6c(%r14), %rsi
movq 0xc1f44(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
callq *(%rax)
cmpl $0x0, 0x70(%r14)
je 0x180b0
leaq 0x70(%r14), %rsi
movq 0xc1f2d(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
callq *(%rax)
cmpl $0x0, 0x74(%r14)
je 0x180ca
addq $0x74, %r14
movq 0xc1f16(%rip), %rax     # 0xd9fd8
pushq $0x1
popq %rdi
movq %r14, %rsi
callq *(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
andq $0x0, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::DrawEdgeIDs() const
void R3Mesh::
DrawEdgeIDs(void) const
{
  // Draw all edge IDs
  glDisable(GL_LIGHTING);
  RNGrfxBegin(RN_GRFX_LINES);
  for (int i = 0; i < edges.NEntries(); i++) {
    R3MeshEdge *e = edges.Kth(i);
    unsigned int index = i+1;    
    unsigned char r = (index >> 0) & 0xFF;
    unsigned char g = (index >> 8) & 0xFF;
    unsigned char b = (index >> 16) & 0xFF;
    RNLoadRgb(r, g, b);
    R3LoadPoint(VertexPosition(VertexOnEdge(e, 0)));
    R3LoadPoint(VertexPosition(VertexOnEdge(e, 1)));
  }
  glEnable(GL_LIGHTING);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0xb50, %edi            # imm = 0xB50
callq 0xe140
pushq $0x1
popq %rdi
callq 0xe110
pushq $0x1
popq %r14
movl $0xff, %ebp
leaq -0x1(%r14), %rax
movslq 0x24(%rbx), %rcx
cmpq %rcx, %rax
jge 0x18482
movq 0x18(%rbx), %rax
movq -0x8(%rax,%r14,8), %r15
movl %r14d, %esi
shrl $0x8, %esi
movl %r14d, %edx
shrl $0x10, %edx
movl %r14d, %edi
andl %ebp, %edi
andl %ebp, %esi
andl %ebp, %edx
callq 0xe420
movq 0x8(%r15), %rdi
addq $0x18, %rdi
callq 0xe130
movq 0x10(%r15), %rdi
addq $0x18, %rdi
callq 0xe130
incq %r14
jmp 0x18433
movl $0xb50, %edi            # imm = 0xB50
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe3f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::DrawEdge(gaps::R3MeshEdge*) const
void R3Mesh::
DrawEdge(R3MeshEdge *e) const
{
  // Draw edge
  R3BeginLine();
  R3LoadPoint(e->vertex[0]->position);
  R3LoadPoint(e->vertex[1]->position);
  R3EndLine();
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
callq 0x21c38
movq 0x8(%rbx), %rdi
addq $0x18, %rdi
callq 0xe130
movq 0x10(%rbx), %rdi
addq $0x18, %rdi
callq 0xe130
popq %rbx
jmp 0xe5f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::DrawFace(gaps::R3MeshFace*) const
void R3Mesh::
DrawFace(R3MeshFace *f) const
{
  // Draw polygon
  R3BeginPolygon();
  R3LoadNormal(FaceNormal(f));
  R3LoadPoint(f->vertex[0]->position);
  R3LoadPoint(f->vertex[1]->position);
  R3LoadPoint(f->vertex[2]->position);
  R3EndPolygon();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x21c40
movq %r14, %rdi
movq %rbx, %rsi
callq 0x10dd0
movq %rax, %rdi
callq 0xe6e0
movq 0x8(%rbx), %rdi
addq $0x18, %rdi
callq 0xe130
movq 0x10(%rbx), %rdi
addq $0x18, %rdi
callq 0xe130
movq 0x18(%rbx), %rdi
addq $0x18, %rdi
callq 0xe130
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe5f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::Intersection(gaps::R3Ray const&, gaps::R3MeshIntersection*) const
R3MeshType R3Mesh::
Intersection(const R3Ray& ray, R3MeshIntersection *intersection) const
{
  // Initialize intersection variables
  R3MeshType type = R3_MESH_NULL_TYPE;
  if (intersection) {
    intersection->type = R3_MESH_NULL_TYPE;
    intersection->vertex = NULL;
    intersection->edge = NULL;
    intersection->face = NULL;
    intersection->t = RN_INFINITY;
  }

  // Check bounding box for intersection 
  if (R3Intersects(ray, bbox)) {
    // Check each face to find closest intersection
    RNScalar min_t = FLT_MAX;
    for (int i = 0; i < faces.NEntries(); i++) {
      // Get ith face
      R3MeshFace *f = faces[i];

      // Get intersection with face
      R3MeshIntersection face_intersection;
      if (Intersection(ray, f, &face_intersection)) {
        if (face_intersection.t < min_t) {
          if (intersection) *intersection = face_intersection;
          type = face_intersection.type;
          min_t = face_intersection.t;
        }
      }
    }
  }

  // Return intersection type
  return type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testq %rdx, %rdx
je 0x185db
andl $0x0, (%rbx)
xorps %xmm0, %xmm0
andq $0x0, 0x18(%rbx)
movups %xmm0, 0x8(%rbx)
leaq 0xc25e6(%rip), %rax     # 0xdabb8
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rbx)
leaq 0xf8(%r15), %rsi
xorl %ebp, %ebp
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3dfb5
testl %eax, %eax
je 0x18676
xorl %r13d, %r13d
movsd 0x7aa16(%rip), %xmm0    # 0x93018
movsd %xmm0, (%rsp)
xorl %ebp, %ebp
movslq 0x34(%r15), %rax
cmpq %rax, %r13
jge 0x18676
movq 0x28(%r15), %rax
movq (%rax,%r13,8), %r12
leaq 0x28(%rsp), %rdi
callq 0x37b4a
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
leaq 0x8(%rsp), %rcx
callq *0x178(%rax)
testl %eax, %eax
je 0x18671
movsd 0x40(%rsp), %xmm0
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x18671
testq %rbx, %rbx
je 0x18668
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x21c48
movsd 0x40(%rsp), %xmm0
movl 0x8(%rsp), %ebp
movsd %xmm0, (%rsp)
incq %r13
jmp 0x18609
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::ClosestPoint(gaps::R3Point const&, gaps::R3MeshIntersection*) const
R3Point R3Mesh::
ClosestPoint(const R3Point& point, R3MeshIntersection *closest_point) const
{
  // Check each face to find closest point
  R3Point closest_position = R3zero_point;
  RNScalar closest_distance_squared = FLT_MAX;
  for (int i = 0; i < faces.NEntries(); i++) {
    R3MeshFace *f = faces[i];
    R3MeshIntersection intersection;
    R3Point position = ClosestPointOnFace(f, point, (closest_point) ? &intersection : NULL);
    RNLength distance_squared = R3SquaredDistance(position, point);
    if (distance_squared < closest_distance_squared) {
      if (closest_point) *closest_point = intersection;
      closest_distance_squared = distance_squared;
      closest_position = position;
    }
  }

  // Return closest position on mesh
  return closest_position;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %rbp
movq %rdx, %r14
movq %rsi, %r12
leaq 0x4c2c28(%rip), %rsi    # 0x4dba70
movq %rdi, 0x8(%rsp)
callq 0x37b5c
testq %rbp, %rbp
leaq 0x20(%rsp), %rax
cmoveq %rbp, %rax
movq %rax, 0x18(%rsp)
movsd 0x7a1ad(%rip), %xmm0    # 0x93018
movsd %xmm0, 0x10(%rsp)
xorl %ebx, %ebx
leaq 0x60(%rsp), %r15
movslq 0x34(%r12), %rax
cmpq %rax, %rbx
jge 0x18ef0
movq 0x28(%r12), %rax
movq (%rax,%rbx,8), %r13
leaq 0x40(%rsp), %rdi
callq 0x37b4a
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r14, %rcx
movq 0x18(%rsp), %r8
callq 0x18b48
movq %r15, %rdi
movq %r14, %rsi
callq 0x431f1
movapd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x18eeb
movsd %xmm1, 0x10(%rsp)
testq %rbp, %rbp
je 0x18ede
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x21c48
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37e36
incq %rbx
jmp 0x18e78
movq 0x8(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::RandomPointOnFace(gaps::R3MeshFace const*) const
R3Point R3Mesh::
RandomPointOnFace(const R3MeshFace *face) const
{
  // Seed random number generator
  static RNBoolean seed = 0;
  if (!seed) { seed = 1; RNSeedRandomScalar(); }

  // Get vertex positions
  R3MeshVertex *v0 = VertexOnFace(face, 0);
  R3MeshVertex *v1 = VertexOnFace(face, 1);
  R3MeshVertex *v2 = VertexOnFace(face, 2);
  const R3Point& p0 = VertexPosition(v0);
  const R3Point& p1 = VertexPosition(v1);
  const R3Point& p2 = VertexPosition(v2);


  // Return random point on face
  RNScalar r1 = sqrt(RNRandomScalar());
  RNScalar r2 = RNRandomScalar();
  R3Point p = p0 * (1.0 - r1) + p1 * r1 * (1.0 - r2) + p2 * r1 * r2;
  return p;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r14
movq %rdi, %rbx
cmpb $0x0, 0xc1d1f(%rip)     # 0xdac40
jne 0x18f33
movb $0x1, 0xc1d16(%rip)     # 0xdac40
xorpd %xmm0, %xmm0
callq 0x67dd3
movq 0x8(%r14), %r12
movq 0x10(%r14), %r15
movq 0x18(%r14), %r14
addq $0x18, %r12
addq $0x18, %r15
addq $0x18, %r14
callq 0x67e16
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x18f60
sqrtsd %xmm0, %xmm0
jmp 0x18f65
callq 0xe350
movsd %xmm0, (%rsp)
callq 0x67e16
movsd %xmm0, 0x8(%rsp)
movsd 0x7a08b(%rip), %xmm0    # 0x93008
subsd (%rsp), %xmm0
leaq 0x70(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x382c0
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x382c0
movsd 0x7a059(%rip), %xmm0    # 0x93008
subsd 0x8(%rsp), %xmm0
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x382c0
leaq 0x88(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x3827a
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movsd (%rsp), %xmm0
callq 0x382c0
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x382c0
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x3827a
movq %rbx, %rax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3MeshVertexIsSaddleOrBoundary(gaps::R3Mesh const*, gaps::R3MeshVertex const*)
static RNBoolean
R3MeshVertexIsSaddleOrBoundary(const R3Mesh *mesh, const R3MeshVertex *vertex)
{
  // Return whether vertex is a saddle or boundary
  int nconvex = 0;
  int nconcave = 0;
  RNScalar angle_epsilon = 0.1;
  for (int i = 0; i < mesh->VertexValence(vertex); i++) {
    R3MeshEdge *e = mesh->EdgeOnVertex(vertex, i);
    if (!mesh->FaceOnEdge(e, 0)) return TRUE;
    if (!mesh->FaceOnEdge(e, 1)) return TRUE;
    RNAngle angle = mesh->EdgeInteriorAngle(e);
    if (RNIsGreater(angle, RN_PI, angle_epsilon)) nconcave++;
    else if (RNIsLess(angle, RN_PI, angle_epsilon)) nconvex++;
    if (nconvex * nconcave != 0) return TRUE;
  }

  // Not a saddle
  return FALSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x81091(%rip), %rax     # 0x9af48
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
xorl %eax, %eax
xorl %ebp, %ebp
xorl %r15d, %r15d
movq %rax, %r12
movslq 0x14(%rbx), %r13
cmpq %r13, %rax
jge 0x19f35
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %rsi
cmpq $0x0, 0x18(%rsi)
je 0x19f35
cmpq $0x0, 0x20(%rsi)
je 0x19f35
movq %r14, %rdi
callq 0x11796
subsd (%rsp), %xmm0
xorl %eax, %eax
movsd 0x79328(%rip), %xmm1    # 0x93228
ucomisd %xmm1, %xmm0
seta %al
addl %eax, %ebp
cmpnltpd %xmm0, %xmm1
movsd 0x7931a(%rip), %xmm2    # 0x93230
cmpltpd %xmm2, %xmm0
andpd %xmm1, %xmm0
movd %xmm0, %eax
subl %eax, %r15d
movl %r15d, %ecx
imull %ebp, %ecx
leaq 0x1(%r12), %rax
testl %ecx, %ecx
je 0x19ec7
xorl %eax, %eax
cmpq %r13, %r12
setl %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::CreateEllipsoid(gaps::R3Ellipsoid const&, double)
void R3Mesh::
CreateEllipsoid(const R3Ellipsoid& ellipsoid, RNLength vertex_spacing)
{
  // Get info
  R3Vector radii = ellipsoid.Radii();
  RNLength max_radius = radii[radii.MaxDimension()];
  if (RNIsZero(max_radius)) return ;
  R3Triad axes = ellipsoid.CoordSystem().Axes();
  int saved_nvertices = NVertices();
  
  // Create mesh elements for a sphere of suitable radius
  R3Sphere sphere(R3zero_point, max_radius);
  CreateSphere(sphere, vertex_spacing);

  // Map vertices from unit sphere to ellipsoid
  for (int i = saved_nvertices; i < NVertices(); i++) {
    R3MeshVertex *v = Vertex(i);
    R3Vector p = VertexPosition(v).Vector();
    R3Point position = ellipsoid.Center();
    position += p[0]*(radii[0]/max_radius)*axes[0];
    position += p[1]*(radii[1]/max_radius)*axes[1];
    position += p[2]*(radii[2]/max_radius)*axes[2];
    SetVertexPosition(v, position);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movsd %xmm0, 0x10(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
addq $0x68, %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x3831c
movq %r15, %rdi
callq 0x38490
cltq
movsd 0x18(%rsp,%rax,8), %xmm2
leaq 0xbee35(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm0
movapd 0x772b1(%rip), %xmm1    # 0x93030
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jb 0x1bd93
ucomisd %xmm2, %xmm0
jae 0x1bebc
leaq 0x20(%rbx), %rsi
leaq 0x70(%rsp), %rdi
movsd %xmm2, 0x8(%rsp)
callq 0x28198
movslq 0x14(%r14), %r12
leaq 0x4bfcbe(%rip), %rsi    # 0x4dba70
leaq 0x48(%rsp), %r15
movq %r15, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x24714
movq %r14, %rdi
movq %r15, %rsi
movsd 0x10(%rsp), %xmm0
callq 0x1b9aa
addq $0x8, %rbx
leaq 0xd0(%rsp), %rbp
leaq 0xb8(%rsp), %r15
movslq 0x14(%r14), %rax
cmpq %rax, %r12
jge 0x1beb2
movq 0x8(%r14), %rax
movq (%rax,%r12,8), %r13
leaq 0x18(%r13), %rsi
leaq 0x30(%rsp), %rdi
callq 0x212f8
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x37b5c
movsd 0x18(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm0
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x38a02
movq %rbp, %rdi
movq %r15, %rsi
callq 0x37e9c
movsd 0x20(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
movq %r15, %rdi
leaq 0x88(%rsp), %rsi
callq 0x38a02
movq %rbp, %rdi
movq %r15, %rsi
callq 0x37e9c
movsd 0x28(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
mulsd 0x40(%rsp), %xmm0
movq %r15, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x38a02
movq %rbp, %rdi
movq %r15, %rsi
callq 0x37e9c
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x12ccc
incq %r12
jmp 0x1bdea
leaq 0x48(%rsp), %rdi
callq 0x25832
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1bed8
jmp 0x1bed8
jmp 0x1bed8
jmp 0x1bed8
jmp 0x1bed8
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x25832
movq %rbx, %rdi
callq 0xe810
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::ReadPlyFile(char const*)
int R3Mesh::
ReadPlyFile(const char *filename)
{
  // Open file
  FILE *fp = fopen(filename, "rb");
  if (!fp) {
    RNFail("Unable to open file: %s", filename);
    return 0;
  }

  // Read file
  if (!ReadPlyStream(fp)) return 0;
  
  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x75d49(%rip), %rsi     # 0x9355b
movq %rbx, %rdi
callq 0xe550
testq %rax, %rax
je 0x1d842
movq %rax, %r14
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x210(%rax)
testl %eax, %eax
je 0x1d857
movq %r14, %rdi
callq 0xe440
pushq $0x1
popq %rbp
jmp 0x1d859
leaq 0x75d15(%rip), %rdi     # 0x9355e
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x681ca
jmp 0x1d859
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::WriteFile(char const*) const
int R3Mesh::
WriteFile(const char *filename) const
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .ply)", filename);
    return 0;
  }

  // Write file of appropriate type
  if (!strncmp(extension, ".ray", 4)) 
    return WriteRayFile(filename);
  else if (!strncmp(extension, ".ply", 4)) 
    return WritePlyFile(filename);
  else if (!strncmp(extension, ".obj", 4)) 
    return WriteObjFile(filename);
  else if (!strncmp(extension, ".off", 4)) 
    return WriteOffFile(filename);
  else if (!strncmp(extension, ".cat", 4)) 
    return WriteCattFile(filename);
  else if (!strncmp(extension, ".ifs", 4)) 
    return WriteIfsFile(filename);
  else if (!strncmp(extension, ".stl", 4)) 
    return WriteSTLFile(filename);
  else {
    RNFail("Unable to write file %s (unrecognized extension: %s)", filename, extension);
    return 0;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0xe4e0
testq %rax, %rax
je 0x1fe0e
movq %rax, %r15
leaq 0x735ce(%rip), %rsi     # 0x93317
pushq $0x4
popq %rdx
movq %rax, %rdi
callq 0xe220
testl %eax, %eax
je 0x1fe27
leaq 0x735b9(%rip), %rsi     # 0x9331c
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1fe33
leaq 0x73590(%rip), %rsi     # 0x9330d
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1fe4d
leaq 0x7357b(%rip), %rsi     # 0x93312
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1fe59
leaq 0x73570(%rip), %rsi     # 0x93321
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1fe65
leaq 0x7355b(%rip), %rsi     # 0x93326
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1fe71
leaq 0x73546(%rip), %rsi     # 0x9332b
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1fe7d
leaq 0x73b36(%rip), %rdi     # 0x93935
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x681ca
jmp 0x1fe1f
leaq 0x73af6(%rip), %rdi     # 0x9390b
movq %rbx, %rsi
xorl %eax, %eax
callq 0xe070
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq (%r14), %rax
movq 0x1d8(%rax), %rax
jmp 0x1fe87
movq (%r14), %rax
movq 0x1e0(%rax), %rax
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
movq (%r14), %rax
movq 0x1e8(%rax), %rax
jmp 0x1fe87
movq (%r14), %rax
movq 0x1f0(%rax), %rax
jmp 0x1fe87
movq (%r14), %rax
movq 0x1f8(%rax), %rax
jmp 0x1fe87
movq (%r14), %rax
movq 0x200(%rax), %rax
jmp 0x1fe87
movq (%r14), %rax
movq 0x208(%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::WriteRayFile(char const*) const
int R3Mesh::
WriteRayFile(const char *filename) const
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "w"))) {
    RNFail("Unable to open file %s", filename);
    return 0;
  }

  // Write vertices
  for (int i = 0; i < NVertices(); i++) {
    R3MeshVertex *vertex = Vertex(i);
    const R3Point& p = VertexPosition(vertex);
    const R3Vector& n = VertexNormal(vertex);
    fprintf(fp, "#vertex %g %g %g %g %g %g 0 0\n", p.X(), p.Y(), p.Z(), n.X(), n.Y(), n.Z());
  }

  // Write Faces
  for (int i = 0; i < NFaces(); i++) {
    R3MeshFace *face = Face(i);
    R3MeshVertex *v0 = VertexOnFace(face, 0);
    R3MeshVertex *v1 = VertexOnFace(face, 1);
    R3MeshVertex *v2 = VertexOnFace(face, 2);
    int m = FaceMaterial(face);
    fprintf(fp, "#shape_triangle %d %d %d %d\n", m, v0->id, v1->id, v2->id);
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x788bf(%rip), %rsi     # 0x98769
movq %r15, %rdi
callq 0xe550
testq %rax, %rax
je 0x1ff70
movq %rax, %r14
xorl %r13d, %r13d
leaq 0x73aa2(%rip), %r15     # 0x9396a
movslq 0x14(%rbx), %rax
cmpq %rax, %r13
jge 0x1ff19
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x21234
movsd 0x18(%r12), %xmm0
movsd 0x20(%r12), %xmm1
movsd 0x28(%r12), %xmm2
movsd (%rax), %xmm3
movsd 0x8(%rax), %xmm4
movsd 0x10(%rax), %xmm5
movq %r14, %rdi
movq %r15, %rsi
movb $0x6, %al
callq 0xe6a0
incq %r13
jmp 0x1fec8
leaq 0x73a69(%rip), %r15     # 0x93989
xorl %r12d, %r12d
movslq 0x34(%rbx), %rax
cmpq %rax, %r12
jge 0x1ff63
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdi
movl 0x98(%rax), %edx
movl 0x70(%rcx), %ecx
movl 0x70(%rsi), %r8d
movl 0x70(%rdi), %r9d
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe6a0
incq %r12
jmp 0x1ff23
movq %r14, %rdi
callq 0xe440
pushq $0x1
popq %rbx
jmp 0x1ff83
leaq 0x733f3(%rip), %rdi     # 0x9336a
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x681ca
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::WritePlyFile(char const*, int) const
int R3Mesh::
WritePlyFile(const char *filename, RNBoolean binary)  const
{
  // Open file
  FILE *fp = fopen(filename, "w");
  if (!fp) {
    RNFail("Unable to open file: %s", filename);
    return 0;
  }

  // Write file
  if (!WritePlyStream(fp, binary)) return 0;
  
  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r12
leaq 0x787c2(%rip), %rsi     # 0x98769
movq %r15, %rdi
callq 0xe550
testq %rax, %rax
je 0x1ffda
movq %rax, %r14
movq (%r12), %rax
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq *0x218(%rax)
testl %eax, %eax
je 0x1ffef
movq %r14, %rdi
callq 0xe440
pushq $0x1
popq %rbx
jmp 0x1fff1
leaq 0x7357d(%rip), %rdi     # 0x9355e
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x681ca
jmp 0x1fff1
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::WriteOffFile(char const*) const
int R3Mesh::
WriteOffFile(const char *filename) const
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "w"))) {
    RNFail("Unable to open file %s", filename);
    return 0;
  }

  // Write header
  fprintf(fp, "OFF\n");
  fprintf(fp, "%d %d %d\n", NVertices(), NFaces(), NEdges());

  // Write vertices
  for (int i = 0; i < NVertices(); i++) {
    R3MeshVertex *vertex = Vertex(i);
    const R3Point& p = VertexPosition(vertex);
    fprintf(fp, "%g %g %g\n", p.X(), p.Y(), p.Z());
  }

  // Write Faces
  for (int i = 0; i < NFaces(); i++) {
    R3MeshFace *face = Face(i);
    R3MeshVertex *v0 = VertexOnFace(face, 0);
    R3MeshVertex *v1 = VertexOnFace(face, 1);
    R3MeshVertex *v2 = VertexOnFace(face, 2);
    fprintf(fp, "3 %d %d %d\n", v0->id, v1->id, v2->id);
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x781da(%rip), %rsi     # 0x98769
movq %r15, %rdi
callq 0xe550
testq %rax, %rax
je 0x2065f
movq %rax, %r14
leaq 0x73433(%rip), %rdi     # 0x939dd
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rax, %rcx
callq 0xe8e0
movl 0x34(%rbx), %ecx
movl 0x14(%rbx), %edx
movl 0x24(%rbx), %r8d
leaq 0x7341b(%rip), %rsi     # 0x939e4
xorl %r12d, %r12d
movq %r14, %rdi
xorl %eax, %eax
callq 0xe6a0
leaq 0x73420(%rip), %r15     # 0x939fd
movslq 0x14(%rbx), %rax
cmpq %rax, %r12
jge 0x2060f
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %rax
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
movq %r14, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0xe6a0
incq %r12
jmp 0x205dd
leaq 0x733cc(%rip), %r15     # 0x939e2
xorl %r12d, %r12d
movslq 0x34(%rbx), %rax
cmpq %rax, %r12
jge 0x20652
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rax
movl 0x70(%rcx), %edx
movl 0x70(%rsi), %ecx
movl 0x70(%rax), %r8d
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe6a0
incq %r12
jmp 0x20619
movq %r14, %rdi
callq 0xe440
pushq $0x1
popq %rbx
jmp 0x20672
leaq 0x72d04(%rip), %rdi     # 0x9336a
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x681ca
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::WriteCattFile(char const*) const
int R3Mesh::
WriteCattFile(const char *filename) const
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "w"))) {
    RNFail("Unable to open file %s", filename);
    return 0;
  }

  // Write vertex header
  fprintf(fp, "%%CORNERS\n\n");

  // Write vertices
  for (int i = 0; i < NVertices(); i++) {
    R3MeshVertex *vertex = Vertex(i);
    int id = VertexID(vertex);
    const R3Point& p = VertexPosition(vertex);
    fprintf(fp, "%d %g %g %g\n", id+1, p.X(), p.Y(), p.Z());
  }

  // Write face header
  fprintf(fp, "\n%%PLANES\n\n");

  // Write Faces
  for (int i = 0; i < NFaces(); i++) {
    R3MeshFace *face = Face(i);
    R3MeshVertex *v0 = VertexOnFace(face, 0);
    R3MeshVertex *v1 = VertexOnFace(face, 1);
    R3MeshVertex *v2 = VertexOnFace(face, 2);
    fprintf(fp, "%d / /RIGID\n%d %d %d\n\n", i, VertexID(v0) + 1, VertexID(v1) + 1, VertexID(v2) + 1);
  }

  // Write trailer
  fprintf(fp, "%%EOF\n");

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
leaq 0x780d4(%rip), %rsi     # 0x98769
movq %r15, %rdi
callq 0xe550
testq %rax, %rax
je 0x20779
movq %rax, %rbx
leaq 0x7333e(%rip), %rsi     # 0x939ee
xorl %r12d, %r12d
movq %rax, %rdi
xorl %eax, %eax
callq 0xe6a0
leaq 0x73336(%rip), %r15     # 0x939fa
movslq 0x14(%r14), %rax
cmpq %rax, %r12
jge 0x206fb
movq 0x8(%r14), %rax
movq (%rax,%r12,8), %rax
movl 0x70(%rax), %edx
incl %edx
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
movq %rbx, %rdi
movq %r15, %rsi
movb $0x3, %al
callq 0xe6a0
incq %r12
jmp 0x206c4
leaq 0x73305(%rip), %rsi     # 0x93a07
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe6a0
leaq 0x73300(%rip), %r15     # 0x93a13
xorl %r12d, %r12d
movslq 0x34(%r14), %rax
cmpq %rax, %r12
jge 0x2075b
movq 0x28(%r14), %rax
movq (%rax,%r12,8), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rdx
movq 0x18(%rax), %rax
movl 0x70(%rcx), %ecx
incl %ecx
movl 0x70(%rdx), %r8d
incl %r8d
movl 0x70(%rax), %r9d
incl %r9d
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe6a0
incq %r12
jmp 0x20716
leaq 0x732c8(%rip), %rsi     # 0x93a2a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe6a0
movq %rbx, %rdi
callq 0xe440
pushq $0x1
popq %rbx
jmp 0x2078c
leaq 0x72bea(%rip), %rdi     # 0x9336a
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x681ca
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::WriteSTLFile(char const*) const
int R3Mesh::
WriteSTLFile(const char *filename) const
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "w"))) {
    RNFail("Unable to open file %s", filename);
    return 0;
  }

  // Write header
  fprintf(fp, "solid %s\n", filename);

  // Write Faces
  for (int i = 0; i < NFaces(); i++) {
    R3MeshFace *face = Face(i);
    const R3Vector& n = FaceNormal(face);
    fprintf(fp, "facet normal %g %g %g\n", n[0], n[1], n[2]);
    fprintf(fp, "  outer loop\n");
    for (int j = 0; j < 3; j++) {
      R3MeshVertex *vertex = VertexOnFace(face, j);
      const R3Point& p = VertexPosition(vertex);
      fprintf(fp, "   vertex %g %g %g\n", p[0], p[1], p[2]);
    }
    fprintf(fp, "  endloop\n");
    fprintf(fp, "endfacet\n");
  }

  // Write trailer
  fprintf(fp, "endsolid\n");

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %r14
leaq 0x77da9(%rip), %rsi     # 0x98769
movq %r12, %rdi
callq 0xe550
testq %rax, %rax
je 0x20ad7
movq %rax, %rbx
leaq 0x73061(%rip), %rsi     # 0x93a3c
xorl %r15d, %r15d
movq %rax, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe6a0
pushq $0x1
popq %rbp
leaq 0x73076(%rip), %r12     # 0x93a6b
movq %r14, (%rsp)
movslq 0x34(%r14), %rax
cmpq %rax, %r15
jge 0x20ab5
movq 0x28(%r14), %rax
movq (%rax,%r15,8), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x10dd0
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movq %rbx, %rdi
leaq 0x73015(%rip), %rsi     # 0x93a46
movb $0x3, %al
callq 0xe6a0
leaq 0x7301e(%rip), %rdi     # 0x93a5d
pushq $0xd
popq %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0xe8e0
movq %rbp, %r14
cmpq $0x4, %rbp
je 0x20a7c
movq (%r13,%rbp,8), %rax
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
movq %rbx, %rdi
movq %r12, %rsi
movb $0x3, %al
callq 0xe6a0
incq %rbp
jmp 0x20a50
leaq 0x72ffc(%rip), %rdi     # 0x93a7f
pushq $0xa
popq %rsi
movq %r14, %rbp
movq %r14, %rdx
movq %rbx, %rcx
callq 0xe8e0
leaq 0x72fef(%rip), %rdi     # 0x93a8a
pushq $0x9
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0xe8e0
incq %r15
movq (%rsp), %r14
jmp 0x209f9
leaq 0x72fd8(%rip), %rdi     # 0x93a94
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0xe8e0
movq %rbx, %rdi
callq 0xe440
pushq $0x1
popq %rbx
jmp 0x20aea
leaq 0x7288c(%rip), %rdi     # 0x9336a
xorl %ebx, %ebx
movq %r12, %rsi
xorl %eax, %eax
callq 0x681ca
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::UpdateVertexNormal(gaps::R3MeshVertex*) const
void R3Mesh::
UpdateVertexNormal(R3MeshVertex *v) const
{
  // Average face normals
  v->normal = R3zero_vector;
  for (int i = 0; i < v->edges.NEntries(); i++) {
    R3MeshEdge *e = v->edges[i];
    if (e->vertex[0] == v) {
      if (e->face[0]) 
        v->normal += FaceNormal(e->face[0]);
    }
    else {
      if (e->face[1]) 
        v->normal += FaceNormal(e->face[1]);
    }
  }
  v->normal.Normalize();

  // Update flags
  v->flags.Add(R3_MESH_VERTEX_NORMAL_UPTODATE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x30(%rsi), %r14
leaq 0x78b6b(%rip), %rsi     # 0x99690
movq %r14, %rdi
callq 0x3887c
xorl %r12d, %r12d
movslq 0x14(%rbx), %rax
cmpq %rax, %r12
jge 0x20b6e
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %rax
cmpq %rbx, 0x8(%rax)
je 0x20b4d
movq 0x20(%rax), %rsi
jmp 0x20b51
movq 0x18(%rax), %rsi
testq %rsi, %rsi
je 0x20b69
movq %r15, %rdi
callq 0x10dd0
movq %r14, %rdi
movq %rax, %rsi
callq 0x38a24
incq %r12
jmp 0x20b30
movq %r14, %rdi
callq 0x3860e
orb $0x2, 0x78(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::UpdateFaceArea(gaps::R3MeshFace*) const
void R3Mesh::
UpdateFaceArea(R3MeshFace *f) const
{
  // Compute area of face
  R3Vector v1 = f->vertex[1]->position - f->vertex[0]->position;
  R3Vector v2 = f->vertex[2]->position - f->vertex[0]->position;
  R3Vector v3 = v1 % v2;
  f->area = 0.5 * v3.Length();

  // Update flags
  f->flags.Add(R3_MESH_FACE_AREA_UPTODATE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq 0x8(%rsi), %rdx
movq 0x10(%rsi), %rsi
addq $0x18, %rsi
addq $0x18, %rdx
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x37d29
movq 0x8(%rbx), %rdx
movq 0x18(%rbx), %rsi
addq $0x18, %rsi
addq $0x18, %rdx
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x37d29
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x389be
movq %r12, %rdi
callq 0x38412
mulsd 0x723fd(%rip), %xmm0    # 0x93010
movsd %xmm0, 0x90(%rbx)
orb $0x2, 0xa8(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Mesh::UpdateFaceBBox(gaps::R3MeshFace*) const
void R3Mesh::
UpdateFaceBBox(R3MeshFace *f) const
{
  // Update face bbox
  f->bbox = R3null_box;
  f->bbox.Union(f->vertex[0]->position);
  f->bbox.Union(f->vertex[1]->position);
  f->bbox.Union(f->vertex[2]->position);

  // Update flags
  f->flags.Add(R3_MESH_FACE_BBOX_UPTODATE);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x58(%rsi), %r14
leaq 0xba21e(%rip), %rsi     # 0xdaea8
movq %r14, %rdi
callq 0x2141e
movq 0x8(%rbx), %rsi
addq $0x18, %rsi
movq %r14, %rdi
callq 0x254a4
movq 0x10(%rbx), %rsi
addq $0x18, %rsi
movq %r14, %rdi
callq 0x254a4
movq 0x18(%rbx), %rsi
addq $0x18, %rsi
movq %r14, %rdi
callq 0x254a4
orb $0x8, 0xa8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Distance(gaps::R3Mesh*, gaps::R3MeshVertex*, gaps::R3Point const&, gaps::R3MeshIntersection*)
RNLength
R3Distance(R3Mesh *mesh, R3MeshVertex *vertex, const R3Point& point, R3MeshIntersection* closest_point)
{
  // Compute squared distance from vertex to point
  const R3Point& vertex_position = mesh->VertexPosition(vertex);
  RNLength distance = R3Distance(point, vertex_position);

  // Fill in closest_point info
  if (closest_point) {
    closest_point->type = R3_MESH_VERTEX_TYPE;
    closest_point->vertex = vertex;
    closest_point->edge = NULL;
    closest_point->face = NULL;
    closest_point->point = vertex_position;
    closest_point->t = distance; 
  }

  // Return distance
  return distance;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %rdi
movq %rsi, %r15
leaq 0x18(%rsi), %r14
movq %r14, %rsi
callq 0x4321a
testq %rbx, %rbx
je 0x20d89
movl $0x1, (%rbx)
movq %r15, 0x8(%rbx)
leaq 0x20(%rbx), %rdi
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq %r14, %rsi
callq 0x37e36
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x38(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Mesh.cpp
// Function: gaps::R3Distance(gaps::R3Mesh*, gaps::R3MeshEdge*, gaps::R3Point const&, gaps::R3MeshIntersection*)
RNLength 
R3Distance(R3Mesh *mesh, R3MeshEdge *edge, const R3Point& point, R3MeshIntersection* closest_point)
{
  // Compute distance from edge to point
  R3Span edge_span = mesh->EdgeSpan(edge);
  RNScalar distance = R3Distance(point, edge_span);

  // Fill in closest point info
  if (closest_point) {
    closest_point->edge = edge;
    closest_point->face = NULL;
    closest_point->t = distance; 
    RNScalar edge_t = edge_span.T(point);
    if (RNIsEqual(edge_t, 0)) {
      R3MeshVertex *vertex = mesh->VertexOnEdge(edge, 0);
      closest_point->type = R3_MESH_VERTEX_TYPE;
      closest_point->vertex = vertex;
      closest_point->point = mesh->VertexPosition(vertex);
    }
    else if (RNIsEqual(edge_t, edge_span.Length())) {
      R3MeshVertex *vertex = mesh->VertexOnEdge(edge, 1);
      closest_point->type = R3_MESH_VERTEX_TYPE;
      closest_point->vertex = vertex;
      closest_point->point = mesh->VertexPosition(vertex);
    }
    else {
      closest_point->type = R3_MESH_EDGE_TYPE;
      closest_point->vertex = NULL;
      closest_point->point = edge_span.Point(edge_t);
    }
  }

  // Return squared distance
  return distance;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rsi
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r14, %rdx
callq 0x214e0
movq %r15, %rdi
movq %r12, %rsi
callq 0x432fc
testq %rbx, %rbx
je 0x20e7b
movq %r14, 0x10(%rbx)
andq $0x0, 0x18(%rbx)
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x38(%rbx)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x37276
leaq 0xb9db2(%rip), %rax     # 0xdaba8
movsd (%rax), %xmm1
movapd 0x7222e(%rip), %xmm2    # 0x93030
xorpd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jb 0x20e18
ucomisd %xmm0, %xmm1
jb 0x20e18
movq 0x8(%r14), %rsi
jmp 0x20e32
movapd %xmm0, %xmm3
subsd 0x58(%rsp), %xmm3
ucomisd %xmm2, %xmm3
jb 0x20e49
ucomisd %xmm3, %xmm1
jb 0x20e49
movq 0x10(%r14), %rsi
movl $0x1, (%rbx)
movq %rsi, 0x8(%rbx)
addq $0x18, %rsi
addq $0x20, %rbx
movq %rbx, %rdi
jmp 0x20e70
movl $0x2, (%rbx)
andq $0x0, 0x8(%rbx)
leaq 0x60(%rsp), %r14
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x37180
addq $0x20, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x37e36
movsd 0x8(%rsp), %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/./R3Mesh.h
// Function: gaps::R3Mesh::VertexAcrossFace(gaps::R3MeshFace const*, gaps::R3MeshEdge const*) const
inline R3MeshVertex *R3Mesh:: 
VertexAcrossFace(const R3MeshFace *f, const R3MeshEdge *e) const
{
  // Returns the vertex across a triangle from an edge (the edge is the base and the vertex is the apex)
  assert(IsEdgeOnFace(e, f));
  if (!IsVertexOnEdge(f->vertex[0], e)) return f->vertex[0];
  if (!IsVertexOnEdge(f->vertex[1], e)) return f->vertex[1];
  if (!IsVertexOnEdge(f->vertex[2], e)) return f->vertex[2];
  return NULL;
}

// Assembly:
movq 0x8(%rsi), %rax
movq 0x8(%rdx), %rcx
cmpq %rax, %rcx
je 0x21382
cmpq %rax, 0x10(%rdx)
je 0x21382
retq
movq 0x10(%rsi), %rax
cmpq %rax, %rcx
je 0x21391
cmpq %rax, 0x10(%rdx)
jne 0x21381
movq 0x18(%rsi), %rsi
xorl %eax, %eax
cmpq %rsi, %rcx
je 0x21381
cmpq %rsi, 0x10(%rdx)
cmovneq %rsi, %rax
retq
nop