LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::WriteSUNCGFile(char const*) const
int R3Scene::
WriteSUNCGFile(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, "{\n");
  fprintf(fp, "  \"version\":\"suncg@1.0.0\",\n");
  if (root->Name()) fprintf(fp, "  \"id\":\"%s\",\n", root->Name());
  fprintf(fp, "  \"up\":[0,1,0],\n");
  fprintf(fp, "  \"front\":[0,0,1],\n");
  fprintf(fp, "  \"scaleToMeters\":1,\n");  
  fprintf(fp, "  \"levels\":[\n");  

  // Write nodes recursively
  for (int i = 0; i < root->NChildren(); i++) {
    R3SceneNode *child = root->Child(i);
    if (!WriteSUNCGNode(this, child, fp)) {
      fclose(fp);
      return 0;
    }
  }

  // Write trailer
  fprintf(fp, "\n  ]\n");
  fprintf(fp, "}\n");
  
  // Close file
  fclose(fp);
  
  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x9a120(%rip), %rsi     # 0xc8dc4
movq %r15, %rdi
callq 0x21ab0
testq %rax, %rax
je 0x2ed90
movq %rax, %rbx
leaq 0x97cb2(%rip), %rdi     # 0xc6971
pushq $0x2
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rax, %rcx
callq 0x222c0
leaq 0x975e2(%rip), %rdi     # 0xc62ba
pushq $0x1b
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x222c0
movq (%r14), %rax
movq 0x1a0(%rax), %rdx
testq %rdx, %rdx
je 0x2ed06
leaq 0x97c7e(%rip), %rsi     # 0xc697a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21da0
leaq 0x975c9(%rip), %rdi     # 0xc62d6
pushq $0x10
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rbx, %rcx
callq 0x222c0
leaq 0x975c1(%rip), %rdi     # 0xc62e7
pushq $0x13
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x222c0
leaq 0x975c0(%rip), %rdi     # 0xc62fb
pushq $0x15
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x222c0
leaq 0x975c1(%rip), %rdi     # 0xc6311
pushq $0xd
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x222c0
xorl %r15d, %r15d
movq (%r14), %rax
movslq 0x2c(%rax), %rcx
cmpq %rcx, %r15
jge 0x2eda5
movq 0x20(%rax), %rax
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
callq 0x3294c
incq %r15
testl %eax, %eax
jne 0x2ed61
movq %rbx, %rdi
callq 0x218c0
xorl %ebx, %ebx
jmp 0x2edde
leaq 0x9688f(%rip), %rdi     # 0xc5626
xorl %ebx, %ebx
movq %r15, %rsi
xorl %eax, %eax
callq 0x7e83e
jmp 0x2edde
leaq 0x97573(%rip), %rdi     # 0xc631f
pushq $0x5
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x222c0
leaq 0x97c37(%rip), %rdi     # 0xc69fc
pushq $0x2
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x222c0
movq %rbx, %rdi
callq 0x218c0
pushq $0x1
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::ReadMesh(char const*)
static R3TriangleArray *
ReadMesh(const char *filename)
{
  // Read mesh file
  R3Mesh mesh;
  if (!mesh.ReadFile(filename)) {
    RNFail("Unable to read mesh %s\n", filename);
    return NULL;
  }

  // Allocate triangle array
  R3TriangleArray *array = new R3TriangleArray();
  if (!array) {
    RNFail("Unable to allocate triangle array");
    return NULL;
  }

  // Load mesh into triangle array
  array->LoadMesh(mesh);

  // Return triangle array
  return array;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, %r14
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x4a990
movq %rbx, %rdi
movq %r14, %rsi
callq 0x55e20
testl %eax, %eax
je 0x316e6
pushq $0x70
popq %rdi
callq 0x218d0
movq %rax, %rbx
movq %rax, %rdi
callq 0x5f076
movq (%rbx), %rax
movq %rsp, %rsi
movq %rbx, %rdi
callq *0x240(%rax)
jmp 0x316f9
xorl %ebx, %ebx
leaq 0x940e3(%rip), %rdi     # 0xc57d2
movq %r14, %rsi
xorl %eax, %eax
callq 0x7e83e
movq %rsp, %rdi
callq 0x4ae78
movq %rbx, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r14
retq
movq %rax, %r14
pushq $0x70
popq %rsi
movq %rbx, %rdi
callq 0x218f0
jmp 0x31724
jmp 0x31721
movq %rax, %r14
movq %rsp, %rdi
callq 0x4ae78
movq %r14, %rdi
callq 0x220e0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::FindPrincetonMaterialAndElement(gaps::R3Scene*, gaps::R3SceneNode*, gaps::RNArray<gaps::R3Material*> const&, int, gaps::R3Material*&, gaps::R3Material*&, gaps::R3SceneElement*&)
static int
FindPrincetonMaterialAndElement(R3Scene *scene, R3SceneNode *node,
  const RNArray<R3Material *>& materials, int m, R3Material *&default_material,
  R3Material *& material, R3SceneElement *& element)
{
  // Find material from m
  material = NULL;
  if (m >= 0) {
    if (m < materials.NEntries()) material = materials[m];
    else return 0;
  }
  else {
    // Get material from 
    material = default_material;
    if (!material) {
      R3Brdf *brdf = new R3Brdf(R3default_brdf);
      scene->InsertBrdf(brdf);
      material = new R3Material(brdf);
      scene->InsertMaterial(material);
      default_material = material;
    }
  }

  // Find element with that material
  element = NULL;
  for (int i = 0; i < node->NElements(); i++) {
    R3SceneElement *e = node->Element(i);
    if (e->Material() == material) { element = e; break; }
  }

  // Create element if none found
  if (!element) {
    element = new R3SceneElement(material);
    node->InsertElement(element);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %rsi, %rbx
andq $0x0, (%r9)
testl %ecx, %ecx
js 0x31766
xorl %eax, %eax
cmpl %ecx, 0xc(%rdx)
jle 0x3182a
movl %ecx, %eax
shlq $0x3, %rax
addq (%rdx), %rax
movq %r14, %r15
jmp 0x317c9
movq %r8, %r15
movq (%r8), %rax
movq %rax, (%r14)
testq %rax, %rax
jne 0x317cf
movq %rdi, %r12
movl $0xb8, %edi
callq 0x218d0
movq %rax, %r13
leaq 0x102b35(%rip), %rsi    # 0x1342c0
movq %rax, %rdi
xorl %edx, %edx
callq 0x3f100
movq %r12, %rdi
movq %r13, %rsi
callq 0x2788a
pushq $0x30
popq %rdi
callq 0x218d0
movq %rax, %rbp
movq %rax, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3edf2
movq %rbp, (%r14)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x27846
movq %r14, %rax
movq (%rax), %rax
movq %rax, (%r15)
movq 0x40(%rsp), %r12
andq $0x0, (%r12)
movl 0x3c(%rbx), %eax
movq (%r14), %r14
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0x31802
movq 0x30(%rbx), %rdx
movq (%rdx,%rcx,8), %rdx
incq %rcx
cmpq %r14, 0x8(%rdx)
jne 0x317e6
movq %rdx, (%r12)
jmp 0x31827
pushq $0x60
popq %rdi
callq 0x218d0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x394c0
movq %r15, (%r12)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x389c8
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x30
popq %rsi
movq %rbp, %rdi
jmp 0x3185a
movq %rax, %rbx
movl $0xb8, %esi
movq %r13, %rdi
jmp 0x3185a
movq %rax, %rbx
pushq $0x60
popq %rsi
movq %r15, %rdi
callq 0x218f0
movq %rbx, %rdi
callq 0x220e0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::InsertCopiesOfLight(gaps::R3Scene*, gaps::R3Light*, char const*)
static int
InsertCopiesOfLight(R3Scene *scene, R3Light *original, const char *reference_frame)
{
  // Iniitalize return status
  int status = 0;
  
  // Insert copies of light into scene
  if (!strcmp(reference_frame, "world")) {
    // Insert one copy of light 
    R3Light *light = original->Copy();
    scene->InsertLight(light);
    status++;
  }
  else {
    // Insert copy of light for each matching node with name matching reference frame
    for (int i = 0; i < scene->NNodes(); i++) {
      R3SceneNode *node = scene->Node(i);
      if (!MatchReferencedSceneName(node, reference_frame)) continue;
      R3Light *light = original->Copy();
      R3Affine transformation_to_world = node->CumulativeTransformation();
      light->Transform(node->CumulativeTransformation());
      scene->InsertLight(light);
      status++;
    }
  }

  // Return whether inserted any lights
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x9326b(%rip), %rsi     # 0xc6b05
movq %rdx, %rdi
callq 0x21d30
testl %eax, %eax
je 0x339b5
movq %r14, 0x8(%rsp)
xorl %r12d, %r12d
leaq 0x18(%rsp), %r13
movl $0x0, 0x4(%rsp)
movq %rbx, 0x10(%rsp)
movslq 0x14(%rbx), %rax
cmpq %rax, %r12
jge 0x339a3
movq 0x8(%rbx), %rax
movq (%rax,%r12,8), %rbp
movq 0x1a0(%rbp), %rdi
testq %rdi, %rdi
je 0x338f1
movq %r15, %rsi
callq 0x21d30
testl %eax, %eax
je 0x33943
movslq 0x4c(%rbp), %r14
testl %r14d, %r14d
movl $0x0, %ebx
cmovgl %r14d, %ebx
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0x33934
movq 0x40(%rbp), %rax
movq (%rax,%r13,8), %rax
movq (%rax), %rax
movq 0x150(%rax), %rdi
testq %rdi, %rdi
je 0x3392c
movq %r15, %rsi
callq 0x21d30
testl %eax, %eax
je 0x33931
incq %r13
jmp 0x33904
movq %r13, %rbx
cmpq %r14, %rbx
movq 0x10(%rsp), %rbx
leaq 0x18(%rsp), %r13
jge 0x3399b
movq 0x8(%rsp), %rdi
callq 0x3e746
movq %rax, %r14
leaq 0x128(%rsp), %rdi
movq %rbp, %rsi
callq 0x3884e
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3884e
movq (%r14), %rax
movq %r14, %rdi
movq %r13, %rsi
callq *0x30(%rax)
movq %r13, %rdi
callq 0x66856
movq %rbx, %rdi
movq %r14, %rsi
callq 0x277fe
incl 0x4(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x66856
incq %r12
jmp 0x338c4
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x3e746
movq %rbx, %rdi
movq %rax, %rsi
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x277fe
jmp 0x339ea
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x66856
jmp 0x339ed
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x66856
movq %rbx, %rdi
callq 0x220e0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::~R3SceneNode()
R3SceneNode::
~R3SceneNode(void)
{
  // Remove elements
  for (int i = 0; i < elements.NEntries(); i++) {
    R3SceneElement *element = elements.Kth(i);
    RemoveElement(element);
  }

  // Remove references
  for (int i = 0; i < references.NEntries(); i++) {
    R3SceneReference *reference = references.Kth(i);
    RemoveReference(reference);
  }

  // Remove children
  for (int i = 0; i < children.NEntries(); i++) {
    R3SceneNode *child = children.Kth(i);
    RemoveChild(child);
  }

  // Remove node from parent
  if (parent) {
    parent->RemoveChild(this);
  }

  // Remove node from scene
  if (scene) {
    scene->RemoveNode(this);
  }

  // Delete name
  if (name) free(name);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
leaq 0x30(%rdi), %rbx
xorl %r15d, %r15d
movslq 0x3c(%r14), %rax
cmpq %rax, %r15
jge 0x37cf1
movq 0x30(%r14), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0x37db8
incq %r15
jmp 0x37cd3
leaq 0x40(%r14), %r15
xorl %r12d, %r12d
movslq 0x4c(%r14), %rax
cmpq %rax, %r12
jge 0x37d16
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
callq 0x37dd2
incq %r12
jmp 0x37cf8
leaq 0x20(%r14), %r12
xorl %r13d, %r13d
movslq 0x2c(%r14), %rax
cmpq %rax, %r13
jge 0x37d3b
movq 0x20(%r14), %rax
movq (%rax,%r13,8), %rsi
movq %r14, %rdi
callq 0x37de8
incq %r13
jmp 0x37d1d
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x37d4c
movq %r14, %rsi
callq 0x37de8
movq (%r14), %rdi
testq %rdi, %rdi
je 0x37d5c
movq %r14, %rsi
callq 0x277cc
movq 0x1a0(%r14), %rdi
callq 0x21ad0
leaq 0x168(%r14), %rdi
callq 0x6499a
leaq 0x58(%r14), %rdi
callq 0x66856
addq $0x50, %r14
movq %r14, %rdi
callq 0x34350
movq %r15, %rdi
callq 0x7c234
movq %rbx, %rdi
callq 0x7c234
movq %r12, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x7c234
jmp 0x37db0
jmp 0x37db0
jmp 0x37db0
movq %rax, %rdi
callq 0x3471e
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::RemoveChild(gaps::R3SceneNode*)
void R3SceneNode::
RemoveChild(R3SceneNode *node) 
{
  // Remove node from children
  assert(node->parent == this);
  RNArrayEntry *entry = children.KthEntry(node->parent_index);
  assert(children.EntryContents(entry) == node);
  R3SceneNode *tail = children.Tail();
  children.EntryContents(entry) = tail;
  tail->parent_index = node->parent_index;
  children.RemoveTail();
  node->parent = NULL;
  node->parent_index = -1;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x20, %rdi
movslq 0x18(%rsi), %rax
movq 0x20(%r14), %rcx
movslq 0x2c(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rdx
movq %rdx, (%rcx,%rax,8)
movl %eax, 0x18(%rdx)
callq 0x3436e
andq $0x0, 0x10(%rbx)
orl $-0x1, 0x18(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x389ac
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::NFacets() const
const RNInterval R3SceneNode::
NFacets(void) const
{
  // Initialize nfacets
  RNInterval nfacets(0,0);
  
  // Add facets from elements
  for (int i = 0; i < NElements(); i++) {
    R3SceneElement *element = Element(i);
    nfacets += element->NFacets();
  }
  
  // Add facets from references
  for (int i = 0; i < NReferences(); i++) {
    R3SceneReference *reference = Reference(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    if (referenced_scene) nfacets += referenced_scene->NFacets();
  }
  
  // Add facets from children
  for (int i = 0; i < NChildren(); i++) {
    R3SceneNode *child = Child(i);
    nfacets += child->NFacets();
  }

  // Return nfacets
  return nfacets;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x7dbf8
xorl %r12d, %r12d
movq %rsp, %r15
movslq 0x3c(%r14), %rax
cmpq %rax, %r12
jge 0x37e7a
movq 0x30(%r14), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x395d8
movupd (%rbx), %xmm0
addpd (%rsp), %xmm0
movupd %xmm0, (%rbx)
incq %r12
jmp 0x37e4f
xorl %r12d, %r12d
movq %rsp, %r15
movslq 0x4c(%r14), %rax
cmpq %rax, %r12
jge 0x37eb3
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %rax
movq (%rax), %rsi
testq %rsi, %rsi
je 0x37eae
movq %r15, %rdi
callq 0x3918a
movupd (%rbx), %xmm0
addpd (%rsp), %xmm0
movupd %xmm0, (%rbx)
incq %r12
jmp 0x37e80
xorl %r12d, %r12d
movq %rsp, %r15
movslq 0x2c(%r14), %rax
cmpq %rax, %r12
jge 0x37ee4
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x37e2c
movupd (%rbx), %xmm0
addpd (%rsp), %xmm0
movupd %xmm0, (%rbx)
incq %r12
jmp 0x37eb9
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::Length() const
const RNLength R3SceneNode::
Length(void) const
{
  // Initialize length
  RNLength length = 0;
  
  // Add length from elements
  for (int i = 0; i < NElements(); i++) {
    R3SceneElement *element = Element(i);
    length += element->Length();
  }
  
  // Add length from references
  for (int i = 0; i < NReferences(); i++) {
    R3SceneReference *reference = Reference(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    if (referenced_scene) length += referenced_scene->Length();
  }
  
  // Add length from children
  for (int i = 0; i < NChildren(); i++) {
    R3SceneNode *child = Child(i);
    length += child->Length();
  }

  // Return length
  return length;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
xorl %r14d, %r14d
movslq 0x3c(%rbx), %rax
cmpq %rax, %r14
jge 0x37f30
movq 0x30(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x39636
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x37f07
xorl %r14d, %r14d
movslq 0x4c(%rbx), %rax
cmpq %rax, %r14
jge 0x37f64
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x37f5f
callq 0x3919c
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x37f33
xorl %r14d, %r14d
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jge 0x37f90
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x37ef4
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x37f67
movsd (%rsp), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::Area() const
const RNArea R3SceneNode::
Area(void) const
{
  // Initialize area
  RNArea area = 0;
  
  // Add area from elements
  for (int i = 0; i < NElements(); i++) {
    R3SceneElement *element = Element(i);
    area += element->Area();
  }
  
  // Add area from references
  for (int i = 0; i < NReferences(); i++) {
    R3SceneReference *reference = Reference(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    if (referenced_scene) area += referenced_scene->Area();
  }
  
  // Add area from children
  for (int i = 0; i < NChildren(); i++) {
    R3SceneNode *child = Child(i);
    area += child->Area();
  }

  // Return area
  return area;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
xorl %r14d, %r14d
movslq 0x3c(%rbx), %rax
cmpq %rax, %r14
jge 0x37fda
movq 0x30(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x39680
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x37fb1
xorl %r14d, %r14d
movslq 0x4c(%rbx), %rax
cmpq %rax, %r14
jge 0x3800e
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x38009
callq 0x391a4
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x37fdd
xorl %r14d, %r14d
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jge 0x3803a
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x37f9e
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x38011
movsd (%rsp), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::Volume() const
const RNVolume R3SceneNode::
Volume(void) const
{
  // Initialize volume
  RNVolume volume = 0;
  
  // Add volume from elements
  for (int i = 0; i < NElements(); i++) {
    R3SceneElement *element = Element(i);
    volume += element->Volume();
  }
  
  // Add volume from references
  for (int i = 0; i < NReferences(); i++) {
    R3SceneReference *reference = Reference(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    if (referenced_scene) volume += referenced_scene->Volume();
  }
  
  // Add volume from children
  for (int i = 0; i < NChildren(); i++) {
    R3SceneNode *child = Child(i);
    volume += child->Volume();
  }

  // Return volume
  return volume;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
xorl %r14d, %r14d
movslq 0x3c(%rbx), %rax
cmpq %rax, %r14
jge 0x38084
movq 0x30(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x396ca
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x3805b
xorl %r14d, %r14d
movslq 0x4c(%rbx), %rax
cmpq %rax, %r14
jge 0x380b8
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x380b3
callq 0x391ac
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x38087
xorl %r14d, %r14d
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jge 0x380e4
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x38048
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r14
jmp 0x380bb
movsd (%rsp), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::BShape() const
const R3Shape& R3SceneNode::
BShape(void) const
{
  // Return bounding box
  if (bbox[0][0] == FLT_MAX) 
    ((R3SceneNode *) this)->UpdateBBox();
  return bbox;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movsd 0x170(%rdi), %xmm0
ucomisd 0x8e61c(%rip), %xmm0    # 0xc6b80
jne 0x38570
jp 0x38570
movq %rbx, %rdi
callq 0x3857c
addq $0x168, %rbx            # imm = 0x168
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::UpdateBBox()
void R3SceneNode::
UpdateBBox(void)
{
  // Initialize bounding box
  bbox = R3null_box;

  // Add bounding box of elements
  for (int i = 0; i < elements.NEntries(); i++) {
    R3SceneElement *element = elements.Kth(i);
    R3Box element_bbox = element->BBox();
    element_bbox.Transform(transformation);
    bbox.Union(element_bbox);
  }
    
  // Add bounding box of references
  for (int i = 0; i < references.NEntries(); i++) {
    R3SceneReference *reference = references.Kth(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    if (!referenced_scene) continue;
    R3Box reference_bbox = referenced_scene->BBox();
    reference_bbox.Transform(transformation);
    bbox.Union(reference_bbox);
  }
    
  // Add bounding box of children nodes
  for (int i = 0; i < children.NEntries(); i++) {
    R3SceneNode *child = children.Kth(i);
    R3Box child_bbox = child->BBox();
    child_bbox.Transform(transformation);
    bbox.Union(child_bbox);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x168(%rdi), %r14
leaq 0xfdf9e(%rip), %rsi     # 0x136538
movq %r14, %rdi
callq 0x3921c
leaq 0x58(%rbx), %r15
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
movslq 0x3c(%rbx), %rax
cmpq %rax, %r13
jge 0x385f2
movq 0x30(%rbx), %rax
movq (%rax,%r13,8), %rdi
callq 0x391b4
movq %r12, %rdi
movq %rax, %rsi
callq 0x63ce2
movq %r12, %rdi
movq %r15, %rsi
callq 0x648b2
movq %r14, %rdi
movq %r12, %rsi
callq 0x646fa
movq %r12, %rdi
callq 0x6499a
incq %r13
jmp 0x385ae
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
movslq 0x4c(%rbx), %rax
cmpq %rax, %r13
jge 0x38646
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x38641
callq 0x27352
movq %r12, %rdi
movq %rax, %rsi
callq 0x63ce2
movq %r12, %rdi
movq %r15, %rsi
callq 0x648b2
movq %r14, %rdi
movq %r12, %rsi
callq 0x646fa
movq %r12, %rdi
callq 0x6499a
incq %r13
jmp 0x385fa
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
movslq 0x2c(%rbx), %rax
cmpq %rax, %r13
jge 0x38692
movq 0x20(%rbx), %rax
movq (%rax,%r13,8), %rdi
callq 0x386ba
movq %r12, %rdi
movq %rax, %rsi
callq 0x63ce2
movq %r12, %rdi
movq %r15, %rsi
callq 0x648b2
movq %r14, %rdi
movq %r12, %rsi
callq 0x646fa
movq %r12, %rdi
callq 0x6499a
incq %r13
jmp 0x3864e
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x386a4
jmp 0x386a4
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6499a
movq %rbx, %rdi
callq 0x220e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::BBox() const
const R3Box& R3SceneNode::
BBox(void) const
{
  // Return bounding box
  if (bbox[0][0] == FLT_MAX) 
    ((R3SceneNode *) this)->UpdateBBox();
  return bbox;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movsd 0x170(%rdi), %xmm0
ucomisd 0x8e4b2(%rip), %xmm0    # 0xc6b80
jne 0x386da
jp 0x386da
movq %rbx, %rdi
callq 0x3857c
addq $0x168, %rbx            # imm = 0x168
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::WorldBBox() const
R3Box R3SceneNode::
WorldBBox(void) const
{
  // This returns bounding box in world coordinate frame
  // Note that BBox() returns bounding box after xform (in parent's coordinate frame)
  // Note that this bbox will be over-estimating, since it is a transformed AABB

  // Start for bbox in parent's coordinate frame
  R3Box box = BBox();

  // Transform box
  R3SceneNode *ancestor = Parent();
  while (ancestor) {
    box.Transform(ancestor->Transformation());
    ancestor = ancestor->Parent();
  }

  // Return box;
  return bbox;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x386ba
movq %rsp, %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x63ce2
movq %r14, %r12
movq 0x10(%r12), %r12
testq %r12, %r12
je 0x38729
leaq 0x58(%r12), %rsi
movq %r15, %rdi
callq 0x648b2
jmp 0x38710
addq $0x168, %r14            # imm = 0x168
movq %rbx, %rdi
movq %r14, %rsi
callq 0x63ce2
movq %rsp, %rdi
callq 0x6499a
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x38754
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6499a
movq %rbx, %rdi
callq 0x220e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::LocalBBox() const
R3Box R3SceneNode::
LocalBBox(void) const
{
  // This returns bounding box in this node's coordinate frame (before transformation)
  // Note that BBox() returns bounding box after xform (in parent's coordinate frame)
  
  // Compute bounding box in local coordinates
  R3Box bbox = R3null_box;

  // Include elements
  for (int i = 0; i < NElements(); i++) {
    R3SceneElement *element = Element(i);
    bbox.Union(element->BBox());
  }

  // Include references
  for (int i = 0; i < NReferences(); i++) {
    R3SceneReference *reference = Reference(i);
    bbox.Union(reference->BBox());
  }

  // Include children
  for (int i = 0; i < NChildren(); i++) {
    R3SceneNode *child = Child(i);
    bbox.Union(child->BBox());
  }

  // Return box
  return bbox;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xfddbe(%rip), %rsi     # 0x136538
callq 0x63ce2
xorl %r15d, %r15d
movslq 0x3c(%r14), %rax
cmpq %rax, %r15
jge 0x387a8
movq 0x30(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x391b4
movq %rbx, %rdi
movq %rax, %rsi
callq 0x646fa
incq %r15
jmp 0x38782
xorl %r15d, %r15d
movslq 0x4c(%r14), %rax
cmpq %rax, %r15
jge 0x387d1
movq 0x40(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x39c5c
movq %rbx, %rdi
movq %rax, %rsi
callq 0x646fa
incq %r15
jmp 0x387ab
xorl %r15d, %r15d
movslq 0x2c(%r14), %rax
cmpq %rax, %r15
jge 0x387fa
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x386ba
movq %rbx, %rdi
movq %rax, %rsi
callq 0x646fa
incq %r15
jmp 0x387d4
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
jmp 0x38807
jmp 0x38807
movq %rax, %r14
movq %rbx, %rdi
callq 0x6499a
movq %r14, %rdi
callq 0x220e0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::CumulativeTransformation() const
R3Affine R3SceneNode::
CumulativeTransformation(void) const
{
  // Initialize cumulative transformation
  R3Affine cumulative_transformation(R3identity_affine);

  // Concatenate transformations back to the root
  const R3SceneNode *ancestor = this;
  while (ancestor) {
    R3Affine t(R3identity_affine);
    t.Transform(ancestor->Transformation());
    t.Transform(cumulative_transformation);
    cumulative_transformation = t;
    ancestor = ancestor->Parent();
  }

  // Return cumulative transformation from root to node (including node's transformation)
  return cumulative_transformation;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xfde37(%rip), %r15     # 0x1366a0
movq %r15, %rsi
callq 0x34464
leaq 0x8(%rsp), %r12
testq %r14, %r14
je 0x388b6
movq %r12, %rdi
movq %r15, %rsi
callq 0x34464
leaq 0x58(%r14), %rsi
movq %r12, %rdi
callq 0x669c2
movq %r12, %rdi
movq %rbx, %rsi
callq 0x669c2
movq %rbx, %rdi
movq %r12, %rsi
callq 0x391da
movq 0x10(%r14), %r14
movq %r12, %rdi
callq 0x66856
jmp 0x38876
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
jmp 0x388da
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x66856
movq %rbx, %rdi
callq 0x66856
movq %r14, %rdi
callq 0x220e0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::CumulativeParentTransformation() const
R3Affine R3SceneNode::
CumulativeParentTransformation(void) const
{
  // Initialize cumulative transformation
  R3Affine cumulative_transformation(R3identity_affine);

  // Concatenate transformations back to the root
  const R3SceneNode *ancestor = Parent();
  while (ancestor) {
    R3Affine t(R3identity_affine);
    t.Transform(ancestor->Transformation());
    t.Transform(cumulative_transformation);
    cumulative_transformation = t;
    ancestor = ancestor->Parent();
  }

  // Return cumulative transformation from root to parent (not including node's transformation)
  return cumulative_transformation;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xfdd9b(%rip), %r14     # 0x1366a0
movq %r14, %rsi
callq 0x34464
movq 0x10(%r15), %r12
leaq 0x8(%rsp), %r15
testq %r12, %r12
je 0x38958
movq %r15, %rdi
movq %r14, %rsi
callq 0x34464
leaq 0x58(%r12), %rsi
movq %r15, %rdi
callq 0x669c2
movq %r15, %rdi
movq %rbx, %rsi
callq 0x669c2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x391da
movq 0x10(%r12), %r12
movq %r15, %rdi
callq 0x66856
jmp 0x38916
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
jmp 0x3897c
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x66856
movq %rbx, %rdi
callq 0x66856
movq %r14, %rdi
callq 0x220e0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneNode.cpp
// Function: gaps::R3SceneNode::Draw(gaps::RNFlags, gaps::RNArray<gaps::R3Material*> const*) const
void R3SceneNode::
Draw(const R3DrawFlags draw_flags, const RNArray<R3Material *> *materials) const
{
  // Push transformation
  transformation.Push();

  // Draw elements
  for (int i = 0; i < elements.NEntries(); i++) {
    R3SceneElement *element = elements.Kth(i);
    element->Draw(draw_flags, materials);
  }

  // Draw references
  for (int i = 0; i < references.NEntries(); i++) {
    R3SceneReference *reference = references.Kth(i);
    reference->Draw(draw_flags, materials);
  }

  // Draw children
  for (int i = 0; i < children.NEntries(); i++) {
    R3SceneNode *child = children.Kth(i);
    child->Draw(draw_flags, materials);
  }

  // Pop transformation
  transformation.Pop();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
leaq 0x58(%rdi), %r15
movq %r15, %rdi
callq 0x40294
xorl %r13d, %r13d
movslq 0x3c(%r12), %rax
cmpq %rax, %r13
jge 0x3912c
movq 0x30(%r12), %rax
movq (%rax,%r13,8), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x39a8a
incq %r13
jmp 0x39109
xorl %r13d, %r13d
movslq 0x4c(%r12), %rax
cmpq %rax, %r13
jge 0x39152
movq 0x40(%r12), %rax
movq (%rax,%r13,8), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x39e28
incq %r13
jmp 0x3912f
xorl %r13d, %r13d
movslq 0x2c(%r12), %rax
cmpq %rax, %r13
jge 0x39178
movq 0x20(%r12), %rax
movq (%rax,%r13,8), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x390e8
incq %r13
jmp 0x39155
movq %r15, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x402d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/./R3SceneElement.h
// Function: gaps::R3SceneElement::BBox() const
inline const R3Box& R3SceneElement::
BBox(void) const
{
  // Return bounding box
  if (bbox[0][0] == FLT_MAX) 
    ((R3SceneElement *) this)->UpdateBBox();
  return bbox;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movsd 0x30(%rdi), %xmm0
ucomisd 0x8d9bb(%rip), %xmm0    # 0xc6b80
jne 0x391d1
jp 0x391d1
movq %rbx, %rdi
callq 0x39b0e
addq $0x28, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::~R3SceneElement()
R3SceneElement::
~R3SceneElement(void)
{
  // Delete display list
  if (opengl_id > 0) glDeleteLists(opengl_id, 1); 

  // Remove from node
  if (node) node->RemoveElement(this);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x20(%rdi), %edi
testl %edi, %edi
je 0x3958b
pushq $0x1
popq %rsi
callq 0x22360
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3959b
movq %rbx, %rsi
callq 0x37db8
leaq 0x28(%rbx), %rdi
callq 0x6499a
addq $0x10, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x7c234
movq %rax, %rdi
callq 0x3471e
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::NFacets() const
const RNInterval R3SceneElement::
NFacets(void) const
{
  // Initialize nfacets
  RNInterval nfacets(0,0);
  
  // Add facets from shapes
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    nfacets += shape->NFacets();
  }
  
  // Return nfacets
  return nfacets;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x7dbf8
xorl %r12d, %r12d
movq %rsp, %r15
movslq 0x1c(%r14), %rax
cmpq %rax, %r12
jge 0x39627
movq 0x10(%r14), %rax
movq (%rax,%r12,8), %rsi
movq (%rsi), %rax
movq %r15, %rdi
callq *0x48(%rax)
movupd (%rbx), %xmm0
addpd (%rsp), %xmm0
movupd %xmm0, (%rbx)
incq %r12
jmp 0x395fb
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::Length() const
const RNLength R3SceneElement::
Length(void) const
{
  // Initialize length
  RNLength length = 0;
  
  // Add length from shapes
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    length += shape->Length();
  }
  
  // Return length
  return length;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movslq 0x1c(%rbx), %rax
cmpq %rax, %r14
jge 0x39678
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
movsd %xmm0, (%rsp)
callq *0x50(%rax)
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r14
jmp 0x39644
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::Area() const
const RNArea R3SceneElement::
Area(void) const
{
  // Initialize area
  RNArea area = 0;
  
  // Add area from shapes
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    area += shape->Area();
  }
  
  // Return area
  return area;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movslq 0x1c(%rbx), %rax
cmpq %rax, %r14
jge 0x396c2
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
movsd %xmm0, (%rsp)
callq *0x58(%rax)
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r14
jmp 0x3968e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::Volume() const
const RNVolume R3SceneElement::
Volume(void) const
{
  // Initialize volume
  RNVolume volume = 0;
  
  // Add volume from shapes
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    volume += shape->Volume();
  }

  // Return volume
  return volume;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movslq 0x1c(%rbx), %rax
cmpq %rax, %r14
jge 0x3970c
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
movsd %xmm0, (%rsp)
callq *0x60(%rax)
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r14
jmp 0x396d8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::Transform(gaps::R3Transformation const&)
void R3SceneElement::
Transform(const R3Transformation& transformation)
{
  // Transform all shapes
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    shape->Transform(transformation);
  }


  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorl %r15d, %r15d
movslq 0x1c(%rbx), %rax
cmpq %rax, %r15
jge 0x39792
movq 0x10(%rbx), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0xa0(%rax)
incq %r15
jmp 0x39770
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x39730
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::FindClosest(gaps::R3Point const&, gaps::R3Shape**, gaps::R3Point*, gaps::R3Vector*, double*, double, double) const
RNBoolean R3SceneElement::
FindClosest(const R3Point& point, R3Shape **hit_shape,
  R3Point *hit_point, R3Vector *hit_normal, RNLength *hit_d,
  RNLength min_d, RNLength max_d) const
{
  // Check if bounding box is within max_d
  RNScalar bbox_d = R3Distance(point, BBox());
  if (bbox_d > max_d) return FALSE;

  // Find distance to closest shape
  RNBoolean found = FALSE;
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    R3Point closest = shape->ClosestPoint(point);
    RNLength d = R3Distance(closest, point);
    if ((d >= min_d) && (d <= max_d)) {
      if (hit_shape) *hit_shape = shape;
      if (hit_point) *hit_point = closest;
      if (hit_normal) *hit_normal = R3zero_vector; // ???
      if (hit_d) *hit_d = d;
      found = TRUE;
      max_d = d;
    }
  }

  // Return whether hit any shape
  return found;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x38(%rsp)
movq %r9, %rbx
movq %r8, %r15
movq %rcx, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, %r13
movq %rdi, %rbp
callq 0x391b4
movq %r13, %rdi
movq %rax, %rsi
callq 0x483ab
xorl %r14d, %r14d
ucomisd 0x8(%rsp), %xmm0
jbe 0x39839
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
xorl %r12d, %r12d
leaq 0x40(%rsp), %rbx
xorl %r14d, %r14d
movslq 0x1c(%rbp), %rax
cmpq %rax, %r12
jge 0x39827
movq 0x10(%rbp), %rax
movq (%rax,%r12,8), %r15
movq (%r15), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq *0x70(%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x48146
ucomisd 0x38(%rsp), %xmm0
jb 0x398f1
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x398f1
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3989e
movq %r15, (%rax)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
movsd %xmm1, 0x10(%rsp)
je 0x398bc
movq %rbx, %rsi
callq 0x6bb5e
movsd 0x10(%rsp), %xmm1
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
movq 0x20(%rsp), %r14
je 0x398dd
leaq 0x8e42e(%rip), %rsi     # 0xc7d00
callq 0x6c5a4
movsd 0x10(%rsp), %xmm1
testq %r14, %r14
je 0x398e7
movsd %xmm1, (%r14)
pushq $0x1
popq %r14
movsd %xmm1, 0x8(%rsp)
incq %r12
jmp 0x3984e
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::Intersects(gaps::R3Ray const&, gaps::R3Shape**, gaps::R3Point*, gaps::R3Vector*, double*, double, double) const
RNBoolean R3SceneElement::
Intersects(const R3Ray& ray, R3Shape **hit_shape,
  R3Point *hit_point, R3Vector *hit_normal, RNScalar *hit_t,
  RNScalar min_t, RNScalar max_t) const
{
  // Variables
  RNScalar bbox_t;
  RNScalar closest_t = max_t;
  R3Point point;
  R3Vector normal;
  RNScalar t;

  // Check if ray intersects bounding box
  if (!R3Intersects(ray, BBox(), NULL, NULL, &bbox_t)) return FALSE;
  if (RNIsGreater(bbox_t, max_t)) return FALSE;

  // Intersect with shapes
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    if (shape->Intersects(ray, &point, &normal, &t)) {
      if ((t >= min_t) && (t <= closest_t)) {
        if (hit_shape) *hit_shape = shape;
        if (hit_point) *hit_point = point;
        if (hit_normal) *hit_normal = normal;
        if (hit_t) *hit_t = t;
        closest_t = t;
      }
    }
  }

  // Return whether hit any shape
  return (closest_t == max_t) ? FALSE : TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x38(%rsp)
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq %rdx, 0x30(%rsp)
movq %rsi, %r13
movq %rdi, %rbp
leaq 0x48(%rsp), %rdi
callq 0x6b872
leaq 0x60(%rsp), %rdi
callq 0x6c032
movq %rbp, %rdi
callq 0x391b4
xorl %ebx, %ebx
leaq 0x40(%rsp), %r8
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x42e21
testl %eax, %eax
je 0x39a79
movsd 0x40(%rsp), %xmm0
leaq 0xf5789(%rip), %rax     # 0x12f0f8
movsd 0x8(%rsp), %xmm1
subsd %xmm1, %xmm0
ucomisd (%rax), %xmm0
ja 0x39a79
movapd %xmm1, %xmm0
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
xorl %r15d, %r15d
leaq 0x60(%rsp), %r14
movslq 0x1c(%rbp), %rax
cmpq %rax, %r15
jge 0x39a6c
movsd %xmm1, 0x10(%rsp)
movq %r12, %rbx
movq 0x10(%rbp), %rax
movq (%rax,%r15,8), %r12
movq (%r12), %rax
movq %r12, %rdi
movq %r13, %rsi
leaq 0x48(%rsp), %rdx
movq %r14, %rcx
leaq 0x18(%rsp), %r8
callq *0x1d8(%rax)
testl %eax, %eax
je 0x39a4d
movsd 0x18(%rsp), %xmm0
ucomisd 0x38(%rsp), %xmm0
movq 0x30(%rsp), %rax
movsd 0x10(%rsp), %xmm1
jb 0x39a5b
ucomisd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
jb 0x39a61
testq %rax, %rax
je 0x39a05
movq %r12, (%rax)
testq %rbx, %rbx
je 0x39a1d
movq %rbx, %rdi
leaq 0x48(%rsp), %rsi
callq 0x6bb5e
movsd 0x8(%rsp), %xmm0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
movq 0x28(%rsp), %r12
je 0x39a3a
movq %r14, %rsi
callq 0x6c5a4
movsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
testq %r12, %r12
je 0x39a61
movsd %xmm1, (%r12)
jmp 0x39a61
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
jmp 0x39a61
movsd 0x8(%rsp), %xmm0
incq %r15
movq %rbx, %r12
jmp 0x39999
cmpneqsd %xmm0, %xmm1
movq %xmm1, %rbx
andl $0x1, %ebx
movl %ebx, %eax
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/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::Draw(gaps::RNFlags, gaps::RNArray<gaps::R3Material*> const*) const
void R3SceneElement::
Draw(const R3DrawFlags draw_flags, const RNArray<R3Material *> *materials) const
{
  // Check shapes
  if (NShapes() == 0) return;

  // Draw material
  if (material && draw_flags[R3_SURFACE_MATERIAL_DRAW_FLAG]) {
    int material_index = material->SceneIndex();
    if (materials && (material_index >= 0) && (material_index < materials->NEntries()) && materials->Kth(material_index)) materials->Kth(material_index)->Draw();
    else material->Draw();
  }

  // Draw shapes
  if (0 && (draw_flags == R3_DEFAULT_DRAW_FLAGS)) {
    // Create display list
    if (opengl_id == 0) {
      // Begin display list
      R3SceneElement *element = (R3SceneElement *) this;
      element->opengl_id = glGenLists(1);
      glNewList(opengl_id, GL_COMPILE);
      
      // Draw shapes
      for (int i = 0; i < NShapes(); i++) {
        R3Shape *shape = Shape(i);
        shape->Draw(draw_flags);
      }

      // End display list
      glEndList();
    }

    // Call display list
    glCallList(opengl_id);
  }
  else {
    // Draw shapes with non-default draw flags
    for (int i = 0; i < NShapes(); i++) {
      R3Shape *shape = Shape(i);
      shape->Draw(draw_flags);
    }
  }
}

// Assembly:
cmpl $0x0, 0x1c(%rdi)
je 0x39b0d
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
testq %rax, %rax
sete %cl
testb $0x40, %bl
sete %sil
orb %cl, %sil
jne 0x39ae3
movslq 0x8(%rax), %rcx
testq %rcx, %rcx
sets %sil
testq %rdx, %rdx
sete %dil
orb %sil, %dil
jne 0x39ad9
cmpl 0xc(%rdx), %ecx
jge 0x39ad9
movq (%rdx), %rdx
movq (%rdx,%rcx,8), %rdi
testq %rdi, %rdi
jne 0x39adc
movq %rax, %rdi
xorl %esi, %esi
callq 0x3effc
xorl %r15d, %r15d
movslq 0x1c(%r14), %rax
cmpq %rax, %r15
jge 0x39b08
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0xa8(%rax)
incq %r15
jmp 0x39ae6
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3SceneElement.cpp
// Function: gaps::R3SceneElement::UpdateBBox()
void R3SceneElement::
UpdateBBox(void)
{
  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NShapes(); i++) {
    R3Shape *shape = Shape(i);
    bbox.Union(shape->BBox());
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
leaq 0xfca11(%rip), %rsi     # 0x136538
movq %r14, %rdi
callq 0x3921c
xorl %r12d, %r12d
movq %rsp, %r15
movslq 0x1c(%rbx), %rax
cmpq %rax, %r12
jge 0x39b6a
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq (%rsi), %rax
movq %r15, %rdi
callq *0x88(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x646fa
movq %r15, %rdi
callq 0x6499a
incq %r12
jmp 0x39b35
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6499a
movq %rbx, %rdi
callq 0x220e0
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::ResizeViewport(int, int)
void R3Viewer::
ResizeViewport (int width, int height) 
{
    // Resize viewport
    viewport.Resize(width, height);

    // Adjust camera field of view to match viewport aspect ratio
    RNScalar aspect = (RNScalar) height / (RNScalar) width;
    camera.SetYFOV(atan(aspect * tan(camera.XFOV())));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
addq $0x98, %rdi
callq 0x3c46c
cvtsi2sd %ebx, %xmm1
cvtsi2sd %ebp, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x68(%r14), %xmm0
addq $0x8, %r14
callq 0x214c0
mulsd 0x8(%rsp), %xmm0
callq 0x21730
movq %r14, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x3c026
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::ScaleWorld(gaps::R3Point const&, double)
void R3Viewer::
ScaleWorld (const R3Point& origin, RNScalar factor)
{
    // Scale world by factor - translate camera
    assert(factor > 0.0);
    factor = (factor - 1.0) / factor;
    camera.Translate((origin - camera.Origin()) * factor);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movsd 0x8b3fe(%rip), %xmm1    # 0xc54d0
addsd %xmm0, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
addq $0x8, %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq 0x6ba51
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x6c72a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3c038
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Viewer.cpp
// Function: gaps::R3Viewer::RotateWorld(gaps::R3Point const&, gaps::R3Vector const&, double)
void R3Viewer::
RotateWorld (const R3Point& origin, const R3Vector& axis, RNAngle dtheta)
{
    // Rotate camera around line (origin, axis)
    R3Line axis_line = R3Line(origin, axis);
    R3Point apex = camera.Origin();
    apex.Rotate(axis_line, dtheta);
    R3Vector towards = camera.Towards();
    towards.Rotate(axis, dtheta);
    R3Vector up = camera.Up();
    up.Rotate(axis, dtheta);
    camera.Reset(apex, towards, up);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movsd %xmm0, 0x8(%rsp)
movq %rdx, %rbx
movq %rdi, %r12
leaq 0x58(%rsp), %r13
movq %r13, %rdi
xorl %ecx, %ecx
callq 0x6b58e
leaq 0x8(%r12), %r14
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6b884
movq %r15, %rdi
movq %r13, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x6be56
leaq 0x50(%r12), %rsi
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x6c99a
movq %r13, %rdi
movq %rbx, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x6c5c4
addq $0x38, %r12
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x6c044
movq %rbp, %rdi
movq %rbx, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x6c5c4
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x3bdbe
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop