LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelNode.cpp
// Function: gaps::R3SurfelNode::UpdateFlags()
void R3SurfelNode::
UpdateFlags(void)
{
  // Reset flags
  flags.Remove(R3_SURFEL_NODE_HAS_ACTIVE_FLAG);
  flags.Remove(R3_SURFEL_NODE_HAS_NORMALS_FLAG);
  flags.Remove(R3_SURFEL_NODE_HAS_AERIAL_FLAG);
  flags.Remove(R3_SURFEL_NODE_HAS_TERRESTRIAL_FLAG);

  // Update flags
  for (int i = 0; i < NBlocks(); i++) {
    R3SurfelBlock *block = Block(i);
    if (block->HasActive()) flags.Add(R3_SURFEL_NODE_HAS_ACTIVE_FLAG);
    if (block->HasNormals()) flags.Add(R3_SURFEL_NODE_HAS_NORMALS_FLAG);
    if (block->HasAerial()) flags.Add(R3_SURFEL_NODE_HAS_AERIAL_FLAG);
    if (block->HasTerrestrial()) flags.Add(R3_SURFEL_NODE_HAS_TERRESTRIAL_FLAG);
  }

  // Mark flags uptodate
  flags.Add(R3_SURFEL_NODE_FLAGS_UPTODATE_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq $-0xf1, %rax
andq 0xc0(%rdi), %rax
movq %rax, 0xc0(%rdi)
cmpl $0x0, 0x4c(%rdi)
jle 0x38689
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %r14
movq %r14, %rdi
callq 0x2d20e
testl %eax, %eax
je 0x3863d
orb $0x40, 0xc0(%rbx)
movq %r14, %rdi
callq 0x2d36a
testl %eax, %eax
je 0x38650
orb $-0x80, 0xc0(%rbx)
movq %r14, %rdi
callq 0x2d3b2
testl %eax, %eax
je 0x38663
orb $0x10, 0xc0(%rbx)
movq %r14, %rdi
callq 0x2d3d6
testl %eax, %eax
je 0x38676
orb $0x20, 0xc0(%rbx)
incq %r15
movslq 0x4c(%rbx), %rax
cmpq %rax, %r15
jl 0x38622
movq 0xc0(%rbx), %rax
orq $0x4, %rax
movq %rax, 0xc0(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelNodeSet.cpp
// Function: gaps::R3SurfelNodeSet::InsertNodes(gaps::R3SurfelObject*, double)
void R3SurfelNodeSet::
InsertNodes(R3SurfelObject *object, RNScalar max_resolution)
{
  // Insert cut at nodes rooted at object
  for (int i = 0; i < object->NNodes(); i++) {
    R3SurfelNode *node = object->Node(i);
    InsertNodes(node, max_resolution);
  }
}

// Assembly:
cmpl $0x0, 0x6c(%rsi)
jle 0x3887c
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movsd %xmm0, 0x8(%rsp)
movq 0x60(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq (%r14), %rax
movq %r14, %rdi
movsd 0x8(%rsp), %xmm0
callq *0x18(%rax)
incq %r15
movslq 0x6c(%rbx), %rax
cmpq %rax, %r15
jl 0x38850
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelNodeSet.cpp
// Function: gaps::R3SurfelNodeSet::InsertNode(gaps::R3SurfelNode*)
void R3SurfelNodeSet::
InsertNode(R3SurfelNode *node)
{
  // Insert node
  nodes.Insert(node);

  // Update complexity
  complexity += node->Complexity();

  // Update bounding box
  bbox.Union(node->BBox());

  // Update timestamp range
  timestamp_range.Union(node->TimestampRange());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rdi
movl 0x14(%rbx), %edx
callq 0xa9d3e
movq %r14, %rdi
callq 0x3742e
addsd 0x18(%rbx), %xmm0
movsd %xmm0, 0x18(%rbx)
leaq 0x20(%rbx), %r15
movq %r14, %rdi
callq 0x3755c
movq %r15, %rdi
movq %rax, %rsi
callq 0x6de0c
movq %r14, %rdi
callq 0x375ac
movsd (%rax), %xmm0
movsd 0x58(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x38c06
movsd %xmm0, 0x58(%rbx)
movsd 0x8(%rax), %xmm0
ucomisd 0x60(%rbx), %xmm0
jbe 0x38c17
movsd %xmm0, 0x60(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelNodeSet.cpp
// Function: gaps::R3SurfelNodeSet::Empty()
void R3SurfelNodeSet::
Empty(void)
{
  // Remove nodes
  nodes.Empty();

  // Update complexity
  complexity = 0;

  // Update bounding box
  bbox = R3null_box;

  // Update timestamp range
  timestamp_range.Reset(FLT_MAX,-FLT_MAX);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x8, %rdi
xorl %esi, %esi
callq 0xa9f08
movq $0x0, 0x18(%rbx)
leaq 0x28(%rbx), %rdi
leaq 0xfbd0d(%rip), %r14     # 0x1349c8
leaq 0x8(%r14), %rsi
callq 0x8412a
leaq 0x40(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0x8412a
movaps 0xa4655(%rip), %xmm0    # 0xdd330
movups %xmm0, 0x58(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelNodeSet.cpp
// Function: gaps::R3SurfelNodeSet::ReadBlocks()
void R3SurfelNodeSet::
ReadBlocks(void)
{
  // Read nodes in set
  for (int i = 0; i < NNodes(); i++) {
    R3SurfelNode *node = Node(i);
    node->ReadBlocks();
  }
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x38d1a
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
xorl %esi, %esi
callq 0x37c3e
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x38cf8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelNodeSet.cpp
// Function: gaps::R3SurfelNodeSet::ReleaseBlocks()
void R3SurfelNodeSet::
ReleaseBlocks(void)
{
  // Release nodes in set
  for (int i = 0; i < NNodes(); i++) {
    R3SurfelNode *node = Node(i);
    node->ReleaseBlocks();
  }
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x38d4e
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
xorl %esi, %esi
callq 0x37cdc
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x38d2c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelNodeSet.cpp
// Function: gaps::R3SurfelNodeSet::AreBlocksResident() const
RNBoolean R3SurfelNodeSet::
AreBlocksResident(void) const
{
  // Return whether nodes are in memory
  for (int i = 0; i < NNodes(); i++) {
    R3SurfelNode *node = Node(i);
    if (!node->AreBlocksResident()) return FALSE;
  }

  // All nodes are resident
  return TRUE;
}

// Assembly:
cmpl $0x0, 0x14(%rdi)
jle 0x38d8d
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x37db6
testl %eax, %eax
je 0x38d7d
incq %r14
movslq 0x14(%rbx), %rcx
cmpq %rcx, %r14
jl 0x38d60
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x38d92
movl $0x1, %ecx
movl %ecx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelNodeSet.cpp
// Function: gaps::R3SurfelNodeSet::Draw(gaps::RNFlags) const
void R3SurfelNodeSet::
Draw(RNFlags flags) const
{
  // Draw nodes
  for (int i = 0; i < NNodes(); i++) {
    R3SurfelNode *node = Node(i);
    node->Draw(flags);
  }
}

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

  // Print nodes
  // Print all surfel nodes
  if (prefix) fprintf(fp, "%s", prefix);
  for (int i = 0; i < NNodes(); i++) {
    R3SurfelNode *node = Node(i);
    fprintf(fp, "%d ", node->TreeIndex());
  }
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r14
movq %rsi, %rbx
movq %rdi, %r15
testq %rsi, %rsi
jne 0x38def
movq 0xfa184(%rip), %rax     # 0x132f70
movq (%rax), %rbx
testq %rdx, %rdx
je 0x38dff
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x135b0
cmpl $0x0, 0x14(%r15)
jle 0x38e34
leaq 0xa4a96(%rip), %r12     # 0xdd8a3
xorl %r13d, %r13d
movq 0x8(%r15), %rax
movq (%rax,%r13,8), %rax
movl 0x20(%rax), %edx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x13740
incq %r13
movslq 0x14(%r15), %rax
cmpq %rax, %r13
jl 0x38e10
testq %r14, %r14
je 0x38e44
movq %r14, %rdi
movq %rbx, %rsi
callq 0x135b0
movl $0xa, %edi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x13670
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::R3SurfelTree()
R3SurfelTree::
R3SurfelTree(void)
  : scene(NULL),
    database(NULL),
    nodes()
{
  // Create database
  database = new R3SurfelDatabase();
  database->tree = this;

  // Create root node
  R3SurfelNode *node = new R3SurfelNode("Root");
  InsertNode(node, NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0xf5c9d(%rip), %rax     # 0x12eb08
movq %rax, (%rdi)
leaq 0x18(%rdi), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movq %rbx, %rdi
callq 0xa9ca8
movl $0xc0, %edi
callq 0x134e0
movq %rax, %r15
movq %rax, %rdi
callq 0x40e34
movq %r15, 0x10(%r14)
movq %r14, 0xb0(%r15)
movl $0xd0, %edi
callq 0x134e0
movq %rax, %r15
leaq 0xa454f(%rip), %rsi     # 0xdd404
movq %rax, %rdi
callq 0x3715c
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x38f02
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movl $0xd0, %esi
jmp 0x38ee2
movq %rax, %r14
movl $0xc0, %esi
movq %r15, %rdi
callq 0x134f0
jmp 0x38ef1
jmp 0x38eee
movq %rax, %r14
movq %rbx, %rdi
callq 0xa9d12
movq %r14, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::InsertNode(gaps::R3SurfelNode*, gaps::R3SurfelNode*)
void R3SurfelTree::
InsertNode(R3SurfelNode *node, R3SurfelNode *parent)
{
  // Just checking
  assert(node);
  assert(node->tree == NULL);
  assert(node->tree_index == -1);

  // Insert node into tree
  node->tree = this;
  node->tree_index = nodes.NEntries();
  nodes.Insert(node);

  // Update parent
  node->parent = parent;
  if (parent) parent->parts.Insert(node);

  // Update nodes
  node->UpdateAfterInsert(this);

  // Mark scene as dirty
  if (scene) scene->SetDirty();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x18(%rsi)
addq $0x18, %rdi
movl 0x24(%rbx), %edx
movl %edx, 0x20(%rsi)
callq 0xa9d3e
movq %r15, 0x28(%r14)
testq %r15, %r15
je 0x38f3f
movl 0x3c(%r15), %edx
addq $0x30, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa9d3e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x380f4
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x38f5a
orb $0x1, 0x1e8(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::~R3SurfelTree()
R3SurfelTree::
~R3SurfelTree(void)
{
  // Delete nodes
  // If uncomment this, need to comment recursive delete in R3SurfelNode
  // while (NNodes() > 0) delete Node(NNodes()-1);
  if (RootNode()) delete RootNode();
  
  // Remove from scene
  if (scene) scene->tree = NULL;

  // Delete database
  if (database) delete database;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xf5b57(%rip), %rax     # 0x12eb08
movq %rax, (%rdi)
movq 0x18(%rdi), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x38fc6
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x38fd7
movq $0x0, 0x8(%rax)
movq 0x10(%rbx), %rdi
addq $0x18, %rbx
testq %rdi, %rdi
je 0x38fea
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
popq %rbx
jmp 0xa9d12
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::FindNodeByName(char const*) const
R3SurfelNode *R3SurfelTree::
FindNodeByName(const char *node_name) const
{
  // Search for node
  for (int i = 0; i < NNodes(); i++) {
    R3SurfelNode *node = Node(i);
    if (!node->Name()) continue;
    if (strcmp(node->Name(), node_name)) continue;
    return node;
  }

  // Not found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x24(%rdi), %r15
testq %r15, %r15
jle 0x3904c
movq %rsi, %rbx
movq 0x18(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %r14
movq 0xb8(%r14), %rdi
testq %rdi, %rdi
je 0x39044
movq %rbx, %rsi
callq 0x13710
testl %eax, %eax
je 0x3904f
incq %r13
cmpq %r13, %r15
jne 0x39028
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::RemoveNode(gaps::R3SurfelNode*)
void R3SurfelTree::
RemoveNode(R3SurfelNode *node)
{
  // Just checking
  assert(node);
  assert(node->tree == this);
  assert(node->tree_index >= 0);
  assert(nodes.Kth(node->tree_index) == node);

  // Update node
  node->UpdateBeforeRemove(this);

  // Update parent
  if (node->parent) node->parent->parts.Remove(node);

  // Update node
  node->parent = NULL;

  // Remove node from tree
  RNArrayEntry *entry = nodes.KthEntry(node->tree_index);
  R3SurfelNode *tail = nodes.Tail();
  tail->tree_index = node->tree_index;
  nodes.EntryContents(entry) = tail;
  nodes.RemoveTail();
  node->tree_index = -1;
  node->tree = NULL;

  // Mark scene as dirty
  if (scene) scene->SetDirty();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movq %rbx, %rsi
callq 0x38140
movq 0x28(%r14), %r12
testq %r12, %r12
je 0x390a1
leaq 0x30(%r12), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa9d20
subq 0x30(%r12), %rax
shrq $0x3, %rax
movq %r15, %rdi
movl %eax, %esi
callq 0xa9ec8
xorl %r15d, %r15d
movq %r15, 0x28(%r14)
leaq 0x18(%rbx), %rdi
movslq 0x20(%r14), %rax
movq 0x18(%rbx), %rcx
movslq 0x24(%rbx), %rdx
movq -0x8(%rcx,%rdx,8), %rsi
movl %eax, 0x20(%rsi)
movq %rsi, (%rcx,%rax,8)
leal -0x1(%rdx), %esi
callq 0xa9ec8
movl $0xffffffff, 0x20(%r14) # imm = 0xFFFFFFFF
movq %r15, 0x18(%r14)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x390e8
orb $0x1, 0x1e8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::SplitNodes(gaps::R3SurfelNode*, int, int, double, double, double, double, int)
int R3SurfelTree::
SplitNodes(R3SurfelNode *start_node,
    int max_parts_per_node, int max_blocks_per_node, 
    RNScalar max_leaf_complexity, RNScalar max_block_complexity,
    RNLength max_leaf_extent, RNLength max_block_extent,
    int max_levels)
{
  // Initialize stack for depth first traversal from root node
  RNArray<R3SurfelNode *> stack;
  stack.Insert(start_node);
  int status = 0;

  // Split nodes into manageable sized chunks
  while (!stack.IsEmpty()) {
    // Pop node from stack
    R3SurfelNode *node = stack.Tail();
    stack.RemoveTail();

    // Split node
    status |= SplitNode(node, 
      max_parts_per_node, max_blocks_per_node, 
      max_leaf_complexity, max_block_complexity, 
      max_leaf_extent, max_block_extent, 
      max_levels);

    // Push parts onto stack
    for (int i = 0; i < node->NParts(); i++) {
      stack.Insert(node->Part(i));
    }
  }

  // Return whether any nodes were split
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, 0x24(%rsp)
movsd %xmm3, 0x40(%rsp)
movsd %xmm2, 0x38(%rsp)
movsd %xmm1, 0x30(%rsp)
movsd %xmm0, 0x28(%rsp)
movl %ecx, 0x20(%rsp)
movl %edx, 0x1c(%rsp)
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xa9ca8
movl 0xc(%r12), %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0xa9d3e
movl 0x14(%rsp), %eax
xorl %r12d, %r12d
testl %eax, %eax
je 0x3a2a2
leaq 0x8(%rsp), %r13
movq 0x8(%rsp), %rcx
movslq %eax, %rsi
movq -0x8(%rcx,%rsi,8), %rbx
decl %esi
movq %r13, %rdi
callq 0xa9ec8
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
movl 0x1c(%rsp), %edx
movl 0x20(%rsp), %ecx
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movsd 0x38(%rsp), %xmm2
movsd 0x40(%rsp), %xmm3
movl 0x24(%rsp), %r8d
callq *0x10(%rax)
movl %eax, %ebp
cmpl $0x0, 0x3c(%rbx)
jle 0x3a297
xorl %r14d, %r14d
movq 0x30(%rbx), %rax
movq (%rax,%r14,8), %rsi
movl 0x14(%rsp), %edx
movq %r13, %rdi
callq 0xa9d3e
incq %r14
movslq 0x3c(%rbx), %rax
cmpq %rax, %r14
jl 0x3a277
orl %ebp, %r12d
movl 0x14(%rsp), %eax
testl %eax, %eax
jne 0x3a224
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movl %r12d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a2c2
jmp 0x3a2c2
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa9d12
movq %rbx, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::SplitBlocks(gaps::R3SurfelNode*, gaps::R3SurfelPointSet&, gaps::RNArray<gaps::R3SurfelBlock*>*, gaps::RNArray<gaps::R3SurfelBlock*>*)
int R3SurfelTree::
SplitBlocks(R3SurfelNode *node, R3SurfelPointSet& pointset,
  RNArray<R3SurfelBlock *> *blocksA, RNArray<R3SurfelBlock *> *blocksB)
{
  // Just checking
  assert(node);
  assert(node->Tree() == this);
  assert(node->tree_index >= 0);
  assert(nodes.Kth(node->tree_index) == node);
  int status = 0;
  
  // Create array of blocks containing points in point set
  RNArray<R3SurfelBlock *> *pointset_blocks = pointset.Blocks();;
  if (!pointset_blocks) return 0;

  // Create constraint to include only marked points
  const R3SurfelMarkConstraint constraint(TRUE, FALSE);

  // Split blocks 
  for (int i = 0; i < pointset_blocks->NEntries(); i++) {
    R3SurfelBlock *block = pointset_blocks->Kth(i);
    if (block->Node() != node) continue;
    block->SetMarks(FALSE);
    pointset.SetMarks(TRUE);
    R3SurfelBlock *blockA, *blockB;
    if (SplitBlock(node, block, constraint, &blockA, &blockB)) status = 1;
    if (blocksA && blockA) blocksA->Insert(blockA);
    if (blocksB && blockB) blocksB->Insert(blockB);
  }

  // Delete array of blocks containing points in point set
  delete pointset_blocks;

  // Return whether any blocks were split
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, (%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, 0x10(%rsp)
movq %rdx, %rdi
callq 0x348de
testq %rax, %rax
je 0x3a9b7
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
xorl %ebp, %ebp
movl $0x1, %esi
xorl %edx, %edx
callq 0x31afe
movl 0xc(%rbx), %eax
testl %eax, %eax
jle 0x3a996
xorl %r14d, %r14d
xorl %ebp, %ebp
movq (%rbx), %rcx
movq (%rcx,%r14,8), %r15
cmpq %r13, 0xb8(%r15)
jne 0x3a987
movq %r15, %rdi
xorl %esi, %esi
callq 0x2dab8
movq (%r12), %rax
movq %r12, %rdi
movl $0x1, %esi
callq *0xa8(%rax)
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movq %r13, %rsi
movq %r15, %rdx
leaq 0x28(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x18(%rsp), %r9
callq *0x50(%rax)
cmpq $0x0, 0x8(%rsp)
setne %cl
testl %eax, %eax
movl $0x1, %eax
cmovnel %eax, %ebp
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
setne %al
testb %al, %cl
je 0x3a95e
movq 0x8(%rsp), %rdi
movl 0xc(%rdi), %edx
callq 0xa9d3e
cmpq $0x0, (%rsp)
setne %al
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3a984
movq (%rsp), %rdi
movl 0xc(%rdi), %edx
callq 0xa9d3e
movl 0xc(%rbx), %eax
incq %r14
movslq %eax, %rcx
cmpq %rcx, %r14
jl 0x3a8df
movq %rbx, %rdi
callq 0xa9d12
movl $0x10, %esi
movq %rbx, %rdi
callq 0x134f0
leaq 0x28(%rsp), %rdi
callq 0x31dba
jmp 0x3a9b9
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a9cc
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x31dba
movq %rbx, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::SplitBlocks(gaps::R3SurfelNode*, gaps::R3SurfelConstraint const&, gaps::RNArray<gaps::R3SurfelBlock*>*, gaps::RNArray<gaps::R3SurfelBlock*>*)
int R3SurfelTree::
SplitBlocks(R3SurfelNode *node, const R3SurfelConstraint& constraint, 
  RNArray<R3SurfelBlock *> *blocksA, RNArray<R3SurfelBlock *> *blocksB)
{
  // Just checking
  assert(node);
  assert(node->Tree() == this);
  assert(node->tree_index >= 0);
  assert(nodes.Kth(node->tree_index) == node);
  int status = 0;

  // Make a temporary array of blocks
  RNArray<R3SurfelBlock *> splittable_blocks;
  for (int i = 0; i < node->NBlocks(); i++) {
    R3SurfelBlock *block = node->Block(i);
    splittable_blocks.Insert(block);
  }

  // Split blocks 
  for (int i = 0; i < splittable_blocks.NEntries(); i++) {
    R3SurfelBlock *block = splittable_blocks.Kth(i);
    R3SurfelBlock *blockA, *blockB;
    if (SplitBlock(node, block, constraint, &blockA, &blockB)) status = 1;
    if (blocksA && blockA) blocksA->Insert(blockA);
    if (blocksB && blockB) blocksB->Insert(blockB);
  }

  // Return whether any blocks were split
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, %r13
movq %rsp, %rdi
callq 0xa9ca8
cmpl $0x0, 0x4c(%r12)
jle 0x3ad43
xorl %r15d, %r15d
movq %rsp, %rbp
movq 0x40(%r12), %rax
movq (%rax,%r15,8), %rsi
movl 0xc(%rsp), %edx
movq %rbp, %rdi
callq 0xa9d3e
incq %r15
movslq 0x4c(%r12), %rax
cmpq %rax, %r15
jl 0x3ad21
cmpl $0x0, 0xc(%rsp)
jle 0x3add4
xorl %r15d, %r15d
xorl %ebp, %ebp
movq (%rsp), %rax
movq (%rax,%r15,8), %rdx
movq (%r13), %rax
movq %r13, %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x18(%rsp), %r9
callq *0x50(%rax)
testq %r14, %r14
setne %cl
testl %eax, %eax
movl $0x1, %eax
cmovnel %eax, %ebp
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
setne %al
testb %al, %cl
je 0x3ada2
movl 0xc(%r14), %edx
movq %r14, %rdi
callq 0xa9d3e
testq %rbx, %rbx
setne %al
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3adc5
movl 0xc(%rbx), %edx
movq %rbx, %rdi
callq 0xa9d3e
incq %r15
movslq 0xc(%rsp), %rax
cmpq %rax, %r15
jl 0x3ad53
jmp 0x3add6
xorl %ebp, %ebp
movq %rsp, %rdi
callq 0xa9d12
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3adf1
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/R3SurfelTree.cpp
// Function: gaps::R3SurfelTree::Print(_IO_FILE*, char const*, char const*) const
void R3SurfelTree::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print tree header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "%s", "Tree");
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

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

  // Print all nodes
  for (int i = 0; i < NNodes(); i++) {
    R3SurfelNode *node = Node(i);
    node->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 0x3b069
movq 0xf7f0a(%rip), %rax     # 0x132f70
movq (%rax), %r15
testq %r12, %r12
je 0x3b079
movq %r12, %rdi
movq %r15, %rsi
callq 0x135b0
leaq 0xa3627(%rip), %rdi     # 0xde6a7
movq %r15, %rsi
callq 0x135b0
testq %rbx, %rbx
je 0x3b098
movq %rbx, %rdi
movq %r15, %rsi
callq 0x135b0
movl $0xa, %edi
movq %r15, %rsi
callq 0x13670
leaq 0xa2373(%rip), %rsi     # 0xdd41f
movq %rsp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x130e0
cmpl $0x0, 0x24(%r14)
jle 0x3b0e9
xorl %r13d, %r13d
movq %rsp, %r12
movq 0x18(%r14), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq *0x60(%rax)
incq %r13
movslq 0x24(%r14), %rax
cmpq %rax, %r13
jl 0x3b0c6
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::~R3SurfelScan()
R3SurfelScan::
~R3SurfelScan(void)
{
  // Remove node
  if (node) SetNode(NULL);

  // Remove image
  if (image) SetImage(NULL);

  // Remove scan from scene
  if (scene) scene->RemoveScan(this);

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

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xf3905(%rip), %rax     # 0x12eba8
movq %rax, (%rdi)
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0x3b2c9
xorl %ecx, %ecx
movq %rcx, 0x10(%rax)
movq %rcx, 0x18(%rbx)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x3b2c9
orb $0x1, 0x1e8(%rax)
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x3b2ee
xorl %ecx, %ecx
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x3b303
orb $0x1, 0x1e8(%rdi)
jmp 0x3b2f7
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x3b303
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x98(%rax)
movq 0xb8(%rbx), %rdi
testq %rdi, %rdi
je 0x3b315
popq %rbx
jmp 0x135e0
popq %rbx
retq
movq %rax, %rdi
callq 0x183c3
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::operator=(gaps::R3SurfelScan const&)
R3SurfelScan& R3SurfelScan::
operator=(const R3SurfelScan& scan)
{
  // Copy properties
  this->pose = scan.pose;
  this->timestamp = scan.timestamp;
  this->image_width = scan.image_width; 
  this->image_height = scan.image_height;
  this->image_center = scan.image_center;
  this->xfocal = scan.xfocal;
  this->yfocal = scan.yfocal;
  this->name = (scan.name) ? RNStrdup(scan.name) : NULL;
  this->flags = 0;

  // Return this
  return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x28, %rsi
addq $0x28, %rdi
callq 0x8412a
leaq 0x40(%rbx), %rdi
leaq 0x40(%r14), %rsi
callq 0x84fe2
leaq 0x58(%r14), %rsi
leaq 0x58(%rbx), %rdi
callq 0x84fe2
leaq 0x70(%r14), %rsi
leaq 0x70(%rbx), %rdi
callq 0x84fe2
movsd 0x88(%r14), %xmm0
movsd %xmm0, 0x88(%rbx)
movq 0x90(%r14), %rax
movq %rax, 0x90(%rbx)
movl $0x98, %edi
leaq (%r14,%rdi), %rsi
addq %rbx, %rdi
callq 0xa267a
movups 0xa8(%r14), %xmm0
movups %xmm0, 0xa8(%rbx)
movq 0xb8(%r14), %rdi
testq %rdi, %rdi
je 0x3b3dc
callq 0xac67b
jmp 0x3b3de
xorl %eax, %eax
movq %rax, 0xb8(%rbx)
movq $0x0, 0xc0(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::SetName(char const*)
void R3SurfelScan::
SetName(const char *name)
{
  // Delete previous name
  if (this->name) free(this->name);
  this->name = (name) ? RNStrdup(name) : NULL;

  // Mark scene as dirty
  if (Scene()) Scene()->SetDirty();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0xb8(%rdi), %rdi
testq %rdi, %rdi
je 0x3b4c5
callq 0x135e0
testq %r14, %r14
je 0x3b4d4
movq %r14, %rdi
callq 0xac67b
jmp 0x3b4d6
xorl %eax, %eax
movq %rax, 0xb8(%rbx)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x3b4ed
orb $0x1, 0x1e8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::Print(_IO_FILE*, char const*, char const*) const
void R3SurfelScan::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print scan
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "%d %s %d %d",
          SceneIndex(), (Name()) ? Name() : "-",
          (Node()) ? node->TreeIndex() : -1,
          (Image()) ? image->SceneIndex() : -1);
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %r14
movq %rsi, %rbx
movq %rdi, %r15
testq %rsi, %rsi
jne 0x3b5af
movq 0xf79c4(%rip), %rax     # 0x132f70
movq (%rax), %rbx
testq %rdx, %rdx
je 0x3b5bf
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x135b0
movq 0xb8(%r15), %rax
testq %rax, %rax
leaq 0xa1d76(%rip), %rcx     # 0xdd346
cmovneq %rax, %rcx
movq 0x18(%r15), %rax
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x3b5ed
movl 0x20(%rax), %r8d
movl 0x10(%r15), %edx
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x3b5fe
movl 0x10(%rax), %r9d
leaq 0xa30bd(%rip), %rsi     # 0xde6c2
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13740
testq %r14, %r14
je 0x3b61f
movq %r14, %rdi
movq %rbx, %rsi
callq 0x135b0
movl $0xa, %edi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x13670
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScan.cpp
// Function: gaps::R3SurfelScan::ImagePosition(gaps::R3Point const&) const
R2Point R3SurfelScan::
ImagePosition(const R3Point& world_position) const
{
  // Transform 3D point into canonical coordinate system
  R3Point p = Pose().InverseMatrix() * world_position;
  if (RNIsPositiveOrZero(p.Z())) return R2infinite_point;

  // Compute 2D point projected onto viewport
  const R2Point c = ImageCenter();
  RNCoord x = c.X() + xfocal * p.X() / -p.Z();
  RNCoord y = c.Y() + yfocal * p.Y() / -p.Z();

  // Return point projected onto viewport
  return R2Point(x, y);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
addq $0x28, %rsi
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x70856
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x7443a
movsd 0x10(%r13), %xmm0
leaq 0xf8578(%rip), %rax     # 0x133c08
movsd (%rax), %xmm1
xorpd 0xa1d04(%rip), %xmm1    # 0xdd3a0
ucomisd %xmm1, %xmm0
jae 0x3b6ff
leaq 0x98(%r14), %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0xa254c
movsd 0xa8(%r14), %xmm1
movsd 0xb0(%r14), %xmm2
mulsd 0x8(%rsp), %xmm1
movsd 0x18(%rsp), %xmm3
divsd %xmm3, %xmm1
movsd (%r15), %xmm0
subsd %xmm1, %xmm0
movsd 0x8(%r15), %xmm1
mulsd 0x10(%rsp), %xmm2
divsd %xmm3, %xmm2
subsd %xmm2, %xmm1
movq %rbx, %rdi
callq 0xa2542
jmp 0x3b70e
leaq 0x4fac6a(%rip), %rsi    # 0x536370
movq %rbx, %rdi
callq 0xa254c
movq %rbx, %rax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::R3SurfelImage(char const*)
R3SurfelImage::
R3SurfelImage(const char *name)
  : scene(NULL),
    scene_index(-1),
    scan(NULL),
    channels(),
    pose(R3Point(0,0,0), R3Triad(R3Vector(0,0,0), R3Vector(0,0,0))),
    timestamp(0),
    image_width(0), 
    image_height(0),
    image_center(0,0),
    xfocal(0),
    yfocal(0),
    distortion_type(R3_SURFEL_NO_DISTORTION),
    name((name) ? RNStrdup(name) : NULL),
    flags(0),
    data(NULL)
{
  // Intialize distortion parameters
  radial_distortion[0] = 0;
  radial_distortion[1] = 0;
  radial_distortion[2] = 0;
  tangential_distortion[0] = 0;
  tangential_distortion[1] = 0;

  // Initialize rolling shutter pose parameters
  rolling_shutter_poses[0] = pose;
  rolling_shutter_poses[1] = pose;
  rolling_shutter_timestamps[0] = timestamp;
  rolling_shutter_timestamps[1] = timestamp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0xf351e(%rip), %rax     # 0x12ec60
movq %rax, (%rdi)
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movl $0xffffffff, 0x10(%rdi) # imm = 0xFFFFFFFF
movq %rax, 0x18(%rdi)
addq $0x20, %rdi
movq %rdi, (%rsp)
callq 0xa9ca8
leaq 0x38(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x83dc2
leaq 0x20(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x84856
leaq 0x8(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x84856
leaq 0x50(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x70ca6
leaq 0x30(%r14), %r12
leaq 0x38(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %r12, %rdi
callq 0x707a8
leaq 0xa0(%r14), %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%r14)
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0xa2542
leaq 0xf0(%r14), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0xb0(%r14)
movl $0x0, 0xc0(%r14)
movq %rbp, %rdi
callq 0x70768
leaq 0x150(%r14), %r13
movq %r13, %rdi
callq 0x70768
testq %r15, %r15
je 0x3b826
movq %r15, %rdi
callq 0xac67b
jmp 0x3b828
xorl %eax, %eax
movq %rax, 0x1c0(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0xc8(%r14)
movups %xmm0, 0xd8(%r14)
movq $0x0, 0xe8(%r14)
movups %xmm0, 0x1c8(%r14)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x8412a
leaq 0x108(%r14), %rdi
leaq 0x48(%r14), %r15
movq %r15, %rsi
callq 0x84fe2
leaq 0x60(%r14), %rbp
leaq 0x120(%r14), %rdi
movq %rbp, %rsi
callq 0x84fe2
leaq 0x78(%r14), %rbx
leaq 0x138(%r14), %rdi
movq %rbx, %rsi
callq 0x84fe2
movq %r13, %rdi
movq %r12, %rsi
callq 0x8412a
leaq 0x168(%r14), %rdi
movq %r15, %rsi
callq 0x84fe2
leaq 0x180(%r14), %rdi
movq %rbp, %rsi
callq 0x84fe2
leaq 0x198(%r14), %rdi
movq %rbx, %rsi
callq 0x84fe2
movsd 0x90(%r14), %xmm0
movsd %xmm0, 0x1b0(%r14)
movsd %xmm0, 0x1b8(%r14)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3b906
jmp 0x3b906
jmp 0x3b906
jmp 0x3b906
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/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::~R3SurfelImage()
R3SurfelImage::
~R3SurfelImage(void)
{
  // Remove image from scan
  if (scan) SetScan(NULL);
  
  // Remove image from scene
  if (scene) scene->RemoveImage(this);

  // Delete all channels
  for (int i = 0; i < channels.NEntries(); i++) {
    R2Grid *channel = channels.Kth(i);
    if (channel) delete channel;
  }
  
  // Delete name
  if (name) free(name);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xf30ca(%rip), %rax     # 0x12ec60
movq %rax, (%rdi)
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0x3bbbe
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
movq %rcx, 0x18(%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x3bbd3
orb $0x1, 0x1e8(%rdi)
jmp 0x3bbc7
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x3bbd3
movq (%rdi), %rax
movq %rbx, %rsi
callq *0xa8(%rax)
leaq 0x20(%rbx), %r14
movl 0x2c(%rbx), %eax
testl %eax, %eax
jle 0x3bc10
xorl %r12d, %r12d
movq (%r14), %rcx
movq (%rcx,%r12,8), %r15
testq %r15, %r15
je 0x3bc05
movq %r15, %rdi
callq 0x918ec
movl $0xd0, %esi
movq %r15, %rdi
callq 0x134f0
movl 0x2c(%rbx), %eax
incq %r12
movslq %eax, %rcx
cmpq %rcx, %r12
jl 0x3bbe1
movq 0x1c0(%rbx), %rdi
testq %rdi, %rdi
je 0x3bc21
callq 0x135e0
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xa9d12
movq %rax, %rdi
callq 0x183c3
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::ColorChannels() const
R2Image R3SurfelImage::
ColorChannels(void) const
{
  // Allocate color image for result
  R2Image color_image;

  // Get RGB channels
  const R2Grid *red_channel = RedChannel();
  const R2Grid *green_channel = GreenChannel();
  const R2Grid *blue_channel = BlueChannel();
  if (red_channel && green_channel && blue_channel) {
    // Fill in RGB for each pixel
    color_image = R2Image(ImageWidth(), ImageHeight(), 3);
    for (int iy = 0; iy < ImageHeight(); iy++) {
      for (int ix = 0; ix < ImageWidth(); ix++) {
        RNScalar red = red_channel->GridValue(ix, iy);
        RNScalar green = green_channel->GridValue(ix, iy);
        RNScalar blue = blue_channel->GridValue(ix, iy);
        RNRgb color(red, green, blue);
        color_image.SetPixelRGB(ix, iy, color);
      }
    }
  }

  // Return color image
  return color_image;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, 0x10(%rsp)
callq 0xa2dd4
movq %rbx, 0x8(%rsp)
movl 0x2c(%rbx), %eax
testl %eax, %eax
jle 0x3bdcf
cmpl $0x1, %eax
je 0x3bdcf
cmpl $0x3, %eax
jb 0x3bdcf
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rbx
movq 0x10(%rax), %r14
movq %rcx, 0x18(%rsp)
testq %rcx, %rcx
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
testq %r14, %r14
sete %al
orb %cl, %al
jne 0x3bdcf
movq 0x8(%rsp), %rax
movl 0x98(%rax), %esi
movl 0x9c(%rax), %edx
leaq 0x20(%rsp), %rdi
movl $0x3, %ecx
callq 0xa30f6
leaq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0xa33ee
leaq 0x20(%rsp), %rdi
callq 0xa3350
movq 0x8(%rsp), %rax
movl 0x9c(%rax), %ecx
testl %ecx, %ecx
jle 0x3bdcf
movq 0x8(%rsp), %rax
movl 0x98(%rax), %eax
xorl %r15d, %r15d
leaq 0x20(%rsp), %rbp
testl %eax, %eax
jle 0x3bdc3
movslq %r15d, %r12
xorl %r13d, %r13d
movq 0x18(%rsp), %rcx
movq 0xb8(%rcx), %rax
movslq 0xc8(%rcx), %rcx
imulq %r12, %rcx
addq %r13, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0xb8(%rbx), %rax
movslq 0xc8(%rbx), %rcx
imulq %r12, %rcx
addq %r13, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0xb8(%r14), %rax
movslq 0xc8(%r14), %rcx
imulq %r12, %rcx
addq %r13, %rcx
movsd (%rax,%rcx,8), %xmm2
movq %rbp, %rdi
callq 0xa9b1c
movq 0x10(%rsp), %rdi
movl %r13d, %esi
movl %r15d, %edx
movq %rbp, %rcx
callq 0xa34a6
movq 0x8(%rsp), %rax
movl 0x98(%rax), %eax
incq %r13
cmpl %eax, %r13d
jl 0x3bd33
movq 0x8(%rsp), %rcx
movl 0x9c(%rcx), %ecx
incl %r15d
cmpl %ecx, %r15d
jl 0x3bd25
movq 0x10(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0xa3350
jmp 0x3bdf7
jmp 0x3bdf4
movq %rax, %r14
movq 0x10(%rsp), %rdi
callq 0xa3350
movq %r14, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::ProjectionMatrix(double, double) const
R4Matrix R3SurfelImage::
ProjectionMatrix(RNScalar neardist, RNScalar fardist) const
{
  // Return projection transformation from camera coordinates to normalized image coordinates
  RNScalar fx = XFocal();
  RNScalar fy = YFocal();
  RNScalar cx = ImageCenter().X();
  RNScalar cy = ImageCenter().Y();
  RNScalar W = ImageWidth();
  RNScalar H = ImageHeight();
  return R4Matrix(
    2*fx/W, 0, -2*(cx/W)+1, 0,
    0, 2*fy/H, -2*(cy/H)+1, 0,
    0, 0, -(fardist + neardist) / (fardist - neardist),  -2.0 * neardist * fardist / (fardist - neardist),
    0, 0, -1, 0 );
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
movapd %xmm0, %xmm3
movq %rdi, %rbx
movsd 0xb0(%rsi), %xmm0
movsd 0xb8(%rsi), %xmm5
movsd 0xa0(%rsi), %xmm4
cvtsi2sdl 0x98(%rsi), %xmm2
cvtsi2sdl 0x9c(%rsi), %xmm7
movsd 0xa8(%rsi), %xmm8
addsd %xmm0, %xmm0
divsd %xmm2, %xmm0
divsd %xmm2, %xmm4
addsd %xmm4, %xmm4
movsd 0xa12e9(%rip), %xmm6    # 0xdd148
movapd %xmm6, %xmm2
subsd %xmm4, %xmm2
addsd %xmm5, %xmm5
divsd %xmm7, %xmm5
divsd %xmm7, %xmm8
addsd %xmm8, %xmm8
movapd %xmm3, %xmm4
addsd %xmm1, %xmm4
xorpd 0xa1517(%rip), %xmm4    # 0xdd3a0
subsd %xmm8, %xmm6
movapd %xmm1, %xmm7
subsd %xmm3, %xmm7
divsd %xmm7, %xmm4
mulsd 0xa1c76(%rip), %xmm3    # 0xddb18
mulsd %xmm1, %xmm3
divsd %xmm7, %xmm3
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x30(%rsp)
xorpd %xmm1, %xmm1
movupd %xmm1, 0x20(%rsp)
movsd %xmm3, 0x18(%rsp)
movupd %xmm1, (%rsp)
movsd %xmm4, 0x10(%rsp)
movq $0x0, 0x38(%rsp)
xorpd %xmm1, %xmm1
xorpd %xmm3, %xmm3
xorpd %xmm4, %xmm4
xorpd %xmm7, %xmm7
callq 0x723de
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::PixelWorldRay(gaps::R2Point const&) const
R3Ray R3SurfelImage::
PixelWorldRay(const R2Point& image_position) const
{
  // Get/check intrinsics matrix
  if (RNIsZero(xfocal)) return R3null_ray;
  if (RNIsZero(yfocal)) return R3null_ray;

  // Get point at depth 1.0 along ray in camera coordinates
  R3Point camera_position;
  camera_position[0] = (image_position[0] - image_center.X()) / xfocal;
  camera_position[1] = (image_position[1] - image_center.Y()) / yfocal;
  camera_position[2] = -1.0;

  // Create ray and transform into world coordinates
  R3Ray ray(R3zero_point, camera_position);
  ray.Transform(R3Affine(CameraToWorld(), 0));

  // Return ray through pixel in world coordinates
  return ray;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movsd 0xb0(%rsi), %xmm2
leaq 0xf7ce6(%rip), %rax     # 0x133c08
movsd (%rax), %xmm0
movapd 0xa1472(%rip), %xmm1    # 0xdd3a0
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm2
jb 0x3bf3e
ucomisd %xmm2, %xmm0
jae 0x3bf53
movsd 0xb8(%r14), %xmm2
ucomisd %xmm1, %xmm2
jb 0x3bf67
ucomisd %xmm2, %xmm0
jb 0x3bf67
leaq 0x4f9476(%rip), %rsi    # 0x5353d0
movq %rbx, %rdi
callq 0x839aa
jmp 0x3bff6
movq %rsp, %r12
movq %r12, %rdi
callq 0x83dc0
movupd (%r15), %xmm0
movupd 0xa0(%r14), %xmm1
subpd %xmm1, %xmm0
movupd 0xb0(%r14), %xmm1
divpd %xmm1, %xmm0
movapd %xmm0, (%r12)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x10(%r12)
leaq 0x4f96c3(%rip), %rsi    # 0x535670
movq %rbx, %rdi
movq %r12, %rdx
callq 0x839b6
addq $0x30, %r14
leaq 0x128(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x707ce
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x7005a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x83a84
leaq 0x18(%rsp), %rdi
callq 0x700a8
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x700a8
movq %rbx, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::TrajectoryDirection() const
R3Vector R3SurfelImage::
TrajectoryDirection(void) const
{
  // Check scene
  if (!scene) return R3zero_vector;
  if (scene_index < 0) return R3zero_vector;
  
  // Find images before/after this image
  int delta = 7;
  int index = scene_index;
  int indexA = index - delta;
  int indexB = index + delta;
  if (indexA < 0) indexA = 0;
  if (indexB > scene->NImages()-1) indexB = scene->NImages()-1;
  R3SurfelImage *imageA = scene->Image(indexA);
  R3SurfelImage *imageB = scene->Image(indexB);

  // Compute trajector direction
  R3Point viewpointA = imageA->Viewpoint();
  R3Point viewpointB = imageB->Viewpoint();
  R3Vector trajectory_direction = viewpointB - viewpointA;
  trajectory_direction.Normalize();

  // Return trajectory direction
  return trajectory_direction;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x3c0a8
movl 0x10(%rsi), %ecx
testl %ecx, %ecx
js 0x3c0a8
leal 0x7(%rcx), %edx
cmpl $0x8, %ecx
movl $0x7, %esi
cmovael %ecx, %esi
movl 0x9c(%rax), %ecx
leal -0x1(%rcx), %edi
cmpl %ecx, %edx
cmovll %edx, %edi
movq 0x90(%rax), %rax
movq -0x38(%rax,%rsi,8), %rsi
movslq %edi, %rcx
movq (%rax,%rcx,8), %r14
addq $0x30, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x83dd2
addq $0x30, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x83dd2
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8401e
movq %rbx, %rdi
callq 0x84b6c
jmp 0x3c0b7
leaq 0xa9109(%rip), %rsi     # 0xe51b8
movq %rbx, %rdi
callq 0x84866
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::SetChannel(int, gaps::R2Grid const&)
void R3SurfelImage::
SetChannel(int channel_index, const R2Grid& channel)
{
  // Check channel index
  assert(channel_index >= 0);

  // Insert channels up to channel index
  for (int i = channels.NEntries(); i <= channel_index; i++) {
    channels.Insert(NULL);
  }

  // Delete previous channel
  if (channels[channel_index]) delete channels[channel_index];

  // Update image width and height
  if (image_width <= 0) image_width = channel.XResolution();
  if (image_height <= 0) image_height = channel.YResolution();
  
  // Copy image into channel
  channels[channel_index] = new R2Grid(channel);

  // Resample if necessary
  if ((image_width != channel.XResolution()) || (image_height != channel.YResolution())) {
    channels[channel_index]->Resample(image_width, image_height, TRUE);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
leaq 0x20(%rdi), %rbx
movl 0x2c(%rdi), %eax
cmpl %esi, %eax
jg 0x3c338
movl %ebp, %r12d
subl %eax, %r12d
incl %r12d
movl 0x2c(%r15), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa9d3e
decl %r12d
jne 0x3c325
movq (%rbx), %rax
movslq %ebp, %r13
movq (%rax,%r13,8), %r12
testq %r12, %r12
je 0x3c35c
movq %r12, %rdi
callq 0x918ec
movl $0xd0, %esi
movq %r12, %rdi
callq 0x134f0
cmpl $0x0, 0x98(%r15)
jg 0x3c374
movl 0xc0(%r14), %eax
movl %eax, 0x98(%r15)
cmpl $0x0, 0x9c(%r15)
jg 0x3c38c
movl 0xc4(%r14), %eax
movl %eax, 0x9c(%r15)
movl $0xd0, %edi
callq 0x134e0
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x91714
movq 0x20(%r15), %rax
movq %r12, (%rax,%r13,8)
movl 0x98(%r15), %esi
movl 0x9c(%r15), %edx
cmpl 0xc0(%r14), %esi
jne 0x3c3db
cmpl 0xc4(%r14), %edx
jne 0x3c3db
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
movq (%rax,%r13,8), %rdi
movl $0x1, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x96588
movq %rax, %rbx
movl $0xd0, %esi
movq %r12, %rdi
callq 0x134f0
movq %rbx, %rdi
callq 0x138b0
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::SetColorChannels(gaps::R2Image const&)
void R3SurfelImage::
SetColorChannels(const R2Image& color_image)
{
  // Initialize channels
  R2Grid red_channel(color_image.Width(), color_image.Height());
  R2Grid green_channel(color_image.Width(), color_image.Height());
  R2Grid blue_channel(color_image.Width(), color_image.Height());

  // Fill channels
  for (int iy = 0; iy < color_image.Height(); iy++) {
    for (int ix = 0; ix < color_image.Width(); ix++) {
      RNRgb rgb = color_image.PixelRGB(ix, iy);
      red_channel.SetGridValue(ix, iy, rgb.R());
      green_channel.SetGridValue(ix, iy, rgb.G());
      blue_channel.SetGridValue(ix, iy, rgb.B());
    }
  }

  // Set channels
  SetRedChannel(red_channel);
  SetGreenChannel(green_channel);
  SetBlueChannel(blue_channel);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %esi
movl 0x4(%r14), %edx
leaq 0x1b8(%rsp), %rdi
callq 0x90cb8
movl (%r14), %esi
movl 0x4(%r14), %edx
leaq 0xe8(%rsp), %rdi
callq 0x90cb8
movl (%r14), %esi
movl 0x4(%r14), %edx
leaq 0x18(%rsp), %rdi
callq 0x90cb8
movl 0x4(%r14), %ecx
testl %ecx, %ecx
jle 0x3c581
movl (%r14), %eax
xorl %r15d, %r15d
movq %rsp, %r12
testl %eax, %eax
jle 0x3c575
movslq %r15d, %rbp
xorl %r13d, %r13d
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %edx
movl %r15d, %ecx
callq 0xa335e
movsd (%rsp), %xmm0
movq 0x270(%rsp), %rax
movslq 0x280(%rsp), %rcx
imulq %rbp, %rcx
addq %r13, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x8(%rsp), %xmm0
movq 0x1a0(%rsp), %rax
movslq 0x1b0(%rsp), %rcx
imulq %rbp, %rcx
addq %r13, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x10(%rsp), %xmm0
movq 0xd0(%rsp), %rax
movslq 0xe0(%rsp), %rcx
imulq %rbp, %rcx
addq %r13, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl (%r14), %eax
incq %r13
cmpl %eax, %r13d
jl 0x3c4ec
movl 0x4(%r14), %ecx
incl %r15d
cmpl %ecx, %r15d
jl 0x3c4de
movq (%rbx), %rax
leaq 0x1b8(%rsp), %rsi
movq %rbx, %rdi
callq *0x18(%rax)
movq (%rbx), %rax
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq *0x20(%rax)
movq (%rbx), %rax
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq *0x28(%rax)
leaq 0x18(%rsp), %rdi
callq 0x918ec
leaq 0xe8(%rsp), %rdi
callq 0x918ec
leaq 0x1b8(%rsp), %rdi
callq 0x918ec
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3c600
movq %rax, %rbx
jmp 0x3c60d
jmp 0x3c5f3
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x918ec
leaq 0xe8(%rsp), %rdi
callq 0x918ec
leaq 0x1b8(%rsp), %rdi
callq 0x918ec
movq %rbx, %rdi
callq 0x138b0