LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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 0x21f7f
testq %rax, %rax
je 0x22a03
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 0x36486
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
jmp 0x22a05
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_O3/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 0x22a62
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x18(%rax)
testl %eax, %eax
je 0x22b42
cmpl $0x0, 0x3c(%r15)
je 0x22a9e
jle 0x22b42
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 0x22a29
incq %rbx
movslq 0x3c(%r15), %rax
cmpq %rax, %rbx
jl 0x22a71
jmp 0x22b42
cmpl $0x0, 0x4c(%r15)
jle 0x22b42
xorl %ebx, %ebx
movq %r15, 0x10(%rsp)
movq 0x40(%r15), %rax
movq (%rax,%rbx,8), %r13
cmpl $0x0, 0x8(%r13)
je 0x22b2d
movq %r13, %rdi
callq 0x2cb9e
movq (%r14), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq *0x30(%rcx)
testl %eax, %eax
je 0x22b2d
cmpq $0x0, 0x98(%r13)
je 0x22ae8
cmpq $0x0, (%r13)
je 0x22b2d
cmpl $0x0, 0x8(%r13)
jle 0x22b2d
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 0x22b1d
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 0x22af5
incq %rbx
movq 0x10(%rsp), %r15
movslq 0x4c(%r15), %rax
cmpq %rax, %rbx
jl 0x22ab0
addq $0x18, %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/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 0x22b9f
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x22b9f
movq 0x10(%rax), %r14
testq %r14, %r14
je 0x22b9f
movq %rsi, %r15
movl $0xc8, %edi
callq 0x134e0
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2b84e
movq %rbx, %rdi
callq 0x2dfb8
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x10(%rax)
jmp 0x22ba1
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_O3/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 0x21f7f
testq %rax, %rax
je 0x22bf2
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x22b51
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movq %r14, %rax
jmp 0x22bf4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xa9ca8
cmpl $0x0, 0x1c(%rbx)
jle 0x22fcd
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %r15
cmpq (%rax), %r15
je 0x22fc1
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x22fa1
movl $0x1, %esi
callq 0x17588
testl %eax, %eax
je 0x22fc1
movq %r15, %rdi
movl $0x1, %esi
callq 0x17588
testl %eax, %eax
jne 0x22fc1
movl 0x14(%rsp), %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xa9d3e
incq %r12
movslq 0x1c(%rbx), %rax
cmpq %rax, %r12
jl 0x22f7d
cmpl $0x0, 0x14(%rsp)
jle 0x22ff5
xorl %r14d, %r14d
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x23027
incq %r14
movslq 0x14(%rsp), %rax
cmpq %rax, %r14
jl 0x22fd7
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x23012
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x23089
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%rdi), %rax
movl $0x1, %ebx
cmpq %rsi, (%rax)
je 0x2308b
cmpl $0x0, 0x2c(%r14)
jle 0x23072
xorl %r12d, %r12d
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x23027
testl %eax, %eax
je 0x23089
incq %r12
movslq 0x2c(%r14), %rax
cmpq %rax, %r12
jl 0x23052
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x20(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
jmp 0x2308b
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xa9ca8
movl 0x1c(%rbx), %eax
testl %eax, %eax
jle 0x230e8
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x10(%rbx), %rcx
movq (%rcx,%r15,8), %rsi
cmpq (%rcx), %rsi
je 0x230dd
cmpq $0x0, 0x18(%rsi)
jne 0x230dd
movl 0xc(%rsp), %edx
movq %r14, %rdi
callq 0xa9d3e
movl 0x1c(%rbx), %eax
incq %r15
movslq %eax, %rcx
cmpq %rcx, %r15
jl 0x230ba
cmpl $0x0, 0xc(%rsp)
jle 0x2310f
xorl %r14d, %r14d
movq (%rsp), %rax
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x23027
incq %r14
movslq 0xc(%rsp), %rax
cmpq %rax, %r14
jl 0x230f2
movq %rsp, %rdi
callq 0xa9d12
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x23128
movq %rax, %rbx
movq %rsp, %rdi
callq 0xa9d12
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x231bc
movq %rsi, %r14
movq %rdi, %r15
movq 0x18(%rdi), %rax
movl $0x1, %ebx
cmpq %rsi, (%rax)
je 0x231be
cmpl $0x0, 0x3c(%r14)
jle 0x2319f
xorl %r12d, %r12d
movq 0x30(%r14), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x23150
testl %eax, %eax
je 0x231bc
incq %r12
movslq 0x3c(%r14), %rax
cmpq %rax, %r12
jl 0x2317b
testl %eax, %eax
jg 0x231be
cmpl $0x0, 0x4c(%r14)
jg 0x231be
movq %r15, %rdi
movq %r14, %rsi
callq 0x3905c
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
jmp 0x231be
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x233f5
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %rdi
callq 0xa9ca8
cmpl $0x0, 0x8c(%r14)
jle 0x233bc
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 0x233ad
movl 0xc(%rsp), %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0xa9d3e
incq %r13
movslq 0x8c(%r14), %rax
cmpq %rax, %r13
jl 0x23381
movl 0xc(%rsp), %eax
testl %eax, %eax
jle 0x233e8
xorl %ebx, %ebx
movq (%rsp), %rcx
movq (%rcx,%rbx,8), %rdi
testq %rdi, %rdi
je 0x233dd
movq (%rdi), %rax
callq *0x8(%rax)
movl 0xc(%rsp), %eax
incq %rbx
movslq %eax, %rcx
cmpq %rcx, %rbx
jl 0x233c6
movq %rsp, %rdi
callq 0xa9d12
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0xa9d12
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x234cb
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %rdi
callq 0xa9ca8
cmpl $0x0, 0x9c(%r14)
jle 0x23492
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 0x23483
movl 0xc(%rsp), %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0xa9d3e
incq %r13
movslq 0x9c(%r14), %rax
cmpq %rax, %r13
jl 0x23457
movl 0xc(%rsp), %eax
testl %eax, %eax
jle 0x234be
xorl %ebx, %ebx
movq (%rsp), %rcx
movq (%rcx,%rbx,8), %rdi
testq %rdi, %rdi
je 0x234b3
movq (%rdi), %rax
callq *0x8(%rax)
movl 0xc(%rsp), %eax
incq %rbx
movslq %eax, %rcx
cmpq %rcx, %rbx
jl 0x2349c
movq %rsp, %rdi
callq 0xa9d12
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0xa9d12
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2373b
movq 0x10(%r15), %rax
movq (%rax), %rbx
movl $0xf8, %edi
callq 0x134e0
movq %rax, %r14
movq %rax, %rdi
movq %r12, %rsi
callq 0x16b68
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rax)
movq %r14, %rdi
callq 0x18324
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
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::RemoveParts(gaps::R3SurfelScene*, gaps::R3SurfelObject*)
int
RemoveParts(R3SurfelScene *scene, R3SurfelObject *object)
{
  // Copy array of parts
  RNArray<R3SurfelObject *> parts;
  for (int i = 0; i < object->NParts(); i++) {
    R3SurfelObject *part = object->Part(i);
    parts.Insert(part);
  }
  
  // Delete parts
  for (int i = 0; i < parts.NEntries(); i++) {
    R3SurfelObject *part = parts.Kth(i);
    RemoveParts(scene, part);
    scene->RemoveObject(part);
    delete part;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa9ca8
cmpl $0x0, 0x2c(%r14)
jle 0x23f33
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %rsi
movl 0x14(%rsp), %edx
movq %r15, %rdi
callq 0xa9d3e
incq %r12
movslq 0x2c(%r14), %rax
cmpq %rax, %r12
jl 0x23f13
cmpl $0x0, 0x14(%rsp)
jle 0x23f78
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
movq (%rax,%r15,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x23ee9
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x20(%rax)
testq %r14, %r14
je 0x23f6b
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
incq %r15
movslq 0x14(%rsp), %rax
cmpq %rax, %r15
jl 0x23f3d
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x23f95
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::SplitObject(gaps::R3SurfelObject*, gaps::R3SurfelPointSet*, gaps::R3SurfelObject**, gaps::R3SurfelObject**)
int
SplitObject(R3SurfelObject *object, R3SurfelPointSet *pointset,
  R3SurfelObject **resultA, R3SurfelObject **resultB)
{
  // Read blocks
  object->ReadBlocks();

  // Set marks
  object->SetMarks(FALSE);
  pointset->SetMarks(TRUE);

  // Create constraint
  R3SurfelMultiConstraint constraint;
  R3SurfelMarkConstraint mark_constraint(TRUE, FALSE);
  R3SurfelObjectConstraint object_constraint(object);
  constraint.InsertConstraint(&mark_constraint);
  constraint.InsertConstraint(&object_constraint);

  // Split object
  int status = SplitObject(object, &constraint, resultA, resultB);

  // Release blocks
  object->ReleaseBlocks();

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
xorl %esi, %esi
callq 0x17eae
movq (%rbx), %rax
movq %rbx, %rdi
xorl %esi, %esi
callq *0x40(%rax)
movq (%r12), %rax
movq %r12, %rdi
movl $0x1, %esi
callq *0xa8(%rax)
movq %rsp, %rdi
callq 0x31b58
leaq 0x18(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x31afe
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x31816
movq %rsp, %rdi
leaq 0x18(%rsp), %rsi
callq 0x31b6c
movq %rsp, %rdi
leaq 0x28(%rsp), %rsi
callq 0x31b6c
movq %rsp, %rsi
movq %rbx, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x240d5
movl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x17ee2
leaq 0x28(%rsp), %rdi
callq 0x31dba
leaq 0x18(%rsp), %rdi
callq 0x31dba
leaq 0x10a5b8(%rip), %rax    # 0x12e618
addq $0x10, %rax
leaq 0x8(%rsp), %rdi
movq %rax, -0x8(%rdi)
callq 0xa9d12
movq %rsp, %rdi
callq 0x31dba
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x240a2
movq %rax, %rbx
jmp 0x240ac
jmp 0x24095
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x31dba
leaq 0x18(%rsp), %rdi
callq 0x31dba
leaq 0x10a565(%rip), %rax    # 0x12e618
addq $0x10, %rax
leaq 0x8(%rsp), %rdi
movq %rax, -0x8(%rdi)
callq 0xa9d12
movq %rsp, %rdi
callq 0x31dba
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::GetObjectOBBProperty(gaps::R3SurfelObject*, gaps::R3OrientedBox*, double*, int*)
R3SurfelObjectProperty *
GetObjectOBBProperty(R3SurfelObject *object,
  R3OrientedBox *obb, RNScalar *confidence, int *originator)
{
  // Constants for OBB property
  static const int property_type = R3_SURFEL_OBJECT_AMODAL_OBB_PROPERTY;
  static const int noperands = 20;

  // Get object property
  R3SurfelObjectProperty *property = object->FindObjectProperty(property_type);
  if (!property) return NULL;

  // Check property operands
  if (property->NOperands() != noperands) return NULL;

  // Extract obb
  if (obb) {
    R3Point center(property->Operand(0), property->Operand(1), property->Operand(2));
    R3Vector axis0(property->Operand(3), property->Operand(4), property->Operand(5));
    R3Vector axis1(property->Operand(6), property->Operand(7), property->Operand(8));
    // R3Vector axis2(property->Operand(9), property->Operand(10), property->Operand(11));
    RNScalar radius0 = property->Operand(12);
    RNScalar radius1 = property->Operand(13);
    RNScalar radius2 = property->Operand(14);
    obb->Reset(center, axis0, axis1, radius0, radius1, radius2);
  }

  // Extract confidence and originator
  if (confidence) *confidence = property->Operand(15);
  if (originator) *originator = (int) (property->Operand(16) + 0.5);

  // Return property
  return property;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movl $0x2, %esi
callq 0x17482
testq %rax, %rax
je 0x245c1
movq %rax, %rbx
cmpl $0x14, 0x28(%rax)
jne 0x245c1
testq %r12, %r12
je 0x2458c
movq 0x20(%rbx), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movq %rsp, %rdi
callq 0x83dc2
movq 0x20(%rbx), %rax
movsd 0x18(%rax), %xmm0
movsd 0x20(%rax), %xmm1
movsd 0x28(%rax), %xmm2
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
callq 0x84856
movq 0x20(%rbx), %rax
movsd 0x30(%rax), %xmm0
movsd 0x38(%rax), %xmm1
movsd 0x40(%rax), %xmm2
leaq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0x84856
movq 0x20(%rbx), %rax
movsd 0x60(%rax), %xmm0
movsd 0x68(%rax), %xmm1
movsd 0x70(%rax), %xmm2
movq (%r12), %rax
movq %r12, %rdi
movq %rsp, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq *0x268(%rax)
testq %r15, %r15
je 0x2459f
movq 0x20(%rbx), %rax
movsd 0x78(%rax), %xmm0
movsd %xmm0, (%r15)
testq %r14, %r14
je 0x245c3
movq 0x20(%rbx), %rax
movsd 0x80(%rax), %xmm0
addsd 0xb8b80(%rip), %xmm0    # 0xdd138
cvttsd2si %xmm0, %eax
movl %eax, (%r14)
jmp 0x245c3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x48, %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/R3SurfelUtils.cpp
// Function: gaps::SetObjectOBBProperty(gaps::R3SurfelObject*, gaps::R3OrientedBox const&, double, int)
int
SetObjectOBBProperty(R3SurfelObject *object,
  const R3OrientedBox& obb, double confidence, int originator)
{
  // Constants for OBB property
  static const int property_type = R3_SURFEL_OBJECT_AMODAL_OBB_PROPERTY;
  static const int noperands = 20;

  // Get/create object property
  R3SurfelObjectProperty *property = object->FindObjectProperty(property_type);
  if (!property) property = CreateObjectProperty(object, property_type);
  if (!property) return 0;

  // Check number of operands
  if (property->NOperands() != noperands) return 0;

  // Fill property operands
  double operands[noperands];
  operands[0] = obb.Center().X();
  operands[1] = obb.Center().Y();
  operands[2] = obb.Center().Z();
  operands[3] = obb.Axis(0).X();
  operands[4] = obb.Axis(0).Y();
  operands[5] = obb.Axis(0).Z();
  operands[6] = obb.Axis(1).X();
  operands[7] = obb.Axis(1).Y();
  operands[8] = obb.Axis(1).Z();
  operands[9] = obb.Axis(2).X();
  operands[10] = obb.Axis(2).Y();
  operands[11] = obb.Axis(2).Z();
  operands[12] = obb.Radius(0);
  operands[13] = obb.Radius(1);
  operands[14] = obb.Radius(2);
  operands[15] = confidence;
  operands[16] = originator;
  operands[17] = 0;
  operands[18] = 0;
  operands[19] = 0;

  // Set property operands
  property->ResetOperands(operands, noperands);
  
  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movl %edx, %ebx
movsd %xmm0, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movl $0x2, %esi
callq 0x17482
testq %rax, %rax
jne 0x24614
movq %r15, %rdi
movl $0x2, %esi
callq 0x2441e
testq %rax, %rax
je 0x246b1
cmpl $0x14, 0x28(%rax)
jne 0x246b1
movups 0x8(%r14), %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
movups 0x18(%r14), %xmm0
movaps %xmm0, 0x10(%rsi)
movups 0x28(%r14), %xmm0
movaps %xmm0, 0x20(%rsi)
movups 0x38(%r14), %xmm0
movaps %xmm0, 0x30(%rsi)
movups 0x48(%r14), %xmm0
movaps %xmm0, 0x40(%rsi)
movups 0x58(%r14), %xmm0
movaps %xmm0, 0x50(%rsi)
movups 0x68(%r14), %xmm0
movaps %xmm0, 0x60(%rsi)
movsd 0x78(%r14), %xmm0
movsd %xmm0, 0x70(%rsi)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x78(%rsi)
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x80(%rsi)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x88(%rsi)
movq $0x0, 0x98(%rsi)
movq %rax, %rdi
movl $0x14, %edx
callq 0x3f5a0
movl $0x1, %eax
jmp 0x246b3
xorl %eax, %eax
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreateLabel(gaps::R3SurfelScene*, gaps::R3SurfelLabel*, char const*, int, int, gaps::RNRgb const&)
R3SurfelLabel *
CreateLabel(R3SurfelScene *scene, R3SurfelLabel *parent_label,
  const char *label_name, int identifier, int key, const RNRgb& color)
{
  // Create label
  R3SurfelLabel *label = new R3SurfelLabel(label_name);
  if (!label) {
    RNFail("Unable to allocate label\n");
    return NULL;
  }

  // Set label properties
  if (identifier >= 0) label->SetIdentifier(identifier);
  if (key >= 0) label->SetAssignmentKeystroke(key);
  if ((color.R() >= 0) && (color.G() >= 0) && (color.B() >=0)) label->SetColor(color);
         
  // Find parent label
  if (!parent_label) parent_label = scene->RootLabel();

  // Insert label into scene
  scene->InsertLabel(label, parent_label);

  // Return label
  return label;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r12
movl %r8d, %ebp
movl %ecx, %r13d
movq %rdx, %r14
movq %rsi, (%rsp)
movq %rdi, %r15
movl $0x98, %edi
callq 0x134e0
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x4018c
testl %r13d, %r13d
js 0x24707
movq (%rbx), %rax
movq %rbx, %rdi
movl %r13d, %esi
callq *0x20(%rax)
testl %ebp, %ebp
js 0x24716
movq (%rbx), %rax
movq %rbx, %rdi
movl %ebp, %esi
callq *0x28(%rax)
movsd (%r12), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0x24750
movsd 0x8(%r12), %xmm1
ucomisd %xmm0, %xmm1
jb 0x24750
movsd 0x10(%r12), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x24750
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0x30(%rax)
movq (%rsp), %rdx
testq %rdx, %rdx
jne 0x24760
movq 0x20(%r15), %rax
movq (%rax), %rdx
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
callq *0x30(%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x98, %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::RemoveParts(gaps::R3SurfelScene*, gaps::R3SurfelLabel*)
int
RemoveParts(R3SurfelScene *scene, R3SurfelLabel *label)
{
  // Copy array of parts
  RNArray<R3SurfelLabel *> parts;
  for (int i = 0; i < label->NParts(); i++) {
    R3SurfelLabel *part = label->Part(i);
    parts.Insert(part);
  }
  
  // Delete parts
  for (int i = 0; i < parts.NEntries(); i++) {
    R3SurfelLabel *part = parts.Kth(i);
    RemoveParts(scene, part);
    scene->RemoveLabel(part);
    delete part;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa9ca8
cmpl $0x0, 0x2c(%r14)
jle 0x247f4
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %rsi
movl 0x14(%rsp), %edx
movq %r15, %rdi
callq 0xa9d3e
incq %r12
movslq 0x2c(%r14), %rax
cmpq %rax, %r12
jl 0x247d4
cmpl $0x0, 0x14(%rsp)
jle 0x24839
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
movq (%rax,%r15,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x247aa
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x38(%rax)
testq %r14, %r14
je 0x2482c
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
incq %r15
movslq 0x14(%rsp), %rax
cmpq %rax, %r15
jl 0x247fe
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x24856
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreateConnectedPointSet(gaps::R3SurfelPointGraph*, int)
R3SurfelPointSet *
CreateConnectedPointSet(R3SurfelPointGraph *graph, int seed_index)
{
  // Initialize result
  R3SurfelPointSet *connected_pointset = new R3SurfelPointSet();
  if (graph->NPoints() == 0) return connected_pointset;

  // Find seed point 
  R3SurfelPoint *seed_point = graph->Point(seed_index);

  // Initialize marks
  for (int i = 0; i < graph->NPoints(); i++) {
    R3SurfelPoint *point = graph->Point(i);
    point->SetMark(FALSE);
  }

  // Flood fill from seed point
  RNArray<R3SurfelPoint *> stack;
  stack.Insert(seed_point);
  seed_point->SetMark(TRUE);
  while (!stack.IsEmpty()) {
    R3SurfelPoint *point = stack.Tail();
    stack.RemoveTail();
    connected_pointset->InsertPoint(*point);
    int point_index = graph->PointIndex(point);
    for (int i = 0; i < graph->NNeighbors(point_index); i++) {
      R3SurfelPoint *neighbor = graph->Neighbor(point_index, i);
      if (neighbor->IsMarked()) continue;
      stack.InsertTail(neighbor);
      neighbor->SetMark(TRUE);
    }
  }

  // Return connected pointset
  return connected_pointset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %r14
movl $0x60, %edi
callq 0x134e0
movq %rax, %rbx
movq %rax, %rdi
callq 0x32620
movl 0x18(%r14), %eax
testl %eax, %eax
je 0x258a1
movslq %ebp, %r15
shlq $0x4, %r15
addq 0x10(%r14), %r15
testl %eax, %eax
jle 0x257d0
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x10(%r14), %rdi
addq %r12, %rdi
xorl %esi, %esi
callq 0x32568
incq %r13
movslq 0x18(%r14), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x257b2
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xa9ca8
movl 0xc(%r12), %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0xa9d3e
movq %r15, %rdi
movl $0x1, %esi
callq 0x32568
movl 0x14(%rsp), %eax
testl %eax, %eax
je 0x25897
leaq 0x8(%rsp), %r15
movq 0x8(%rsp), %rcx
movslq %eax, %rsi
movq -0x8(%rcx,%rsi,8), %r12
decl %esi
movq %r15, %rdi
callq 0xa9ec8
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0x68(%rax)
subq 0x10(%r14), %r12
shrq $0x4, %r12
movslq %r12d, %r13
movq 0x68(%r14), %rax
shlq $0x4, %r13
cmpl $0x0, 0xc(%rax,%r13)
jle 0x2588b
xorl %ebp, %ebp
movq (%rax,%r13), %rcx
movq (%rcx,%rbp,8), %r12
movq 0x8(%r12), %rcx
cmpb $0x0, 0x2f(%rcx)
js 0x2587e
movl 0x14(%rsp), %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0xa9d3e
movq %r12, %rdi
movl $0x1, %esi
callq 0x32568
movq 0x68(%r14), %rax
incq %rbp
movslq 0xc(%rax,%r13), %rcx
cmpq %rcx, %rbp
jl 0x2584b
movl 0x14(%rsp), %eax
testl %eax, %eax
jne 0x2580b
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x60, %esi
movq %rbx, %rdi
callq 0x134f0
jmp 0x258d6
jmp 0x258c9
jmp 0x258c9
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movq %r14, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreateConnectedPointSet(gaps::R3SurfelPointGraph*, gaps::R3Point const&)
R3SurfelPointSet *
CreateConnectedPointSet(R3SurfelPointGraph *graph, const R3Point& center)
{
  // Find seed point (closest to center)
  int seed_index = -1;
  RNLength seed_distance = FLT_MAX;
  for (int i = 0; i < graph->NPoints(); i++) {
    R3SurfelPoint *point = graph->Point(i);
    RNLength distance = R3SquaredDistance(point->Position(), center);
    if (distance < seed_distance) {
      seed_distance = distance;
      seed_index = i;
    }
  }     

  // Check seed index
  if (seed_index < 0) return NULL;

  // Return connected component
  return CreateConnectedPointSet(graph, seed_index);
}

// Assembly:
cmpl $0x0, 0x18(%rdi)
jle 0x259a9
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movsd 0xb7850(%rip), %xmm0    # 0xdd168
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x8, %r12d
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
movsd %xmm0, 0x8(%rsp)
movq 0x10(%rbx), %rax
movq -0x8(%rax,%r12), %rcx
movq (%rax,%r12), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
addsd 0x10(%rcx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x4(%rax), %xmm1
addsd 0x18(%rcx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x8(%rax), %xmm2
addsd 0x20(%rcx), %xmm2
movq %r15, %rdi
callq 0x83dc2
movq %r15, %rdi
movq %r14, %rsi
callq 0x4feeb
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
minsd %xmm1, %xmm0
cmoval %r13d, %ebp
incq %r13
movslq 0x18(%rbx), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x2592b
testl %ebp, %ebp
js 0x259ac
movq %rbx, %rdi
movl %ebp, %esi
callq 0x25769
jmp 0x259ae
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x28, %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/R3SurfelUtils.cpp
// Function: gaps::CreateObjectSet(gaps::R3SurfelScene*, gaps::R3SurfelConstraint const*)
R3SurfelObjectSet *
CreateObjectSet(R3SurfelScene *scene, 
  const R3SurfelConstraint *constraint)
{
  // Create object set
  R3SurfelObjectSet *objectset = new R3SurfelObjectSet();
  if (!objectset) {
    RNFail("Unable to allocate object set\n");
    return NULL;
  }

  // Construct object set
  for (int i = 0; i < scene->NObjects(); i++) {
    R3SurfelObject *object = scene->Object(i);
    if (constraint && !constraint->Check(object)) continue;
    objectset->InsertObject(object);
  }


  // Return object set
  return objectset;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x60, %edi
callq 0x134e0
movq %rax, %rbx
movq %rax, %rdi
callq 0x3eb14
cmpl $0x0, 0x1c(%r15)
jle 0x275b3
xorl %r13d, %r13d
movq 0x10(%r15), %rax
movq (%rax,%r13,8), %r12
testq %r14, %r14
je 0x2759b
movq (%r14), %rax
movq %r14, %rdi
movq %r12, %rsi
callq *0x10(%rax)
testl %eax, %eax
je 0x275a7
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0x10(%rax)
incq %r13
movslq 0x1c(%r15), %rax
cmpq %rax, %r13
jl 0x2757e
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
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::FitPlane(gaps::R3SurfelPointSet*)
R3Plane
FitPlane(R3SurfelPointSet *pointset)
{
  // Allocate points
  int max_points = 1024;
  int npoints = pointset->NPoints();
  if (npoints > max_points) npoints = max_points;
  if (npoints == 0) return R3null_plane;
  R3Point *points = new R3Point [npoints];
  int step = pointset->NPoints() / npoints;
  if (step == 0) step = 1;
  for (int i = 0; i < npoints; i++) {
    const R3SurfelPoint *point = pointset->Point(i*step);
    points[i] = point->Position();
  }

  // Solve for plane
  R3Point centroid = R3Centroid(npoints, points);
  R3Triad triad = R3PrincipleAxes(centroid, npoints, points);
  R3Vector normal = triad[2];
  if (normal[2] < 0) normal.Flip();
  R3Plane plane(centroid, normal);

  // Delete points
  delete [] points;

  // Return plane
  return plane;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbp
movl 0x10(%rsi), %ebx
movl $0x400, %eax            # imm = 0x400
cmpl %eax, %ebx
cmovll %ebx, %eax
testl %ebx, %ebx
je 0x2775d
movq %rsi, 0x10(%rsp)
movl %eax, 0xc(%rsp)
movslq %eax, %r13
movl $0x18, %ecx
movq %r13, %rax
mulq %rcx
movq $-0x1, %r12
cmovnoq %rax, %r12
movq %r12, %rdi
callq 0x13030
movq %rax, %r14
shlq $0x3, %r13
leaq (,%r13,2), %r15
addq %r13, %r15
xorl %r13d, %r13d
leaq (%r14,%r13), %rdi
callq 0x83dc0
addq $0x18, %r13
cmpq %r13, %r15
jne 0x27640
movq %rbp, 0x18(%rsp)
testl %ebx, %ebx
movq 0x10(%rsp), %rsi
jle 0x276de
movl 0x10(%rsi), %eax
cltd
movl 0xc(%rsp), %ecx
idivl %ecx
cmpl $0x1, %eax
adcl $0x0, %eax
movslq %eax, %rbx
movl %ecx, %ebp
shlq $0x4, %rbx
movl $0x8, %r15d
leaq 0x50(%rsp), %r12
movq %r14, %r13
movq 0x8(%rsi), %rax
movq -0x8(%rax,%r15), %rcx
movq (%rax,%r15), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
addsd 0x10(%rcx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x4(%rax), %xmm1
addsd 0x18(%rcx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x8(%rax), %xmm2
addsd 0x20(%rcx), %xmm2
movq %r12, %rdi
callq 0x83dc2
movq %r13, %rdi
movq %r12, %rsi
callq 0x8412a
movq 0x10(%rsp), %rsi
addq %rbx, %r15
addq $0x18, %r13
decq %rbp
jne 0x27687
leaq 0x38(%rsp), %r15
movq %r15, %rdi
movl 0xc(%rsp), %ebx
movl %ebx, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x545c1
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl %ebx, %edx
movq %r14, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x5464b
leaq 0x80(%rsp), %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x84866
xorpd %xmm0, %xmm0
ucomisd 0x10(%r15), %xmm0
jbe 0x27739
leaq 0x20(%rsp), %rdi
callq 0x84bc4
leaq 0x38(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x82942
movq %r14, %rdi
callq 0x13680
movq %rbx, %rax
jmp 0x2776f
leaq 0x50db3c(%rip), %rsi    # 0x5352a0
movq %rbp, %rdi
callq 0x828b6
movq %rbp, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
movq %r12, %rsi
callq 0x139b0
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::EstimateSupportPlane(gaps::R3SurfelScene*, gaps::R3SurfelNode*, gaps::R3SurfelConstraint const*, double, double*)
R3Plane 
EstimateSupportPlane(R3SurfelScene *scene, 
  R3SurfelNode *source_node, const R3SurfelConstraint *constraint,
  RNLength accuracy, RNScalar *npoints)
{
  // Get points 
  R3SurfelPointSet *pointset = CreatePointSet(scene, source_node, constraint);
  if (!pointset) { 
    if (npoints) *npoints = 0;
    return R3null_plane; 
  }

  // Estimate support plane 
  R3Plane plane = EstimateSupportPlane(pointset, accuracy, npoints);

  // Delete points
  delete pointset;

  // Return plane
  return plane;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %r8, %r14
movsd %xmm0, 0x8(%rsp)
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x21f7f
testq %rax, %rax
je 0x277e1
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
movsd 0x8(%rsp), %xmm0
movq %r14, %rdx
callq 0x22302
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
jmp 0x277fc
testq %r14, %r14
je 0x277ed
movq $0x0, (%r14)
leaq 0x50daac(%rip), %rsi    # 0x5352a0
movq %rbx, %rdi
callq 0x828b6
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::EstimateSupportZ(gaps::R3SurfelScene*, gaps::R3Point const&, double, double, double*)
RNCoord
EstimateSupportZ(R3SurfelScene *scene, 
  const R3Point& center, RNLength radius,
  RNLength accuracy, RNScalar *npoints)
{
 // Get points 
  R3SurfelCylinderConstraint cylinder_constraint(center, radius);
  R3SurfelPointSet *pointset = CreatePointSet(scene, NULL, &cylinder_constraint);
  if (!pointset) { 
    if (npoints) *npoints = 0;
    return -1; 
  }

  // Estimate support Z 
  R3Plane plane = EstimateSupportPlane(pointset, accuracy, npoints);
  RNScalar z = -(center[0]*plane[0] + center[1]*plane[1] + plane[3]) / plane[2];

  // Delete points
  delete pointset;

  // Return support z
  return z;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r14
movsd %xmm1, (%rsp)
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x30(%rsp), %r12
movsd 0xb58c0(%rip), %xmm1    # 0xdd170
movsd 0xb58b0(%rip), %xmm2    # 0xdd168
movq %r12, %rdi
callq 0x303e6
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x21f7f
movq %rax, %r15
testq %rax, %rax
je 0x27927
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
movq %r14, %rdx
callq 0x22302
movsd 0x8(%rbx), %xmm0
mulsd 0x18(%rsp), %xmm0
movsd (%rbx), %xmm1
mulsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
addsd 0x28(%rsp), %xmm1
xorpd 0xb5a8f(%rip), %xmm1    # 0xdd3a0
divsd 0x20(%rsp), %xmm1
movapd %xmm1, (%rsp)
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
jmp 0x27940
movsd 0xb5831(%rip), %xmm0    # 0xdd160
testq %r14, %r14
movapd %xmm0, (%rsp)
je 0x27940
movq $0x0, (%r14)
leaq 0x30(%rsp), %rdi
callq 0x31dba
movaps (%rsp), %xmm0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x2795c
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x31dba
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::FitSupportPlane(gaps::R3SurfelPointSet*, double, double*)
R3Plane
FitSupportPlane(R3SurfelPointSet *pointset,
  RNLength accuracy, RNScalar *npoints)
{
  // Estimate support plane
  R3Plane plane = EstimateSupportPlane(pointset, accuracy, npoints);

  // Create a set of points near plane
  R3SurfelPlaneConstraint constraint(plane, FALSE, TRUE, FALSE, 5 * accuracy);
  R3SurfelPointSet *plane_pointset = CreatePointSet(pointset, &constraint);

  // Fit plane to pointset
  if (plane_pointset->NPoints() > 3) {
    plane = FitPlane(plane_pointset);
    if (npoints) *npoints = plane_pointset->NPoints();
  }

  // Delete point set
  delete plane_pointset;

  // Return plane
  return plane;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r14
movsd %xmm0, (%rsp)
movq %rsi, %r15
movq %rdi, %rbx
callq 0x22302
movsd (%rsp), %xmm0
mulsd 0xb616c(%rip), %xmm0    # 0xddb08
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x3065a
movq %r15, %rdi
movq %r12, %rsi
callq 0x21f14
movq %rax, %r15
cmpl $0x4, 0x10(%rax)
jl 0x27a02
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x275d8
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x84fe2
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x18(%rbx)
testq %r14, %r14
je 0x27a02
xorps %xmm0, %xmm0
cvtsi2sdl 0x10(%r15), %xmm0
movsd %xmm0, (%r14)
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
leaq 0x28(%rsp), %rdi
callq 0x31dba
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x27a26
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x31dba
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::EstimateOrientedBBox(gaps::R3SurfelObject*)
R3OrientedBox 
EstimateOrientedBBox(R3SurfelObject *object)
{
  // Check object
  if (!object) return R3null_oriented_box;
  
  // Get pointset
  R3SurfelPointSet *pointset = object->PointSet(TRUE);
  if (!pointset) return R3null_oriented_box;

  // Compute oriented box
  R3OrientedBox obb = EstimateOrientedBBox(pointset);

  // Delete pointset
  delete pointset;
           
  // Return oriented box
  return obb;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x2807a
xorps %xmm0, %xmm0
movq %rsi, %rdi
movl $0x1, %esi
callq 0x174a6
testq %rax, %rax
je 0x2807a
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x27df7
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
jmp 0x28089
leaq 0x10c70f(%rip), %rsi    # 0x134790
movq %rbx, %rdi
callq 0x6bf0a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::ClosestImage(gaps::R3SurfelScene*, gaps::R3Point const&)
R3SurfelImage *
ClosestImage(R3SurfelScene *scene, const R3Point& query_position)
{
  // Check scene
  if (!scene) return NULL;
  
  // Search for closest image
  RNScalar best_dd = FLT_MAX;
  R3SurfelImage *best_image = NULL;
  for (int i = 0; i < scene->NImages(); i++) {
    R3SurfelImage *image = scene->Image(i);
    RNScalar dd = R3SquaredDistance(image->Viewpoint(), query_position);
    if (dd < best_dd) {
      best_image = image;
      best_dd = dd;
    }
  }

  // Return closest image
  return best_image;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x2a7fe
movq %rdi, %r14
cmpl $0x0, 0x9c(%rdi)
jle 0x2a7fe
movq %rsi, %rbx
movsd 0xb29b0(%rip), %xmm0    # 0xdd168
xorl %r12d, %r12d
xorl %r15d, %r15d
movsd %xmm0, 0x8(%rsp)
movq 0x90(%r14), %rax
movq (%rax,%r12,8), %r13
leaq 0x30(%r13), %rdi
movq %rbx, %rsi
callq 0x4feeb
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
cmovaq %r13, %r15
minsd %xmm1, %xmm0
incq %r12
movslq 0x9c(%r14), %rax
cmpq %rax, %r12
jl 0x2a7be
jmp 0x2a801
xorl %r15d, %r15d
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3Surfel.cpp
// Function: gaps::R3Surfel::R3Surfel(float, float, float, float, float, float, float, unsigned char, unsigned char, unsigned char, unsigned char)
R3Surfel::
R3Surfel(float x, float y, float z, float nx, float ny, float nz,
  float radius, unsigned char r, unsigned char g, unsigned char b, 
  unsigned char flags)
  : timestamp(0),
    identifier(0),
    attribute(0),
    depth(0),
    elevation(0),
    flags(flags)
{
  // Set everything
  SetPosition(x, y, z);
  SetNormal(nx, ny, nz);
  SetTangent(0, 0, 0);
  SetRadius(radius);
  SetColor(r, g, b);
}

// Assembly:
xorl %eax, %eax
movl %eax, 0xc(%rdi)
movl %eax, 0x28(%rdi)
movq $0x0, 0x20(%rdi)
movb %r8b, 0x2f(%rdi)
movss %xmm0, (%rdi)
movss %xmm1, 0x4(%rdi)
movss %xmm2, 0x8(%rdi)
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm3
unpcklps %xmm4, %xmm3            # xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
cvtps2pd %xmm3, %xmm1
mulpd 0xb2be4(%rip), %xmm1    # 0xddd80
addpd 0xb2bec(%rip), %xmm1    # 0xddd90
cvttpd2dq %xmm1, %xmm1
pshuflw $0xe8, %xmm1, %xmm1     # xmm1 = xmm1[0,2,2,3,4,5,6,7]
xorps %xmm2, %xmm2
cvtss2sd %xmm5, %xmm2
mulsd 0xb2c04(%rip), %xmm2    # 0xdddc0
addsd 0xb1f74(%rip), %xmm2    # 0xdd138
movd %xmm1, 0x10(%rdi)
cvttsd2si %xmm2, %eax
movw %ax, 0x14(%rdi)
jne 0x2b1e3
jp 0x2b1e3
ucomiss %xmm0, %xmm4
jne 0x2b1e3
jp 0x2b1e3
ucomiss %xmm0, %xmm5
jne 0x2b1e3
jnp 0x2b1eb
orb $0x40, %r8b
movb %r8b, 0x2f(%rdi)
movl $0x0, 0x16(%rdi)
xorps %xmm0, %xmm0
cvtss2sd %xmm6, %xmm0
mulsd 0xb2bc7(%rip), %xmm0    # 0xdddc8
addsd 0xb1f2f(%rip), %xmm0    # 0xdd138
movw $0x0, 0x1a(%rdi)
cvtsd2ss %xmm0, %xmm0
movss 0xb2bbd(%rip), %xmm1    # 0xdddd8
minss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movw %ax, 0x1c(%rdi)
movw %ax, 0x1e(%rdi)
movb %sil, 0x2c(%rdi)
movb %dl, 0x2d(%rdi)
movb %cl, 0x2e(%rdi)
retq