LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::WriteFile(char const*) const
int R3SurfelBlock::
WriteFile(const char *filename) const
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .ply)\n", filename);
    return 0;
  }

  // Write file of appropriate type
  if (!strncmp(extension, ".xyz", 4)) {
    return WriteXYZAsciiFile(filename);
  }
  else if (!strncmp(extension, ".blk", 4)) {
    return WriteBinaryFile(filename);
  }
  else { 
    RNFail("Unable to write file %s (unrecognized extension: %s)\n", filename, extension); 
    return 0; 
  }

  // Should never get here
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0x13560
testq %rax, %rax
je 0x2ee94
movq %rax, %r15
leaq 0xb007c(%rip), %rsi     # 0xdeed1
movl $0x4, %edx
movq %rax, %rdi
callq 0x13240
testl %eax, %eax
je 0x2eead
leaq 0xb006e(%rip), %rsi     # 0xdeedb
movl $0x4, %edx
movq %r15, %rdi
callq 0x13240
testl %eax, %eax
je 0x2eebd
leaq 0xaf617(%rip), %rdi     # 0xde49c
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xaddb2
jmp 0x2eea5
leaq 0xb0001(%rip), %rdi     # 0xdee9c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x13070
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2eece
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2ef2c
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::WriteXYZAsciiFile(char const*) const
int R3SurfelBlock::
WriteXYZAsciiFile(const char *filename) const
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "w"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Write file
  if (!WriteXYZAscii(fp)) {
    RNFail("Unable to write XYZ file %s\n", filename);
    fclose(fp);
    return 0;
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xb6416(%rip), %rsi     # 0xe52f8
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x2ef0c
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x2f83a
movq %r15, %rdi
callq 0x134d0
movl $0x1, %ebp
jmp 0x2ef1f
leaq 0xaf5bf(%rip), %rdi     # 0xde4d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xaddb2
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::WriteBinaryFile(char const*) const
int R3SurfelBlock::
WriteBinaryFile(const char *filename) const
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "wb"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Write file
  if (!WriteBinary(fp)) {
    RNFail("Unable to write surfel file %s\n", filename);
    fclose(fp);
    return 0;
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xb00a9(%rip), %rsi     # 0xdefe9
movq %rbx, %rdi
callq 0x135d0
testq %rax, %rax
je 0x2ef6e
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x2fcc2
testl %eax, %eax
je 0x2ef83
movq %r14, %rdi
callq 0x134d0
movl $0x1, %ebp
jmp 0x2ef9e
leaq 0xaf55d(%rip), %rdi     # 0xde4d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xaddb2
jmp 0x2ef9e
leaq 0xb0062(%rip), %rdi     # 0xdefec
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xaddb2
movq %r14, %rdi
callq 0x134d0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::WriteXYZAscii(_IO_FILE*) const
int R3SurfelBlock::
WriteXYZAscii(FILE *fp) const
{
  // Write surfels
  for (int i = 0; i < NSurfels(); i++) {
    const R3Surfel *surfel = Surfel(i);
    const float *position = surfel->PositionPtr();
    const unsigned char *color = surfel->ColorPtr();
    fprintf(fp, "%g %g %g ", position[0], position[1], position[2]);
    fprintf(fp, "%u %u %u ", color[0], color[1], color[2]);
    fprintf(fp, "0 0\n");
  }

  // Return success
  return 1;
}

// Assembly:
cmpl $0x0, 0x8(%rdi)
jle 0x2f8eb
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x2e, %ebp
leaq 0xb0b0f(%rip), %r13     # 0xe0370
xorl %r15d, %r15d
movq (%r14), %r12
xorps %xmm0, %xmm0
cvtss2sd -0x2e(%r12,%rbp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd -0x2a(%r12,%rbp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd -0x26(%r12,%rbp), %xmm2
movq %rbx, %rdi
leaq 0xaf019(%rip), %rsi     # 0xde8a8
movb $0x3, %al
callq 0x13740
movzbl -0x2(%r12,%rbp), %edx
movzbl -0x1(%r12,%rbp), %ecx
movzbl (%r12,%rbp), %r8d
movq %rbx, %rdi
leaq 0xaf6d3(%rip), %rsi     # 0xdef84
xorl %eax, %eax
callq 0x13740
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x139a0
incq %r15
movslq 0x8(%r14), %rax
addq $0x30, %rbp
cmpq %rax, %r15
jl 0x2f864
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl $0x1, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::WriteBinary(_IO_FILE*) const
int R3SurfelBlock::
WriteBinary(FILE *fp) const
{
  // Write number of surfels
  int nsurfels = NSurfels();
  if (fwrite(&nsurfels, sizeof(int), 1, fp) != (size_t) 1) {
    RNFail("Unable to write number of surfels\n");
    return 0;
  }

  // Write bounding box
  if (fwrite(&bbox, sizeof(R3Box), 1, fp) != (size_t) 1) {
    RNFail("Unable to write bounding box of surfel block\n");
    return 0;
  }

  // Write resolution
  if (fwrite(&resolution, sizeof(R3Box), 1, fp) != (size_t) 1) {
    RNFail("Unable to write resolution of surfel block\n");
    return 0;
  }

  // Write flags
  RNFlags tmp = flags; tmp.Remove(R3_SURFEL_BLOCK_DATABASE_FLAGS);
  if (fwrite(&tmp, sizeof(RNFlags), 1, fp) != (size_t) 1) {
    RNFail("Unable to write flags of surfel block\n");
    return 0;
  }

  // Write surfels
  for (int i = 0; i < NSurfels(); i++) {
    if (fwrite(&surfels[i], sizeof(R3Surfel), 1, fp) != (size_t) 1) {
      return 0;
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rdi), %eax
leaq 0xc(%rsp), %rdi
movl %eax, (%rdi)
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x139a0
cmpq $0x1, %rax
jne 0x2fddb
leaq 0x28(%r14), %rdi
movl $0x38, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x139a0
cmpq $0x1, %rax
jne 0x2fde4
leaq 0x80(%r14), %rdi
movl $0x38, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x139a0
cmpq $0x1, %rax
jne 0x2fded
movq $-0xff01, %rax          # imm = 0xFFFF00FF
andq 0x88(%r14), %rax
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x139a0
cmpq $0x1, %rax
jne 0x2fdf6
cmpl $0x0, 0x8(%r14)
setle %bpl
jle 0x2fdd5
movq (%r14), %rdi
movl $0x30, %r15d
movl $0x30, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x139a0
cmpq $0x1, %rax
jne 0x2fdd5
xorl %r12d, %r12d
incq %r12
movslq 0x8(%r14), %rax
cmpq %rax, %r12
setge %bpl
jge 0x2fdd5
leaq 0x30(%r15), %r13
addq (%r14), %r15
movl $0x30, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x139a0
movq %r13, %r15
cmpq $0x1, %rax
je 0x2fda0
movzbl %bpl, %ebx
jmp 0x2fe06
leaq 0xaf2e7(%rip), %rdi     # 0xdf0c9
jmp 0x2fdfd
leaq 0xaf301(%rip), %rdi     # 0xdf0ec
jmp 0x2fdfd
leaq 0xaf326(%rip), %rdi     # 0xdf11a
jmp 0x2fdfd
leaq 0xaf349(%rip), %rdi     # 0xdf146
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xaddb2
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ResetSurfels(int)
void R3SurfelBlock::
ResetSurfels(int nsurfels)
{
  // Delete old surfels
  if (surfels) delete [] surfels;

  // Reset everything
  this->surfels = NULL;
  this->nsurfels = 0;
  this->position_origin = R3zero_point;
  this->bbox = R3null_box;
  this->timestamp_origin = 0;
  this->timestamp_range.Reset(FLT_MAX,-FLT_MAX);
  this->min_identifier = UINT_MAX;
  this->max_identifier = 0;
  this->resolution = 0;
  this->flags = 0;
  this->data = NULL;
  this->database = NULL;
  this->database_index = -1;
  this->file_surfels_offset = 0;
  this->file_surfels_count = 0;
  this->file_read_count = 0;
  this->node = NULL;
  this->opengl_id = 0;

  // Allocate new surfels
  if (nsurfels > 0) {
    this->nsurfels = nsurfels;
    this->surfels = new R3Surfel [ nsurfels ];
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x301f2
callq 0x13680
movq $0x0, (%rbx)
movl $0x0, 0x8(%rbx)
leaq 0x10(%rbx), %rdi
leaq 0x506465(%rip), %rsi    # 0x536670
callq 0x850ec
leaq 0x30(%rbx), %rdi
leaq 0x1057ad(%rip), %r14    # 0x1359c8
leaq 0x8(%r14), %rsi
callq 0x850ec
leaq 0x48(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0x850ec
xorps %xmm0, %xmm0
movhps 0xadf32(%rip), %xmm0    # xmm0 = xmm0[0,1],mem[0,1]
xorps %xmm1, %xmm1
movups %xmm0, 0x60(%rbx)
movabsq $-0x3810000020000000, %rax # imm = 0xC7EFFFFFE0000000
movq %rax, 0x70(%rbx)
movl $0xffffffff, 0x78(%rbx) # imm = 0xFFFFFFFF
movups %xmm1, 0x7c(%rbx)
movups %xmm1, 0x8c(%rbx)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x9c(%rbx)
movups %xmm1, 0xa8(%rbx)
movups %xmm1, 0xb4(%rbx)
testl %ebp, %ebp
jle 0x302b8
movl %ebp, 0x8(%rbx)
movl %ebp, %eax
shlq $0x4, %rax
leaq (%rax,%rax,2), %r14
movq %r14, %rdi
callq 0x13030
movq %rax, %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x2b548
addq $0x30, %r12
cmpq %r12, %r14
jne 0x302a3
movq %r15, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x139b0
movq %rbx, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/./R3SurfelBlock.h
// Function: gaps::R3SurfelTimestampConstraint::Check(gaps::R3SurfelBlock const*, gaps::R3Surfel const*) const
inline int R3SurfelBlock::
SurfelIndex(const R3Surfel *surfel) const
{
  // Return index of surfel in this block
  if (!surfels) return 0;
  int index = surfel - surfels;
  assert((index >= 0) && (index < nsurfels));
  return index;
}

// Assembly:
movq (%rsi), %rcx
testq %rcx, %rcx
je 0x30556
subq %rcx, %rdx
shrq $0x4, %rdx
imull $0xaaaaaaab, %edx, %eax # imm = 0xAAAAAAAB
movslq %eax, %rdx
jmp 0x30558
xorl %edx, %edx
movsd 0x8(%rdi), %xmm0
movsd 0x10(%rdi), %xmm1
movl $0x2, %eax
ucomisd %xmm1, %xmm0
ja 0x30594
leaq (%rdx,%rdx,2), %rax
shlq $0x4, %rax
cvtss2sd 0xc(%rcx,%rax), %xmm2
addsd 0x60(%rsi), %xmm2
xorl %ecx, %ecx
ucomisd %xmm2, %xmm1
setae %cl
addl %ecx, %ecx
xorl %eax, %eax
ucomisd %xmm0, %xmm2
cmovael %ecx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelCoordinateConstraint::Check(gaps::R3Box const&) const
int R3SurfelCoordinateConstraint::
Check(const R3Box& box) const
{
  // Return whether any point in box can satisfy constraint
  RNInterval box_interval(box.Min()[dimension], box.Max()[dimension]);
  if (interval.Contains(box_interval)) return R3_SURFEL_CONSTRAINT_PASS;
  else if (interval.Intersects(box_interval)) return R3_SURFEL_CONSTRAINT_MAYBE;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movslq 0x8(%rdi), %rax
movsd 0x8(%rsi,%rax,8), %xmm0
movsd 0x20(%rsi,%rax,8), %xmm1
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xace9e
movsd 0x10(%rbx), %xmm0
movsd 0x18(%rbx), %xmm1
movsd 0x8(%r14), %xmm2
movapd %xmm0, %xmm3
cmplepd %xmm2, %xmm0
cmpnlepd %xmm1, %xmm2
movsd (%r14), %xmm4
cmpnlepd %xmm4, %xmm3
orpd %xmm2, %xmm3
movd %xmm3, %eax
cmplepd %xmm1, %xmm4
andpd %xmm0, %xmm4
movd %xmm4, %ecx
andl $0x1, %ecx
testb $0x1, %al
movl $0x2, %eax
cmovnel %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelNormalConstraint::R3SurfelNormalConstraint(gaps::R3Vector const&, double)
R3SurfelNormalConstraint::
R3SurfelNormalConstraint(const R3Vector& direction, RNAngle max_angle)
{
  // Remember reference vector
  this->direction[0] = direction.X();
  this->direction[1] = direction.Y();
  this->direction[2] = direction.Z();

  // Compute min dot product
  this->min_dot = cos(max_angle);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xfe9d3(%rip), %rax     # 0x12f038
movq %rax, (%rdi)
movupd (%rsi), %xmm1
cvtpd2ps %xmm1, %xmm1
movlpd %xmm1, 0x8(%rdi)
xorps %xmm1, %xmm1
cvtsd2ss 0x10(%rsi), %xmm1
movss %xmm1, 0x10(%rdi)
callq 0x13950
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelLineConstraint::Check(gaps::R3Point const&) const
int R3SurfelLineConstraint::
Check(const R3Point& point) const
{
  // Return whether line contains point
  RNScalar d = R3Distance(line, point);
  if (d <= tolerance) return R3_SURFEL_CONSTRAINT_PASS;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %rsi
movq %rax, %rdi
callq 0x508e2
movsd 0x38(%rbx), %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
setae %al
addl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelPlaneConstraint::Check(gaps::R3Box const&) const
int R3SurfelPlaneConstraint::
Check(const R3Box& box) const
{
  // Returncontains/intersects box
  RNScalar d = R3SignedDistance(plane, box);
  if (fabs(d) <= tolerance) return R3_SURFEL_CONSTRAINT_MAYBE;
  if (above && (d > tolerance)) return R3_SURFEL_CONSTRAINT_PASS;
  if (below && (d < tolerance)) return R3_SURFEL_CONSTRAINT_PASS;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x8, %rdi
callq 0x52328
movapd 0xad921(%rip), %xmm2    # 0xde3d0
andpd %xmm0, %xmm2
movsd 0x38(%rbx), %xmm1
movl $0x1, %eax
ucomisd %xmm2, %xmm1
jae 0x30ae9
ucomisd %xmm1, %xmm0
jbe 0x30ad4
movl $0x2, %eax
cmpl $0x0, 0x30(%rbx)
jne 0x30ae9
cmpl $0x0, 0x28(%rbx)
setne %al
ucomisd %xmm0, %xmm1
seta %cl
andb %al, %cl
movzbl %cl, %eax
addl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelPlaneConstraint::Check(gaps::R3Point const&) const
int R3SurfelPlaneConstraint::
Check(const R3Point& point) const
{
  // Return whether plane contains point
  RNScalar d = R3SignedDistance(plane, point);
  if (above && (d > tolerance)) return R3_SURFEL_CONSTRAINT_PASS;
  if (on && (fabs(d) <= tolerance)) return R3_SURFEL_CONSTRAINT_PASS;
  if (below && (d < tolerance)) return R3_SURFEL_CONSTRAINT_PASS;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x8, %rdi
callq 0x50acf
cmpl $0x0, 0x30(%rbx)
movsd 0x38(%rbx), %xmm1
movl $0x2, %eax
je 0x30b0f
ucomisd %xmm1, %xmm0
ja 0x30b3c
cmpl $0x0, 0x2c(%rbx)
je 0x30b27
movapd 0xad8b3(%rip), %xmm2    # 0xde3d0
andpd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
jae 0x30b3c
cmpl $0x0, 0x28(%rbx)
setne %al
ucomisd %xmm0, %xmm1
seta %cl
andb %al, %cl
movzbl %cl, %eax
addl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelPlanarGridConstraint::Check(gaps::R3Box const&) const
int R3SurfelPlanarGridConstraint::
Check(const R3Box& box) const
{
  // Check distance from box to plane
  RNLength offplane_distance = R3Distance(grid->Plane(), box);
  if (offplane_distance > max_offplane_distance) return R3_SURFEL_CONSTRAINT_FAIL;

  // Check distance from box to grid
  RNLength bbox_distance = R3Distance(box, grid->WorldBox());
  if (bbox_distance > max_offplane_distance) return R3_SURFEL_CONSTRAINT_FAIL;

  // Points might pass
  return R3_SURFEL_CONSTRAINT_MAYBE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x522e7
xorl %eax, %eax
ucomisd 0x10(%rbx), %xmm0
ja 0x30e37
movl $0x200, %esi            # imm = 0x200
addq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x52931
xorl %eax, %eax
ucomisd 0x10(%rbx), %xmm0
setbe %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelOverheadGridConstraint::Check(gaps::R3Box const&) const
int R3SurfelOverheadGridConstraint::
Check(const R3Box& box) const
{
  // Return whether any point in box can satisfy constraint
  R2Box projected_box(box[0][0], box[0][1], box[1][0], box[1][1]);
  if (R2Intersects(projected_box, grid->WorldBox())) return R3_SURFEL_CONSTRAINT_MAYBE;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
movsd 0x8(%rsi), %xmm0
movsd 0x10(%rsi), %xmm1
movsd 0x20(%rsi), %xmm2
movsd 0x28(%rsi), %xmm3
leaq 0x68(%rsp), %rdi
callq 0xa0a64
movq 0x8(%rbx), %rbx
leaq 0x10(%rsp), %rdi
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
callq 0xa3776
movl 0xc0(%rbx), %eax
decl %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movl 0xc4(%rbx), %eax
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movq %rsp, %rdi
callq 0xa3776
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x99214
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x99214
leaq 0x40(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0xa0992
leaq 0x68(%rsp), %rdi
leaq 0x40(%rsp), %rsi
xorl %edx, %edx
callq 0x91bd4
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
leaq 0x40(%rsp), %rdi
callq 0xa12e4
leaq 0x68(%rsp), %rdi
callq 0xa12e4
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
retq
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xa12e4
jmp 0x31109
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0xa12e4
movq %rbx, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelViewConstraint::R3SurfelViewConstraint(gaps::R3Viewer const&, gaps::R2Grid const*, int)
R3SurfelViewConstraint::
R3SurfelViewConstraint(
  const R3Viewer& viewer,
  const R2Grid *image_mask,
  RNBoolean must_be_inside_frustum)
  : frustum(viewer.Camera().Frustum()),
    world_to_camera(viewer.Camera().CoordSystem().InverseMatrix()),
    w(viewer.Viewport().Width()),
    h(viewer.Viewport().Height()),
    fx(0),
    fy(0),
    cx(0.5*viewer.Viewport().Width()),
    cy(0.5*viewer.Viewport().Height()),
    neardist(viewer.Camera().Near()),
    fardist(viewer.Camera().Far()),
    image_mask(image_mask),
    must_be_inside_frustum(must_be_inside_frustum)
{
  // Update focal lengths
  const R3Camera& camera = viewer.Camera();
  RNScalar xfov = camera.XFOV();
  RNScalar yfov = camera.YFOV();
  RNScalar tan_xfov = tan(xfov);
  RNScalar tan_yfov = tan(yfov);
  this->fx = (tan_xfov != 0) ? 0.5 * w / tan(xfov) : 0;
  this->fy = (tan_yfov != 0) ? 0.5 * h / tan(yfov) : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, 0x8(%rsp)
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xfe10a(%rip), %rax     # 0x12f3a8
movq %rax, (%rdi)
leaq 0x8(%rdi), %r12
leaq 0x8(%rsi), %r13
addq $0x50, %rsi
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0x864ac
leaq 0x38(%r14), %rcx
movsd 0x68(%r14), %xmm0
movsd 0x70(%r14), %xmm1
movsd 0x78(%r14), %xmm2
movsd 0x80(%r14), %xmm3
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x6b818
leaq 0x150(%rbx), %rdi
movq %r13, %rsi
callq 0x714b6
leaq 0x1d8(%rbx), %r12
movq 0xa0(%r14), %rax
movq %rax, %xmm0
movq %rax, 0x1d0(%rbx)
xorps %xmm1, %xmm1
cvtdq2pd %xmm0, %xmm0
mulpd 0xada81(%rip), %xmm0    # 0xdeda0
movups %xmm1, 0x1d8(%rbx)
movupd %xmm0, 0x1e8(%rbx)
movups 0x78(%r14), %xmm0
movups %xmm0, 0x1f8(%rbx)
movq %r15, 0x208(%rbx)
movl 0x8(%rsp), %eax
movl %eax, 0x210(%rbx)
movsd 0x68(%r14), %xmm0
movsd 0x70(%r14), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x18(%rsp)
callq 0x132d0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x132d0
movapd %xmm0, %xmm1
xorpd %xmm0, %xmm0
movsd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
xorpd %xmm2, %xmm2
jne 0x31391
jnp 0x313cd
xorps %xmm0, %xmm0
cvtsi2sdl 0x1d0(%rbx), %xmm0
mulsd 0xacd9c(%rip), %xmm0    # 0xde140
movsd %xmm0, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
movsd %xmm1, (%rsp)
callq 0x132d0
movsd 0x10(%rsp), %xmm2
movsd (%rsp), %xmm1
divsd %xmm0, %xmm2
xorpd %xmm0, %xmm0
movsd %xmm2, (%r12)
ucomisd %xmm0, %xmm1
jne 0x313db
jnp 0x3140b
xorps %xmm0, %xmm0
cvtsi2sdl 0x1d4(%rbx), %xmm0
mulsd 0xacd52(%rip), %xmm0    # 0xde140
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x132d0
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movsd %xmm0, 0x1e0(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r12, %rdi
callq 0x6ede0
movq %rbx, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelViewConstraint::Check(gaps::R3Point const&) const
int R3SurfelViewConstraint::
Check(const R3Point& point) const
{
  // Transform into camera coordinates (z is negative)
  R3Point camera_point = world_to_camera * point;
  RNScalar depth = -camera_point.Z();

  // Check if z is too near or far
  if (depth < neardist) return R3_SURFEL_CONSTRAINT_FAIL;
  if (depth > fardist) return R3_SURFEL_CONSTRAINT_FAIL;

  // Compute image position
  int ix = (int) (cx + fx*camera_point.X()/depth);
  int iy = (int) (cy + fy*camera_point.Y()/depth);

  // Check image position
  if (must_be_inside_frustum) {
    // Return fail if outside
    if ((ix < 0) || (ix >= w)) return R3_SURFEL_CONSTRAINT_FAIL;
    if ((iy < 0) || (iy >= h)) return R3_SURFEL_CONSTRAINT_FAIL;
  }
  else {
    // Snap to closest pixel on boundary
    if (ix < 0) ix = 0;
    if (ix >= w) ix = w-1;
    if (iy < 0) iy = 0;
    if (iy >= h) iy = h-1;
  }

  // Check if point is masked
  if (image_mask) {
    RNScalar mask_value = image_mask->GridValue(ix, iy);
    if (mask_value == R2_GRID_UNKNOWN_VALUE) return R3_SURFEL_CONSTRAINT_FAIL;
    if (mask_value == 0.0) return R3_SURFEL_CONSTRAINT_FAIL;
  }
  
  // Passed all tests
  return R3_SURFEL_CONSTRAINT_PASS;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rdx
movq %rdi, %rbx
leaq 0x150(%rdi), %rsi
movq %rsp, %r14
movq %r14, %rdi
callq 0x7514e
movsd 0x10(%r14), %xmm0
movapd 0xacad7(%rip), %xmm1    # 0xde3a0
xorpd %xmm0, %xmm1
movsd 0x1f8(%rbx), %xmm2
xorl %eax, %eax
ucomisd %xmm1, %xmm2
ja 0x319e6
ucomisd 0x200(%rbx), %xmm1
ja 0x319e6
movupd 0x1e8(%rbx), %xmm1
movupd 0x1d8(%rbx), %xmm2
mulpd (%rsp), %xmm2
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm2
subpd %xmm2, %xmm1
cvttpd2dq %xmm1, %xmm0
cmpl $0x0, 0x210(%rbx)
movl 0x1d0(%rbx), %ecx
je 0x3195c
movd %xmm0, %edx
testl %edx, %edx
setns %sil
cmpl %edx, %ecx
setg %cl
andb %sil, %cl
cmpb $0x1, %cl
jne 0x319e6
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %ecx
testl %ecx, %ecx
js 0x319e6
cmpl %ecx, 0x1d4(%rbx)
jg 0x31998
jmp 0x319e6
xorpd %xmm1, %xmm1
movdqa %xmm0, %xmm2
pcmpgtd %xmm1, %xmm2
pand %xmm0, %xmm2
movd 0x1d4(%rbx), %xmm0
movd %ecx, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
pcmpeqd %xmm3, %xmm3
paddd %xmm1, %xmm3
movdqa %xmm1, %xmm0
pcmpgtd %xmm2, %xmm0
pand %xmm0, %xmm2
pandn %xmm3, %xmm0
por %xmm2, %xmm0
movq 0x208(%rbx), %rcx
testq %rcx, %rcx
je 0x319e1
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %edx
imull 0xc8(%rcx), %edx
movq 0xb8(%rcx), %rcx
movd %xmm0, %esi
addl %edx, %esi
movslq %esi, %rdx
movsd (%rcx,%rdx,8), %xmm0
ucomisd 0xad8cf(%rip), %xmm0    # 0xdf2a0
jne 0x319d5
jnp 0x319e6
pxor %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x319e1
jnp 0x319e6
movl $0x2, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMeshConstraint::R3SurfelMeshConstraint(gaps::R3Mesh*, gaps::R3Affine const&, double)
R3SurfelMeshConstraint::
R3SurfelMeshConstraint(R3Mesh *mesh, const R3Affine& surfels_to_mesh, RNLength max_distance)
  : mesh(mesh),
    surfels_to_mesh(surfels_to_mesh),
    max_distance(max_distance),
    tree(NULL)
{
  // Just checking
  assert(mesh);
  tree = new R3MeshSearchTree(mesh);
  assert(tree);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
leaq 0xfd9ed(%rip), %rax     # 0x12f3f8
movq %rax, (%rdi)
movq %rsi, 0x8(%rdi)
leaq 0x10(%rdi), %rbx
leaq 0xfffdb(%rip), %rax     # 0x1319f8
addq $0x10, %rax
movq %rax, 0x10(%rdi)
addq $0x18, %rdi
leaq 0x8(%rdx), %rsi
callq 0x73052
leaq 0x98(%r14), %rdi
leaq 0x88(%r12), %rsi
callq 0x73052
movq 0x108(%r12), %rax
movq %rax, 0x118(%r14)
movsd (%rsp), %xmm0
movsd %xmm0, 0x120(%r14)
movq $0x0, 0x128(%r14)
movl $0x18, %edi
callq 0x134e0
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x459f8
movq %r12, 0x128(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movl $0x18, %esi
movq %r12, %rdi
callq 0x134f0
jmp 0x31aae
movq %rax, %r14
movq %rbx, %rdi
callq 0x70d14
jmp 0x31ac3
movq %rax, %r14
movq %rbx, %rdi
callq 0x7139c
movq %r14, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMeshConstraint::Check(gaps::R3Box const&) const
int R3SurfelMeshConstraint::
Check(const R3Box& box) const
{
  // Return whether any point in box can satisfy constraint
  R3Box transformed_box = box;
  transformed_box.Transform(surfels_to_mesh);
  RNLength distance = R3Distance(transformed_box, mesh->BBox());
  if (distance > max_distance) return R3_SURFEL_CONSTRAINT_FAIL;
  return R3_SURFEL_CONSTRAINT_MAYBE;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x6df88
leaq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x6ecac
movl $0xf8, %esi
addq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x52931
xorl %ebp, %ebp
ucomisd 0x120(%rbx), %xmm0
setbe %bpl
leaq 0x8(%rsp), %rdi
callq 0x6ede0
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x31b86
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6ede0
movq %rbx, %rdi
callq 0x138b0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMeshConstraint::Check(gaps::R3Point const&) const
int R3SurfelMeshConstraint::
Check(const R3Point& point) const
{
  // Check mesh
  if (!mesh) return R3_SURFEL_CONSTRAINT_FAIL;

  // Transform position
  R3Point transformed_point = point;
  transformed_point.Transform(surfels_to_mesh);

  // Check if closest point is within max_distance
  R3MeshIntersection closest;
  tree->FindClosest(transformed_point, closest, 0, max_distance);
  if (closest.type == R3_MESH_NULL_TYPE) return R3_SURFEL_CONSTRAINT_FAIL;
  return R3_SURFEL_CONSTRAINT_PASS;
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x31c07
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x84d8e
leaq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x8569a
leaq 0x38(%rsp), %rdi
callq 0x84d7c
movq 0x128(%rbx), %rdi
movsd 0x120(%rbx), %xmm1
leaq 0x18(%rsp), %rbx
xorps %xmm0, %xmm0
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x4744e
xorl %eax, %eax
cmpl $0x0, (%rbx)
setne %al
addl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelObjectConstraint::Check(gaps::R3SurfelObject const*) const
int R3SurfelObjectConstraint::
Check(const R3SurfelObject *object) const
{
  // Return whether surfel satisfies constraint
  int status = R3_SURFEL_CONSTRAINT_PASS;
  if (!object) status = R3_SURFEL_CONSTRAINT_FAIL;
  else if (target_object && (object != target_object)) status = R3_SURFEL_CONSTRAINT_FAIL;
  if (converse) {
    if (status == R3_SURFEL_CONSTRAINT_FAIL) status = R3_SURFEL_CONSTRAINT_PASS;
    else status = R3_SURFEL_CONSTRAINT_FAIL;
  }
  return status;
}

// Assembly:
testq %rsi, %rsi
je 0x31c42
movq 0x8(%rdi), %rax
testq %rax, %rax
setne %cl
cmpq %rsi, %rax
setne %dl
andb %cl, %dl
movzbl %dl, %eax
xorb $0x1, %dl
movzbl %dl, %ecx
addl %ecx, %ecx
addl %eax, %eax
jmp 0x31c49
xorl %ecx, %ecx
movl $0x2, %eax
cmpl $0x0, 0x10(%rdi)
cmovel %ecx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelLabelConstraint::Check(gaps::R3SurfelObject const*) const
int R3SurfelLabelConstraint::
Check(const R3SurfelObject *object) const
{
  // Return whether surfel satisfies constraint
  int status = R3_SURFEL_CONSTRAINT_PASS;
  if (!object) status = R3_SURFEL_CONSTRAINT_FAIL;
  else {
    R3SurfelLabel *label = object->CurrentLabel();
    if (!label) status = R3_SURFEL_CONSTRAINT_FAIL;
    else {
      if (target_label && (label != target_label)) status = R3_SURFEL_CONSTRAINT_FAIL;
    }
  }
  if (converse) {
    if (status == R3_SURFEL_CONSTRAINT_FAIL) status = R3_SURFEL_CONSTRAINT_PASS;
    else status = R3_SURFEL_CONSTRAINT_FAIL;
  }
  return status;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
testq %rsi, %rsi
je 0x31ce9
movq %rsi, %rdi
callq 0x1791a
testq %rax, %rax
je 0x31ce9
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
sete %dl
cmpq %rcx, %rax
sete %al
orb %dl, %al
movzbl %al, %ebp
addl %ebp, %ebp
xorl %eax, %eax
testl %ebp, %ebp
sete %al
addl %eax, %eax
cmpl $0x0, 0x10(%rbx)
cmovel %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelBoundaryConstraint::Check(gaps::R3SurfelBlock const*, gaps::R3Surfel const*) const
int R3SurfelBoundaryConstraint::
Check(const R3SurfelBlock *block, const R3Surfel *surfel) const
{
  // Return whether surfel satisfies constraint
  if (include_interior && !(surfel->Flags() & R3_SURFEL_BOUNDARY_FLAGS)) return R3_SURFEL_CONSTRAINT_PASS;
  if (include_silhouette && surfel->IsOnSilhouetteBoundary()) return R3_SURFEL_CONSTRAINT_PASS;
  if (include_shadow && surfel->IsOnShadowBoundary()) return R3_SURFEL_CONSTRAINT_PASS;
  if (include_border && surfel->IsOnBorderBoundary()) return R3_SURFEL_CONSTRAINT_PASS;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
cmpl $0x0, 0x8(%rdi)
je 0x31d78
testb $0x30, 0x2f(%rdx)
je 0x31dbc
cmpl $0x0, 0x10(%rdi)
je 0x31d8e
movb 0x2f(%rdx), %cl
andb $0x30, %cl
movl $0x2, %eax
cmpb $0x10, %cl
je 0x31dbb
cmpl $0x0, 0x14(%rdi)
je 0x31da4
movb 0x2f(%rdx), %cl
andb $0x30, %cl
movl $0x2, %eax
cmpb $0x20, %cl
je 0x31dbb
cmpl $0x0, 0xc(%rdi)
je 0x31db9
movb 0x2f(%rdx), %cl
notb %cl
movl $0x2, %eax
testb $0x30, %cl
je 0x31dbb
xorl %eax, %eax
retq
movl $0x2, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelSourceConstraint::Check(gaps::R3SurfelBlock const*, gaps::R3Surfel const*) const
int R3SurfelSourceConstraint::
Check(const R3SurfelBlock *block, const R3Surfel *surfel) const
{
  // Return whether surfel satisfies constraint
  if (include_terrestrial && surfel->IsTerrestrial()) return R3_SURFEL_CONSTRAINT_PASS;
  if (include_aerial && surfel->IsAerial()) return R3_SURFEL_CONSTRAINT_PASS;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
cmpl $0x0, 0xc(%rdi)
je 0x31edd
movl $0x2, %eax
testb $0x2, 0x2f(%rdx)
je 0x31ef0
cmpl $0x0, 0x8(%rdi)
je 0x31eee
movl $0x2, %eax
testb $0x2, 0x2f(%rdx)
jne 0x31ef0
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMultiConstraint::Check(gaps::R3SurfelObject const*) const
int R3SurfelMultiConstraint::
Check(const R3SurfelObject *object) const
{
  // Initialize return status 
  int status = R3_SURFEL_CONSTRAINT_PASS;

  // Check whether all constraints are met
  for (int i = 0; i < constraints.NEntries(); i++) {
    const R3SurfelConstraint *constraint = constraints.Kth(i);
    int s = constraint->Check(object);
    if (s == R3_SURFEL_CONSTRAINT_FAIL) return R3_SURFEL_CONSTRAINT_FAIL;
    else if (s == R3_SURFEL_CONSTRAINT_MAYBE) status = R3_SURFEL_CONSTRAINT_MAYBE;
  }

  // Return how all constraints are met
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x14(%rdi)
jle 0x31fdd
movq %rsi, %r14
movq %rdi, %r15
movl $0x2, %ebx
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x10(%rax)
testl %eax, %eax
je 0x31fe4
cmpl $0x1, %eax
cmovel %eax, %ebx
incq %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jl 0x31fb4
jmp 0x31fe6
movl $0x2, %ebx
jmp 0x31fe6
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMultiConstraint::Check(gaps::R3SurfelNode const*) const
int R3SurfelMultiConstraint::
Check(const R3SurfelNode *node) const
{
  // Initialize return status 
  int status = R3_SURFEL_CONSTRAINT_PASS;

  // Check whether all constraints are met
  for (int i = 0; i < constraints.NEntries(); i++) {
    const R3SurfelConstraint *constraint = constraints.Kth(i);
    int s = constraint->Check(node);
    if (s == R3_SURFEL_CONSTRAINT_FAIL) return R3_SURFEL_CONSTRAINT_FAIL;
    else if (s == R3_SURFEL_CONSTRAINT_MAYBE) status = R3_SURFEL_CONSTRAINT_MAYBE;
  }

  // Return how all constraints are met
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x14(%rdi)
jle 0x32039
movq %rsi, %r14
movq %rdi, %r15
movl $0x2, %ebx
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
testl %eax, %eax
je 0x32040
cmpl $0x1, %eax
cmovel %eax, %ebx
incq %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jl 0x32010
jmp 0x32042
movl $0x2, %ebx
jmp 0x32042
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMultiConstraint::Check(gaps::R3SurfelBlock const*) const
int R3SurfelMultiConstraint::
Check(const R3SurfelBlock *block) const
{
  // Initialize return status 
  int status = R3_SURFEL_CONSTRAINT_PASS;

  // Check whether all constraints are met
  for (int i = 0; i < constraints.NEntries(); i++) {
    const R3SurfelConstraint *constraint = constraints.Kth(i);
    int s = constraint->Check(block);
    if (s == R3_SURFEL_CONSTRAINT_FAIL) return R3_SURFEL_CONSTRAINT_FAIL;
    else if (s == R3_SURFEL_CONSTRAINT_MAYBE) status = R3_SURFEL_CONSTRAINT_MAYBE;
  }

  // Return how all constraints are met
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x14(%rdi)
jle 0x32095
movq %rsi, %r14
movq %rdi, %r15
movl $0x2, %ebx
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x20(%rax)
testl %eax, %eax
je 0x3209c
cmpl $0x1, %eax
cmovel %eax, %ebx
incq %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jl 0x3206c
jmp 0x3209e
movl $0x2, %ebx
jmp 0x3209e
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMultiConstraint::Check(gaps::R3SurfelBlock const*, gaps::R3Surfel const*) const
int R3SurfelMultiConstraint::
Check(const R3SurfelBlock *block, const R3Surfel *surfel) const
{
  // Check whether all constraints are met
  for (int i = 0; i < constraints.NEntries(); i++) {
    const R3SurfelConstraint *constraint = constraints.Kth(i);
    if (!constraint->Check(block, surfel)) return R3_SURFEL_CONSTRAINT_FAIL;
  }

  // Return how all constraints are met
  return R3_SURFEL_CONSTRAINT_PASS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl $0x2, %ebx
cmpl $0x0, 0x14(%rdi)
jle 0x320f6
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %r13d, %r13d
movq 0x8(%r12), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r14, %rdx
callq *0x28(%rax)
testl %eax, %eax
je 0x320f4
incq %r13
movslq 0x14(%r12), %rax
cmpq %rax, %r13
jl 0x320cc
jmp 0x320f6
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMultiConstraint::Check(gaps::R3Box const&) const
int R3SurfelMultiConstraint::
Check(const R3Box& box) const
{
  // Initialize return status 
  int status = R3_SURFEL_CONSTRAINT_PASS;

  // Check whether all constraints are met
  for (int i = 0; i < constraints.NEntries(); i++) {
    const R3SurfelConstraint *constraint = constraints.Kth(i);
    int s = constraint->Check(box);
    if (s == R3_SURFEL_CONSTRAINT_FAIL) return R3_SURFEL_CONSTRAINT_FAIL;
    else if (s == R3_SURFEL_CONSTRAINT_MAYBE) status = R3_SURFEL_CONSTRAINT_MAYBE;
  }

  // Return how all constraints are met
  return status;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x14(%rdi)
jle 0x32147
movq %rsi, %r14
movq %rdi, %r15
movl $0x2, %ebx
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x30(%rax)
testl %eax, %eax
je 0x3214e
cmpl $0x1, %eax
cmovel %eax, %ebx
incq %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jl 0x3211e
jmp 0x32150
movl $0x2, %ebx
jmp 0x32150
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelMultiConstraint::Check(gaps::R3Point const&) const
int R3SurfelMultiConstraint::
Check(const R3Point& point) const
{
  // Check whether all constraints are met
  for (int i = 0; i < constraints.NEntries(); i++) {
    const R3SurfelConstraint *constraint = constraints.Kth(i);
    if (!constraint->Check(point)) return R3_SURFEL_CONSTRAINT_FAIL;
  }

  // All constraints are met
  return R3_SURFEL_CONSTRAINT_PASS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl $0x2, %ebx
cmpl $0x0, 0x14(%rdi)
jle 0x3219f
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x38(%rax)
testl %eax, %eax
je 0x3219d
incq %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jl 0x3217a
jmp 0x3219f
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPoint.cpp
// Function: gaps::R3SurfelPoint::R3SurfelPoint(gaps::R3SurfelBlock*, int)
R3SurfelPoint::
R3SurfelPoint(R3SurfelBlock *block, int surfel_index)
  : block(block),
    surfel(NULL)
{
  // Update block reference count
  if (block && block->Database()) block->Database()->ReadBlock(block);

  // Find surfel
  surfel = block->Surfel(surfel_index);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, (%rdi)
movq $0x0, 0x8(%rdi)
testq %rsi, %rsi
je 0x32458
movq 0x98(%r14), %rdi
testq %rdi, %rdi
je 0x32458
cmpl $0x0, 0xb4(%r14)
jne 0x32451
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
movl 0x28(%rdi), %ecx
movq %r14, %rsi
callq *0x88(%rax)
testl %eax, %eax
je 0x32458
incl 0xb4(%r14)
movslq %ebp, %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq (%r14), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPoint.cpp
// Function: gaps::R3SurfelPoint::Copy(gaps::R3SurfelPoint const*)
void R3SurfelPoint::
Copy(const R3SurfelPoint *point)
{
  // Update block reference counts
  if (this->block != point->block) {
    if (this->block && this->block->Database()) this->block->Database()->ReleaseBlock(this->block);
    if (point->block && point->block->Database()) point->block->Database()->ReadBlock(point->block);
  }

  // Copy block and surfel
  this->block = point->block;
  this->surfel = point->surfel;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r15
cmpq (%rsi), %r15
je 0x325ba
testq %r15, %r15
je 0x3257e
movq 0x98(%r15), %r12
testq %r12, %r12
je 0x3257e
cmpl $0x1, 0xb4(%r15)
jne 0x32549
movq (%r12), %rax
movq 0x8(%r12), %rdx
movl 0x28(%r12), %ecx
movq %r12, %rdi
movq %r15, %rsi
callq *0x90(%rax)
testl %eax, %eax
je 0x3257e
decl 0xb4(%r15)
jne 0x3257e
testb $0x2, 0x89(%r15)
je 0x3257e
movq (%r12), %rax
movq %r12, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %r15, %rdi
callq 0x2ce2e
movl $0xc8, %esi
movq %r15, %rdi
callq 0x134f0
movq (%r14), %r15
testq %r15, %r15
je 0x325ba
movq 0x98(%r15), %rdi
testq %rdi, %rdi
je 0x325ba
cmpl $0x0, 0xb4(%r15)
jne 0x325b3
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
movl 0x28(%rdi), %ecx
movq %r15, %rsi
callq *0x88(%rax)
testl %eax, %eax
je 0x325ba
incl 0xb4(%r15)
movups (%r14), %xmm0
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPoint.cpp
// Function: gaps::R3SurfelPoint::Reset(gaps::R3SurfelBlock*, gaps::R3Surfel const*)
void R3SurfelPoint::
Reset(R3SurfelBlock *block, const R3Surfel *surfel)
{
  // Update block reference counts
  if (this->block != block) {
    if (this->block && this->block->Database()) this->block->Database()->ReleaseBlock(this->block);
    if (block && block->Database()) block->Database()->ReadBlock(block);
  }

  // Copy block and surfel
  this->block = block;
  this->surfel = surfel;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %r12
cmpq %rsi, %r12
je 0x32695
testq %r12, %r12
je 0x3265c
movq 0x98(%r12), %r13
testq %r13, %r13
je 0x3265c
cmpl $0x1, 0xb4(%r12)
jne 0x32625
movq (%r13), %rax
movq 0x8(%r13), %rdx
movl 0x28(%r13), %ecx
movq %r13, %rdi
movq %r12, %rsi
callq *0x90(%rax)
testl %eax, %eax
je 0x3265c
decl 0xb4(%r12)
jne 0x3265c
testb $0x2, 0x89(%r12)
je 0x3265c
movq (%r13), %rax
movq %r13, %rdi
movq %r12, %rsi
callq *0x18(%rax)
movq %r12, %rdi
callq 0x2ce2e
movl $0xc8, %esi
movq %r12, %rdi
callq 0x134f0
testq %r15, %r15
je 0x32695
movq 0x98(%r15), %rdi
testq %rdi, %rdi
je 0x32695
cmpl $0x0, 0xb4(%r15)
jne 0x3268e
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
movl 0x28(%rdi), %ecx
movq %r15, %rsi
callq *0x88(%rax)
testl %eax, %eax
je 0x32695
incl 0xb4(%r15)
movq %r15, (%r14)
movq %rbx, 0x8(%r14)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPoint.cpp
// Function: gaps::R3SurfelPoint::Draw(gaps::RNFlags) const
void R3SurfelPoint::
Draw(RNFlags flags) const
{
  // Draw surfel
  RNGrfxBegin(RN_GRFX_POINTS);
  if (flags[R3_SURFEL_COLOR_DRAW_FLAG]) RNLoadRgb(Color());
  R3LoadPoint(Position().Coords());
  RNGrfxEnd();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorl %edi, %edi
callq 0x13130
testb $0x1, %r14b
je 0x32941
movq 0x8(%rbx), %rdi
addq $0x2c, %rdi
callq 0x13660
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cvtss2sd (%rcx), %xmm0
addsd 0x10(%rax), %xmm0
cvtss2sd 0x4(%rcx), %xmm1
addsd 0x18(%rax), %xmm1
cvtss2sd 0x8(%rcx), %xmm2
addsd 0x20(%rax), %xmm2
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x84d7e
movq %rbx, %rdi
callq 0x13150
callq 0x136a0
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPointSet.cpp
// Function: gaps::R3SurfelPointSet::Centroid() const
R3Point R3SurfelPointSet::
Centroid(void) const
{
  // Return centroid of set
  R3Point sum(0, 0, 0);
  if (npoints == 0) return sum;
  for (int i = 0; i < npoints; i++) {
    R3SurfelPoint& point = points[i];
    sum[0] += point.X();
    sum[1] += point.Y();
    sum[2] += point.Z();
  }
  return R3Point(sum[0]/npoints, sum[1]/npoints, sum[2]/npoints); 
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
callq 0x84d7e
movl 0x10(%r14), %eax
testq %rax, %rax
je 0x32c2c
testl %eax, %eax
jle 0x32bfe
movq 0x8(%r14), %rcx
movapd (%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %rax, %rdx
shlq $0x4, %rdx
xorl %esi, %esi
movq 0x8(%rcx,%rsi), %rdi
cvtps2pd (%rdi), %xmm2
movq (%rcx,%rsi), %r8
movupd 0x10(%r8), %xmm3
addpd %xmm2, %xmm3
addpd %xmm3, %xmm0
xorps %xmm2, %xmm2
cvtss2sd 0x8(%rdi), %xmm2
addsd 0x20(%r8), %xmm2
addsd %xmm2, %xmm1
movsd %xmm1, 0x10(%rsp)
addq $0x10, %rsi
cmpq %rsi, %rdx
jne 0x32bbe
movapd %xmm0, (%rsp)
xorps %xmm3, %xmm3
cvtsi2sd %eax, %xmm3
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
divsd %xmm3, %xmm0
divsd %xmm3, %xmm1
movsd 0x10(%rsp), %xmm2
divsd %xmm3, %xmm2
movq %rbx, %rdi
callq 0x84d7e
jmp 0x32c37
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x84d8e
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPointSet.cpp
// Function: gaps::R3SurfelPointSet::InsertPoints(gaps::R3SurfelBlock*)
void R3SurfelPointSet::
InsertPoints(R3SurfelBlock *block)
{
  // Check block
  if (block->NSurfels() == 0) return;

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

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

  // Allocate space for points
  AllocatePoints(npoints + block->NSurfels());

  // Read block
  if (block->database) block->database->ReadBlock(block);

  // Copy surfels
  for (int i = 0; i < block->NSurfels(); i++) {
    const R3Surfel *surfel = block->Surfel(i);
    points[npoints].Reset(block, surfel);
    npoints++;
  }

  // Release block
  if (block->database) block->database->ReleaseBlock(block);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, 0x8(%rsi)
je 0x3314e
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rdi), %r15
movq %rsi, %rdi
callq 0x2cfc6
movq %r15, %rdi
movq %rax, %rsi
callq 0x6ea70
movq %rbx, %rdi
callq 0x2d262
movsd (%rax), %xmm0
movsd 0x50(%r14), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x3307b
movsd %xmm0, 0x50(%r14)
movsd 0x8(%rax), %xmm0
ucomisd 0x58(%r14), %xmm0
jbe 0x3308e
movsd %xmm0, 0x58(%r14)
movl 0x8(%rbx), %esi
addl 0x10(%r14), %esi
movq (%r14), %rax
movq %r14, %rdi
callq *0x80(%rax)
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x330d3
cmpl $0x0, 0xb4(%rbx)
jne 0x330cd
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
movl 0x28(%rdi), %ecx
movq %rbx, %rsi
callq *0x88(%rax)
testl %eax, %eax
je 0x330d3
incl 0xb4(%rbx)
cmpl $0x0, 0x8(%rbx)
jle 0x3310d
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rbx), %rdx
addq %r15, %rdx
movslq 0x10(%r14), %rdi
shlq $0x4, %rdi
addq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x325ce
incl 0x10(%r14)
incq %r12
movslq 0x8(%rbx), %rax
addq $0x30, %r15
cmpq %rax, %r12
jl 0x330df
movq 0x98(%rbx), %r14
testq %r14, %r14
je 0x3314e
cmpl $0x1, 0xb4(%rbx)
jne 0x3313d
movq (%r14), %rax
movq 0x8(%r14), %rdx
movl 0x28(%r14), %ecx
movq %r14, %rdi
movq %rbx, %rsi
callq *0x90(%rax)
testl %eax, %eax
je 0x3314e
decl 0xb4(%rbx)
jne 0x3314e
testb $0x2, 0x89(%rbx)
jne 0x3315a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x18(%rax)
movq %rbx, %rdi
callq 0x2ce2e
movl $0xc8, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x134f0