LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::RemoveScan(gaps::R3SurfelScan*)
void R3SurfelScene::
RemoveScan(R3SurfelScan *scan)
{
  // Just checking
  assert(scan);

  // Remove scan from scene
  RNArrayEntry *entry = scans.KthEntry(scan->scene_index);
  R3SurfelScan *tail = scans.Tail();
  tail->scene_index = scan->scene_index;
  scans.EntryContents(entry) = tail;
  scans.RemoveTail();
  scan->scene_index = -1;
  scan->scene = NULL;

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x80, %rdi
movslq 0x10(%rsi), %rax
movq 0x80(%r14), %rcx
movslq 0x8c(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rsi
movl %eax, 0x10(%rsi)
movq %rsi, (%rcx,%rax,8)
leal -0x1(%rdx), %esi
callq 0xab13e
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
orb $0x1, 0x1e8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::RemoveImage(gaps::R3SurfelImage*)
void R3SurfelScene::
RemoveImage(R3SurfelImage *image)
{
  // Just checking
  assert(image);

  // Remove image from scene
  RNArrayEntry *entry = images.KthEntry(image->scene_index);
  R3SurfelImage *tail = images.Tail();
  tail->scene_index = image->scene_index;
  images.EntryContents(entry) = tail;
  images.RemoveTail();
  image->scene_index = -1;
  image->scene = NULL;

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x90, %rdi
movslq 0x10(%rsi), %rax
movq 0x90(%r14), %rcx
movslq 0x9c(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rsi
movl %eax, 0x10(%rsi)
movq %rsi, (%rcx,%rax,8)
leal -0x1(%rdx), %esi
callq 0xab13e
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
orb $0x1, 0x1e8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xaafca
cmpl $0x0, 0x1c(%rbx)
jle 0x19bf6
xorl %r13d, %r13d
movq 0x10(%rbx), %rax
movq (%rax,%r13,8), %r15
cmpl $0x0, 0x80(%r15)
jle 0x19bea
leaq 0x70(%r15), %r12
movl 0xac(%rbx), %esi
movq %r12, %rdi
callq 0x3ebd6
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x48(%rax)
incq %r13
movslq 0x1c(%rbx), %rax
cmpq %rax, %r13
jl 0x19bb7
orb $0x1, 0x1e8(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xab13e
movl $0xffffffff, 0x10(%r14) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%r14)
cmpq %r14, %r15
je 0x19caa
cmpl $0x0, 0x1c(%rbx)
jle 0x19caa
xorl %r12d, %r12d
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %r14
movslq 0x80(%r14), %rax
testq %rax, %rax
je 0x19c9e
movq 0x78(%r14), %rcx
addq $0x70, %r14
movsd -0x8(%rcx,%rax,8), %xmm0
movl 0x10(%r15), %esi
movq %r14, %rdi
callq 0x3ed04
movl 0xac(%rbx), %esi
movq %r14, %rdi
callq 0x3ebd6
incq %r12
movslq 0x1c(%rbx), %rax
cmpq %rax, %r12
jl 0x19c62
orb $0x1, 0x1e8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
movq %rax, (%rsp)
movslq 0x1e4(%rdi), %r14
testq %r14, %r14
setg %bpl
jle 0x19d2c
movq (%rsp), %rax
movq (%rax), %r13
movq (%r13), %rsi
movq %r12, %rdi
callq 0x13710
testl %eax, %eax
je 0x19d27
leaq -0x1(%r14), %r15
xorl %ebp, %ebp
cmpq %rbp, %r15
je 0x19d2c
movq 0x8(%r13,%rbp,8), %rsi
movq %r12, %rdi
callq 0x13710
incq %rbp
testl %eax, %eax
jne 0x19d07
cmpq %r14, %rbp
setb %bpl
testb %bpl, %bpl
jne 0x19d4a
movq %r12, %rdi
callq 0x13910
movq (%rsp), %rdi
movq %rax, %rsi
movl %r14d, %edx
callq 0xaafca
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_O1/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 0x19db9
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 0x19da5
incq %r12
cmpq %r12, %rbp
jne 0x19d88
jmp 0x19db9
movq %r13, %rdi
callq 0x135e0
movq (%rsp), %rdi
movl %r12d, %esi
callq 0xab13e
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_O1/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 0x1ab7b
movq 0x18(%rax), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1ab7b
movl $0x1, %esi
jmp 0x37fa6
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1ab9b
movq 0x18(%rax), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1ab9b
movl $0x1, %esi
jmp 0x3803a
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b19c
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 0x1b17a
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b1c9
movq 0x118daa(%rip), %rax    # 0x133f70
movq (%rax), %r15
testq %r12, %r12
je 0x1b1d9
movq %r12, %rdi
movq %r15, %rsi
callq 0x135b0
movq 0x1d0(%r14), %rax
testq %rax, %rax
leaq 0xc322f(%rip), %rdi     # 0xde419
cmovneq %rax, %rdi
movq %r15, %rsi
callq 0x135b0
testq %rbx, %rbx
je 0x1b206
movq %rbx, %rdi
movq %r15, %rsi
callq 0x135b0
movl $0xa, %edi
movq %r15, %rsi
callq 0x13670
leaq 0xc3205(%rip), %rsi     # 0xde41f
movq %rsp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x130e0
cmpl $0x0, 0x1c(%r14)
jle 0x1b257
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 0x1b234
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movq 0x1c0(%rdi), %rdi
testq %rdi, %rdi
je 0x1b293
callq 0x135e0
movq %rbx, %rdi
callq 0xadc0f
movq %rax, 0x1c0(%r14)
movq 0x1c8(%r14), %rdi
testq %rdi, %rdi
je 0x1b2b3
callq 0x135e0
testq %r13, %r13
je 0x1b2f2
leaq 0xca039(%rip), %rbp     # 0xe52f8
movq %r13, %rdi
movq %rbp, %rsi
callq 0x13710
testl %eax, %eax
je 0x1b2f9
movq %r13, %rdi
movl $0x2b, %esi
callq 0x131d0
testq %rax, %rax
leaq 0xce59e(%rip), %rax     # 0xe9883
leaq 0xc3138(%rip), %rbp     # 0xde424
cmoveq %rax, %rbp
jmp 0x1b2f9
leaq 0xce58a(%rip), %rbp     # 0xe9883
movq %rbp, %rdi
callq 0xadc0f
movq %rax, 0x1c8(%r14)
testq %r12, %r12
je 0x1b32a
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x1b32a
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movq %r15, %rdx
callq *0x30(%rax)
testl %eax, %eax
je 0x1b35b
movq 0x1c8(%r14), %rdi
leaq 0xc9fc0(%rip), %rsi     # 0xe52f8
callq 0x13710
testl %eax, %eax
je 0x1b354
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x100(%rax)
testl %eax, %eax
je 0x1b35b
movl $0x1, %eax
jmp 0x1b35d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/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 0x1b3e0
movq %rsi, %r15
movq %rdi, %r14
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1b3a1
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x1b3a1
movq (%rdi), %rax
callq *0x38(%rax)
testl %eax, %eax
je 0x1b3b9
testq %r15, %r15
je 0x1b3bd
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x128(%rax)
testl %eax, %eax
jne 0x1b3e0
xorl %ebx, %ebx
jmp 0x1b3e0
movq 0x1c0(%r14), %r15
testq %r15, %r15
je 0x1b3e0
movq 0x1c8(%r14), %rdi
leaq 0xce4ac(%rip), %rsi     # 0xe9883
callq 0x13710
testl %eax, %eax
jne 0x1b3a6
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b418
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x1b418
movq (%rdi), %rax
callq *0x80(%rax)
testl %eax, %eax
je 0x1b418
orb $0x1, 0x1e8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0xf0(%rax)
xorl %ebp, %ebp
testl %eax, %eax
je 0x1b44e
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x1b449
movq 0x10(%rax), %rdi
testq %rdi, %rdi
je 0x1b449
movq (%rdi), %rax
callq *0x40(%rax)
testl %eax, %eax
je 0x1b44e
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b4bc
movq %rax, %r15
leaq 0xc2fd5(%rip), %rsi     # 0xde452
movl $0x4, %edx
movq %rax, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b4d5
leaq 0xc2fc2(%rip), %rsi     # 0xde457
movl $0x4, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b4e1
leaq 0xc2faf(%rip), %rdi     # 0xde45c
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xaddb2
jmp 0x1b4cd
leaq 0xc2f64(%rip), %rdi     # 0xde427
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 0x1b4eb
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_O1/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 0x1b58e
movq %rax, %r15
leaq 0xc2f33(%rip), %rsi     # 0xde452
movl $0x4, %edx
movq %rax, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b5a7
leaq 0xc2f20(%rip), %rsi     # 0xde457
movl $0x4, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b5b3
leaq 0xc2f42(%rip), %rsi     # 0xde491
movl $0x5, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b5bf
leaq 0xc2f30(%rip), %rsi     # 0xde497
movl $0x4, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x1b5cb
leaq 0xc2f1d(%rip), %rdi     # 0xde49c
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xaddb2
jmp 0x1b59f
leaq 0xc2e92(%rip), %rdi     # 0xde427
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 0x1b5d5
movq (%r14), %rax
movq 0x138(%rax), %rax
jmp 0x1b5d5
movq (%r14), %rax
movq 0x140(%rax), %rax
jmp 0x1b5d5
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_O1/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 0xce28f(%rip), %rsi     # 0xe9883
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x1b621
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 0x1b634
leaq 0xc2eaa(%rip), %rdi     # 0xde4d2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xaddb2
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xc9cac(%rip), %rsi     # 0xe52f8
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x1b679
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 0x1b68c
leaq 0xc2e52(%rip), %rdi     # 0xde4d2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xaddb2
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xc80a5(%rip), %rsi     # 0xe59b9
movq %rbx, %rdx
xorl %eax, %eax
callq 0x13930
cmpl $0x1, %eax
je 0x1d948
leaq 0xc10eb(%rip), %rdi     # 0xdea15
xorl %eax, %eax
popq %rbx
jmp 0xaddb2
movb $0x9, (%rbx)
cmpb $0x26, (%rbx)
jne 0x1d93d
movb $0xa, (%rbx)
cmpb $0x2b, (%rbx)
jne 0x1d945
movb $0x20, (%rbx)
incq %rbx
movzbl (%rbx), %eax
cmpl $0x5e, %eax
je 0x1d932
testl %eax, %eax
jne 0x1d935
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x1e9ed
leaq 0xbfb3f(%rip), %rsi     # 0xde52c
movq %rsp, %rdi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x13280
movq %rsp, %rax
movzbl (%rax), %ecx
cmpl $0x9, %ecx
je 0x1ea0b
testl %ecx, %ecx
jne 0x1ea0e
jmp 0x1ea23
movb $0x5e, (%rax)
cmpb $0xa, (%rax)
jne 0x1ea16
movb $0x26, (%rax)
cmpb $0x20, (%rax)
jne 0x1ea1e
movb $0x2b, (%rax)
incq %rax
jmp 0x1e9fd
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x135b0
movzbl (%r14), %eax
cmpl $0x5e, %eax
je 0x1ea40
testl %eax, %eax
jne 0x1ea44
jmp 0x1ea5d
movb $0x9, (%r14)
cmpb $0x26, (%r14)
jne 0x1ea4e
movb $0xa, (%r14)
cmpb $0x2b, (%r14)
jne 0x1ea58
movb $0x20, (%r14)
incq %r14
jmp 0x1ea31
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xcae09(%rip), %rsi     # 0xe9883
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x1eaa7
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 0x1eaba
leaq 0xbfa24(%rip), %rdi     # 0xde4d2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xaddb2
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xc6826(%rip), %rsi     # 0xe52f8
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x1eaff
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 0x1eb12
leaq 0xbf9cc(%rip), %rdi     # 0xde4d2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xaddb2
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x216ca
movq %rsp, %rdi
movq %r15, %rsi
jmp 0x216d4
leaq 0xbce5b(%rip), %rsi     # 0xde52c
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 0x21709
leaq 0xbd379(%rip), %rdi     # 0xdea79
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xaddb2
movl %ebx, %eax
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x329b8
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
testq %r15, %r15
je 0x2214e
movq %r15, %rdx
callq *0x60(%rax)
jmp 0x22151
callq *0x40(%rax)
cmpl $0x0, 0x10(%rbx)
jne 0x22162
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_O1/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 0x2221e
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x18(%rax)
testl %eax, %eax
je 0x22284
cmpl $0x0, 0x3c(%r14)
je 0x22250
cmpl $0x0, 0x3c(%r14)
jle 0x22284
xorl %r12d, %r12d
movq 0x30(%r14), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x221f8
incq %r12
movslq 0x3c(%r14), %rax
cmpq %rax, %r12
jl 0x2222f
jmp 0x22284
cmpl $0x0, 0x4c(%r14)
jle 0x22284
xorl %r12d, %r12d
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %rsi
movq (%r15), %rax
movq %r15, %rdi
testq %rbx, %rbx
je 0x22275
movq %rbx, %rdx
callq *0x30(%rax)
jmp 0x22278
callq *0x10(%rax)
incq %r12
movslq 0x4c(%r14), %rax
cmpq %rax, %r12
jl 0x2225a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreatePointGraph(gaps::R3SurfelScene*, gaps::R3SurfelNode*, gaps::R3SurfelConstraint const*, int, double)
R3SurfelPointGraph *
CreatePointGraph(R3SurfelScene *scene, 
  R3SurfelNode *source_node, const R3SurfelConstraint *constraint, 
  int max_neighbors, RNLength max_neighbor_distance)
{
  // Create point graph with all surfels satisfying constraint
  R3SurfelPointSet *pointset = CreatePointSet(scene, source_node, constraint);
  if (!pointset) return NULL;
  R3SurfelPointGraph *graph = new R3SurfelPointGraph(*pointset, max_neighbors, max_neighbor_distance);
  delete pointset;
  return graph;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movsd %xmm0, 0x8(%rsp)
movl %ecx, %ebp
callq 0x22183
testq %rax, %rax
je 0x22c2e
movq %rax, %r14
movl $0x80, %edi
callq 0x134e0
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movsd 0x8(%rsp), %xmm0
callq 0x36764
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
jmp 0x22c30
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movl $0x80, %esi
movq %rbx, %rdi
callq 0x134f0
movq %r14, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::VisitResidentSurfels(gaps::R3SurfelScene*, void (*)(gaps::R3SurfelBlock const*, gaps::R3Surfel const*, void*), gaps::R3SurfelNode*, gaps::R3SurfelConstraint const*, void*)
void
VisitResidentSurfels(R3SurfelScene *scene,
  void (*callback_function)(const R3SurfelBlock *block, const R3Surfel *surfel, void *callback_data),
  R3SurfelNode *source_node,
  const R3SurfelConstraint *constraint,
  void *callback_data)
{
  // Check node
  if (constraint && !constraint->Check(source_node)) return;

  // Check if leaf node
  if (source_node->NParts() == 0) {
    // Visit blocks
    for (int i = 0; i < source_node->NBlocks(); i++) {
      R3SurfelBlock *block = source_node->Block(i);
      if (block->NSurfels() == 0) continue;
      if (!constraint->Check(block->BBox())) continue;
      if (block->Database() && !block->Database()->IsBlockResident(block)) continue;

      // Visit surfels
      for (int i = 0; i < block->NSurfels(); i++) {
        const R3Surfel *surfel = block->Surfel(i);
        if (!constraint->Check(block, surfel)) continue;
        (*callback_function)(block, surfel, callback_data);
      }
    }
  }
  else {
    // Consider parts
    for (int i = 0; i < source_node->NParts(); i++) {
      R3SurfelNode *part = source_node->Part(i);
      VisitResidentSurfels(scene, callback_function, part, constraint, callback_data);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x8(%rsp)
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, (%rsp)
movq %rdi, %r13
testq %rcx, %rcx
je 0x22c8d
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x18(%rax)
testl %eax, %eax
je 0x22d72
cmpl $0x0, 0x3c(%r15)
je 0x22cce
cmpl $0x0, 0x3c(%r15)
jle 0x22d72
xorl %ebx, %ebx
movq 0x30(%r15), %rax
movq (%rax,%rbx,8), %rdx
movq %r13, %rdi
movq (%rsp), %rsi
movq %r14, %rcx
movq 0x8(%rsp), %r8
callq 0x22c54
incq %rbx
movslq 0x3c(%r15), %rax
cmpq %rax, %rbx
jl 0x22ca1
jmp 0x22d72
cmpl $0x0, 0x4c(%r15)
jle 0x22d72
xorl %ebx, %ebx
movq %r15, 0x10(%rsp)
movq 0x40(%r15), %rax
movq (%rax,%rbx,8), %r13
cmpl $0x0, 0x8(%r13)
je 0x22d5d
movq %r13, %rdi
callq 0x2cfc6
movq (%r14), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq *0x30(%rcx)
testl %eax, %eax
je 0x22d5d
cmpq $0x0, 0x98(%r13)
je 0x22d18
cmpq $0x0, (%r13)
je 0x22d5d
cmpl $0x0, 0x8(%r13)
jle 0x22d5d
xorl %r12d, %r12d
xorl %r15d, %r15d
movq (%r13), %rbp
addq %r12, %rbp
movq (%r14), %rax
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq *0x28(%rax)
testl %eax, %eax
je 0x22d4d
movq %r13, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
callq *(%rsp)
incq %r15
movslq 0x8(%r13), %rax
addq $0x30, %r12
cmpq %rax, %r15
jl 0x22d25
incq %rbx
movq 0x10(%rsp), %r15
movslq 0x4c(%r15), %rax
cmpq %rax, %rbx
jl 0x22ce0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreateBlock(gaps::R3SurfelScene*, gaps::R3SurfelPointSet*, int)
R3SurfelBlock *
CreateBlock(R3SurfelScene *scene, R3SurfelPointSet *pointset, 
  RNBoolean copy_surfels)
{
  // Get convenient variables
  if (pointset->NPoints() == 0) return NULL;
  R3SurfelTree *tree = scene->Tree();
  if (!tree) return NULL;
  R3SurfelDatabase *database = tree->Database();
  if (!database) return NULL;

  // Create block with copy of points
  R3SurfelBlock *block = new R3SurfelBlock(pointset);

  // Update properties
  block->UpdateProperties();

  // Insert block into database
  database->InsertBlock(block);

  // Remove and delete pointset from other blocks ???
  // tree->RemoveAndDeletePoints(scene, pointset);

  // Return block
  return block;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x0, 0x10(%rsi)
je 0x22dcf
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x22dcf
movq 0x10(%rax), %r14
testq %r14, %r14
je 0x22dcf
movq %rsi, %r15
movl $0xc8, %edi
callq 0x134e0
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2bc76
movq %rbx, %rdi
callq 0x2e364
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x10(%rax)
jmp 0x22dd1
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movl $0xc8, %esi
movq %rbx, %rdi
callq 0x134f0
movq %r14, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreateBlock(gaps::R3SurfelScene*, gaps::R3SurfelNode*, gaps::R3SurfelConstraint const*, int)
R3SurfelBlock *
CreateBlock(R3SurfelScene *scene, 
  R3SurfelNode *source_node, const R3SurfelConstraint *constraint, 
  RNBoolean copy_surfels)
{
  // Create point set
  R3SurfelPointSet *pointset = CreatePointSet(scene, source_node, constraint);
  if (!pointset) return NULL;

  // Create block
  R3SurfelBlock *block = CreateBlock(scene, pointset);

  // Delete point set
  delete pointset;

  // Return block
  return block;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x22183
testq %rax, %rax
je 0x22e22
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x22d81
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movq %r14, %rax
jmp 0x22e24
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::RemoveEmptyObjects(gaps::R3SurfelScene*)
int
RemoveEmptyObjects(R3SurfelScene *scene)
{
  // Find empty subtrees of objects
  RNArray<R3SurfelObject *> deletable_subtrees;
  for (int i = 0; i < scene->NObjects(); i++) {
    R3SurfelObject *object = scene->Object(i);
    if (object == scene->RootObject()) continue;
    R3SurfelObject *parent = object->Parent();
    if (parent && !parent->HasSurfels(TRUE)) continue;
    if (object->HasSurfels(TRUE)) continue;
    deletable_subtrees.Insert(object);
  }

  // Delete subtrees
  for (int i = 0; i < deletable_subtrees.NEntries(); i++) {
    R3SurfelObject *object = deletable_subtrees.Kth(i);
    RemoveSubtree(scene, object);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0xaaf34
cmpl $0x0, 0x1c(%rbx)
jle 0x23208
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %r15
cmpq (%rax), %r15
je 0x231fc
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x231dc
movl $0x1, %esi
callq 0x175ce
testl %eax, %eax
je 0x231fc
movq %r15, %rdi
movl $0x1, %esi
callq 0x175ce
testl %eax, %eax
jne 0x231fc
movl 0x14(%rsp), %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xaafca
incq %r12
movslq 0x1c(%rbx), %rax
cmpq %rax, %r12
jl 0x231b8
cmpl $0x0, 0x14(%rsp)
jle 0x23230
xorl %r14d, %r14d
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x23262
incq %r14
movslq 0x14(%rsp), %rax
cmpq %rax, %r14
jl 0x23212
leaq 0x8(%rsp), %rdi
callq 0xaaf9e
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x2324d
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xaaf9e
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::RemoveSubtree(gaps::R3SurfelScene*, gaps::R3SurfelObject*)
static int
RemoveSubtree(R3SurfelScene *scene, R3SurfelObject *object)
{
  // Check object
  if (!object) return 0;
  if (object == scene->RootObject()) return 1;
  
  // Remove parts
  for (int i = 0; i < object->NParts(); i++) {
    R3SurfelObject *part = object->Part(i);
    if (!RemoveSubtree(scene, part)) return 0;
  }

  // Delete object
  scene->RemoveObject(object);
  delete object;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebp, %ebp
testq %rsi, %rsi
je 0x232e6
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rdi), %rax
cmpq %rsi, (%rax)
je 0x232e1
cmpl $0x0, 0x2c(%rbx)
setg %r15b
jle 0x232cc
movq 0x20(%rbx), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x23262
testl %eax, %eax
je 0x232c7
movl $0x1, %r12d
movslq 0x2c(%rbx), %rax
cmpq %rax, %r12
setl %r15b
jge 0x232cc
movq 0x20(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
callq 0x23262
incq %r12
testl %eax, %eax
jne 0x232a3
testb %r15b, %r15b
jne 0x232e6
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x20(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::RemoveDisconnectedObjects(gaps::R3SurfelScene*)
int
RemoveDisconnectedObjects(R3SurfelScene *scene)
{
  // Find subtrees of objects disconnected from root
  RNArray<R3SurfelObject *> deletable_subtrees;
  for (int i = 0; i < scene->NObjects(); i++) {
    R3SurfelObject *object = scene->Object(i);
    if (object == scene->RootObject()) continue;
    if (object->Parent()) continue;
    deletable_subtrees.Insert(object);
  }

  // Delete subtrees
  for (int i = 0; i < deletable_subtrees.NEntries(); i++) {
    R3SurfelObject *object = deletable_subtrees.Kth(i);
    RemoveSubtree(scene, object);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsp, %rdi
callq 0xaaf34
cmpl $0x0, 0x1c(%rbx)
jle 0x2333d
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x10(%rbx), %rax
movq (%rax,%r15,8), %rsi
cmpq (%rax), %rsi
je 0x23331
cmpq $0x0, 0x18(%rsi)
jne 0x23331
movl 0xc(%rsp), %edx
movq %r14, %rdi
callq 0xaafca
incq %r15
movslq 0x1c(%rbx), %rax
cmpq %rax, %r15
jl 0x23311
cmpl $0x0, 0xc(%rsp)
jle 0x23364
xorl %r14d, %r14d
movq (%rsp), %rax
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x23262
incq %r14
movslq 0xc(%rsp), %rax
cmpq %rax, %r14
jl 0x23347
movq %rsp, %rdi
callq 0xaaf9e
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x2337d
movq %rax, %rbx
movq %rsp, %rdi
callq 0xaaf9e
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::RemoveEmptyNodes(gaps::R3SurfelTree*, gaps::R3SurfelNode*)
static int
RemoveEmptyNodes(R3SurfelTree *tree, R3SurfelNode *node)
{
  // Check node
  if (!node) return 0;
  if (node == tree->RootNode()) return 1;
  
  // Remove empty parts
  for (int i = 0; i < node->NParts(); i++) {
    R3SurfelNode *part = node->Part(i);
    if (!RemoveEmptyNodes(tree, part)) return 0;
  }

  // Check if node is empty
  if (node->NParts() > 0) return 1;
  if (node->NBlocks() > 0) return 1;

  // Delete node
  tree->RemoveNode(node);
  delete node;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebp, %ebp
testq %rsi, %rsi
je 0x23438
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rax
cmpq %rsi, (%rax)
je 0x23433
cmpl $0x0, 0x3c(%rbx)
setg %r15b
jle 0x23413
movq 0x30(%rbx), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x233a5
testl %eax, %eax
je 0x2340e
movl $0x1, %r12d
movslq 0x3c(%rbx), %rax
cmpq %rax, %r12
setl %r15b
jge 0x23413
movq 0x30(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
callq 0x233a5
incq %r12
testl %eax, %eax
jne 0x233ea
testb %r15b, %r15b
jne 0x23438
cmpl $0x0, 0x3c(%rbx)
jg 0x23433
cmpl $0x0, 0x4c(%rbx)
jg 0x23433
movq %r14, %rdi
movq %rbx, %rsi
callq 0x393e0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CullScans(gaps::R3SurfelScene*, gaps::R3SurfelConstraint const*)
int
CullScans(R3SurfelScene *scene, const R3SurfelConstraint *constraint)
{
  // Check inputs
  if (!scene) return 0;
  if (!constraint) return 0;

  // Find all scans to delete
  RNArray<R3SurfelScan *> delete_scans;
  for (int i = 0; i < scene->NScans(); i++) {
    R3SurfelScan *scan = scene->Scan(i);
    if (constraint->Check(scan->Viewpoint()) != R3_SURFEL_CONSTRAINT_FAIL) continue;
    delete_scans.Insert(scan);
  }

  // Delete scans
  for (int i = 0; i < delete_scans.NEntries(); i++) {
    R3SurfelScan *scan = delete_scans.Kth(i);
    delete scan;
  }
  
  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x23669
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %rdi
callq 0xaaf34
cmpl $0x0, 0x8c(%r14)
jle 0x23633
xorl %r13d, %r13d
movq %rsp, %r15
movq 0x80(%r14), %rax
movq (%rax,%r13,8), %r12
leaq 0x28(%r12), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x38(%rax)
testl %eax, %eax
jne 0x23624
movl 0xc(%rsp), %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0xaafca
incq %r13
movslq 0x8c(%r14), %rax
cmpq %rax, %r13
jl 0x235f8
cmpl $0x0, 0xc(%rsp)
jle 0x2365c
xorl %ebx, %ebx
movq (%rsp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2364f
movq (%rdi), %rax
callq *0x8(%rax)
incq %rbx
movslq 0xc(%rsp), %rax
cmpq %rax, %rbx
jl 0x2363c
movq %rsp, %rdi
callq 0xaaf9e
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0xaaf9e
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CullImages(gaps::R3SurfelScene*, gaps::R3SurfelConstraint const*)
int
CullImages(R3SurfelScene *scene, const R3SurfelConstraint *constraint)
{
  // Check inputs
  if (!scene) return 0;
  if (!constraint) return 0;

  // Find all images to delete
  RNArray<R3SurfelImage *> delete_images;
  for (int i = 0; i < scene->NImages(); i++) {
    R3SurfelImage *image = scene->Image(i);
    if (constraint->Check(image->Viewpoint()) != R3_SURFEL_CONSTRAINT_FAIL) continue;
    delete_images.Insert(image);
  }

  // Delete images
  for (int i = 0; i < delete_images.NEntries(); i++) {
    R3SurfelImage *image = delete_images.Kth(i);
    delete image;
  }
  
  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x2373c
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %rdi
callq 0xaaf34
cmpl $0x0, 0x9c(%r14)
jle 0x23706
xorl %r13d, %r13d
movq %rsp, %r15
movq 0x90(%r14), %rax
movq (%rax,%r13,8), %r12
leaq 0x30(%r12), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x38(%rax)
testl %eax, %eax
jne 0x236f7
movl 0xc(%rsp), %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0xaafca
incq %r13
movslq 0x9c(%r14), %rax
cmpq %rax, %r13
jl 0x236cb
cmpl $0x0, 0xc(%rsp)
jle 0x2372f
xorl %ebx, %ebx
movq (%rsp), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x23722
movq (%rdi), %rax
callq *0x8(%rax)
incq %rbx
movslq 0xc(%rsp), %rax
cmpq %rax, %rbx
jl 0x2370f
movq %rsp, %rdi
callq 0xaaf9e
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0xaaf9e
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreateObject(gaps::R3SurfelScene*, gaps::R3SurfelObject*, char const*)
R3SurfelObject *
CreateObject(R3SurfelScene *scene, 
  R3SurfelObject *parent_object, const char *object_name)
{
  // Get parent object
  if (!parent_object) parent_object = scene->RootObject();

  // Create object
  R3SurfelObject *object = new R3SurfelObject(object_name);
    
  // Insert object into scene
  scene->InsertObject(object, parent_object);

  // Update properties
  object->UpdateProperties();

  // Return object
  return object;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
testq %rsi, %rsi
jne 0x239ad
movq 0x10(%r15), %rax
movq (%rax), %rbx
movl $0xf8, %edi
callq 0x134e0
movq %rax, %r14
movq %rax, %rdi
movq %r12, %rsi
callq 0x16bb8
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq %r14, %rdi
callq 0x183f8
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movl $0xf8, %esi
movq %r14, %rdi
callq 0x134f0
movq %rbx, %rdi
callq 0x138b0