LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2cfdc
callq 0x136a0
andq $0x0, (%rbx)
andl $0x0, 0x8(%rbx)
leaq 0x10(%rbx), %rdi
leaq 0x4f96a1(%rip), %rsi    # 0x526690
callq 0x784a6
leaq 0x28(%rbx), %rdi
leaq 0xf89e9(%rip), %rsi     # 0x1259e8
callq 0x177ee
xorps %xmm0, %xmm0
movhps 0x9b15a(%rip), %xmm0    # xmm0 = xmm0[0,1],mem[0,1]
movups %xmm0, 0x60(%rbx)
movabsq $-0x3810000020000000, %rax # imm = 0xC7EFFFFFE0000000
movq %rax, 0x70(%rbx)
orl $-0x1, 0x78(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x7c(%rbx)
movups %xmm0, 0x8c(%rbx)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x9c(%rbx)
movups %xmm0, 0xa8(%rbx)
movups %xmm0, 0xb4(%rbx)
testl %ebp, %ebp
jle 0x2d081
movl %ebp, 0x8(%rbx)
movl %ebp, %eax
imulq $0x30, %rax, %r14
movq %r14, %rdi
callq 0x13030
movq %rax, %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
callq 0x29118
addq $0x30, %r12
cmpq %r12, %r14
jne 0x2d06c
movq %r15, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x139f0
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2d42d
subq %rcx, %rdx
pushq $0x30
popq %r8
movq %rdx, %rax
cqto
idivq %r8
cltq
jmp 0x2d42f
xorl %eax, %eax
movsd 0x8(%rdi), %xmm0
movsd 0x10(%rdi), %xmm1
ucomisd %xmm1, %xmm0
ja 0x2d463
imulq $0x30, %rax, %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
pushq $0x2
popq %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0xf1b13(%rip), %rax     # 0x11f048
movq %rax, (%rdi)
movupd (%rsi), %xmm1
cvtpd2ps %xmm1, %xmm1
movlpd %xmm1, 0x8(%rdi)
cvtsd2ss 0x10(%rsi), %xmm1
movss %xmm1, 0x10(%rdi)
callq 0x13990
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x14(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelOrientedBoxConstraint::Check(gaps::R3Box const&) const
int R3SurfelOrientedBoxConstraint::
Check(const R3Box& query) const
{
  // Return whether box contains/intersects query
  if (R3Contains(box, query)) return R3_SURFEL_CONSTRAINT_PASS;
  else if (R3Intersects(box, query)) return R3_SURFEL_CONSTRAINT_MAYBE;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x48c82
testl %eax, %eax
je 0x2d665
pushq $0x2
popq %rax
jmp 0x2d679
movq %r14, %rdi
movq %rbx, %rsi
callq 0x46b0c
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelSphereConstraint::Check(gaps::R3Box const&) const
int R3SurfelSphereConstraint::
Check(const R3Box& box) const
{
  // Return whether sphere contains/intersects box
  if (R3Contains(sphere, box)) return R3_SURFEL_CONSTRAINT_PASS;
  else if (R3Intersects(sphere, box)) return R3_SURFEL_CONSTRAINT_MAYBE;
  return R3_SURFEL_CONSTRAINT_FAIL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x4906f
testl %eax, %eax
je 0x2d7f7
pushq $0x2
popq %rax
jmp 0x2d80b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x46bb3
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x495f0
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_O2/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 0x4adfc
movapd 0x9aa65(%rip), %xmm2    # 0xc83d0
andpd %xmm0, %xmm2
movsd 0x38(%rbx), %xmm1
ucomisd %xmm2, %xmm1
jae 0x2d98a
ucomisd %xmm1, %xmm0
jbe 0x2d98f
cmpl $0x0, 0x30(%rbx)
je 0x2d98f
pushq $0x2
jmp 0x2d98c
pushq $0x1
popq %rax
jmp 0x2d9a4
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_O2/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 0x497d0
cmpl $0x0, 0x30(%rbx)
movsd 0x38(%rbx), %xmm1
pushq $0x2
popq %rax
je 0x2d9c7
ucomisd %xmm1, %xmm0
ja 0x2d9f4
cmpl $0x0, 0x2c(%rbx)
je 0x2d9df
movapd 0x9a9fb(%rip), %xmm2    # 0xc83d0
andpd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
jae 0x2d9f4
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_O2/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 0x4adbb
xorl %eax, %eax
ucomisd 0x10(%rbx), %xmm0
ja 0x2dbff
movl $0x200, %esi            # imm = 0x200
addq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x4b35f
xorl %eax, %eax
ucomisd 0x10(%rbx), %xmm0
setbe %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 $0x50, %rsp
movq %rdi, %rbx
movsd 0x8(%rsi), %xmm0
movsd 0x10(%rsi), %xmm1
movsd 0x20(%rsi), %xmm2
movsd 0x28(%rsi), %xmm3
leaq 0x28(%rsp), %rdi
callq 0x9101e
movq 0x8(%rbx), %rsi
movq %rsp, %rdi
callq 0x2ed88
leaq 0x28(%rsp), %rdi
movq %rsp, %rsi
xorl %edx, %edx
callq 0x838d9
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movq %rsp, %rdi
callq 0x91792
leaq 0x28(%rsp), %rdi
callq 0x91792
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x91792
jmp 0x2ddf2
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x91792
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xf1462(%rip), %rax     # 0x11f3b8
movq %rax, (%rdi)
leaq 0x8(%rdi), %r12
leaq 0x8(%rsi), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2ee46
leaq 0x150(%rbx), %rdi
movq %r13, %rsi
callq 0x66f9c
leaq 0x1d8(%rbx), %r12
movq 0xa0(%r14), %rax
movq %rax, %xmm0
movq %rax, 0x1d0(%rbx)
xorps %xmm1, %xmm1
cvtdq2pd %xmm0, %xmm0
mulpd 0x9adec(%rip), %xmm0    # 0xc8d90
movups %xmm1, 0x1d8(%rbx)
movupd %xmm0, 0x1e8(%rbx)
movups 0x78(%r14), %xmm0
movups %xmm0, 0x1f8(%rbx)
movq %r15, 0x208(%rbx)
movl %ebp, 0x210(%rbx)
movsd 0x68(%r14), %xmm0
movsd 0x70(%r14), %xmm1
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x20(%rsp)
callq 0x132e0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x132e0
movapd %xmm0, %xmm1
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm2
ucomisd %xmm0, %xmm2
xorpd %xmm2, %xmm2
jne 0x2e014
jnp 0x2e04f
cvtsi2sdl 0x1d0(%rbx), %xmm0
mulsd 0x9a114(%rip), %xmm0    # 0xc8138
movsd %xmm0, 0x18(%rsp)
movsd 0x20(%rsp), %xmm0
movsd %xmm1, 0x8(%rsp)
callq 0x132e0
movsd 0x18(%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm2
xorpd %xmm0, %xmm0
movsd %xmm2, (%r12)
ucomisd %xmm0, %xmm1
jne 0x2e05d
jnp 0x2e08c
cvtsi2sdl 0x1d4(%rbx), %xmm0
mulsd 0x9a0cb(%rip), %xmm0    # 0xc8138
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x132e0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movsd %xmm0, 0x1e0(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r12, %rdi
callq 0x649ae
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelViewConstraint::R3SurfelViewConstraint(gaps::R3SurfelImage const&, double, double, gaps::R2Grid const*, int)
R3SurfelViewConstraint::
R3SurfelViewConstraint(
  const R3SurfelImage& image,
  RNLength neardist, RNLength fardist, 
  const R2Grid *image_mask,
  RNBoolean must_be_inside_frustum)
  : frustum(image.Frustum()),
    world_to_camera(image.Extrinsics()),
    w(image.ImageWidth()), h(image.ImageHeight()),
    fx(image.XFocal()), fy(image.YFocal()),
    cx(image.ImageCenter().X()), cy(image.ImageCenter().Y()),
    neardist(neardist), fardist(fardist),
    image_mask(image_mask),
    must_be_inside_frustum(must_be_inside_frustum)
{
  // Compute default image center
  if (this->cx <= 0) this->cx = 0.5*w;
  if (this->cy <= 0) this->cy = 0.5*h;

  // Compute default near and far distances
  if (this->neardist <= 0) this->neardist = RN_EPSILON;
  if (this->fardist <= 0) this->fardist = RN_INFINITY;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xf12d6(%rip), %rax     # 0x11f3b8
movq %rax, (%rdi)
leaq 0x8(%rdi), %r12
leaq 0xf6b38(%rip), %r13     # 0x124c28
movsd (%r13), %xmm0
leaq 0xf6b3b(%rip), %rax     # 0x124c38
movsd (%rax), %xmm1
movq %r12, %rdi
callq 0x2ee9a
leaq 0x150(%rbx), %rdi
leaq 0x30(%r15), %rsi
callq 0x66f9c
movl 0x98(%r15), %ecx
movl %ecx, 0x1d0(%rbx)
movl 0x9c(%r15), %eax
movl %eax, 0x1d4(%rbx)
movups 0xb0(%r15), %xmm0
movups %xmm0, 0x1d8(%rbx)
movsd 0xa0(%r15), %xmm2
movsd %xmm2, 0x1e8(%rbx)
movsd 0xa8(%r15), %xmm0
movsd %xmm0, 0x1f0(%rbx)
movsd 0x8(%rsp), %xmm4
movsd %xmm4, 0x1f8(%rbx)
movsd 0x10(%rsp), %xmm3
movsd %xmm3, 0x200(%rbx)
movq %r14, 0x208(%rbx)
movl %ebp, 0x210(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
jb 0x2e1ab
cvtsi2sd %ecx, %xmm2
mulsd 0x99f95(%rip), %xmm2    # 0xc8138
movsd %xmm2, 0x1e8(%rbx)
ucomisd %xmm0, %xmm1
jb 0x2e1c5
cvtsi2sd %eax, %xmm0
mulsd 0x99f7b(%rip), %xmm0    # 0xc8138
movsd %xmm0, 0x1f0(%rbx)
xorpd %xmm0, %xmm0
ucomisd %xmm4, %xmm0
jb 0x2e1dd
movsd (%r13), %xmm1
movsd %xmm1, 0x1f8(%rbx)
ucomisd %xmm3, %xmm0
jb 0x2e1f6
leaq 0xf6a4e(%rip), %rax     # 0x124c38
movsd (%rax), %xmm0
movsd %xmm0, 0x200(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r12, %rdi
callq 0x649ae
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x6a31b
movsd 0x10(%r14), %xmm0
movapd 0x99f0f(%rip), %xmm1    # 0xc83a0
xorpd %xmm0, %xmm1
movsd 0x1f8(%rbx), %xmm2
xorl %eax, %eax
ucomisd %xmm1, %xmm2
ja 0x2e5ac
ucomisd 0x200(%rbx), %xmm1
ja 0x2e5ac
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 0x2e524
movd %xmm0, %edx
testl %edx, %edx
setns %sil
cmpl %edx, %ecx
setg %cl
andb %sil, %cl
cmpb $0x1, %cl
jne 0x2e5ac
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %ecx
testl %ecx, %ecx
js 0x2e5ac
cmpl %ecx, 0x1d4(%rbx)
jg 0x2e560
jmp 0x2e5ac
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 0x2e5a9
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 0x9acf7(%rip), %xmm0    # 0xc9290
jne 0x2e59d
jnp 0x2e5ac
pxor %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2e5a9
jnp 0x2e5ac
pushq $0x2
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, %r15
movq %rdi, %r14
leaq 0xf0e3a(%rip), %rax     # 0x11f408
movq %rax, (%rdi)
movq %rsi, 0x8(%rdi)
leaq 0x10(%rdi), %rbx
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x20a04
movsd (%rsp), %xmm0
movsd %xmm0, 0x120(%r14)
andq $0x0, 0x128(%r14)
pushq $0x18
popq %rdi
callq 0x134f0
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x3fe04
movq %r12, 0x128(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
pushq $0x18
popq %rsi
movq %r12, %rdi
callq 0x13500
jmp 0x2e636
movq %rax, %r14
movq %rbx, %rdi
callq 0x6686a
movq %r14, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x63ce6
leaq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x648b6
movl $0xf8, %esi
addq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x4b35f
xorl %ebp, %ebp
ucomisd 0x120(%rbx), %xmm0
setbe %bpl
leaq 0x8(%rsp), %rdi
callq 0x649ae
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x2e6fe
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x649ae
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2e77f
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x781cc
leaq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x78802
leaq 0x38(%rsp), %rdi
callq 0x781ba
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 0x415f2
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_O2/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 0x2e7bf
movq 0x8(%rdi), %rax
testq %rax, %rax
setne %cl
cmpq %rsi, %rax
setne %al
andb %cl, %al
movzbl %al, %ecx
notb %al
movzbl %al, %eax
andl $0x1, %eax
addl %eax, %eax
andl $0x1, %ecx
addl %ecx, %ecx
jmp 0x2e7c4
pushq $0x2
popq %rcx
xorl %eax, %eax
cmpl $0x0, 0x10(%rdi)
cmovnel %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x2e861
movq %rsi, %rdi
callq 0x16d9c
testq %rax, %rax
je 0x2e861
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
sete %dl
cmpq %rcx, %rax
sete %al
orb %dl, %al
je 0x2e861
pushq $0x2
popq %rax
xorl %ecx, %ecx
jmp 0x2e866
pushq $0x2
popq %rcx
xorl %eax, %eax
cmpl $0x0, 0x10(%rbx)
cmovnel %ecx, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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)
pushq $0x2
popq %rax
je 0x2e8e9
testb $0x30, 0x2f(%rdx)
je 0x2e91d
cmpl $0x0, 0x10(%rdi)
je 0x2e8fa
movb 0x2f(%rdx), %cl
andb $0x30, %cl
cmpb $0x10, %cl
je 0x2e91d
cmpl $0x0, 0x14(%rdi)
je 0x2e90b
movb 0x2f(%rdx), %cl
andb $0x30, %cl
cmpb $0x20, %cl
je 0x2e91d
cmpl $0x0, 0xc(%rdi)
je 0x2e91b
movb 0x2f(%rdx), %cl
notb %cl
testb $0x30, %cl
je 0x2e91d
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/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)
pushq $0x2
popq %rax
je 0x2ea23
testb $0x2, 0x2f(%rdx)
je 0x2ea31
cmpl $0x0, 0x8(%rdi)
je 0x2ea2f
testb $0x2, 0x2f(%rdx)
jne 0x2ea31
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rsi, %r14
movq %rdi, %r15
pushq $0x2
popq %rbx
xorl %r12d, %r12d
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jge 0x2eae9
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x10(%rax)
testl %eax, %eax
je 0x2eae7
cmpl $0x1, %eax
cmovel %eax, %ebx
incq %r12
jmp 0x2eabe
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_O2/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
movq %rsi, %r14
movq %rdi, %r15
pushq $0x2
popq %rbx
xorl %r12d, %r12d
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jge 0x2eb37
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x18(%rax)
testl %eax, %eax
je 0x2eb35
cmpl $0x1, %eax
cmovel %eax, %ebx
incq %r12
jmp 0x2eb0c
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_O2/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
movq %rsi, %r14
movq %rdi, %r15
pushq $0x2
popq %rbx
xorl %r12d, %r12d
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jge 0x2eb85
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x20(%rax)
testl %eax, %eax
je 0x2eb83
cmpl $0x1, %eax
cmovel %eax, %ebx
incq %r12
jmp 0x2eb5a
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_O2/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
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %r13d, %r13d
pushq $0x2
popq %rbx
movslq 0x14(%r12), %rax
cmpq %rax, %r13
jge 0x2ebd4
movq 0x8(%r12), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r14, %rdx
callq *0x28(%rax)
incq %r13
testl %eax, %eax
jne 0x2ebac
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rsi, %r14
movq %rdi, %r15
pushq $0x2
popq %rbx
xorl %r12d, %r12d
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jge 0x2ec1f
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x30(%rax)
testl %eax, %eax
je 0x2ec1d
cmpl $0x1, %eax
cmovel %eax, %ebx
incq %r12
jmp 0x2ebf4
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_O2/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
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
pushq $0x2
popq %rbx
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jge 0x2ec65
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x38(%rax)
incq %r12
testl %eax, %eax
jne 0x2ec42
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_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/../../pkgs/R3Shapes/R3PlanarGrid.h
// Function: gaps::R3PlanarGrid::WorldValue(gaps::R3Point const&) const
inline RNScalar R3PlanarGrid::
WorldValue(const R3Point& world_point) const
{ 
  // Return value at position on the plane closest to point given in 3D world coordinates
  R3Point p(world_point);
  p.Transform(transformation);
  return grid.WorldValue(p.X(), p.Y()); 
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x781cc
leaq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x78802
addq $0x130, %rbx            # imm = 0x130
movsd (%r14), %xmm0
movsd 0x8(%r14), %xmm1
movq %rbx, %rdi
callq 0x2ee18
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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)
andq $0x0, 0x8(%rdi)
testq %rsi, %rsi
je 0x2f167
movq 0x98(%r14), %rdi
testq %rdi, %rdi
je 0x2f167
movq %r14, %rsi
callq 0x20a64
movslq %ebp, %rax
imulq $0x30, %rax, %rax
addq (%r14), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
movq (%rsi), %rsi
cmpq %rsi, %rax
je 0x2f1ec
testq %rax, %rax
je 0x2f1cf
movq 0x98(%rax), %rdi
testq %rdi, %rdi
je 0x2f1cf
movq %rax, %rsi
callq 0x20aa0
movq (%r14), %rsi
testq %rsi, %rsi
je 0x2f1ea
movq 0x98(%rsi), %rdi
testq %rdi, %rdi
je 0x2f1ec
callq 0x20a64
movq (%r14), %rsi
jmp 0x2f1ec
xorl %esi, %esi
movq %rsi, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %rsi
cmpq %r15, %rsi
je 0x2f245
testq %rsi, %rsi
je 0x2f22c
movq 0x98(%rsi), %rdi
testq %rdi, %rdi
je 0x2f22c
callq 0x20aa0
testq %r15, %r15
je 0x2f245
movq 0x98(%r15), %rdi
testq %rdi, %rdi
je 0x2f245
movq %r15, %rsi
callq 0x20a64
movq %r15, (%r14)
movq %rbx, 0x8(%r14)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2f4fb
movq 0x8(%rbx), %rdi
addq $0x2c, %rdi
callq 0x13680
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x16310
movq %r14, %rdi
callq 0x13150
callq 0x136d0
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x781bc
movl 0x10(%r14), %eax
testl %eax, %eax
je 0x2f793
movq 0x8(%r14), %rcx
movapd (%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
xorl %edx, %edx
testl %eax, %eax
movl $0x0, %esi
cmovgl %eax, %esi
shlq $0x4, %rsi
cmpq %rdx, %rsi
je 0x2f771
movq (%rcx,%rdx), %rdi
movq 0x8(%rcx,%rdx), %r8
cvtps2pd (%r8), %xmm0
movupd 0x10(%rdi), %xmm3
addpd %xmm0, %xmm3
addpd %xmm3, %xmm1
movapd %xmm1, (%rsp)
cvtss2sd 0x8(%r8), %xmm0
addsd 0x20(%rdi), %xmm0
addsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
addq $0x10, %rdx
jmp 0x2f732
cvtsi2sd %eax, %xmm3
movapd %xmm1, %xmm0
divsd %xmm3, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
divsd %xmm3, %xmm1
divsd %xmm3, %xmm2
movq %rbx, %rdi
callq 0x781bc
jmp 0x2f79e
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x781cc
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2fc00
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rdi), %r15
movq %rsi, %rdi
callq 0x2a720
movq %r15, %rdi
movq %rax, %rsi
callq 0x646fe
leaq 0x50(%r14), %r15
movq %rbx, %rdi
callq 0x2a8a8
movq %r15, %rdi
movq %rax, %rsi
callq 0x177ca
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 0x2fbab
movq %rbx, %rsi
callq 0x20a64
xorl %r15d, %r15d
xorl %r12d, %r12d
movslq 0x8(%rbx), %rax
cmpq %rax, %r12
jge 0x2fbe1
movq (%rbx), %rdx
addq %r15, %rdx
movslq 0x10(%r14), %rdi
shlq $0x4, %rdi
addq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x2f200
incl 0x10(%r14)
incq %r12
addq $0x30, %r15
jmp 0x2fbb1
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x2fc00
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x20aa0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPointSet.cpp
// Function: gaps::R3SurfelPointSet::InsertPoints(gaps::R3SurfelBlock*, gaps::R3SurfelConstraint const&)
void R3SurfelPointSet::
InsertPoints(R3SurfelBlock *block, const R3SurfelConstraint& constraint)
{
  // Check block
  if (block->NSurfels() == 0) return;
  if (!constraint.Check(block->BBox())) return;

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

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

  // Copy points
  for (int i = 0; i < block->NSurfels(); i++) {
    const R3Surfel *surfel = block->Surfel(i);
    if (!constraint.Check(block, surfel)) continue;
    points[npoints].Reset(block, surfel);
    bbox.Union(points[npoints].Position());
    timestamp_range.Union(points[npoints].Timestamp());
    npoints++;
  }

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

// Assembly:
cmpl $0x0, 0x8(%rsi)
je 0x30490
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq %rsi, %rdi
callq 0x2a720
movq (%r14), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq *0x30(%rcx)
testl %eax, %eax
je 0x30482
movl 0x8(%rbx), %esi
addl 0x10(%r15), %esi
movq (%r15), %rax
movq %r15, %rdi
callq *0x80(%rax)
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x303a4
movq %rbx, %rsi
callq 0x20a64
leaq 0x18(%r15), %rax
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq 0x8(%rbx), %rax
cmpq %rax, %r13
jge 0x3046e
movq (%rbx), %rbp
addq %r12, %rbp
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq *0x28(%rax)
testl %eax, %eax
je 0x30462
movslq 0x10(%r15), %rdi
shlq $0x4, %rdi
addq 0x8(%r15), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x2f200
movslq 0x10(%r15), %rsi
shlq $0x4, %rsi
addq 0x8(%r15), %rsi
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0x16310
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x6464c
movq 0x8(%r15), %rcx
movslq 0x10(%r15), %rax
movq %rax, %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %rsi
movq 0x8(%rcx,%rdx), %rcx
cvtss2sd 0xc(%rcx), %xmm0
addsd 0x60(%rsi), %xmm0
movsd 0x50(%r15), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x3044e
movsd %xmm0, 0x50(%r15)
ucomisd 0x58(%r15), %xmm0
jbe 0x3045c
movsd %xmm0, 0x58(%r15)
incl %eax
movl %eax, 0x10(%r15)
incq %r13
addq $0x30, %r12
jmp 0x303b3
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x30482
movq %rbx, %rsi
callq 0x20aa0
addq $0x28, %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/R3SurfelPointSet.cpp
// Function: gaps::R3SurfelPointSet::InsertPoints(gaps::R3SurfelPointSet const*)
void R3SurfelPointSet::
InsertPoints(const R3SurfelPointSet *set)
{
  // Check set
  if (set->NPoints() == 0) return;

  // Check and update bounding box (conservatively)
  bbox.Union(set->BBox());

  // Check and update timestamp range (conservatively)
  timestamp_range.Union(set->TimestampRange());

  // Allocate space for points
  AllocatePoints(npoints + set->NPoints());

  // Copy points
  for (int i = 0; i < set->NPoints(); i++) {
    points[npoints] = set->points[i];
    npoints++;
  }
}

// Assembly:
cmpl $0x0, 0x10(%rsi)
je 0x30676
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x18, %rdi
addq $0x18, %rsi
callq 0x646fe
leaq 0x50(%r14), %rdi
leaq 0x50(%rbx), %rsi
callq 0x177ca
movl 0x10(%rbx), %esi
addl 0x10(%r14), %esi
movq (%r14), %rax
movq %r14, %rdi
callq *0x80(%rax)
xorl %r15d, %r15d
xorl %r12d, %r12d
movslq 0x10(%rbx), %rax
cmpq %rax, %r12
jge 0x3066b
movq 0x8(%rbx), %rsi
addq %r15, %rsi
movslq 0x10(%r14), %rdi
shlq $0x4, %rdi
addq 0x8(%r14), %rdi
callq 0x2f252
incl 0x10(%r14)
incq %r12
addq $0x10, %r15
jmp 0x3063d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelPointSet.cpp
// Function: gaps::R3SurfelPointSet::InsertPoints(gaps::R3SurfelPointSet const*, gaps::R2Box const&)
void R3SurfelPointSet::
InsertPoints(const R3SurfelPointSet *set, const R2Box& constraint_box)
{
  // Check set
  if (set->NPoints() == 0) return;

  // Check and update bounding box (conservatively)
  R3Box intersection_box(constraint_box[0][0], constraint_box[0][1], -FLT_MAX, constraint_box[1][0], constraint_box[1][1], FLT_MAX);
  intersection_box.Intersect(set->BBox());
  if (intersection_box.IsEmpty()) return;
  bbox.Union(intersection_box);

  // Check and update timestamp range (conservatively)
  timestamp_range.Union(set->TimestampRange());

  // Allocate space for points
  AllocatePoints(npoints + set->NPoints());

  // Copy points
  for (int i = 0; i < set->NPoints(); i++) {
    const R3SurfelPoint *point = set->Point(i);
    R3Point position = point->Position();
    if (!R2Intersects(constraint_box, R2Point(position.X(), position.Y()))) continue;
    points[npoints] = *point;
    npoints++;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, 0x8(%rsp)
cmpl $0x0, 0x10(%rsi)
je 0x307cc
movq %rsi, %r14
movsd 0x8(%rdx), %xmm0
movsd 0x10(%rdx), %xmm1
movsd 0x18(%rdx), %xmm3
movq %rdx, 0x10(%rsp)
movsd 0x20(%rdx), %xmm4
leaq 0x18(%rsp), %r12
movsd 0x97ab2(%rip), %xmm2    # 0xc8170
movsd 0x97aa2(%rip), %xmm5    # 0xc8168
movq %r12, %rdi
callq 0x63d86
leaq 0x18(%r14), %rsi
movq %r12, %rdi
callq 0x647fc
movsd 0x20(%rsp), %xmm0
ucomisd 0x38(%rsp), %xmm0
ja 0x307c2
movsd 0x28(%rsp), %xmm0
ucomisd 0x40(%rsp), %xmm0
ja 0x307c2
movsd 0x30(%rsp), %xmm0
ucomisd 0x48(%rsp), %xmm0
ja 0x307c2
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %rdi
leaq 0x18(%rsp), %rsi
callq 0x646fe
movq 0x8(%rsp), %rbx
leaq 0x50(%rbx), %rdi
leaq 0x50(%r14), %rsi
callq 0x177ca
movl 0x10(%r14), %esi
addl 0x10(%rbx), %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x80(%rax)
xorl %r12d, %r12d
leaq 0x68(%rsp), %r15
xorl %r13d, %r13d
movslq 0x10(%r14), %rax
cmpq %rax, %r13
jge 0x307c2
movq 0x8(%r14), %rbp
addq %r12, %rbp
leaq 0x50(%rsp), %rdi
movq %rbp, %rsi
callq 0x16310
movsd 0x50(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movq %r15, %rbx
movq %r15, %rdi
callq 0x93a30
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0x82c3f
testl %eax, %eax
je 0x307b9
movq 0x8(%rsp), %rax
movslq 0x10(%rax), %rdi
shlq $0x4, %rdi
addq 0x8(%rax), %rdi
movq %rbp, %rsi
callq 0x2f252
movq 0x8(%rsp), %rax
incl 0x10(%rax)
incq %r13
addq $0x10, %r12
jmp 0x30753
leaq 0x18(%rsp), %rdi
callq 0x649ae
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x307df
jmp 0x307df
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x649ae
movq %rbx, %rdi
callq 0x138f0