LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelObject.cpp
// Function: gaps::R3SurfelObject::UpdateProperties()
void R3SurfelObject::
UpdateProperties(void)
{
  // Update properties
  double dummy = 0;
  dummy += Complexity();
  dummy += BBox().Min().X();
  dummy += TimestampRange().Min();
  if (dummy == 927612.21242) {
    printf("Amazing!\n");
  }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorpd %xmm1, %xmm1
addsd 0x98(%rdi), %xmm1
movsd 0xa8(%rdi), %xmm0
ucomisd 0xc4e20(%rip), %xmm0    # 0xdd168
jne 0x18368
jp 0x18368
movq %rbx, %rdi
movsd %xmm1, 0x8(%rsp)
callq 0x170a4
movsd 0x8(%rsp), %xmm1
movsd 0xa8(%rbx), %xmm0
addsd %xmm0, %xmm1
movsd 0xd8(%rbx), %xmm0
ucomisd 0xc4dec(%rip), %xmm0    # 0xdd168
jne 0x1839c
jp 0x1839c
movq %rbx, %rdi
movsd %xmm1, 0x8(%rsp)
callq 0x1722e
movsd 0x8(%rsp), %xmm1
movsd 0xd8(%rbx), %xmm0
addsd %xmm0, %xmm1
ucomisd 0xc4f78(%rip), %xmm1    # 0xdd320
jne 0x183bd
jp 0x183bd
leaq 0xc4f95(%rip), %rdi     # 0xdd348
addq $0x10, %rsp
popq %rbx
jmp 0x137c0
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindObjectByName(char const*) const
R3SurfelObject *R3SurfelScene::
FindObjectByName(const char *object_name) const
{
  // Search for object
  for (int i = 0; i < NObjects(); i++) {
    R3SurfelObject *object = Object(i);
    if (!object->Name()) continue;
    if (strcmp(object->Name(), object_name)) continue;
    return object;
  }

  // Not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x1c(%rdi), %r15
testq %r15, %r15
jle 0x18afe
movq %rsi, %rbx
movq 0x10(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x88(%r14), %rdi
testq %rdi, %rdi
je 0x18af6
movq %rbx, %rsi
callq 0x13710
testl %eax, %eax
je 0x18b01
incq %r13
cmpq %r13, %r15
jne 0x18ada
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindObjectByIdentifier(int) const
R3SurfelObject *R3SurfelScene::
FindObjectByIdentifier(int identifier) const
{
  // Search for object
  for (int i = 0; i < NObjects(); i++) {
    R3SurfelObject *object = Object(i);
    if (object->Identifier() < 0) continue;
    if (object->Identifier() != identifier) continue;
    return object;
  }

  // Not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x1c(%rdi)
jle 0x18b50
movl %esi, %ebx
movq %rdi, %r14
xorl %r12d, %r12d
movq 0x10(%r14), %rax
movq (%rax,%r12,8), %r15
movq %r15, %rdi
callq 0x17056
testl %eax, %eax
js 0x18b44
movq %r15, %rdi
callq 0x17056
cmpl %ebx, %eax
je 0x18b53
incq %r12
movslq 0x1c(%r14), %rax
cmpq %rax, %r12
jl 0x18b24
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindLabelByName(char const*) const
R3SurfelLabel *R3SurfelScene::
FindLabelByName(const char *label_name) const
{
  // Search for label
  for (int i = 0; i < NLabels(); i++) {
    R3SurfelLabel *label = Label(i);
    if (!label->Name()) continue;
    if (strcmp(label->Name(), label_name)) continue;
    return label;
  }

  // Not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x2c(%rdi), %r15
testq %r15, %r15
jle 0x18b9f
movq %rsi, %rbx
movq 0x20(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x60(%r14), %rdi
testq %rdi, %rdi
je 0x18b97
movq %rbx, %rsi
callq 0x13710
testl %eax, %eax
je 0x18ba2
incq %r13
cmpq %r13, %r15
jne 0x18b7e
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindLabelByIdentifier(int) const
R3SurfelLabel *R3SurfelScene::
FindLabelByIdentifier(int identifier) const
{
  // Search for label
  for (int i = 0; i < NLabels(); i++) {
    R3SurfelLabel *label = Label(i);
    if (label->Identifier() < 0) continue;
    if (label->Identifier() != identifier) continue;
    return label;
  }

  // Not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x2c(%rdi)
jle 0x18bf2
movl %esi, %ebx
movq %rdi, %r14
xorl %r12d, %r12d
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %r15
movq %r15, %rdi
callq 0x4048a
testl %eax, %eax
js 0x18be6
movq %r15, %rdi
callq 0x4048a
cmpl %ebx, %eax
je 0x18bf5
incq %r12
movslq 0x2c(%r14), %rax
cmpq %rax, %r12
jl 0x18bc6
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindLabelByAssignmentKeystroke(int) const
R3SurfelLabel *R3SurfelScene::
FindLabelByAssignmentKeystroke(int key) const
{
  // Search for label
  for (int i = 0; i < NLabels(); i++) {
    R3SurfelLabel *label = Label(i);
    if (label->AssignmentKeystroke() < 0) continue;
    if (label->AssignmentKeystroke() != key) continue;
    return label;
  }

  // Not found
  return NULL;
}

// Assembly:
movslq 0x2c(%rdi), %rcx
testq %rcx, %rcx
jle 0x18c36
movq 0x20(%rdi), %rdx
xorl %edi, %edi
movq (%rdx,%rdi,8), %rax
movl 0x6c(%rax), %r8d
testl %r8d, %r8d
setns %r9b
cmpl %esi, %r8d
sete %r8b
testb %r8b, %r9b
jne 0x18c38
incq %rdi
cmpq %rdi, %rcx
jne 0x18c13
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindLabelAssignment(gaps::R3SurfelObject*, gaps::R3SurfelLabel*, double, int) const
R3SurfelLabelAssignment *R3SurfelScene::
FindLabelAssignment(R3SurfelObject *object, R3SurfelLabel *label, RNScalar confidence, int originator) const
{
  // Search for label assignment
  for (int i = 0; i < object->NLabelAssignments(); i++) {
    R3SurfelLabelAssignment *assignment = object->LabelAssignment(i);
    if (assignment->Label() != label) continue;
    if (assignment->Confidence() != confidence) continue;
    if (assignment->Originator() != originator) continue;
    return assignment;
  }

  // Not found
  return NULL;
}

// Assembly:
movslq 0x5c(%rsi), %rdi
testq %rdi, %rdi
jle 0x18c6e
movq 0x50(%rsi), %rsi
xorl %r8d, %r8d
movq (%rsi,%r8,8), %rax
cmpq %rdx, 0x28(%rax)
jne 0x18c66
movsd 0x38(%rax), %xmm1
ucomisd %xmm0, %xmm1
jne 0x18c66
jp 0x18c66
cmpl %ecx, 0x40(%rax)
je 0x18c70
incq %r8
cmpq %r8, %rdi
jne 0x18c4a
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindScanByName(char const*) const
R3SurfelScan *R3SurfelScene::
FindScanByName(const char *scan_name) const
{
  // Search for scan
  for (int i = 0; i < NScans(); i++) {
    R3SurfelScan *scan = Scan(i);
    if (!scan->Name()) continue;
    if (strcmp(scan->Name(), scan_name)) continue;
    return scan;
  }

  // Not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x8c(%rdi), %r15
testq %r15, %r15
jle 0x18cb8
movq %rsi, %rbx
movq 0x80(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0xb8(%r14), %rdi
testq %rdi, %rdi
je 0x18cb0
movq %rbx, %rsi
callq 0x13710
testl %eax, %eax
je 0x18cbb
incq %r13
cmpq %r13, %r15
jne 0x18c94
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindImageByName(char const*) const
R3SurfelImage *R3SurfelScene::
FindImageByName(const char *image_name) const
{
  // Search for image
  for (int i = 0; i < NImages(); i++) {
    R3SurfelImage *image = Image(i);
    if (!image->Name()) continue;
    if (strcmp(image->Name(), image_name)) continue;
    return image;
  }

  // Not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x9c(%rdi), %r15
testq %r15, %r15
jle 0x18d0e
movq %rsi, %rbx
movq 0x90(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x1c0(%r14), %rdi
testq %rdi, %rdi
je 0x18d06
movq %rbx, %rsi
callq 0x13710
testl %eax, %eax
je 0x18d11
incq %r13
cmpq %r13, %r15
jne 0x18cea
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::FindFeatureByName(char const*) const
R3SurfelFeature *R3SurfelScene::
FindFeatureByName(const char *feature_name) const
{
  // Search for feature
  for (int i = 0; i < NFeatures(); i++) {
    R3SurfelFeature *feature = Feature(i);
    if (!feature->Name()) continue;
    if (strcmp(feature->Name(), feature_name)) continue;
    return feature;
  }

  // Not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0xac(%rdi), %r15
testq %r15, %r15
jle 0x18f0f
movq %rsi, %rbx
movq 0xa0(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x18f07
movq %rbx, %rsi
callq 0x13710
testl %eax, %eax
je 0x18f12
incq %r13
cmpq %r13, %r15
jne 0x18eee
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::SetName(char const*)
void R3SurfelScene::
SetName(const char *name)
{
  // Delete previous name
  if (this->name) free(this->name);

  // Set new name
  this->name = (name) ? RNStrdup(name) : NULL;

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x1d0(%rdi), %rdi
testq %rdi, %rdi
je 0x18f3b
callq 0x135e0
testq %r14, %r14
je 0x18f4a
movq %r14, %rdi
callq 0xac67b
jmp 0x18f4c
xorl %eax, %eax
movq %rax, 0x1d0(%rbx)
orb $0x1, 0x1e8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::InsertObject(gaps::R3SurfelObject*, gaps::R3SurfelObject*)
void R3SurfelScene::
InsertObject(R3SurfelObject *object, R3SurfelObject *parent)
{
  // Just checking
  assert(object);
  assert(object->scene == NULL);
  assert(object->scene_index == -1);

  // Insert object into scene
  object->scene = this;
  object->scene_index = objects.NEntries();
  objects.Insert(object);

  // Insert object into parent
  object->parent = parent;
  if (parent) parent->parts.Insert(object);

  // Update object
  object->UpdateAfterInsert(this);

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x8(%rsi)
addq $0x10, %rdi
movl 0x1c(%rbx), %edx
movl %edx, 0x10(%rsi)
callq 0xa9d3e
movq %r15, 0x18(%r14)
testq %r15, %r15
je 0x19219
movl 0x2c(%r15), %edx
addq $0x20, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa9d3e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x18090
orb $0x1, 0x1e8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::InsertLabel(gaps::R3SurfelLabel*, gaps::R3SurfelLabel*)
void R3SurfelScene::
InsertLabel(R3SurfelLabel *label, R3SurfelLabel *parent)
{
  // Just checking
  assert(label);
  assert(label->scene == NULL);
  assert(label->scene_index == -1);

  // Insert label 
  label->scene = this;
  label->scene_index = labels.NEntries();
  labels.Insert(label);

  // Insert label into parent
  label->parent = parent;
  if (parent) parent->parts.Insert(label);

  // Update label
  label->UpdateAfterInsert(this);

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x8(%rsi)
addq $0x20, %rdi
movl 0x2c(%rbx), %edx
movl %edx, 0x10(%rsi)
callq 0xa9d3e
movq %r15, 0x18(%r14)
testq %r15, %r15
je 0x194d5
movl 0x2c(%r15), %edx
addq $0x20, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa9d3e
orb $0x1, 0x1e8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::InsertObjectRelationship(gaps::R3SurfelObjectRelationship*)
void R3SurfelScene::
InsertObjectRelationship(R3SurfelObjectRelationship *relationship)
{
  // Just checking
  assert(relationship);
  assert(relationship->scene == NULL);
  assert(relationship->scene_index == -1);

  // Insert relationship into scene
  relationship->scene = this;
  relationship->scene_index = object_relationships.NEntries();
  object_relationships.Insert(relationship);

  // Update objects
  for (int i = 0; i < relationship->NObjects(); i++) {
    R3SurfelObject *object = relationship->Object(i);
    object->UpdateAfterInsertObjectRelationship(relationship);
  }

  // Update object relationship
  relationship->UpdateAfterInsert(this);

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x8(%rsi)
addq $0x50, %rdi
movl 0x5c(%rbx), %edx
movl %edx, 0x10(%rsi)
callq 0xa9d3e
cmpl $0x0, 0x24(%r14)
jle 0x1975c
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
callq 0x1818c
incq %r15
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jl 0x19740
orb $0x1, 0x1e8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::RemoveObjectRelationship(gaps::R3SurfelObjectRelationship*)
void R3SurfelScene::
RemoveObjectRelationship(R3SurfelObjectRelationship *relationship)
{
  // Just checking
  assert(relationship);
  assert(relationship->scene == this);
  assert(relationship->scene_index >= 0);
  assert(object_relationships.Kth(relationship->scene_index) == relationship);

  // Update object relationship
  relationship->UpdateBeforeRemove(this);

  // Update objects
  for (int i = 0; i < relationship->NObjects(); i++) {
    R3SurfelObject *object = relationship->Object(i);
    object->UpdateBeforeRemoveObjectRelationship(relationship);
  }

  // Remove relationship from scene
  RNArrayEntry *entry = object_relationships.KthEntry(relationship->scene_index);
  R3SurfelObjectRelationship *tail = object_relationships.Tail();
  tail->scene_index = relationship->scene_index;
  object_relationships.EntryContents(entry) = tail;
  object_relationships.RemoveTail();
  relationship->scene_index = -1;
  relationship->scene = NULL;

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x24(%rsi)
jle 0x1979a
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
callq 0x18198
incq %r15
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jl 0x1977e
leaq 0x50(%rbx), %rdi
movslq 0x10(%r14), %rax
movq 0x50(%rbx), %rcx
movslq 0x5c(%rbx), %rdx
movq -0x8(%rcx,%rdx,8), %rsi
movl %eax, 0x10(%rsi)
movq %rsi, (%rcx,%rax,8)
leal -0x1(%rdx), %esi
callq 0xa9ec8
movl $0xffffffff, 0x10(%r14) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%r14)
orb $0x1, 0x1e8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::InsertLabelRelationship(gaps::R3SurfelLabelRelationship*)
void R3SurfelScene::
InsertLabelRelationship(R3SurfelLabelRelationship *relationship)
{
  // Just checking
  assert(relationship);
  assert(relationship->scene == this);
  assert(relationship->scene_index == -1);

  // Insert relationship into scene
  relationship->scene = this;
  relationship->scene_index = label_relationships.NEntries();
  label_relationships.Insert(relationship);

  // Update labels
  for (int i = 0; i < relationship->NLabels(); i++) {
    R3SurfelLabel *label = relationship->Label(i);
    label->UpdateAfterInsertLabelRelationship(relationship);
  }

  // Update label relationship
  relationship->UpdateAfterInsert(this);

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x8(%rsi)
addq $0x60, %rdi
movl 0x6c(%rbx), %edx
movl %edx, 0x10(%rsi)
callq 0xa9d3e
cmpl $0x0, 0x24(%r14)
jle 0x19820
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
callq 0x40744
incq %r15
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jl 0x19804
orb $0x1, 0x1e8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::RemoveLabelRelationship(gaps::R3SurfelLabelRelationship*)
void R3SurfelScene::
RemoveLabelRelationship(R3SurfelLabelRelationship *relationship)
{
  // Just checking
  assert(relationship);
  assert(relationship->scene == this);
  assert(relationship->scene_index >= 0);
  assert(label_relationships.Kth(relationship->scene_index) == relationship);

  // Update label relationship
  relationship->UpdateAfterInsert(this);

  // Update labels
  for (int i = 0; i < relationship->NLabels(); i++) {
    R3SurfelLabel *label = relationship->Label(i);
    label->UpdateBeforeRemoveLabelRelationship(relationship);
  }

  // Remove relationship from scene
  RNArrayEntry *entry = label_relationships.KthEntry(relationship->scene_index);
  R3SurfelLabelRelationship *tail = label_relationships.Tail();
  tail->scene_index = relationship->scene_index;
  label_relationships.EntryContents(entry) = tail;
  label_relationships.RemoveTail();
  relationship->scene_index = -1;
  relationship->scene = NULL;

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x24(%rsi)
jle 0x1985e
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
callq 0x40750
incq %r15
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jl 0x19842
leaq 0x60(%rbx), %rdi
movslq 0x10(%r14), %rax
movq 0x60(%rbx), %rcx
movslq 0x6c(%rbx), %rdx
movq -0x8(%rcx,%rdx,8), %rsi
movl %eax, 0x10(%rsi)
movq %rsi, (%rcx,%rax,8)
leal -0x1(%rdx), %esi
callq 0xa9ec8
movl $0xffffffff, 0x10(%r14) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%r14)
orb $0x1, 0x1e8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::InsertFeature(gaps::R3SurfelFeature*)
void R3SurfelScene::
InsertFeature(R3SurfelFeature *feature)
{
  // Just checking
  assert(feature);

  // Insert label 
  feature->scene = this;
  feature->scene_index = features.NEntries();
  features.Insert(feature);

  // Update all object feature vectors
  for (int i = 0; i < NObjects(); i++) {
    R3SurfelObject *object = Object(i);
    if (object->feature_vector.NValues() > 0) {
      object->feature_vector.Resize(NFeatures());
      feature->UpdateFeatureVector(object, object->feature_vector);
    }
  }

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x8(%rsi)
addq $0xa0, %rdi
movl 0xac(%rbx), %edx
movl %edx, 0x10(%rsi)
callq 0xa9d3e
movl 0x1c(%rbx), %eax
testl %eax, %eax
jle 0x19ab3
xorl %r13d, %r13d
movq 0x10(%rbx), %rcx
movq (%rcx,%r13,8), %r15
cmpl $0x0, 0x80(%r15)
jle 0x19aa8
leaq 0x70(%r15), %r12
movl 0xac(%rbx), %esi
movq %r12, %rdi
callq 0x3e844
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x48(%rax)
movl 0x1c(%rbx), %eax
incq %r13
movslq %eax, %rcx
cmpq %rcx, %r13
jl 0x19a72
orb $0x1, 0x1e8(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::RemoveFeature(gaps::R3SurfelFeature*)
void R3SurfelScene::
RemoveFeature(R3SurfelFeature *feature)
{
  // Just checking
  assert(feature);
  assert(feature->scene == this);
  assert(feature->scene_index >= 0);
  assert(feature->scene_index < NFeatures());

  // Remove feature from scene
  RNArrayEntry *entry = features.KthEntry(feature->scene_index);
  R3SurfelFeature *tail = features.Tail();
  tail->scene_index = feature->scene_index;
  features.EntryContents(entry) = tail;
  features.RemoveTail();
  feature->scene_index = -1;
  feature->scene = NULL;

  // Update all object feature vectors
  if (feature != tail) {
    for (int i = 0; i < NObjects(); i++) {
      R3SurfelObject *object = Object(i);
      R3SurfelFeatureVector& vector = object->feature_vector;
      if (vector.NValues() == 0) continue;
      assert(vector.NValues() == NFeatures()+1);
      RNScalar tail_value = vector.Value(vector.NValues()-1);
      object->feature_vector.SetValue(tail->scene_index, tail_value);
      object->feature_vector.Resize(NFeatures());
    }
  }

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0xa0, %rdi
movslq 0x10(%rsi), %rax
movq 0xa0(%rbx), %rcx
movslq 0xac(%rbx), %rdx
movq -0x8(%rcx,%rdx,8), %r15
movl %eax, 0x10(%r15)
movq %r15, (%rcx,%rax,8)
leal -0x1(%rdx), %esi
callq 0xa9ec8
movl $0xffffffff, 0x10(%r14) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%r14)
cmpq %r14, %r15
je 0x19b69
movl 0x1c(%rbx), %eax
testl %eax, %eax
jle 0x19b69
xorl %r12d, %r12d
movq 0x10(%rbx), %rcx
movq (%rcx,%r12,8), %r14
movslq 0x80(%r14), %rcx
testq %rcx, %rcx
je 0x19b5e
movq 0x78(%r14), %rax
addq $0x70, %r14
movsd -0x8(%rax,%rcx,8), %xmm0
movl 0x10(%r15), %esi
movq %r14, %rdi
callq 0x3e96a
movl 0xac(%rbx), %esi
movq %r14, %rdi
callq 0x3e844
movl 0x1c(%rbx), %eax
incq %r12
movslq %eax, %rcx
cmpq %rcx, %r12
jl 0x19b1f
orb $0x1, 0x1e8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::InsertComment(char const*)
void R3SurfelScene::
InsertComment(const char *comment)
{
  // Check if already have same comment
  for (int i = 0; i < comments.NEntries(); i++) {
    if (!strcmp(comment, comments[i])) return;
  }
  
  // Insert comment
  comments.Insert(strdup(comment));

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x1d8(%rdi), %r15
movslq 0x1e4(%rdi), %r14
testq %r14, %r14
jle 0x19bbe
movq (%r15), %r13
xorl %ebp, %ebp
movq (%r13,%rbp,8), %rsi
movq %r12, %rdi
callq 0x13710
testl %eax, %eax
je 0x19bdb
incq %rbp
cmpq %rbp, %r14
jne 0x19ba5
movq %r12, %rdi
callq 0x13910
movq %r15, %rdi
movq %rax, %rsi
movl %r14d, %edx
callq 0xa9d3e
orb $0x1, 0x1e8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::RemoveComment(char const*)
void R3SurfelScene::
RemoveComment(const char *comment)
{
  // Remove comment
  for (int i = 0; i < comments.NEntries(); i++) {
    if (!strcmp(comment, comments[i])) {
      free(comments[i]);
      comments.RemoveKth(i);
      break;
    }
  }

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x1e4(%rdi), %rbp
testq %rbp, %rbp
jle 0x19c49
movq %rsi, %r15
leaq 0x1d8(%rbx), %rax
movq %rax, (%rsp)
movq (%rax), %r14
xorl %r12d, %r12d
movq (%r14,%r12,8), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x13710
testl %eax, %eax
je 0x19c35
incq %r12
cmpq %r12, %rbp
jne 0x19c18
jmp 0x19c49
movq %r13, %rdi
callq 0x135e0
movq (%rsp), %rdi
movl %r12d, %esi
callq 0xa9ec8
orb $0x1, 0x1e8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::ReadBlocks()
void R3SurfelScene::
ReadBlocks(void)
{
  // Read blocks for entire tree
  if (!tree) return;
  if (!tree->RootNode()) return;
  tree->RootNode()->ReadBlocks(TRUE);
}

// Assembly:
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1aa3b
movq 0x18(%rax), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1aa3b
movl $0x1, %esi
jmp 0x37c3e
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::ReleaseBlocks()
void R3SurfelScene::
ReleaseBlocks(void)
{
  // Read blocks for entire tree
  if (!tree) return;
  if (!tree->RootNode()) return;
  tree->RootNode()->ReleaseBlocks(TRUE);
}

// Assembly:
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1aa5b
movq 0x18(%rax), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1aa5b
movl $0x1, %esi
jmp 0x37cdc
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::Draw(gaps::RNFlags) const
void R3SurfelScene::
Draw(RNFlags flags) const
{
  // Draw all objects
  for (int i = 0; i < NObjects(); i++) {
    R3SurfelObject *object = Object(i);
    object->Draw(flags);
  } 
}

// Assembly:
cmpl $0x0, 0x1c(%rdi)
jle 0x1b090
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x48(%rax)
incq %r15
movslq 0x1c(%r14), %rax
cmpq %rax, %r15
jl 0x1b06e
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::Print(_IO_FILE*, char const*, char const*) const
void R3SurfelScene::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print scene header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "%s", (name) ? name : "Scene");
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

  // Add indentation to prefix
  char indented_prefix[1024];
  sprintf(indented_prefix, "%s  ", prefix);

  // Print all objects
  for (int i = 0; i < NObjects(); i++) {
    R3SurfelObject *object = Object(i);
    object->Print(fp, indented_prefix, suffix);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x1b0bd
movq 0x117eb6(%rip), %rax    # 0x132f70
movq (%rax), %r15
testq %r12, %r12
je 0x1b0cd
movq %r12, %rdi
movq %r15, %rsi
callq 0x135b0
movq 0x1d0(%r14), %rax
testq %rax, %rax
leaq 0xc233b(%rip), %rdi     # 0xdd419
cmovneq %rax, %rdi
movq %r15, %rsi
callq 0x135b0
testq %rbx, %rbx
je 0x1b0fa
movq %rbx, %rdi
movq %r15, %rsi
callq 0x135b0
movl $0xa, %edi
movq %r15, %rsi
callq 0x13670
leaq 0xc2311(%rip), %rsi     # 0xdd41f
movq %rsp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x130e0
cmpl $0x0, 0x1c(%r14)
jle 0x1b14b
xorl %r13d, %r13d
movq %rsp, %r12
movq 0x10(%r14), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq *0x58(%rax)
incq %r13
movslq 0x1c(%r14), %rax
cmpq %rax, %r13
jl 0x1b128
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::OpenFile(char const*, char const*, char const*, char const*)
int R3SurfelScene::
OpenFile(const char *scene_filename, 
  const char *database_filename, 
  const char *scene_rwaccess,
  const char *database_rwaccess)
{
  // Remember scene file name
  if (this->filename) free(this->filename);
  this->filename = RNStrdup(scene_filename);

  // Remember scene file access mode
  if (this->rwaccess) free(this->rwaccess);
  if (!scene_rwaccess) this->rwaccess = RNStrdup("r");
  else if (!strcmp(scene_rwaccess, "w")) this->rwaccess = RNStrdup("w");
  else if (strstr(scene_rwaccess, "+")) this->rwaccess = RNStrdup("r+");
  else this->rwaccess = RNStrdup("r"); 

  // Open database file
  if (database_filename) {
    if (tree) {
      R3SurfelDatabase *database = tree->Database();
      if (!database->OpenFile(database_filename, database_rwaccess)) {
        return 0;
      }
    }
  }

  // Read scene file
  if (strcmp(this->rwaccess, "w")) {
    if (!ReadFile(scene_filename)) {
      return 0;
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %r15
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movq 0x1c0(%rdi), %rdi
testq %rdi, %rdi
je 0x1b185
callq 0x135e0
movq %rbx, %rdi
callq 0xac67b
movq %rax, 0x1c0(%r14)
movq 0x1c8(%r14), %rdi
testq %rdi, %rdi
je 0x1b1a5
callq 0x135e0
testq %r13, %r13
je 0x1b1dc
cmpb $0x77, (%r13)
jne 0x1b1b8
cmpb $0x0, 0x1(%r13)
je 0x1b1e5
movq %r13, %rdi
movl $0x2b, %esi
callq 0x131d0
testq %rax, %rax
leaq 0xcd6c4(%rip), %rax     # 0xe8893
leaq 0xc224e(%rip), %rdi     # 0xdd424
cmoveq %rax, %rdi
jmp 0x1b1ec
leaq 0xcd6b0(%rip), %rdi     # 0xe8893
jmp 0x1b1ec
leaq 0xc90f8(%rip), %rdi     # 0xe42e4
callq 0xac67b
movq %rax, 0x1c8(%r14)
testq %r12, %r12
je 0x1b221
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0x1b221
movq 0x10(%rcx), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movq %r15, %rdx
callq *0x30(%rax)
testl %eax, %eax
je 0x1b246
movq 0x1c8(%r14), %rax
cmpb $0x77, (%rax)
jne 0x1b22c
cmpb $0x0, 0x1(%rax)
je 0x1b23f
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x100(%rax)
testl %eax, %eax
je 0x1b246
movl $0x1, %eax
jmp 0x1b248
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::SyncFile(char const*)
int R3SurfelScene::
SyncFile(const char *output_scene_filename)
{
  // Check if nothing changed
  if (!flags[R3_SURFEL_SCENE_DIRTY_FLAG]) return 1;

  // Sync surfels
  if (tree) {
    R3SurfelDatabase *database = tree->Database();
    if (database) {
      if (!database->SyncFile()) return 0;
    }
  }

  // Write scene file
  if (output_scene_filename) {
    // Write scene to new file
    if (!WriteFile(output_scene_filename)) {
      return 0;
    }
  }
  else if (this->filename && (strcmp(this->rwaccess, "r"))) {
    // Write scene over original file
    if (!WriteFile(filename)) {
      return 0;
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0x1, %ebx
testb $0x1, 0x1e8(%rdi)
je 0x1b2c7
movq %rsi, %r15
movq %rdi, %r14
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1b287
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x1b287
movq (%rdi), %rax
callq *0x38(%rax)
testl %eax, %eax
je 0x1b2c5
testq %r15, %r15
je 0x1b297
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
jmp 0x1b2bb
movq 0x1c0(%r14), %rsi
testq %rsi, %rsi
je 0x1b2c7
movq 0x1c8(%r14), %rax
cmpb $0x72, (%rax)
jne 0x1b2b5
cmpb $0x0, 0x1(%rax)
je 0x1b2c7
movq (%r14), %rax
movq %r14, %rdi
callq *0x128(%rax)
testl %eax, %eax
jne 0x1b2c7
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::CloseFile(char const*)
int R3SurfelScene::
CloseFile(const char *output_scene_filename)
{
#if 1
  // Clean up
  if (tree) {
    R3SurfelDatabase *database = tree->Database();
    if (database) {
      if (database->PurgeDeletedBlocks()) {
        flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
      }
    }
  }
#endif
  
  // Sync file
  if (!SyncFile(output_scene_filename)) return 0;

  // Close surfel database file
  if (tree) {
    R3SurfelDatabase *database = tree->Database();
    if (database) {
      if (!database->CloseFile()) return 0;
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1b300
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x1b300
movq (%rdi), %rax
callq *0x80(%rax)
testl %eax, %eax
je 0x1b300
orb $0x1, 0x1e8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0xf0(%rax)
xorl %ebp, %ebp
testl %eax, %eax
je 0x1b336
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x1b331
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x1b331
movq (%rdi), %rax
callq *0x40(%rax)
testl %eax, %eax
je 0x1b336
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::ReadFile(char const*)
int R3SurfelScene::
ReadFile(const char *filename)
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .ssa)\n", filename);
    return 0;
  }

  // Read file of appropriate type
  if (!strncmp(extension, ".ssa", 4)) {
    return ReadAsciiFile(filename);
  }
  else if (!strncmp(extension, ".ssx", 4)) {
    return ReadBinaryFile(filename);
  }
  else { 
    RNFail("Unable to read file %s (unrecognized extension: %s)\n", filename, extension); 
    return 0; 
  }

  // Should never get here
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0x13560
testq %rax, %rax
je 0x1b3a4
movq %rax, %r15
leaq 0xc20ed(%rip), %rsi     # 0xdd452
movl $0x4, %edx
movq %rax, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b3bd
leaq 0xc20da(%rip), %rsi     # 0xdd457
movl $0x4, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b3c9
leaq 0xc20c7(%rip), %rdi     # 0xdd45c
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xac81a
jmp 0x1b3b5
leaq 0xc207c(%rip), %rdi     # 0xdd427
movq %rbx, %rsi
xorl %eax, %eax
callq 0x13070
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq (%r14), %rax
movq 0x108(%rax), %rax
jmp 0x1b3d3
movq (%r14), %rax
movq 0x110(%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::WriteFile(char const*)
int R3SurfelScene::
WriteFile(const char *filename) 
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .ssa)\n", filename);
    return 0;
  }

  // Write file of appropriate type
  if (!strncmp(extension, ".ssa", 4)) {
    return WriteAsciiFile(filename);
  }
  else if (!strncmp(extension, ".ssx", 4)) {
    return WriteBinaryFile(filename);
  }
  else if (!strncmp(extension, ".arff", 5)) {
    return WriteARFFFile(filename);
  }
  else if (!strncmp(extension, ".tqn", 4)) {
    return WriteTianqiangFile(filename);
  }
  else { 
    RNFail("Unable to write file %s (unrecognized extension: %s)\n", filename, extension); 
    return 0; 
  }

  // Should never get here
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0x13560
testq %rax, %rax
je 0x1b476
movq %rax, %r15
leaq 0xc204b(%rip), %rsi     # 0xdd452
movl $0x4, %edx
movq %rax, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b48f
leaq 0xc2038(%rip), %rsi     # 0xdd457
movl $0x4, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b49b
leaq 0xc205a(%rip), %rsi     # 0xdd491
movl $0x5, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b4a7
leaq 0xc2048(%rip), %rsi     # 0xdd497
movl $0x4, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b4b3
leaq 0xc2035(%rip), %rdi     # 0xdd49c
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xac81a
jmp 0x1b487
leaq 0xc1faa(%rip), %rdi     # 0xdd427
movq %rbx, %rsi
xorl %eax, %eax
callq 0x13070
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq (%r14), %rax
movq 0x130(%rax), %rax
jmp 0x1b4bd
movq (%r14), %rax
movq 0x138(%rax), %rax
jmp 0x1b4bd
movq (%r14), %rax
movq 0x140(%rax), %rax
jmp 0x1b4bd
movq (%r14), %rax
movq 0x148(%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::ReadAsciiFile(char const*)
int R3SurfelScene::
ReadAsciiFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "r"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Read ascii stream
  int status = ReadAsciiStream(fp);

  // Close file
  fclose(fp);

  // Return status
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xcd3b7(%rip), %rsi     # 0xe8893
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x1b509
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x118(%rax)
movl %eax, %ebx
movq %r15, %rdi
callq 0x134d0
movl %ebx, %eax
jmp 0x1b51c
leaq 0xc1fc2(%rip), %rdi     # 0xdd4d2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xac81a
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::WriteAsciiFile(char const*)
int R3SurfelScene::
WriteAsciiFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "w"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Write ascii stream
  int status = WriteAsciiStream(fp);

  // Close file
  fclose(fp);

  // Return status
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc8db0(%rip), %rsi     # 0xe42e4
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x1b561
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x150(%rax)
movl %eax, %ebx
movq %r15, %rdi
callq 0x134d0
movl %ebx, %eax
jmp 0x1b574
leaq 0xc1f6a(%rip), %rdi     # 0xdd4d2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xac81a
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::ReadAsciiString(_IO_FILE*, char*)
static int 
ReadAsciiString(FILE *fp, char *buffer)
{
  // Read string
  if (fscanf(fp, "%s", buffer) != (unsigned int) 1) {
    RNFail("Unable to read name\n");
    return 0;
  }

  // Restore space characters
  char *bufferp = buffer;
  while (*bufferp) {
    if (*bufferp == '^') *bufferp = '\t';
    if (*bufferp == '&') *bufferp = '\n';
    if (*bufferp == '+') *bufferp = ' ';
    bufferp++;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0xc72a0(%rip), %rsi     # 0xe49a5
movq %rbx, %rdx
xorl %eax, %eax
callq 0x13930
cmpl $0x1, %eax
jne 0x1d742
movzbl (%rbx), %eax
cmpl $0x2a, %eax
jle 0x1d72a
cmpl $0x2b, %eax
je 0x1d733
movb $0x9, %cl
cmpl $0x5e, %eax
je 0x1d735
jmp 0x1d737
cmpl $0x26, %eax
jne 0x1d73c
movb $0xa, %cl
jmp 0x1d735
movb $0x20, %cl
movb %cl, (%rbx)
incq %rbx
jmp 0x1d714
testl %eax, %eax
jne 0x1d737
popq %rbx
retq
leaq 0xc02cc(%rip), %rdi     # 0xdda15
xorl %eax, %eax
popq %rbx
jmp 0xac81a
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::WriteAsciiString(_IO_FILE*, char const*)
static int 
WriteAsciiString(FILE *fp, const char *name)
{
  // Copy name
  char buffer[1024];
  if (name) strncpy(buffer, name, 1023);
  else strncpy(buffer, "None", 1023);

  // Replace space characters
  char *bufferp = buffer;
  while (*bufferp) {
    if (*bufferp == '\t') *bufferp = '^';
    if (*bufferp == '\n') *bufferp = '&';
    if (*bufferp == ' ') *bufferp = '+';
    bufferp++;
  }

  // Write string
  fprintf(fp, "%s", buffer);

  // Restore space characters
  bufferp = buffer;
  while (*bufferp) {
    if (*bufferp == '^') *bufferp = '\t';
    if (*bufferp == '&') *bufferp = '\n';
    if (*bufferp == '+') *bufferp = ' ';
    bufferp++;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdi, %rbx
testq %rsi, %rsi
jne 0x1e7dd
leaq 0xbed4f(%rip), %rsi     # 0xdd52c
movq %rsp, %rdi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x13280
movq %rsp, %rax
movzbl (%rax), %ecx
cmpl $0x9, %ecx
jle 0x1e803
cmpl $0x20, %ecx
je 0x1e80d
cmpl $0xa, %ecx
jne 0x1e811
movb $0x26, %dl
jmp 0x1e80f
movb $0x5e, %dl
je 0x1e80f
testl %ecx, %ecx
jne 0x1e811
jmp 0x1e816
movb $0x2b, %dl
movb %dl, (%rax)
incq %rax
jmp 0x1e7ed
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x135b0
movzbl (%r14), %eax
cmpl $0x2a, %eax
jle 0x1e83b
cmpl $0x2b, %eax
je 0x1e844
movb $0x9, %cl
cmpl $0x5e, %eax
je 0x1e846
jmp 0x1e849
cmpl $0x26, %eax
jne 0x1e84e
movb $0xa, %cl
jmp 0x1e846
movb $0x20, %cl
movb %cl, (%r14)
incq %r14
jmp 0x1e824
testl %eax, %eax
jne 0x1e849
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::ReadBinaryFile(char const*)
int R3SurfelScene::
ReadBinaryFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "r"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Read binary stream
  int status = ReadBinaryStream(fp);

  // Close file
  fclose(fp);

  // Return status
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xca023(%rip), %rsi     # 0xe8893
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x1e89d
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x120(%rax)
movl %eax, %ebx
movq %r15, %rdi
callq 0x134d0
movl %ebx, %eax
jmp 0x1e8b0
leaq 0xbec2e(%rip), %rdi     # 0xdd4d2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xac81a
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::WriteBinaryFile(char const*)
int R3SurfelScene::
WriteBinaryFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "w"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Write binary stream
  int status = WriteBinaryStream(fp);

  // Close file
  fclose(fp);

  // Return status
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc5a1c(%rip), %rsi     # 0xe42e4
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x1e8f5
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x158(%rax)
movl %eax, %ebx
movq %r15, %rdi
callq 0x134d0
movl %ebx, %eax
jmp 0x1e908
leaq 0xbebd6(%rip), %rdi     # 0xdd4d2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xac81a
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::WriteBinaryString(_IO_FILE*, char const*, int)
static int 
WriteBinaryString(FILE *fp, const char *name, int size = 256)
{
  // Copy name
  char buffer[1024] = { '\0' };
  if (size > 1024) size = 1024;
  if (name) strncpy(buffer, name, size-1);
  else strncpy(buffer, "None", size-1);
  if (fwrite(buffer, sizeof(char), size, fp) != (unsigned int) size) {
    RNFail("Unable to write name to binary file\n");
    return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x132a0
leal -0x1(%r14), %edx
testq %r15, %r15
je 0x214da
movq %rsp, %rdi
movq %r15, %rsi
jmp 0x214e4
leaq 0xbc04b(%rip), %rsi     # 0xdd52c
movq %rsp, %rdi
callq 0x13280
movl %r14d, %r14d
movq %rsp, %rdi
movl $0x1, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x139a0
movl $0x1, %ebx
cmpq %r14, %rax
je 0x21519
leaq 0xbc569(%rip), %rdi     # 0xdda79
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xac81a
movl %ebx, %eax
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreatePointSet(gaps::R3SurfelPointSet*, gaps::R3SurfelConstraint const*)
R3SurfelPointSet *
CreatePointSet(R3SurfelPointSet *pointset, 
  const R3SurfelConstraint *constraint)
{
  // Create point set
  R3SurfelPointSet *result = new R3SurfelPointSet();
  if (constraint) result->InsertPoints(pointset, *constraint);
  else result->InsertPoints(pointset);
  if (result->NPoints() == 0) { delete result; return NULL; }
  return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
movl $0x60, %edi
callq 0x134e0
movq %rax, %rbx
movq %rax, %rdi
callq 0x32620
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
testq %r15, %r15
je 0x21f4a
movq %r15, %rdx
callq *0x60(%rax)
jmp 0x21f4d
callq *0x40(%rax)
cmpl $0x0, 0x10(%rbx)
jne 0x21f5e
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movl $0x60, %esi
movq %rbx, %rdi
callq 0x134f0
movq %r14, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::InsertPoints(gaps::R3SurfelPointSet*, gaps::R3SurfelTree*, gaps::R3SurfelNode*, gaps::R3SurfelConstraint const*)
static int
InsertPoints(R3SurfelPointSet *pointset, 
  R3SurfelTree *tree, R3SurfelNode *node,
  const R3SurfelConstraint *constraint)
{
  // Check node
  if (constraint && !constraint->Check(node)) return 0;

  // Check if leaf node
  if (node->NParts() == 0) {
    // Insert blocks
    for (int i = 0; i < node->NBlocks(); i++) {
      R3SurfelBlock *block = node->Block(i);
      if (constraint) pointset->InsertPoints(block, *constraint);
      else pointset->InsertPoints(block);
    }
  }
  else {
    // Consider parts
    for (int i = 0; i < node->NParts(); i++) {
      R3SurfelNode *part = node->Part(i);
      InsertPoints(pointset, tree, part, constraint);
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testq %rdx, %rdx
je 0x2201a
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x18(%rax)
testl %eax, %eax
je 0x2207b
cmpl $0x0, 0x3c(%r14)
je 0x22047
jle 0x2207b
xorl %r12d, %r12d
movq 0x30(%r14), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x21ff4
incq %r12
movslq 0x3c(%r14), %rax
cmpq %rax, %r12
jl 0x22026
jmp 0x2207b
cmpl $0x0, 0x4c(%r14)
jle 0x2207b
xorl %r12d, %r12d
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %rsi
movq (%r15), %rax
movq %r15, %rdi
testq %rbx, %rbx
je 0x2206c
movq %rbx, %rdx
callq *0x30(%rax)
jmp 0x2206f
callq *0x10(%rax)
incq %r12
movslq 0x4c(%r14), %rax
cmpq %rax, %r12
jl 0x22051
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq