LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelLabel.cpp
// Function: gaps::R3SurfelLabel::SetName(char const*)
void R3SurfelLabel::
SetName(const char *name)
{
  // Delete previous name
  if (this->name) free(this->name);

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x60(%rdi), %rdi
callq 0x13600
testq %r14, %r14
je 0x3b76c
movq %r14, %rdi
callq 0x9cc91
jmp 0x3b76e
xorl %eax, %eax
movq %rax, 0x60(%rbx)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x3b782
orb $0x1, 0x1e8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelLabel.cpp
// Function: gaps::R3SurfelLabel::Print(_IO_FILE*, char const*, char const*) const
void R3SurfelLabel::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print label
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "%d %s", scene_index, (name) ? name : "-");
  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 0x3b86f
movq 0xe8714(%rip), %rax     # 0x123f80
movq (%rax), %rbx
testq %rdx, %rdx
je 0x3b87f
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x135d0
movl 0x10(%r15), %edx
movq 0x60(%r15), %rax
testq %rax, %rax
leaq 0x8cab5(%rip), %rcx     # 0xc8346
cmovneq %rax, %rcx
leaq 0x8caa4(%rip), %rsi     # 0xc8340
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13780
testq %r14, %r14
je 0x3b8b6
movq %r14, %rdi
movq %rbx, %rsi
callq 0x135d0
pushq $0xa
popq %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x13690
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelLabelProperty.cpp
// Function: gaps::R3SurfelLabelProperty::R3SurfelLabelProperty(int, gaps::R3SurfelLabel*, double*, int)
R3SurfelLabelProperty::
R3SurfelLabelProperty(int type, R3SurfelLabel *label, RNScalar *operands, int noperands)
  : scene(NULL),
    scene_index(-1),
    label(label),
    operands(NULL),
    noperands(0),
    type(type)
{
  // Check if operands were provided
  if ((noperands > 0) && (operands)) {
    // Copy operands
    this->noperands = noperands;
    this->operands = new RNScalar [ this->noperands ];
    for (int i = 0; i < this->noperands; i++) {
      this->operands[i] = operands[i];
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0xe46c4(%rip), %rax     # 0x11ff98
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
orl $-0x1, 0x10(%rdi)
movq %rdx, 0x18(%rdi)
andq $0x0, 0x20(%rdi)
andl $0x0, 0x28(%rdi)
movq %rcx, %rbx
movl %esi, 0x2c(%rdi)
testl %r8d, %r8d
setle %al
testq %rcx, %rcx
sete %cl
orb %al, %cl
jne 0x3b934
movq %rdi, %r14
movl %r8d, 0x28(%rdi)
movl %r8d, %r15d
leaq (,%r15,8), %rdi
callq 0x13030
movq %rax, 0x20(%r14)
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x3b934
movsd (%rbx,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
incq %rcx
jmp 0x3b920
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelLabelProperty.cpp
// Function: gaps::R3SurfelLabelProperty::R3SurfelLabelProperty(gaps::R3SurfelLabelProperty const&)
R3SurfelLabelProperty::
R3SurfelLabelProperty(const R3SurfelLabelProperty& property)
  : scene(NULL),
    scene_index(-1),
    label(property.label),
    operands(NULL),
    noperands(0),
    type(property.type)
{
  // Copy operands
  if ((property.noperands > 0) && (property.operands)) {
    this->noperands = property.noperands;
    this->operands = new RNScalar [ this->noperands ];
    for (int i = 0; i < this->noperands; i++) {
      this->operands[i] = property.operands[i];
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0xe4652(%rip), %rax     # 0x11ff98
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
orl $-0x1, 0x10(%rdi)
movq 0x18(%rsi), %rax
movq %rax, 0x18(%rdi)
andq $0x0, 0x20(%rdi)
andl $0x0, 0x28(%rdi)
movl 0x2c(%rsi), %eax
movl %eax, 0x2c(%rdi)
movslq 0x28(%rsi), %r15
testq %r15, %r15
jle 0x3b9ae
movq %rsi, %rbx
cmpq $0x0, 0x20(%rsi)
je 0x3b9ae
movq %rdi, %r14
movl %r15d, 0x28(%rdi)
leaq (,%r15,8), %rdi
callq 0x13030
movq %rax, 0x20(%r14)
movq 0x20(%rbx), %rcx
xorl %edx, %edx
cmpq %rdx, %r15
je 0x3b9ae
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
jmp 0x3b99a
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelLabelProperty.cpp
// Function: gaps::R3SurfelLabelProperty::operator=(gaps::R3SurfelLabelProperty const&)
R3SurfelLabelProperty& R3SurfelLabelProperty::
operator=(const R3SurfelLabelProperty& property)
{
  // Assign stuff
  this->label = property.label;
  this->type = property.type;
  
  // Delete previous operands
  if (this->operands) {
    delete [] this->operands;
    this->operands = NULL;
    this->noperands = 0;
  }

  // Copy operands
  if ((property.noperands > 0) && (property.operands)) {
    this->noperands = property.noperands;
    this->operands = new RNScalar [ this->noperands ];
    for (int i = 0; i < this->noperands; i++) {
      this->operands[i] = property.operands[i];
    }
  }

  // Return this
  return *this;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rsi), %rax
movq %rax, 0x18(%rdi)
movl 0x2c(%rsi), %eax
movl %eax, 0x2c(%rdi)
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x3ba34
callq 0x136a0
andq $0x0, 0x20(%rbx)
andl $0x0, 0x28(%rbx)
movslq 0x28(%r14), %r15
testq %r15, %r15
jle 0x3ba73
cmpq $0x0, 0x20(%r14)
je 0x3ba73
movl %r15d, 0x28(%rbx)
leaq (,%r15,8), %rdi
callq 0x13030
movq %rax, 0x20(%rbx)
movq 0x20(%r14), %rcx
xorl %edx, %edx
cmpq %rdx, %r15
je 0x3ba73
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
jmp 0x3ba5f
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelLabelRelationship.cpp
// Function: gaps::R3SurfelLabelRelationship::R3SurfelLabelRelationship(int, gaps::RNArray<gaps::R3SurfelLabel*> const&, double*, int)
R3SurfelLabelRelationship::
R3SurfelLabelRelationship(int type, const RNArray<R3SurfelLabel *>& labels, RNScalar *operands, int noperands)
  : scene(NULL),
    scene_index(-1),
    labels(labels),
    operands(NULL),
    noperands(0),
    type(type)
{
  // Copy operands, if provided
  if ((noperands > 0) && (operands)) {
    this->noperands = noperands;
    this->operands = new RNScalar [ this->noperands ];
    for (int i = 0; i < this->noperands; i++) {
      this->operands[i] = operands[i];
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %ebp
movq %rcx, %rbx
movl %esi, %r12d
movq %rdi, %r14
leaq 0xe452d(%rip), %rax     # 0x11ffc8
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
orl $-0x1, 0x10(%rdi)
leaq 0x18(%rdi), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x9a7b6
andq $0x0, 0x28(%r14)
andl $0x0, 0x30(%r14)
movl %r12d, 0x34(%r14)
testl %ebp, %ebp
setle %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x3bb01
movl %ebp, 0x30(%r14)
movl %ebp, %r12d
leaq (,%r12,8), %rdi
callq 0x13030
movq %rax, 0x28(%r14)
xorl %ecx, %ecx
cmpq %rcx, %r12
je 0x3bb01
movsd (%rbx,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
incq %rcx
jmp 0x3baed
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x9a81c
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelLabelRelationship.cpp
// Function: gaps::R3SurfelLabelRelationship::R3SurfelLabelRelationship(int, gaps::R3SurfelLabel*, gaps::R3SurfelLabel*, double*, int)
R3SurfelLabelRelationship::
R3SurfelLabelRelationship(int type, R3SurfelLabel *label0, R3SurfelLabel *label1, RNScalar *operands, int noperands)
  : scene(NULL),
    scene_index(-1),
    labels(),
    operands(NULL),
    noperands(0),
    type(type)
{
  // Insert labels
  labels.Insert(label0);
  labels.Insert(label1);

  // Copy operands, if provided
  if ((noperands > 0) && (operands)) {
    this->noperands = noperands;
    this->operands = new RNScalar [ this->noperands ];
    for (int i = 0; i < this->noperands; i++) {
      this->operands[i] = operands[i];
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebp
movq %r8, %rbx
movq %rcx, (%rsp)
movq %rdx, %r13
movl %esi, %r12d
movq %rdi, %r14
leaq 0xe4485(%rip), %rax     # 0x11ffc8
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
orl $-0x1, 0x10(%rdi)
leaq 0x18(%rdi), %r15
movq %r15, %rdi
callq 0x9a7ae
andq $0x0, 0x28(%r14)
andl $0x0, 0x30(%r14)
movl %r12d, 0x34(%r14)
movq %r15, %rdi
movq %r13, %rsi
callq 0x1784c
movq %r15, %rdi
movq (%rsp), %rsi
callq 0x1784c
testl %ebp, %ebp
setle %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x3bbbd
movl %ebp, 0x30(%r14)
movl %ebp, %r12d
leaq (,%r12,8), %rdi
callq 0x13030
movq %rax, 0x28(%r14)
xorl %ecx, %ecx
cmpq %rcx, %r12
je 0x3bbbd
movsd (%rbx,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
incq %rcx
jmp 0x3bba9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x9a81c
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelLabelRelationship.cpp
// Function: gaps::R3SurfelLabelRelationship::R3SurfelLabelRelationship(gaps::R3SurfelLabelRelationship const&)
R3SurfelLabelRelationship::
R3SurfelLabelRelationship(const R3SurfelLabelRelationship& relationship)
  : scene(NULL),
    scene_index(-1),
    labels(relationship.labels),
    operands(NULL),
    noperands(0),
    type(relationship.type)
{
  // Copy operands
  if ((relationship.noperands > 0) && (relationship.operands)) {
    this->noperands = relationship.noperands;
    this->operands = new RNScalar [ this->noperands ];
    for (int i = 0; i < this->noperands; i++) {
      this->operands[i] = relationship.operands[i];
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xe43d6(%rip), %rax     # 0x11ffc8
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
orl $-0x1, 0x10(%rdi)
movq %rsi, %r15
leaq 0x18(%rdi), %r14
addq $0x18, %rsi
movq %r14, %rdi
callq 0x9a7b6
andq $0x0, 0x28(%rbx)
andl $0x0, 0x30(%rbx)
movl 0x34(%r15), %eax
movl %eax, 0x34(%rbx)
movslq 0x30(%r15), %r12
testq %r12, %r12
jle 0x3bc60
cmpq $0x0, 0x28(%r15)
je 0x3bc60
movl %r12d, 0x30(%rbx)
leaq (,%r12,8), %rdi
callq 0x13030
movq %rax, 0x28(%rbx)
movq 0x28(%r15), %rcx
xorl %edx, %edx
cmpq %rdx, %r12
je 0x3bc60
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
jmp 0x3bc4c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x9a81c
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::~R3SurfelDatabase()
R3SurfelDatabase::
~R3SurfelDatabase(void)
{
  // Close database
  if (IsOpen()) CloseFile();

  // Delete blocks
  while (NBlocks() > 0) {
    R3SurfelBlock *block = Block(NBlocks()-1);
    // This allows delete of database without releasing all blocks
    block->file_read_count = 0; 
    RemoveBlock(block);
    delete block;
  }

  // Remove from tree
  if (tree) tree->database = NULL;

  // Delete filename
  if (filename) free(filename);

  // Delete rwaccess
  if (rwaccess) free(rwaccess);

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xe3fff(%rip), %rax     # 0x120030
movq %rax, (%rdi)
cmpq $0x0, 0x8(%rdi)
je 0x3c043
movq %rbx, %rdi
callq 0x3df78
leaq 0x40(%rbx), %r14
movslq 0x4c(%rbx), %rax
testq %rax, %rax
jle 0x3c084
movq 0x40(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %r15
andl $0x0, 0xb4(%r15)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %r15, %rdi
callq 0x2a5a6
movl $0xc8, %esi
movq %r15, %rdi
callq 0x13500
jmp 0x3c047
movq 0xb0(%rbx), %rax
testq %rax, %rax
je 0x3c095
andq $0x0, 0x10(%rax)
movq 0x10(%rbx), %rdi
callq 0x13600
movq 0x18(%rbx), %rdi
callq 0x13600
movq 0xa8(%rbx), %rdi
callq 0x13600
addq $0x58, %rbx
movq %rbx, %rdi
callq 0x649ae
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x9a81c
jmp 0x3c0ce
movq %rax, %rdi
callq 0x177bf
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::SetMarks(int)
void R3SurfelDatabase::
SetMarks(RNBoolean mark)
{
  // Mark all surfels
  for (int i = 0; i < NBlocks(); i++) {
    R3SurfelBlock *block = Block(i);
    block->SetMarks(mark);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
xorl %r15d, %r15d
movslq 0x4c(%r14), %rax
cmpq %rax, %r15
jge 0x3c14e
movq 0x40(%r14), %rax
movq (%rax,%r15,8), %rdi
movl %ebx, %esi
callq 0x2b1b6
incq %r15
jmp 0x3c131
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::InsertBlock(gaps::R3SurfelBlock*)
void R3SurfelDatabase::
InsertBlock(R3SurfelBlock *block)
{
  // Just checking
  assert(block->database == NULL);
  assert(block->database_index == -1);
  assert(block->file_surfels_offset == 0);
  assert(block->file_surfels_count == 0);
  assert(block->file_read_count == 0);

  // Update block database info
  block->database = this;
  block->database_index = blocks.NEntries();
  block->file_surfels_offset = 0;
  block->file_surfels_count = 0;
  block->file_read_count = (block->surfels) ? 1 : 0;
  block->SetDirty(TRUE);

  // Insert block
  blocks.Insert(block);

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

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

  // Update max identifier
  if (block->MaxIdentifier() > max_identifier)
    max_identifier = block->MaxIdentifier();

  // Update number of surfels
  nsurfels += block->NSurfels();

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

  // Update resident surfels
  if (block->surfels) resident_surfels += block->NSurfels();

#ifdef PRINT_DEBUG
  // Print debug message
  printf("Inserted Block %6d : %6d %9ld : %9.3f %9.3f %9.3f\n", 
    block->database_index, block->nsurfels, resident_surfels,
    block->Centroid().X(), block->Centroid().Y(), block->Centroid().Z()); 
  fflush(stdout);
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x98(%rsi)
leaq 0x40(%rdi), %r15
movl 0x4c(%rdi), %eax
movl %eax, 0xa0(%rsi)
andq $0x0, 0xa8(%rsi)
andl $0x0, 0xb0(%rsi)
xorl %eax, %eax
cmpq $0x0, (%rsi)
setne %al
movl %eax, 0xb4(%rsi)
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x2ac70
movq %r15, %rdi
movq %r14, %rsi
callq 0x1784c
leaq 0x58(%rbx), %r15
movq %r14, %rdi
callq 0x2a720
movq %r15, %rdi
movq %rax, %rsi
callq 0x646fe
leaq 0x90(%rbx), %r15
movq %r14, %rdi
callq 0x2a8a8
movq %r15, %rdi
movq %rax, %rsi
callq 0x177ca
movq %r14, %rdi
callq 0x2a9fc
cmpl 0xa0(%rbx), %eax
jbe 0x3c1f6
movq %r14, %rdi
callq 0x2a9fc
movl %eax, 0xa0(%rbx)
movslq 0x8(%r14), %rax
addq %rax, 0x50(%rbx)
cmpq $0x0, (%r14)
je 0x3c20b
addq %rax, 0xb8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::RemoveAndDeleteBlock(gaps::R3SurfelBlock*)
void R3SurfelDatabase::
RemoveAndDeleteBlock(R3SurfelBlock *block)
{
  // Check if still referenced
  if (block->file_read_count == 0) {
    // Block is not referenced, can simply delete it
    RemoveBlock(block);
    delete block;
  }
  else {
    // Block is referenced, mark for delete later
    block->flags.Add(R3_SURFEL_BLOCK_DELETE_PENDING_FLAG);
  }
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
cmpl $0x0, 0xb4(%rsi)
je 0x3c2a4
orb $0x2, 0x89(%rbx)
popq %rbx
retq
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x18(%rax)
movq %rbx, %rdi
callq 0x2a5a6
movl $0xc8, %esi
movq %rbx, %rdi
popq %rbx
jmp 0x13500
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::Print(_IO_FILE*, char const*, char const*) const
void R3SurfelDatabase::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print name
  fprintf(fp, "%s%s%s\n", (prefix) ? prefix : "", (name) ? name : "Database", (suffix) ? suffix : "");

  // Add indent to prefix
  char indent_prefix[1024];
  sprintf(indent_prefix, "%s  ", (prefix) ? prefix : "");

  // Print blocks
  for (int i = 0; i < NBlocks(); i++) {
    blocks[i]->Print(fp, indent_prefix, suffix);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x3c4fe
movq 0xe7a85(%rip), %rax     # 0x123f80
movq (%rax), %r15
testq %r12, %r12
leaq 0x8da8a(%rip), %r8      # 0xc9f92
cmoveq %r8, %r12
movq 0xa8(%r14), %rax
testq %rax, %rax
leaq 0x8d48a(%rip), %rcx     # 0xc99a7
cmovneq %rax, %rcx
testq %rbx, %rbx
cmovneq %rbx, %r8
leaq 0x8d375(%rip), %rsi     # 0xc98a4
xorl %ebp, %ebp
movq %r15, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x13780
leaq 0x8beda(%rip), %rsi     # 0xc841f
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x130e0
movslq 0x4c(%r14), %rax
cmpq %rax, %rbp
jge 0x3c579
movq 0x40(%r14), %rax
movq (%rax,%rbp,8), %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2ba4e
incq %rbp
jmp 0x3c555
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::WriteFile(char const*)
int R3SurfelDatabase::
WriteFile(const char *filename)
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .xyz)\n", filename);
    return 0;
  }

  // Write file of appropriate type
  if (!strncmp(extension, ".ssb", 5)) {
    // Open file
    FILE *f = fopen(filename, "wb");
    if (!f) {
      RNFail("Unable to open file %s\n", filename);
      return 0;
    }

    // Write stream
    if (!WriteStream(f)) {
      fclose(f);
      return 0;
    }

    // Close file
    fclose(f);
  }
  else if (NBlocks() == 1) {
    R3SurfelDatabase *database = (R3SurfelDatabase *) this;
    R3SurfelBlock *block = Block(0);
    if (!database->ReadBlock(block)) return 0;
    if (!block->WriteFile(filename)) return 0;
    if (!database->ReleaseBlock(block)) return 0;
  }
  else {
    RNFail("Invalid file extension %s for database with more than one block\n", extension);
    return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x13580
testq %rax, %rax
je 0x3c7fb
movq %rax, %r15
leaq 0x8d107(%rip), %rsi     # 0xc98ac
pushq $0x5
popq %rdx
movq %rax, %rdi
callq 0x13250
testl %eax, %eax
je 0x3c810
cmpl $0x1, 0x4c(%r14)
jne 0x3c846
movq 0x40(%r14), %rax
movq (%rax), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x20a64
xorl %ebp, %ebp
testl %eax, %eax
je 0x3c867
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2bee2
testl %eax, %eax
je 0x3c867
movq %r14, %rdi
movq %r15, %rsi
callq 0x20aa0
testl %eax, %eax
jne 0x3c841
jmp 0x3c867
leaq 0x8d0b5(%rip), %rdi     # 0xc98b7
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x13070
jmp 0x3c867
leaq 0x8c7c2(%rip), %rsi     # 0xc8fd9
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x3c854
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x68(%rax)
movl %eax, %ebx
movq %r15, %rdi
callq 0x134e0
testl %ebx, %ebx
je 0x3c874
pushq $0x1
popq %rbp
jmp 0x3c867
leaq 0x8d095(%rip), %rdi     # 0xc98e2
xorl %ebp, %ebp
movq %r15, %rsi
jmp 0x3c860
leaq 0x8bc77(%rip), %rdi     # 0xc84d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x3c867
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::InternalSyncBlock(gaps::R3SurfelBlock*, _IO_FILE*, int)
int R3SurfelDatabase::
InternalSyncBlock(R3SurfelBlock *block, FILE *fp, int swap_endian)
{
  // Check file
  if (!fp) return 1;

  // Check number of surfels
  if (block->NSurfels() == 0) return 1;

  // Check file rwaccess
  if (!strstr(rwaccess, "+")) {
    RNFail("Unable to write block to read-only file\n");
    return 0;
  }

#if 0
  // Check database version
  if ((major_version != current_major_version) || (minor_version != current_minor_version)) {
    RNFail("Unable to write block to database with different version\n");
    return 0;
  }
#endif
  
  // Just checking
  assert(block->database == this);

  // Check if surfels can be put at original offset in file
  if ((block->file_surfels_offset > 0) && ((unsigned int) block->nsurfels <= block->file_surfels_count)) {
    // Surfels fit at original offset in file
    RNFileSeek(fp, block->file_surfels_offset, RN_FILE_SEEK_SET);
  }
  else {
    // Surfels must be put at end of file
    RNFileSeek(fp, 0, RN_FILE_SEEK_END);
    block->file_surfels_offset = RNFileTell(fp);
    block->file_surfels_count = block->nsurfels;
  }

  // Write surfels to file
  if (!WriteSurfel(fp, block->surfels, block->nsurfels, swap_endian, major_version, minor_version)) return 0;

#ifdef PRINT_DEBUG
  // Print debug message
  printf("Synced Block %6d : %6d %9ld : %9.3f %9.3f %9.3f\n", 
         block->database_index, block->nsurfels, resident_surfels,
         block->Centroid().X(), block->Centroid().Y(), block->Centroid().Z()); 
  fflush(stdout);
#endif

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $0x1
popq %rbp
testq %rdx, %rdx
je 0x3d424
movq %rsi, %r12
movl 0x8(%rsi), %r13d
testl %r13d, %r13d
je 0x3d424
movl %ecx, %ebx
movq %rdx, %r14
movq %rdi, %r15
movq 0x18(%rdi), %rdi
pushq $0x2b
popq %rsi
callq 0x131d0
testq %rax, %rax
je 0x3d3d9
movq 0xa8(%r12), %rsi
testq %rsi, %rsi
je 0x3d3ad
cmpl 0xb0(%r12), %r13d
jbe 0x3d3eb
pushq $0x2
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x9c462
movq %r14, %rdi
callq 0x9c473
movq %rax, 0xa8(%r12)
movl 0x8(%r12), %ecx
movl %ecx, 0xb0(%r12)
jmp 0x3d3fa
leaq 0x8c596(%rip), %rdi     # 0xc9976
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x9ce26
jmp 0x3d424
movq %r14, %rdi
xorl %edx, %edx
callq 0x9c462
movl 0x8(%r12), %ecx
movq (%r12), %rdx
movl 0x20(%r15), %r9d
movl 0x24(%r15), %eax
movq (%r15), %r10
movl %eax, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %r8d
callq *0xa8(%r10)
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::PurgeDeletedBlocks()
int R3SurfelDatabase::
PurgeDeletedBlocks(void)
{
  // Execute pending deletes
  RNArray<R3SurfelBlock *> blocks_to_delete;
  for (int i = 0; i < blocks.NEntries(); i++) {
    R3SurfelBlock *block = blocks.Kth(i);
    if (block->flags[R3_SURFEL_BLOCK_DELETE_PENDING_FLAG]) {
      blocks_to_delete.Insert(block);
    }
  }

  // Delete blocks
  for (int i = 0; i < blocks_to_delete.NEntries(); i++) {
    R3SurfelBlock *block = blocks_to_delete.Kth(i);
    block->file_read_count = 0;
    RemoveBlock(block);
    delete block;
  }

  // Return number of blocks deleted
  return blocks_to_delete.NEntries();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x9a7ae
xorl %r15d, %r15d
movslq 0x4c(%rbx), %rax
cmpq %rax, %r15
jge 0x3dca5
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
testb $0x2, 0x89(%rsi)
je 0x3dca0
movq %r14, %rdi
callq 0x1784c
incq %r15
jmp 0x3dc7e
xorl %r15d, %r15d
movslq 0xc(%rsp), %r14
cmpq %r14, %r15
jge 0x3dce8
movq (%rsp), %rax
movq (%rax,%r15,8), %r14
andl $0x0, 0xb4(%r14)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x18(%rax)
movq %r14, %rdi
callq 0x2a5a6
movl $0xc8, %esi
movq %r14, %rdi
callq 0x13500
incq %r15
jmp 0x3dca8
movq %rsp, %rdi
callq 0x9a81c
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x3dcff
movq %rax, %rbx
movq %rsp, %rdi
callq 0x9a81c
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::OpenFile(char const*, char const*)
int R3SurfelDatabase::
OpenFile(const char *filename, const char *rwaccess)
{
  // Remember file name
  if (this->filename) free(this->filename);
  this->filename = RNStrdup(filename);

  // Parse rwaccess
  if (this->rwaccess) free(this->rwaccess);
  if (!rwaccess) this->rwaccess = RNStrdup("w+b");
  else if (strstr(rwaccess, "w")) this->rwaccess = RNStrdup("w+b");
  else if (strstr(rwaccess, "+")) this->rwaccess = RNStrdup("r+b");
  else this->rwaccess = RNStrdup("rb"); 

  // Open file
  fp = fopen(filename, this->rwaccess);
  if (!fp) {
    RNFail("Unable to open database file %s with rwaccess %s\n", filename, rwaccess);
    return 0;
  }

  // Check if file is new
  if (!strcmp(this->rwaccess, "w+b")) {
    // File is new -- write header
    if (!WriteFileHeader(fp, 0)) {
      fclose(fp);
      fp = NULL;
      return 0;
    }
  }
  else {
    // Read header
    unsigned int nblocks = 0;
    if (!ReadFileHeader(fp, nblocks)) {
      fclose(fp);
      fp = NULL;
    }
    
    // Read blocks
    if (!ReadBlockHeader(fp, nblocks, swap_endian)) {
      fclose(fp);
      fp = NULL;
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x13600
movq %r15, %rdi
callq 0x9cc91
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rdi
callq 0x13600
leaq 0x8bce9(%rip), %r12     # 0xc9a35
testq %r14, %r14
je 0x3dd81
pushq $0x77
popq %rsi
movq %r14, %rdi
callq 0x131d0
testq %rax, %rax
jne 0x3dd81
pushq $0x2b
popq %rsi
movq %r14, %rdi
callq 0x131d0
testq %rax, %rax
leaq 0x8a45f(%rip), %rax     # 0xc81d5
leaq 0x8bcbc(%rip), %r12     # 0xc9a39
cmoveq %rax, %r12
movq %r12, %rdi
callq 0x9cc91
movq %rax, 0x18(%rbx)
movq %r15, %rdi
movq %rax, %rsi
callq 0x135f0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x3de0d
movq %rax, %r12
movq 0x18(%rbx), %rdi
leaq 0x8bc86(%rip), %rsi     # 0xc9a35
callq 0x13750
testl %eax, %eax
je 0x3de25
leaq 0xc(%rsp), %rdx
andl $0x0, (%rdx)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0xb0(%rax)
movq 0x8(%rbx), %rsi
testl %eax, %eax
jne 0x3dde6
movq %rsi, %rdi
callq 0x134e0
andq $0x0, 0x8(%rbx)
xorl %esi, %esi
movl 0xc(%rsp), %edx
movl 0x28(%rbx), %ecx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0xb8(%rax)
testl %eax, %eax
jne 0x3de3c
movq 0x8(%rbx), %rdi
callq 0x134e0
andq $0x0, 0x8(%rbx)
jmp 0x3de3c
leaq 0x8bc29(%rip), %rdi     # 0xc9a3d
xorl %ebp, %ebp
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x9ce26
jmp 0x3de3f
movq (%rbx), %rax
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq *0xc0(%rax)
testl %eax, %eax
je 0x3de4e
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rdi
callq 0x134e0
andq $0x0, 0x8(%rbx)
jmp 0x3de3f
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::SyncFile()
int R3SurfelDatabase::
SyncFile(void)
{
  // Check if file is read-only
  if (!strcmp(rwaccess, "rb")) return 1;

  // Sync blocks
  for (int i = 0; i < blocks.NEntries(); i++) {
    R3SurfelBlock *block = blocks.Kth(i);
    if (!SyncBlock(block)) return 0;
  }

  // Update blocks offset
  unsigned int nblocks = blocks.NEntries();
  if (nblocks > file_blocks_count) {
    // Update block header size
    file_blocks_count = nblocks;

    // Update block header offset (after last block)
    file_blocks_offset = 0;
    for (int i = 0; i < blocks.NEntries(); i++) {
      R3SurfelBlock *block = blocks.Kth(i);
      unsigned long long offset = block->file_surfels_offset + block->file_surfels_count * NBytesPerSurfel();
      if (offset > file_blocks_offset) file_blocks_offset = offset;
    }

    // Double check block header offset
    if (file_blocks_offset <= 0) {
      RNFileSeek(fp, 0, RN_FILE_SEEK_END);
      file_blocks_offset = RNFileTell(fp);
    }
  }

  // Write blocks
  if (!WriteBlockHeader(fp, swap_endian)) return 0;

  // Write header again (now that the offset values have been filled in)
  if (!WriteFileHeader(fp, swap_endian)) return 0;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rax
cmpb $0x72, (%rax)
jne 0x3de85
cmpb $0x62, 0x1(%rax)
jne 0x3de85
cmpb $0x0, 0x2(%rax)
je 0x3df72
xorl %r15d, %r15d
movslq 0x4c(%rbx), %r14
cmpq %r14, %r15
jge 0x3dead
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %rbx, %rdi
callq 0x3e270
incq %r15
testl %eax, %eax
jne 0x3de88
jmp 0x3df61
cmpl 0x38(%rbx), %r14d
jbe 0x3df2c
movl %r14d, 0x38(%rbx)
andq $0x0, 0x30(%rbx)
xorl %r15d, %r15d
testl %r14d, %r14d
cmovlel %r15d, %r14d
movq 0x40(%rbx), %rax
movq %rax, (%rsp)
xorl %r13d, %r13d
cmpq %r15, %r14
je 0x3df0c
movq (%rsp), %rax
movq (%rax,%r15,8), %rax
movq 0xa8(%rax), %rbp
movl 0xb0(%rax), %r12d
movq %rbx, %rdi
callq 0x3c478
imull %r12d, %eax
addq %rbp, %rax
cmpq %r13, %rax
jbe 0x3df07
movq %rax, 0x30(%rbx)
movq %rax, %r13
incq %r15
jmp 0x3ded1
testq %r13, %r13
jne 0x3df2c
movq 0x8(%rbx), %rdi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x9c462
movq 0x8(%rbx), %rdi
callq 0x9c473
movq %rax, 0x30(%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movl 0x28(%rbx), %edx
movq %rbx, %rdi
callq *0xc8(%rax)
testl %eax, %eax
je 0x3df61
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movl 0x28(%rbx), %edx
movq %rbx, %rdi
callq *0xc0(%rax)
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x3df63
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rax
jmp 0x3df63
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::CloseFile()
int R3SurfelDatabase::
CloseFile(void)
{
  // Sync file
  if (!SyncFile()) return 0;

  // Close file
  fclose(fp);
  fp = NULL;

  // Reset filename
  if (filename) free(filename);
  filename = NULL;

  // Reset rwaccess
  if (rwaccess) free(rwaccess);
  rwaccess = NULL;

  // Return success
  return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x38(%rax)
testl %eax, %eax
je 0x3dfb5
movq 0x8(%rbx), %rdi
callq 0x134e0
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x13600
andq $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rdi
callq 0x13600
andq $0x0, 0x18(%rbx)
pushq $0x1
popq %rax
jmp 0x3dfb7
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelDatabase.cpp
// Function: gaps::R3SurfelDatabase::ReadStream(_IO_FILE*)
int R3SurfelDatabase::
ReadStream(FILE *fp)
{
  // Read header
  unsigned int nblocks = 0;
  if (!ReadFileHeader(fp, nblocks)) return 0;
  
  // Read blocks
  if (!ReadBlockHeader(fp, nblocks, swap_endian)) return 0;

  // Read surfels
  for (int i = 0; i < blocks.NEntries(); i++) {
    R3SurfelBlock *block = blocks.Kth(i);
    if (!InternalReadBlock(block, fp, swap_endian)) return 0;
    block->file_read_count = 1;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4(%rsp), %rdx
andl $0x0, (%rdx)
movq (%rdi), %rax
callq *0xb0(%rax)
xorl %ebp, %ebp
testl %eax, %eax
je 0x3e25e
movl 0x4(%rsp), %edx
movl 0x28(%r14), %ecx
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0xb8(%rax)
testl %eax, %eax
je 0x3e25e
xorl %r12d, %r12d
movslq 0x4c(%r14), %r13
cmpq %r13, %r12
jge 0x3e255
movq 0x40(%r14), %rax
movq (%rax,%r12,8), %r15
movl 0x28(%r14), %ecx
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq *0x88(%rax)
testl %eax, %eax
je 0x3e255
movl $0x1, 0xb4(%r15)
incq %r12
jmp 0x3e21a
xorl %ebp, %ebp
cmpq %r13, %r12
setge %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/./R3SurfelDatabase.h
// Function: gaps::R3SurfelDatabase::SyncBlock(gaps::R3SurfelBlock*)
inline int R3SurfelDatabase::
SyncBlock(R3SurfelBlock *block)
{
  // Check whether block needs to be written
  if (block->IsDirty()) {
    if (!InternalSyncBlock(block, fp, swap_endian)) return 0;
    block->SetDirty(FALSE);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
callq 0x2ac62
pushq $0x1
popq %rbx
testl %eax, %eax
je 0x3e2b3
movq (%r15), %rax
movq 0x8(%r15), %rdx
movl 0x28(%r15), %ecx
movq %r15, %rdi
movq %r14, %rsi
callq *0x98(%rax)
testl %eax, %eax
je 0x3e2b1
movq %r14, %rdi
xorl %esi, %esi
callq 0x2ac70
jmp 0x3e2b3
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Frustum.cpp
// Function: gaps::R3Frustum::Corner(int) const
const R3Point R3Frustum::
Corner (RNOctant octant) const
{
  // Return corner point 
  switch (octant) {
  case RN_NNN_OCTANT: return Corner(RN_LO, RN_LO, RN_LO);
  case RN_NNP_OCTANT: return Corner(RN_LO, RN_LO, RN_HI);
  case RN_NPN_OCTANT: return Corner(RN_LO, RN_HI, RN_LO);
  case RN_NPP_OCTANT: return Corner(RN_LO, RN_HI, RN_HI);
  case RN_PNN_OCTANT: return Corner(RN_HI, RN_LO, RN_LO);
  case RN_PNP_OCTANT: return Corner(RN_HI, RN_LO, RN_HI);
  case RN_PPN_OCTANT: return Corner(RN_HI, RN_HI, RN_LO);
  case RN_PPP_OCTANT: return Corner(RN_HI, RN_HI, RN_HI);
  default: RNAbort("Invalid octant for frustum corner"); return R3null_point;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x7, %edx
ja 0x61bba
movl %edx, %eax
leaq 0x68a54(%rip), %rcx     # 0xca5a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
xorl %edx, %edx
jmp 0x61b66
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
jmp 0x61bad
pushq $0x1
popq %rcx
movq %rbx, %rdi
xorl %edx, %edx
jmp 0x61bad
pushq $0x1
popq %rcx
movq %rbx, %rdi
xorl %edx, %edx
jmp 0x61b86
pushq $0x1
popq %rcx
movq %rbx, %rdi
movl %ecx, %edx
movl %ecx, %r8d
jmp 0x61bb0
pushq $0x1
popq %r8
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x61bb0
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
movl %edx, %r8d
jmp 0x61bb0
pushq $0x1
popq %rcx
movq %rbx, %rdi
movl %ecx, %edx
xorl %r8d, %r8d
callq 0x61bda
movq %rbx, %rax
popq %rbx
retq
leaq 0x68a1f(%rip), %rdi     # 0xca5e0
xorl %eax, %eax
callq 0x9cd4c
leaq 0x4c4ac1(%rip), %rsi    # 0x526690
movq %rbx, %rdi
callq 0x781cc
jmp 0x61bb5
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Frustum.cpp
// Function: gaps::R3Frustum::Corner(int, int, int) const
const R3Point R3Frustum::
Corner(int xdir, int ydir, int zdir) const
{
  // Return corner point
  double xsign = (xdir == RN_LO) ? -1 : 1;
  double ysign = (ydir == RN_LO) ? -1 : 1;
  double depth = (zdir == RN_LO) ? Near() : Far();
  R3Point corner = cs.Origin() - cs.Axes().Axis(RN_Z) * depth;
  corner += cs.Axes().Axis(RN_X) * depth * tan(xfov) * xsign;
  corner += cs.Axes().Axis(RN_Y) * depth * tan(yfov) * ysign;
  return corner;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x60, %rsp
xorl %eax, %eax
testl %r8d, %r8d
setne %al
xorl %r8d, %r8d
cmpl $0x1, %ecx
movl $0x0, %ecx
sbbl %ecx, %ecx
orl $0x1, %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r14
cmpl $0x1, %edx
sbbl %r8d, %r8d
movq %rdi, %rbx
orl $0x1, %r8d
cvtsi2sd %r8d, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x138(%rsi,%rax,8), %xmm0
movsd %xmm0, (%rsp)
leaq 0x8(%rsi), %r15
leaq 0x20(%rsi), %r12
addq $0x50, %rsi
leaq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0x79072
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x7890d
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movsd (%rsp), %xmm0
callq 0x79072
movsd 0x128(%r14), %xmm0
callq 0x132e0
leaq 0x48(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x79072
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x79072
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7850c
leaq 0x38(%r14), %rsi
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movsd (%rsp), %xmm0
callq 0x79072
movsd 0x130(%r14), %xmm0
callq 0x132e0
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x79072
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movsd 0x10(%rsp), %xmm0
callq 0x79072
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7850c
movq %rbx, %rax
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Frustum.cpp
// Function: gaps::R3Frustum::BBox() const
const R3Box R3Frustum::
BBox(void) const
{
  // Return bounding box
  R3Box bbox = R3null_box;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        bbox.Union(Corner(i, j, k));
      }
    }
  }
  return bbox;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xc3be3(%rip), %rsi     # 0x1259e8
callq 0x63ce6
xorl %ebp, %ebp
movq %rsp, %r15
cmpl $0x2, %ebp
je 0x61e52
xorl %r12d, %r12d
cmpl $0x2, %r12d
je 0x61e4e
xorl %r13d, %r13d
cmpl $0x2, %r13d
je 0x61e49
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %r12d, %ecx
movl %r13d, %r8d
callq 0x61bda
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6464c
incl %r13d
jmp 0x61e20
incl %r12d
jmp 0x61e17
incl %ebp
jmp 0x61e0f
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x649ae
movq %r14, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Frustum.cpp
// Function: gaps::R3Frustum::BSphere() const
const R3Sphere R3Frustum::
BSphere(void) const
{
  // Return bounding sphere
  R3Point centroid = Centroid();
  R3Point corner = Corner(RN_HI, RN_HI, RN_HI);
  RNLength radius = R3Distance(centroid, corner);
  return R3Sphere(centroid, radius);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq *0x68(%rax)
leaq 0x8(%rsp), %r12
pushq $0x1
popq %rcx
movq %r12, %rdi
movq %r14, %rsi
movl %ecx, %edx
movl %ecx, %r8d
callq 0x61bda
movq %r15, %rdi
movq %r12, %rsi
callq 0x495ca
movq %rbx, %rdi
movq %r15, %rsi
callq 0x625cc
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Frustum.cpp
// Function: gaps::R3Frustum::Empty()
void R3Frustum::
Empty(void)
{
  // Reset coordinate system
  cs = R3xyz_coordinate_system;

  // Reset fovs
  xfov = 0;
  yfov = 0;

  // Reset near and far dists
  neardist = 0;
  fardist = 0;
  
  // Reset halfspaces
  for (int dir = 0; dir < 2; dir++) {
    for (int dim = 0; dim < 3; dim++) {
      halfspaces[dir][dim] = R3null_halfspace;
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x8, %rdi
leaq 0xc3d76(%rip), %rsi     # 0x125c60
callq 0x28a32
leaq 0x68(%rbx), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x128(%rbx)
movups %xmm0, 0x138(%rbx)
xorl %r15d, %r15d
leaq 0x4c42d2(%rip), %rbx    # 0x5261e0
cmpq $0x2, %r15
je 0x61f38
xorl %r12d, %r12d
cmpq $0x60, %r12
je 0x61f2f
leaq (%r14,%r12), %rdi
movq %rbx, %rsi
callq 0x2865e
addq $0x20, %r12
jmp 0x61f17
incq %r15
addq $0x60, %r14
jmp 0x61f0e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Frustum.cpp
// Function: gaps::R3Frustum::Transform(gaps::R3Transformation const&)
void R3Frustum::
Transform(const R3Transformation& transformation)
{
  // Assumes rigid transformation
  // xfov, yfov stay same

  // Transform coordinate system
  cs.Transform(transformation);

  // Transform halfspaces
  for (int dir = 0; dir < 2; dir++) {
    for (int dim = 0; dim < 3; dim++) {
      halfspaces[dir][dim].Transform(transformation);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x8, %rdi
callq 0x6709a
addq $0x68, %r14
xorl %r15d, %r15d
cmpq $0x2, %r15
je 0x61f8c
xorl %r12d, %r12d
cmpq $0x60, %r12
je 0x61f83
leaq (%r14,%r12), %rdi
movq %rbx, %rsi
callq 0x76d78
addq $0x20, %r12
jmp 0x61f6b
incq %r15
addq $0x60, %r14
jmp 0x61f62
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PlanarGrid.cpp
// Function: gaps::R3PlanarGrid::Reset(gaps::R3Plane const&, gaps::R3Affine const&, int, int, gaps::R2Box const&)
void R3PlanarGrid::
Reset(const R3Plane& plane, 
  const R3Affine& world_to_xyplane, 
  int xres, int yres, const R2Box& xyplane_bbox)
{
  // Update stuff
  this->plane = plane;
  this->transformation = world_to_xyplane;
  this->grid.Resample(xres, yres);
  this->grid.SetWorldToGridTransformation(xyplane_bbox);
  
  // Update world bbox
  bbox = R3null_box;
  R2Box xybox = grid.WorldBox();
  R3Point p00(xybox[0][0], xybox[0][1], 0); p00.InverseTransform(world_to_xyplane); bbox.Union(p00);
  R3Point p01(xybox[0][0], xybox[1][1], 0); p01.InverseTransform(world_to_xyplane); bbox.Union(p01);
  R3Point p10(xybox[1][0], xybox[0][1], 0); p10.InverseTransform(world_to_xyplane); bbox.Union(p10);
  R3Point p11(xybox[1][0], xybox[1][1], 0); p11.InverseTransform(world_to_xyplane); bbox.Union(p11);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, %r15
movl %r8d, %ebp
movl %ecx, %r12d
movq %rdx, %r14
movq %rdi, %rbx
callq 0x2865e
leaq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x209c2
leaq 0x130(%rbx), %r13
movq %r13, %rdi
movl %r12d, %esi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x88c46
movq %r13, %rdi
movq %r15, %rsi
callq 0x83cf8
addq $0x200, %rbx            # imm = 0x200
leaq 0xba970(%rip), %rsi     # 0x1259e8
movq %rbx, %rdi
callq 0x177ee
movq %rsp, %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x2ed88
movsd 0x8(%r15), %xmm0
movsd 0x10(%r15), %xmm1
leaq 0x70(%rsp), %rdi
xorps %xmm2, %xmm2
callq 0x781bc
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x78814
leaq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0x6464c
movsd 0x8(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
leaq 0x58(%rsp), %rdi
xorps %xmm2, %xmm2
callq 0x781bc
leaq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x78814
leaq 0x58(%rsp), %rsi
movq %rbx, %rdi
callq 0x6464c
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
leaq 0x40(%rsp), %rdi
xorps %xmm2, %xmm2
callq 0x781bc
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x78814
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x6464c
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
leaq 0x28(%rsp), %rdi
xorps %xmm2, %xmm2
callq 0x781bc
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x78814
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x6464c
movq %rsp, %rdi
callq 0x91792
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6b17a
jmp 0x6b17a
jmp 0x6b17a
movq %rax, %rbx
movq %rsp, %rdi
callq 0x91792
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PlanarGrid.cpp
// Function: gaps::R3PlanarGrid::ReadFile(char const*)
int R3PlanarGrid::
ReadFile(const char *filename)
{
  // Parse input filename extension
  const char *input_extension;
  if (!(input_extension = strrchr(filename, '.'))) {
    RNFail("Input file has no extension (e.g., .pfm).\n");
    return 0;
  }
  
  // Read file of appropriate type
  if (!strncmp(input_extension, ".grd", 4)) return ReadGridFile(filename);
  
  // Should never get here
  RNFail("Unrecognized image file extension");
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x13580
testq %rax, %rax
je 0x6b1f1
leaq 0x5f792(%rip), %rsi     # 0xca96b
pushq $0x4
popq %rdx
movq %rax, %rdi
callq 0x13250
testl %eax, %eax
je 0x6b209
leaq 0x5f781(%rip), %rdi     # 0xca970
jmp 0x6b1f8
leaq 0x5f748(%rip), %rdi     # 0xca940
xorl %eax, %eax
callq 0x9ce26
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6b21c
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PlanarGrid.cpp
// Function: gaps::R3PlanarGrid::ReadGridFile(char const*)
int R3PlanarGrid::
ReadGridFile(const char *filename)
{
  // Open file
  FILE *fp = stdin;
  if (filename) {
    fp = fopen(filename, "rb");
    if (!fp) {
      RNFail("Unable to open file %s", filename);
      return 0;
    }
  }

  // Read file
  int status = ReadGrid(fp);
  if (!status) return 0;

  // Close file
  fclose(fp);

  // Return number of grid values read
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x6b258
movq %rsi, %r14
leaq 0x5cfa2(%rip), %rsi     # 0xc81d5
movq %r14, %rdi
callq 0x135f0
movq %rax, %r15
testq %rax, %rax
jne 0x6b262
leaq 0x5eacd(%rip), %rdi     # 0xc9d17
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x9ce26
jmp 0x6b280
movq 0xb8d49(%rip), %rax     # 0x123fa8
movq (%rax), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6b358
testl %eax, %eax
je 0x6b27e
movq %r15, %rdi
callq 0x134e0
pushq $0x1
popq %rbx
jmp 0x6b280
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PlanarGrid.cpp
// Function: gaps::R3PlanarGrid::WriteFile(char const*) const
int R3PlanarGrid::
WriteFile(const char *filename) const
{
  // Parse input filename extension
  const char *input_extension;
  if (!(input_extension = strrchr(filename, '.'))) {
    RNFail("Output file has no extension (e.g., .pfm).\n");
    return 0;
  }
  
  // Write file of appropriate type
  if (!strncmp(input_extension, ".grd", 4)) return WriteGridFile(filename);

  // Should never get here
  RNFail("Unrecognized image file extension");
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x13580
testq %rax, %rax
je 0x6b2c1
leaq 0x5f6c2(%rip), %rsi     # 0xca96b
pushq $0x4
popq %rdx
movq %rax, %rdi
callq 0x13250
testl %eax, %eax
je 0x6b2d9
leaq 0x5f6b1(%rip), %rdi     # 0xca970
jmp 0x6b2c8
leaq 0x5f6ca(%rip), %rdi     # 0xca992
xorl %eax, %eax
callq 0x9ce26
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6b2ec
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PlanarGrid.cpp
// Function: gaps::R3PlanarGrid::WriteGridFile(char const*) const
int R3PlanarGrid::
WriteGridFile(const char *filename) const
{
  // Open file
  FILE *fp = stdout;
  if (filename) {
    fp = fopen(filename, "wb");
    if (!fp) {
      RNFail("Unable to open file %s", filename);
      return 0;
    }
  }

  // Write file
  int status = WriteGrid(fp);
  if (!status) return 0;

  // Close file
  fclose(fp);

  // Return number of grid values written
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x6b328
movq %rsi, %r14
leaq 0x5dcd6(%rip), %rsi     # 0xc8fd9
movq %r14, %rdi
callq 0x135f0
movq %rax, %r15
testq %rax, %rax
jne 0x6b332
leaq 0x5e9fd(%rip), %rdi     # 0xc9d17
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x9ce26
jmp 0x6b34f
movq 0xb8c51(%rip), %rax     # 0x123f80
movq (%rax), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6b4a6
testl %eax, %eax
je 0x6b34d
movl %eax, %ebx
movq %r15, %rdi
callq 0x134e0
jmp 0x6b34f
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop