LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::UpdateBBox()
void R3SurfelBlock::
UpdateBBox(void)
{
  // Read block
  if (database) database->ReadBlock(this);

  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < nsurfels; i++) {
    const float *p = surfels[i].PositionPtr();
    bbox.Union(R3Point(p[0], p[1], p[2]));
  }

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

  // Translate bounding box by position_origin
  bbox.Translate(position_origin.Vector());

  // Mark bbox uptodate
  flags.Add(R3_SURFEL_BLOCK_BBOX_UPTODATE_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
testq %rdi, %rdi
je 0x2a762
movq %rbx, %rsi
callq 0x20a64
leaq 0x28(%rbx), %r14
leaq 0xfb27b(%rip), %rsi     # 0x1259e8
movq %r14, %rdi
callq 0x177ee
pushq $0x8
popq %r12
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r13
jge 0x2a7bd
movq (%rbx), %rax
cvtss2sd -0x8(%rax,%r12), %xmm0
cvtss2sd -0x4(%rax,%r12), %xmm1
cvtss2sd (%rax,%r12), %xmm2
movq %r15, %rdi
callq 0x781bc
movq %r14, %rdi
movq %r15, %rsi
callq 0x6464c
incq %r13
addq $0x30, %r12
jmp 0x2a781
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x2a7d1
movq %rbx, %rsi
callq 0x20aa0
leaq 0x10(%rbx), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x2d0b2
movq %r14, %rdi
movq %r15, %rsi
callq 0x64622
orb $0x1, 0x88(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ElevationRange() const
RNInterval R3SurfelBlock::
ElevationRange(void) const
{
  // Initialize elevation range
  RNInterval elevation_range = RNnull_interval;

  // Read block
  if (database) database->ReadBlock((R3SurfelBlock *) this);
  
  // Compute elevation range
  for (int i = 0; i < nsurfels; i++) {
    double elevation = SurfelElevation(i);
    elevation_range.Union(elevation);
  }

  // Release block
  if (database) database->ReleaseBlock((R3SurfelBlock *) this);

  // Return elevation range
  return elevation_range;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4fcfdd(%rip), %rsi    # 0x5277f0
callq 0x9c1ea
movq 0x98(%r14), %rdi
testq %rdi, %rdi
je 0x2a82c
movq %r14, %rsi
callq 0x20a64
movslq 0x8(%r14), %rax
movsd (%rbx), %xmm0
movsd 0x8(%rbx), %xmm1
movq (%r14), %rcx
addq $0x2a, %rcx
xorl %edx, %edx
movsd 0x9e586(%rip), %xmm2    # 0xc8dd0
cmpq %rax, %rdx
jge 0x2a888
movswl (%rcx), %esi
cvtsi2sd %esi, %xmm3
divsd %xmm2, %xmm3
cvtsd2ss %xmm3, %xmm3
cvtss2sd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jbe 0x2a870
movsd %xmm3, (%rbx)
movapd %xmm3, %xmm0
ucomisd %xmm1, %xmm3
jbe 0x2a87f
movsd %xmm3, 0x8(%rbx)
movapd %xmm3, %xmm1
incq %rdx
addq $0x30, %rcx
jmp 0x2a84a
movq 0x98(%r14), %rdi
testq %rdi, %rdi
je 0x2a89c
movq %r14, %rsi
callq 0x20aa0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::UpdateTimestampRange()
void R3SurfelBlock::
UpdateTimestampRange(void)
{
  // Read block
  if (database) database->ReadBlock(this);

  // Update timestamp range
  timestamp_range = RNnull_interval;
  for (int i = 0; i < nsurfels; i++) {
    float t = surfels[i].Timestamp();
    timestamp_range.Union(t);
  }

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

  // Translate bounding box by timestamp origin
  timestamp_range += timestamp_origin;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
testq %rdi, %rdi
je 0x2a8dc
movq %rbx, %rsi
callq 0x20a64
leaq 0x68(%rbx), %rax
leaq 0x4fcf09(%rip), %rcx    # 0x5277f0
movups (%rcx), %xmm0
movups %xmm0, 0x68(%rbx)
movslq 0x8(%rbx), %rcx
movq (%rbx), %rdx
movupd 0x68(%rbx), %xmm0
addq $0xc, %rdx
xorl %esi, %esi
cmpq %rcx, %rsi
jge 0x2a943
cvtss2sd (%rdx), %xmm2
ucomisd %xmm2, %xmm0
jbe 0x2a919
movsd %xmm2, (%rax)
movapd %xmm2, %xmm1
jmp 0x2a91d
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
ucomisd %xmm0, %xmm2
jbe 0x2a92e
movsd %xmm2, 0x70(%rbx)
jmp 0x2a932
movapd %xmm0, %xmm2
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
incq %rsi
addq $0x30, %rdx
movapd %xmm1, %xmm0
jmp 0x2a900
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x2a95c
movq %rbx, %rsi
callq 0x20aa0
movupd 0x68(%rbx), %xmm0
movupd 0x60(%rbx), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
addpd %xmm0, %xmm1
movupd %xmm1, 0x68(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::UpdateIdentifierRange()
void R3SurfelBlock::
UpdateIdentifierRange(void)
{
  // Read block
  if (database) database->ReadBlock(this);

  // Update max identifier
  min_identifier = UINT_MAX;
  max_identifier = 0;
  for (int i = 0; i < nsurfels; i++) {
    unsigned int id = surfels[i].Identifier();
    if (id < min_identifier) min_identifier = id;
    if (id > max_identifier) max_identifier = id;
  }

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

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
testq %rdi, %rdi
je 0x2a99e
movq %rbx, %rsi
callq 0x20a64
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x78(%rbx)
movl 0x8(%rbx), %edx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
movq (%rbx), %rcx
imulq $0x30, %rdx, %rdx
pushq $-0x1
popq %rsi
xorl %edi, %edi
cmpq %rax, %rdx
je 0x2a9e5
movl 0x20(%rcx,%rax), %r8d
cmpl %esi, %r8d
jae 0x2a9d3
movl %r8d, 0x78(%rbx)
movl %r8d, %esi
cmpl %edi, %r8d
jbe 0x2a9df
movl %r8d, 0x7c(%rbx)
movl %r8d, %edi
addq $0x30, %rax
jmp 0x2a9bd
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x2a9fa
movq %rbx, %rsi
popq %rbx
jmp 0x20aa0
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::UpdateResolution()
void R3SurfelBlock::
UpdateResolution(void)
{
  // Initialize resolution
  resolution = 0;

#if 0
  // Estimate resoluton based on surfel radii
  if (nsurfels > 0) {
    // Read block
    if (database) database->ReadBlock(this);

    // Sum surfel radii
    int nsamples = 1000;
    if (nsurfels < nsamples) nsamples = nsurfels;
    int step = nsurfels / nsamples;
    RNLength total_radius = 0;
    for (int i = 0; i < nsamples; i++) {
      R3Surfel *surfel = &surfels[i*step];
      RNLength radius = surfel->Radius();
      total_radius += radius;
    }

    // Resolution is samples / area
    if (RNIsZero(total_radius)) return;
    RNLength average_radius = total_radius / nsamples;
    RNScalar area = RN_PI * average_radius * average_radius;
    resolution = 1.0 / area;

    // Release block
    if (database) database->ReleaseBlock(this);
  }
#else
  // Estimate resolution based on number of surfels per cross-section of bounding box
  R3Box box = BBox();
  int dim = box.ShortestAxis();
  RNLength length1 = box.AxisLength((dim+1)%3);
  RNLength length2 = box.AxisLength((dim+2)%3);
  RNArea area = length1 * length2;
  resolution = (area > 0) ? sqrt(nsurfels / area) : 0;
#endif

  // Mark resolution uptodate
  flags.Add(R3_SURFEL_BLOCK_RESOLUTION_UPTODATE_FLAG);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
andq $0x0, 0x80(%rdi)
callq 0x2a720
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x63ce6
movq %r14, %rdi
callq 0x64230
movl %eax, %ecx
leal 0x1(%rcx), %eax
pushq $0x3
popq %rsi
cltd
idivl %esi
movslq %edx, %rax
movsd 0x20(%rsp,%rax,8), %xmm0
subsd 0x8(%rsp,%rax,8), %xmm0
addl $0x2, %ecx
movl %ecx, %eax
cltd
idivl %esi
movslq %edx, %rax
movsd 0x20(%rsp,%rax,8), %xmm1
subsd 0x8(%rsp,%rax,8), %xmm1
mulsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x2aabc
cvtsi2sdl 0x8(%rbx), %xmm0
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x2aab7
sqrtsd %xmm0, %xmm0
jmp 0x2aabc
callq 0x133d0
movsd %xmm0, 0x80(%rbx)
orb $0x2, 0x88(%rbx)
movq %rsp, %rdi
callq 0x649ae
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x649ae
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::UpdateFlags()
void R3SurfelBlock::
UpdateFlags(void)
{
  // Read block
  if (database) database->ReadBlock(this);

  // Reset flags
  flags.Remove(R3_SURFEL_BLOCK_HAS_ACTIVE_FLAG);
  flags.Remove(R3_SURFEL_BLOCK_HAS_NORMALS_FLAG);
  flags.Remove(R3_SURFEL_BLOCK_HAS_AERIAL_FLAG);
  flags.Remove(R3_SURFEL_BLOCK_HAS_TERRESTRIAL_FLAG);

  // Update flags
  for (int i = 0; i < nsurfels; i++) {
    if (surfels[i].IsActive()) flags.Add(R3_SURFEL_BLOCK_HAS_ACTIVE_FLAG);
    if (surfels[i].HasNormal()) flags.Add(R3_SURFEL_BLOCK_HAS_NORMALS_FLAG);
    if (surfels[i].HasTangent()) flags.Add(R3_SURFEL_BLOCK_HAS_TANGENTS_FLAG);
    if (surfels[i].IsAerial()) flags.Add(R3_SURFEL_BLOCK_HAS_AERIAL_FLAG);
    else flags.Add(R3_SURFEL_BLOCK_HAS_TERRESTRIAL_FLAG);
  }

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

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

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
testq %rdi, %rdi
je 0x2ab2a
movq %rbx, %rsi
callq 0x20a64
movq $-0xf1, %rax
andq 0x88(%rbx), %rax
movq %rax, 0x88(%rbx)
movl 0x8(%rbx), %esi
movq (%rbx), %rcx
xorl %edx, %edx
testl %esi, %esi
cmovlel %edx, %esi
imulq $0x30, %rsi, %rsi
cmpq %rdx, %rsi
je 0x2abaa
movb 0x2f(%rcx,%rdx), %dil
movl %edi, %r8d
shlb $0x4, %r8b
andb $0x40, %r8b
leal (%rdi,%rdi), %r9d
andb $-0x80, %r9b
orb %r8b, %r9b
leal (,%rdi,8), %r8d
andb $0x8, %r8b
orb %r9b, %r8b
movzbl %r8b, %r8d
xorl %r9d, %r9d
testb $0x2, %dil
sete %r9b
shll $0x4, %r9d
leaq (%r9,%r8), %rdi
addq $0x10, %rdi
orq %rdi, %rax
movq %rax, 0x88(%rbx)
addq $0x30, %rdx
jmp 0x2ab50
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x2abc5
movq %rbx, %rsi
callq 0x20aa0
movq 0x88(%rbx), %rax
orq $0x4, %rax
movq %rax, 0x88(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelPosition(int, gaps::R3Point const&)
void R3SurfelBlock::
SetSurfelPosition(int surfel_index, const R3Point& position)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel position (relative to position origin)
  float x = position[0] - position_origin[0];
  float y = position[1] - position_origin[1];
  float z = position[2] - position_origin[2];
  surfels[surfel_index].SetPosition(x, y, z);

  // Mark properties out of date
  flags.Remove(R3_SURFEL_BLOCK_BBOX_UPTODATE_FLAG);
  flags.Remove(R3_SURFEL_BLOCK_RESOLUTION_UPTODATE_FLAG);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2ad01
movsd 0x10(%rdx), %xmm0
subsd 0x20(%rdi), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq %esi, %rcx
movupd (%rdx), %xmm1
movupd 0x10(%rdi), %xmm2
subpd %xmm2, %xmm1
cvtpd2ps %xmm1, %xmm1
imulq $0x30, %rcx, %rcx
movlpd %xmm1, (%rax,%rcx)
movss %xmm0, 0x8(%rax,%rcx)
movq $-0x104, %rax           # imm = 0xFEFC
andq 0x88(%rdi), %rax
orq $0x100, %rax            # imm = 0x100
movq %rax, 0x88(%rdi)
retq
pushq %rax
leaq 0x9e117(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelNormal(int, gaps::R3Vector const&)
void R3SurfelBlock::
SetSurfelNormal(int surfel_index, const R3Vector& normal)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel normal
  surfels[surfel_index].SetNormal(normal.X(), normal.Y(), normal.Z());

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x2ad48
movslq %esi, %rax
cvtsd2ss (%rdx), %xmm0
imulq $0x30, %rax, %rax
cvtsd2ss 0x8(%rdx), %xmm1
addq %rax, %rdi
cvtsd2ss 0x10(%rdx), %xmm2
callq 0x293b6
orb $0x1, 0x89(%rbx)
popq %rbx
retq
leaq 0x9e0d1(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelTangent(int, gaps::R3Vector const&)
void R3SurfelBlock::
SetSurfelTangent(int surfel_index, const R3Vector& tangent)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel tangent
  surfels[surfel_index].SetTangent(tangent.X(), tangent.Y(), tangent.Z());

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x2ad8e
movslq %esi, %rax
cvtsd2ss (%rdx), %xmm0
imulq $0x30, %rax, %rax
cvtsd2ss 0x8(%rdx), %xmm1
addq %rax, %rdi
cvtsd2ss 0x10(%rdx), %xmm2
callq 0x29418
orb $0x1, 0x89(%rbx)
popq %rbx
retq
leaq 0x9e08b(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelRadius(int, double)
void R3SurfelBlock::
SetSurfelRadius(int surfel_index, RNLength radius)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel normal
  surfels[surfel_index].SetRadius(radius);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2adef
movslq %esi, %rcx
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x9e00b(%rip), %xmm0    # 0xc8dc8
addsd 0x9d373(%rip), %xmm0    # 0xc8138
imulq $0x30, %rcx, %rcx
cvtsd2ss %xmm0, %xmm0
movss 0x9e003(%rip), %xmm1    # 0xc8dd8
minss %xmm0, %xmm1
cvttss2si %xmm1, %edx
movw %dx, 0x1c(%rax,%rcx)
movw %dx, 0x1e(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9e029(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelRadius(int, int, double)
void R3SurfelBlock::
SetSurfelRadius(int surfel_index, int axis, RNLength radius)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel normal
  surfels[surfel_index].SetRadius(axis, radius);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2ae52
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x9dfac(%rip), %xmm0    # 0xc8dc8
addsd 0x9d314(%rip), %xmm0    # 0xc8138
cvtsd2ss %xmm0, %xmm0
movss 0x9dfa8(%rip), %xmm1    # 0xc8dd8
minss %xmm0, %xmm1
cvttss2si %xmm1, %ecx
movslq %esi, %rsi
movslq %edx, %rdx
imulq $0x30, %rsi, %rsi
addq %rsi, %rax
movw %cx, 0x1c(%rax,%rdx,2)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9dfc6(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelDepth(int, double)
void R3SurfelBlock::
SetSurfelDepth(int surfel_index, RNLength depth)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel normal
  surfels[surfel_index].SetDepth(depth);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2aeae
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x9df52(%rip), %xmm0    # 0xc8dd0
addsd 0x9d2b2(%rip), %xmm0    # 0xc8138
movslq %esi, %rcx
cvtsd2ss %xmm0, %xmm0
movss 0x9df43(%rip), %xmm1    # 0xc8dd8
minss %xmm0, %xmm1
cvttss2si %xmm1, %edx
imulq $0x30, %rcx, %rcx
movw %dx, 0x28(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9df6a(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelElevation(int, double)
void R3SurfelBlock::
SetSurfelElevation(int surfel_index, RNLength elevation)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel normal
  surfels[surfel_index].SetElevation(elevation);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x2aeea
movslq %esi, %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
cvtsd2ss %xmm0, %xmm0
callq 0x2947a
orb $0x1, 0x89(%rbx)
popq %rbx
retq
leaq 0x9df2f(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelColor(int, gaps::RNRgb const&)
void R3SurfelBlock::
SetSurfelColor(int surfel_index, const RNRgb& color)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel color
  surfels[surfel_index].SetColor(color);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x2af25
movslq %esi, %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movq %rdx, %rsi
callq 0x2d162
orb $0x1, 0x89(%rbx)
popq %rbx
retq
leaq 0x9def4(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelTimestamp(int, double)
void R3SurfelBlock::
SetSurfelTimestamp(int surfel_index, RNScalar timestamp)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel timestamp (relative to timestamp_origin)
  surfels[surfel_index].SetTimestamp(timestamp - timestamp_origin);

  // Remember that timestamp range is out of date
  timestamp_range.Empty();

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2af79
subsd 0x60(%rdi), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq %esi, %rcx
imulq $0x30, %rcx, %rcx
movss %xmm0, 0xc(%rax,%rcx)
leaq 0xf9cdb(%rip), %rax     # 0x124c38
movsd (%rax), %xmm0
movsd %xmm0, 0x68(%rdi)
xorps 0x9d433(%rip), %xmm0    # 0xc83a0
movlps %xmm0, 0x70(%rdi)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9de9f(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelAttribute(int, unsigned int)
void R3SurfelBlock::
SetSurfelAttribute(int surfel_index, unsigned int attribute)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel attribute
  surfels[surfel_index].SetAttribute(attribute);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2afe1
movslq %esi, %rcx
imulq $0x30, %rcx, %rcx
movl %edx, 0x24(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9de37(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelActive(int, int)
void R3SurfelBlock::
SetSurfelActive(int surfel_index, RNBoolean active)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel active
  surfels[surfel_index].SetActive(active);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2b025
movslq %esi, %rcx
testl %edx, %edx
setne %dl
imulq $0x30, %rcx, %rcx
movb 0x2f(%rax,%rcx), %sil
andb $-0x5, %sil
shlb $0x2, %dl
orb %sil, %dl
movb %dl, 0x2f(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9ddf3(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelAerial(int, int)
void R3SurfelBlock::
SetSurfelAerial(int surfel_index, RNBoolean aerial)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel position for non-resident block\n");
    abort();
  }

  // Set surfel aerial
  surfels[surfel_index].SetAerial(aerial);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2b068
movslq %esi, %rcx
testl %edx, %edx
setne %dl
imulq $0x30, %rcx, %rcx
movb 0x2f(%rax,%rcx), %sil
andb $-0x3, %sil
addb %dl, %dl
orb %sil, %dl
movb %dl, 0x2f(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9ddb0(%rip), %rdi     # 0xc8e20
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelFlags(int, unsigned char)
void R3SurfelBlock::
SetSurfelFlags(int surfel_index, unsigned char flags)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel property for non-resident block\n");
    abort();
  }

  // Set surfel mark
  surfels[surfel_index].SetFlags(flags);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2b097
movslq %esi, %rcx
imulq $0x30, %rcx, %rcx
movb %dl, 0x2f(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9ddb7(%rip), %rdi     # 0xc8e56
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelSilhouetteBoundary(int, int)
void R3SurfelBlock::
SetSurfelSilhouetteBoundary(int surfel_index, RNBoolean boundary)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel property for non-resident block\n");
    abort();
  }

  // Set surfel mark
  surfels[surfel_index].SetSilhouetteBoundary(boundary);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2b0db
movslq %esi, %rcx
testl %edx, %edx
setne %dl
imulq $0x30, %rcx, %rcx
movb 0x2f(%rax,%rcx), %sil
andb $-0x11, %sil
shlb $0x4, %dl
orb %sil, %dl
movb %dl, 0x2f(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9dd73(%rip), %rdi     # 0xc8e56
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelShadowBoundary(int, int)
void R3SurfelBlock::
SetSurfelShadowBoundary(int surfel_index, RNBoolean boundary)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel property for non-resident block\n");
    abort();
  }

  // Set surfel mark
  surfels[surfel_index].SetShadowBoundary(boundary);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2b11f
movslq %esi, %rcx
testl %edx, %edx
setne %dl
imulq $0x30, %rcx, %rcx
movb 0x2f(%rax,%rcx), %sil
andb $-0x21, %sil
shlb $0x5, %dl
orb %sil, %dl
movb %dl, 0x2f(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9dd2f(%rip), %rdi     # 0xc8e56
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelBorderBoundary(int, int)
void R3SurfelBlock::
SetSurfelBorderBoundary(int surfel_index, RNBoolean boundary)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel property for non-resident block\n");
    abort();
  }

  // Set surfel mark
  surfels[surfel_index].SetBorderBoundary(boundary);

  // Remember that block is dirty
  SetDirty();
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2b166
movslq %esi, %rcx
imulq $0x30, %rcx, %rcx
movb 0x2f(%rax,%rcx), %sil
andb $-0x31, %sil
testl %edx, %edx
pushq $0x30
popq %r8
cmovel %edx, %r8d
orb %sil, %r8b
movb %r8b, 0x2f(%rax,%rcx)
orb $0x1, 0x89(%rdi)
retq
pushq %rax
leaq 0x9dce8(%rip), %rdi     # 0xc8e56
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetSurfelMark(int, int)
void R3SurfelBlock::
SetSurfelMark(int surfel_index, RNBoolean mark)
{
  // Check if surfels are resident
  if (!surfels) {
    RNFail("Unable to set surfel property for non-resident block\n");
    abort();
  }

  // Set surfel mark
  surfels[surfel_index].SetMark(mark);
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x2b1a2
movslq %esi, %rcx
testl %edx, %edx
setne %dl
imulq $0x30, %rcx, %rcx
movb 0x2f(%rax,%rcx), %sil
andb $0x7f, %sil
shlb $0x7, %dl
orb %sil, %dl
movb %dl, 0x2f(%rax,%rcx)
retq
pushq %rax
leaq 0x9dcac(%rip), %rdi     # 0xc8e56
xorl %eax, %eax
callq 0x9ce26
callq 0x132c0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::SetMarks(int)
void R3SurfelBlock::
SetMarks(RNBoolean mark)
{
  // Check surfels
  if (!mark && !surfels) return;

  // Set mark for all surfels
  for (int i = 0; i < nsurfels; i++) {
    surfels[i].SetMark(mark);
  }
}

// Assembly:
testl %esi, %esi
sete %cl
movq (%rdi), %rax
testq %rax, %rax
sete %dl
testb %dl, %cl
je 0x2b1c9
retq
testl %esi, %esi
setne %cl
movl 0x8(%rdi), %esi
shlb $0x7, %cl
xorl %edx, %edx
testl %esi, %esi
cmovlel %edx, %esi
imulq $0x30, %rsi, %rsi
cmpq %rdx, %rsi
je 0x2b1c8
movb 0x2f(%rax,%rdx), %dil
andb $0x7f, %dil
orb %cl, %dil
movb %dil, 0x2f(%rax,%rdx)
addq $0x30, %rdx
jmp 0x2b1df
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::UpdateProperties()
void R3SurfelBlock::
UpdateProperties(void)
{
  // Read block
  if (database) database->ReadBlock(this);

  // Update properties
  double dummy = 0;
  dummy += BBox().Min().X();
  dummy += TimestampRange().Min();
  dummy += MinIdentifier();
  dummy += MaxIdentifier();
  dummy += Resolution();
  dummy += (HasAerial()) ? 1 : 2;
  if (dummy == 927612.21242) {
    printf("Amazing!\n");
  }

  // Update normals
  UpdateSurfelNormals();

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

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
testq %rdi, %rdi
je 0x2b55c
movq %rbx, %rsi
callq 0x20a64
movq %rbx, %rdi
callq 0x2a720
xorpd %xmm0, %xmm0
addsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2a8a8
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2a970
movl %eax, %eax
cvtsi2sd %rax, %xmm0
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2a9fc
movl %eax, %eax
cvtsi2sd %rax, %xmm0
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2aa12
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2ac1a
xorl %ecx, %ecx
cmpl $0x1, %eax
adcl $0x1, %ecx
cvtsi2sd %ecx, %xmm0
addsd 0x8(%rsp), %xmm0
ucomisd 0x9cd29(%rip), %xmm0    # 0xc8320
jne 0x2b607
jp 0x2b607
leaq 0x9cd46(%rip), %rdi     # 0xc8348
callq 0x13800
movq %rbx, %rdi
callq 0x2b62e
movq 0x98(%rbx), %rdi
testq %rdi, %rdi
je 0x2b628
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
jmp 0x20aa0
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::Print(_IO_FILE*, char const*, char const*) const
void R3SurfelBlock::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print block
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "%d %d", DatabaseIndex(), NSurfels());
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %r14
movq %rsi, %rbx
movq %rdi, %r15
testq %rsi, %rsi
jne 0x2ba6b
movq 0xf8518(%rip), %rax     # 0x123f80
movq (%rax), %rbx
testq %rdx, %rdx
je 0x2ba7b
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x135d0
movl 0x8(%r15), %ecx
movl 0xa0(%r15), %edx
leaq 0x9ce4f(%rip), %rsi     # 0xc88dc
movq %rbx, %rdi
xorl %eax, %eax
callq 0x13780
testq %r14, %r14
je 0x2baa7
movq %r14, %rdi
movq %rbx, %rsi
callq 0x135d0
pushq $0xa
popq %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x13690
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ReadFile(char const*)
int R3SurfelBlock::
ReadFile(const char *filename)
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .ply)\n", filename);
    return 0;
  }

  // Read file of appropriate type
  if (!strncmp(extension, ".obj", 4)) {
    return ReadOBJFile(filename);
  }
  else if (!strncmp(extension, ".ply", 4)) {
    return ReadPlyFile(filename);
  }
  else if (!strncmp(extension, ".xyz", 4)) {
    return ReadXYZAsciiFile(filename);
  }
  else if (!strncmp(extension, ".bin", 4)) {
    return ReadXYZBinaryFile(filename);
  }
  else if (!strncmp(extension, ".blk", 4)) {
    return ReadBinaryFile(filename);
  }
  else if (!strncmp(extension, ".upc", 4)) {
    return ReadUPCFile(filename);
  }
  else { 
    RNFail("Unable to read 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
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x13580
testq %rax, %rax
je 0x2bb88
movq %rax, %r15
leaq 0x9d3d6(%rip), %rsi     # 0xc8eb7
pushq $0x4
popq %rdx
movq %rax, %rdi
callq 0x13250
testl %eax, %eax
je 0x2bba1
leaq 0x9d3c1(%rip), %rsi     # 0xc8ebc
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x13250
testl %eax, %eax
je 0x2bbb1
leaq 0x9d3ac(%rip), %rsi     # 0xc8ec1
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x13250
testl %eax, %eax
je 0x2bbc1
leaq 0x9d397(%rip), %rsi     # 0xc8ec6
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x13250
testl %eax, %eax
je 0x2bbd1
leaq 0x9d382(%rip), %rsi     # 0xc8ecb
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x13250
testl %eax, %eax
je 0x2bbe1
leaq 0x9d36d(%rip), %rsi     # 0xc8ed0
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x13250
testl %eax, %eax
je 0x2bbf1
leaq 0x9c8e3(%rip), %rdi     # 0xc845c
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9ce26
jmp 0x2bb99
leaq 0x9d2fd(%rip), %rdi     # 0xc8e8c
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 0x2bc02
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2bc80
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2bcfe
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2bd7c
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2bdfa
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2be78
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ReadOBJFile(char const*)
int R3SurfelBlock::
ReadOBJFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "r"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Read file
  if (!ReadOBJ(fp)) {
    RNFail("Unable to read OBJ 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 0xa799d(%rip), %rsi     # 0xd35b3
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x2bc42
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x2c056
testl %eax, %eax
je 0x2bc57
movq %r14, %rdi
callq 0x134e0
pushq $0x1
popq %rbp
jmp 0x2bc72
leaq 0x9c889(%rip), %rdi     # 0xc84d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
jmp 0x2bc72
leaq 0x9d277(%rip), %rdi     # 0xc8ed5
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movq %r14, %rdi
callq 0x134e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ReadPlyFile(char const*)
int R3SurfelBlock::
ReadPlyFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "r"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Read file
  if (!ReadPly(fp)) {
    RNFail("Unable to read ply 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 0xa791f(%rip), %rsi     # 0xd35b3
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x2bcc0
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x2c288
testl %eax, %eax
je 0x2bcd5
movq %r14, %rdi
callq 0x134e0
pushq $0x1
popq %rbp
jmp 0x2bcf0
leaq 0x9c80b(%rip), %rdi     # 0xc84d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
jmp 0x2bcf0
leaq 0x9d253(%rip), %rdi     # 0xc8f2f
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movq %r14, %rdi
callq 0x134e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ReadXYZAsciiFile(char const*)
int R3SurfelBlock::
ReadXYZAsciiFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "r"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Read file
  if (!ReadXYZAscii(fp)) {
    RNFail("Unable to read 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, %r15
leaq 0xa78a1(%rip), %rsi     # 0xd35b3
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x2bd3e
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x2c518
testl %eax, %eax
je 0x2bd53
movq %r14, %rdi
callq 0x134e0
pushq $0x1
popq %rbp
jmp 0x2bd6e
leaq 0x9c78d(%rip), %rdi     # 0xc84d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
jmp 0x2bd6e
leaq 0x9d1f1(%rip), %rdi     # 0xc8f4b
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movq %r14, %rdi
callq 0x134e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ReadXYZBinaryFile(char const*)
int R3SurfelBlock::
ReadXYZBinaryFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "rb"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Read file
  if (!ReadXYZBinary(fp)) {
    RNFail("Unable to read XYZ binary 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 0x9c445(%rip), %rsi     # 0xc81d5
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x2bdbc
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x2c7d0
testl %eax, %eax
je 0x2bdd1
movq %r14, %rdi
callq 0x134e0
pushq $0x1
popq %rbp
jmp 0x2bdec
leaq 0x9c70f(%rip), %rdi     # 0xc84d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
jmp 0x2bdec
leaq 0x9d1a6(%rip), %rdi     # 0xc8f7e
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movq %r14, %rdi
callq 0x134e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ReadBinaryFile(char const*)
int R3SurfelBlock::
ReadBinaryFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "rb"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Read file
  if (!ReadBinary(fp)) {
    RNFail("Unable to read 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 0x9c3c7(%rip), %rsi     # 0xc81d5
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x2be3a
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x2c9c4
testl %eax, %eax
je 0x2be4f
movq %r14, %rdi
callq 0x134e0
pushq $0x1
popq %rbp
jmp 0x2be6a
leaq 0x9c691(%rip), %rdi     # 0xc84d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
jmp 0x2be6a
leaq 0x9d164(%rip), %rdi     # 0xc8fba
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movq %r14, %rdi
callq 0x134e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelBlock.cpp
// Function: gaps::R3SurfelBlock::ReadUPCFile(char const*)
int R3SurfelBlock::
ReadUPCFile(const char *filename)
{
  // Open file
  FILE *fp;
  if (!(fp = fopen(filename, "rb"))) {
    RNFail("Unable to open file %s\n", filename);
    return 0;
  }

  // Read file
  if (!ReadUPC(fp)) {
    RNFail("Unable to read surfel file %s\n", filename);
    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 0x9c349(%rip), %rsi     # 0xc81d5
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x2beb8
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x2cc4c
testl %eax, %eax
je 0x2bec1
movq %r14, %rdi
callq 0x134e0
pushq $0x1
popq %rbp
jmp 0x2bed4
leaq 0x9c613(%rip), %rdi     # 0xc84d2
jmp 0x2bec8
leaq 0x9d0f2(%rip), %rdi     # 0xc8fba
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x13580
testq %rax, %rax
je 0x2bf42
movq %rax, %r15
leaq 0x9cfba(%rip), %rsi     # 0xc8ec1
pushq $0x4
popq %rdx
movq %rax, %rdi
callq 0x13250
testl %eax, %eax
je 0x2bf5b
leaq 0x9cfae(%rip), %rsi     # 0xc8ecb
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x13250
testl %eax, %eax
je 0x2bf6b
leaq 0x9c569(%rip), %rdi     # 0xc849c
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9ce26
jmp 0x2bf53
leaq 0x9cf43(%rip), %rdi     # 0xc8e8c
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 0x2bf7c
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x2bfd8
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0xa32f4(%rip), %rsi     # 0xcf284
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x2bfb8
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x2c72e
movq %r15, %rdi
callq 0x134e0
pushq $0x1
popq %rbp
jmp 0x2bfcb
leaq 0x9c513(%rip), %rdi     # 0xc84d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x9cfed(%rip), %rsi     # 0xc8fd9
movq %rbx, %rdi
callq 0x135f0
testq %rax, %rax
je 0x2c018
movq %rax, %r14
movq %r15, %rdi
movq %rax, %rsi
callq 0x2cb3a
testl %eax, %eax
je 0x2c02d
movq %r14, %rdi
callq 0x134e0
pushq $0x1
popq %rbp
jmp 0x2c048
leaq 0x9c4b3(%rip), %rdi     # 0xc84d2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
jmp 0x2c048
leaq 0x9cfa8(%rip), %rdi     # 0xc8fdc
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
movq %r14, %rdi
callq 0x134e0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x2e
popq %r12
pushq $0x1
popq %r15
xorl %r13d, %r13d
movslq 0x8(%r14), %rax
cmpq %rax, %r13
jge 0x2c7bd
movq (%r14), %rbp
cvtss2sd -0x2e(%rbp,%r12), %xmm0
cvtss2sd -0x2a(%rbp,%r12), %xmm1
cvtss2sd -0x26(%rbp,%r12), %xmm2
movq %rbx, %rdi
leaq 0x9c133(%rip), %rsi     # 0xc88a8
movb $0x3, %al
callq 0x13780
movzbl -0x2(%rbp,%r12), %edx
movzbl -0x1(%rbp,%r12), %ecx
movzbl (%rbp,%r12), %r8d
movq %rbx, %rdi
leaq 0x9c7dc(%rip), %rsi     # 0xc8f74
xorl %eax, %eax
callq 0x13780
leaq 0x9db67(%rip), %rdi     # 0xca30d
pushq $0x4
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x139e0
incq %r13
addq $0x30, %r12
jmp 0x2c74a
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Surfels/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)
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x139e0
cmpq $0x1, %rax
jne 0x2cc0f
leaq 0x28(%r14), %rdi
pushq $0x38
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x139e0
cmpq $0x1, %rax
jne 0x2cc18
leaq 0x80(%r14), %rdi
pushq $0x38
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x139e0
cmpq $0x1, %rax
jne 0x2cc21
movq $-0xff01, %rax          # imm = 0xFFFF00FF
andq 0x88(%r14), %rax
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x139e0
cmpq $0x1, %rax
jne 0x2cc2a
pushq $-0x1
popq %r13
xorl %edi, %edi
pushq $0x1
popq %r12
movslq 0x8(%r14), %rbp
incq %r13
cmpq %rbp, %r13
jge 0x2cc05
leaq 0x30(%rdi), %r15
addq (%r14), %rdi
pushq $0x30
popq %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x139e0
movq %r15, %rdi
cmpq $0x1, %rax
je 0x2cbdb
xorl %ebx, %ebx
cmpq %rbp, %r13
setge %bl
jmp 0x2cc3a
leaq 0x9c4a3(%rip), %rdi     # 0xc90b9
jmp 0x2cc31
leaq 0x9c4bd(%rip), %rdi     # 0xc90dc
jmp 0x2cc31
leaq 0x9c4e2(%rip), %rdi     # 0xc910a
jmp 0x2cc31
leaq 0x9c505(%rip), %rdi     # 0xc9136
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x9ce26
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop