LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVLaser.cpp
// Function: gaps::GSVLaser::GSVLaser(int)
GSVLaser::
GSVLaser(int device_type)
  : run(NULL),
    run_index(-1),
    surveys(),
    device_type(device_type),
    max_sweep_index(0),
    max_beam_index(0),
    bbox(FLT_MAX,FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX,-FLT_MAX),
    data(NULL)
{
  // Set max sweep and beam indices
  if (device_type == GSV_SICK_LASER) {
    max_sweep_index = 0;
    max_beam_index = 179;
  }
  else if (device_type == GSV_VLP16_LASER) {
    max_sweep_index = 1799;
    max_beam_index = 15;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x18e021(%rip), %rax    # 0x1cca28
movq %rax, (%rdi)
xorl %r15d, %r15d
movq %r15, 0x8(%rdi)
movl $0xffffffff, 0x10(%rdi) # imm = 0xFFFFFFFF
leaq 0x18(%rdi), %r14
movq %r14, %rdi
callq 0xf8b80
movl %ebp, 0x28(%rbx)
movq %r15, 0x2c(%rbx)
leaq 0x38(%rbx), %rdi
movsd 0x10d5d1(%rip), %xmm0   # 0x14c008
movsd 0x10d6e1(%rip), %xmm3   # 0x14c120
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
movaps %xmm3, %xmm4
movaps %xmm3, %xmm5
callq 0xbda10
movq $0x0, 0x70(%rbx)
cmpl $0x1, %ebp
je 0x3ea6c
cmpl $0x2, %ebp
jne 0x3ea78
movsd 0x10e6c6(%rip), %xmm0   # 0x14d130
jmp 0x3ea74
movsd 0x10e6cc(%rip), %xmm0   # 0x14d140
movlps %xmm0, 0x2c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0xf8bea
movq %rbx, %rdi
callq 0x28150
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVLaser.cpp
// Function: gaps::GSVLaser::~GSVLaser()
GSVLaser::
~GSVLaser(void)
{
  // Remove laser from run
  if (run) run->RemoveLaser(this);

  // Remove surveys from this laser
  while (NSurveys() > 0) RemoveSurvey(Survey(0));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x18df84(%rip), %rax    # 0x1cca28
movq %rax, (%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x3eab8
movq %rbx, %rsi
callq 0x38030
leaq 0x18(%rbx), %r14
cmpl $0x0, 0x24(%rbx)
jle 0x3ead3
movq 0x18(%rbx), %rax
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x3eaf8
jmp 0x3eabc
addq $0x38, %rbx
movq %rbx, %rdi
callq 0xbe790
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xf8bea
jmp 0x3eaf0
movq %rax, %rdi
callq 0x3964d
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVLaser.cpp
// Function: gaps::GSVLaser::Draw(gaps::RNFlags) const
void GSVLaser::
Draw(RNFlags flags) const
{
  // Draw surveys
  for (int i = 0; i < NSurveys(); i++) {
    GSVSurvey *survey = Survey(i);
    survey->Draw(flags);
  }
}

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

  // Print laser header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Laser %d:", run_index);
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

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

 // Print surveys
  for (int i = 0; i < NSurveys(); i++) {
    GSVSurvey *survey = Survey(i);
    survey->Print(fp, indented_prefix, suffix);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x3ecbd
movq 0x196256(%rip), %rax    # 0x1d4f10
movq (%rax), %r15
testq %r12, %r12
je 0x3eccd
movq %r12, %rdi
movq %r15, %rsi
callq 0x27a90
movl 0x10(%r14), %edx
leaq 0x10e478(%rip), %rsi    # 0x14d150
movq %r15, %rdi
xorl %eax, %eax
callq 0x27e00
testq %rbx, %rbx
je 0x3ecf2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27a90
movl $0xa, %edi
movq %r15, %rsi
callq 0x27c30
leaq 0x10dcee(%rip), %rsi    # 0x14c9f4
movq %rsp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x27140
cmpl $0x0, 0x24(%r14)
jle 0x3ed43
xorl %r13d, %r13d
movq %rsp, %r12
movq 0x18(%r14), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq *0x18(%rax)
incq %r13
movslq 0x24(%r14), %rax
cmpq %rax, %r13
jl 0x3ed20
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVLaser.cpp
// Function: gaps::GSVLaser::UpdateBBox()
void GSVLaser::
UpdateBBox(void) 
{
  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NSurveys(); i++) {
    bbox.Union(Survey(i)->BBox());
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x40, %rdi
leaq 0x19fc2e(%rip), %r14    # 0x1de998
leaq 0x8(%r14), %rsi
callq 0xd4746
leaq 0x58(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0xd4746
cmpl $0x0, 0x24(%rbx)
jle 0x3edcd
leaq 0x38(%rbx), %r14
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %r15
movsd 0x48(%r15), %xmm0
ucomisd 0x10d262(%rip), %xmm0   # 0x14c008
jne 0x3edb2
jp 0x3edb2
movq %r15, %rdi
callq 0x3f3e4
addq $0x40, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xbe428
incq %r12
movslq 0x24(%rbx), %rax
cmpq %rax, %r12
jl 0x3ed90
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::~GSVSurvey()
GSVSurvey::
~GSVSurvey(void)
{
  // Remove survey from segment
  if (segment) segment->RemoveSurvey(this);

  // Remove survey from laser
  if (laser) laser->RemoveSurvey(this);

  // Delete scans
  while (NScans()) delete Scan(0);

  // Delete travel distances
  if (travel_distances) delete [] travel_distances;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x18dc03(%rip), %rax    # 0x1cca68
movq %rax, (%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x3ee79
movq %rbx, %rsi
callq 0x3a02e
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x3ee8a
movq %rbx, %rsi
callq 0x3eaf8
movl 0x34(%rbx), %eax
testl %eax, %eax
je 0x3eea5
movq 0x28(%rbx), %rcx
movq (%rcx), %rdi
testq %rdi, %rdi
je 0x3ee8d
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3ee8a
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x3eeb3
callq 0x27ca0
leaq 0x40(%rbx), %rdi
callq 0xbe790
addq $0x28, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0xf8bea
movq %rax, %rdi
callq 0x3964d
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::NScanlines() const
int GSVSurvey::
NScanlines(void) const
{
  // Return number of scanlines in survey
  int count = 0;
  for (int i = 0; i < NScans(); i++) {
    GSVScan *scan = Scan(i);
    count += scan->NScanlines();
  }
  return count;
}

// Assembly:
movslq 0x34(%rdi), %rcx
testq %rcx, %rcx
jle 0x3efc9
movq 0x28(%rdi), %rdx
xorl %esi, %esi
xorl %eax, %eax
movq (%rdx,%rsi,8), %rdi
addl 0x34(%rdi), %eax
incq %rsi
cmpq %rsi, %rcx
jne 0x3efb9
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::Scanline(int) const
GSVScanline *GSVSurvey::
Scanline(int scanline_index) const
{
  // Return scanline
  for (int i = 0; i < NScans(); i++) {
    GSVScan *scan = Scan(i);
    if (scanline_index >= scan->NScanlines()) scanline_index -= scan->NScanlines();
    else return scan->Scanline(scanline_index);
  }

  // Index too high
  return NULL;
}

// Assembly:
movslq 0x34(%rdi), %rcx
testq %rcx, %rcx
jle 0x3eff6
movq 0x28(%rdi), %rdx
xorl %eax, %eax
xorl %edi, %edi
movl %esi, %r8d
movq (%rdx,%rdi,8), %r9
subl 0x34(%r9), %r8d
jl 0x3eff9
incq %rdi
movl %r8d, %esi
cmpq %rdi, %rcx
jne 0x3efe0
retq
xorl %eax, %eax
retq
movq 0x28(%r9), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::FindScanBeforeTravelDistance(double, int, int) const
GSVScan *GSVSurvey::
FindScanBeforeTravelDistance(RNScalar travel_distance, int imin, int imax) const
{
  // Binary search
  int i = (imin + imax) / 2;
  if (i == imin) return Scan(imin);
  assert(i < imax);
  GSVScan *scan = Scan(i);
  RNScalar t = TravelDistance(scan->SurveyIndex());
  if (t > travel_distance) return FindScanBeforeTravelDistance(travel_distance, imin, i);
  else if (t < travel_distance) return FindScanBeforeTravelDistance(travel_distance, i, imax);
  else return scan;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebx
movq %rdi, %r15
movsd %xmm0, (%rsp)
movl %r14d, %ebp
movl %ebp, %r14d
leal (%r14,%rbx), %eax
movl %eax, %ebp
shrl $0x1f, %ebp
addl %eax, %ebp
sarl %ebp
movq 0x28(%r15), %rax
cmpl %ebx, %ebp
je 0x3f0d5
movslq %ebp, %rcx
movq (%rax,%rcx,8), %r12
movslq 0x20(%r12), %r13
movq 0x38(%r15), %rax
testq %rax, %rax
jne 0x3f0bf
movq %r15, %rdi
callq 0x3f46a
movsd (%rsp), %xmm0
movq 0x38(%r15), %rax
movsd (%rax,%r13,8), %xmm1
ucomisd %xmm0, %xmm1
ja 0x3f081
ucomisd %xmm1, %xmm0
movl %ebp, %ebx
ja 0x3f07e
jmp 0x3f0dc
movslq %ebx, %rcx
movq (%rax,%rcx,8), %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::FindScanBeforeTravelDistance(double) const
GSVScan *GSVSurvey::
FindScanBeforeTravelDistance(RNScalar travel_distance) const
{
  // Binary search
  if (NScans() == 0) return NULL;
  if (travel_distance <= TravelDistance(0)) return Scan(0);
  if (travel_distance >= TravelDistance(NScans()-1)) return Scan(NScans()-1);
  return FindScanBeforeTravelDistance(travel_distance, 0, NScans()-1);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
cmpl $0x0, 0x34(%rdi)
je 0x3f145
movq %rdi, %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
jne 0x3f11d
movq %rbx, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x3f46a
movsd 0x8(%rsp), %xmm0
movq 0x38(%rbx), %rax
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jae 0x3f149
movslq 0x34(%rbx), %rdx
ucomisd -0x8(%rax,%rdx,8), %xmm0
jae 0x3f152
decq %rdx
movq %rbx, %rdi
xorl %esi, %esi
addq $0x10, %rsp
popq %rbx
jmp 0x3f066
xorl %eax, %eax
jmp 0x3f15b
movq 0x28(%rbx), %rax
movq (%rax), %rax
jmp 0x3f15b
movq 0x28(%rbx), %rax
movq -0x8(%rax,%rdx,8), %rax
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::NPoints() const
int GSVSurvey::
NPoints(void) const
{
  // Return number of points in all scans
  int npoints = 0;
  for (int i = 0; i < NScans(); i++) 
    npoints += Scan(i)->NPoints();
  return npoints;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpl $0x0, 0x34(%rdi)
jle 0x3f191
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3f80e
addl %eax, %ebp
incq %r14
movslq 0x34(%rbx), %rax
cmpq %rax, %r14
jl 0x3f174
jmp 0x3f193
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::MaxBeamIndex() const
int GSVSurvey::
MaxBeamIndex(void) const
{
  // Initialize result
  int max_beam_index = -1;

  // Find maximum beam index of any point in any scan
  for (int i = 0; i < NScans(); i++) {
    GSVScan *scan = Scan(i);
    int m = scan->MaxBeamIndex();
    if (m > max_beam_index) max_beam_index = m;
  }

  // Return result
  return max_beam_index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x0, 0x34(%rdi)
jle 0x3f1d0
movq %rdi, %r14
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq 0x28(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x3f864
cmpl %ebx, %eax
cmovgl %eax, %ebx
incq %r15
movslq 0x34(%r14), %rax
cmpq %rax, %r15
jl 0x3f1b0
jmp 0x3f1d5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::Print(_IO_FILE*, char const*, char const*) const
void GSVSurvey::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print survey header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Survey %d:", segment_index);
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

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

   // Print scans
  for (int i = 0; i < NScans(); i++) {
    GSVScan *scan = Scan(i);
    scan->Print(fp, indented_prefix, suffix);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x3f34d
movq 0x195bc6(%rip), %rax    # 0x1d4f10
movq (%rax), %r15
testq %r12, %r12
je 0x3f35d
movq %r12, %rdi
movq %r15, %rsi
callq 0x27a90
movl 0x10(%r14), %edx
leaq 0x10de03(%rip), %rsi    # 0x14d16b
movq %r15, %rdi
xorl %eax, %eax
callq 0x27e00
testq %rbx, %rbx
je 0x3f382
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27a90
movl $0xa, %edi
movq %r15, %rsi
callq 0x27c30
leaq 0x10d65e(%rip), %rsi    # 0x14c9f4
movq %rsp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x27140
cmpl $0x0, 0x34(%r14)
jle 0x3f3d3
xorl %r13d, %r13d
movq %rsp, %r12
movq 0x28(%r14), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq *0x18(%rax)
incq %r13
movslq 0x34(%r14), %rax
cmpq %rax, %r13
jl 0x3f3b0
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::UpdateBBox()
void GSVSurvey::
UpdateBBox(void) 
{
  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NScans(); i++) {
    bbox.Union(Scan(i)->BBox());
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x48, %rdi
leaq 0x19f59e(%rip), %r14    # 0x1de998
leaq 0x8(%r14), %rsi
callq 0xd4746
leaq 0x60(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0xd4746
cmpl $0x0, 0x34(%rbx)
jle 0x3f45d
leaq 0x40(%rbx), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %r15
movsd 0x40(%r15), %xmm0
ucomisd 0x10cbd2(%rip), %xmm0   # 0x14c008
jne 0x3f442
jp 0x3f442
movq %r15, %rdi
callq 0x405ae
addq $0x38, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xbe428
incq %r12
movslq 0x34(%rbx), %rax
cmpq %rax, %r12
jl 0x3f420
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVSurvey.cpp
// Function: gaps::GSVSurvey::UpdateTravelDistances()
void GSVSurvey::
UpdateTravelDistances(void) 
{
  // Check stuff
  if (travel_distances) return;
  if (NScans() == 0) return;

  // Allocate travel distances
  travel_distances = new RNLength [ NScans() ];
  if (!travel_distances) {
    RNFail("Unable to allocate travel distances\n");
    return;
  }

  // Compute travel distances
  RNLength travel_distance = 0;
  R3Point prev_viewpoint = Scan(0)->Viewpoint();
  for (int i = 0; i < NScans(); i++) {
    GSVScan *scan = Scan(i);
    const R3Point& viewpoint = scan->Viewpoint();
    travel_distance += R3Distance(viewpoint, prev_viewpoint);
    travel_distances[i] = travel_distance;
    prev_viewpoint = viewpoint;
  }
}

// Assembly:
cmpq $0x0, 0x38(%rdi)
je 0x3f472
retq
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movslq 0x34(%rdi), %rax
testq %rax, %rax
je 0x3f567
movq %rax, %rcx
shlq $0x3, %rcx
testl %eax, %eax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0x27040
movq %rax, 0x38(%rbx)
movq 0x28(%rbx), %rax
movq (%rax), %rax
movl 0x34(%rax), %ecx
testl %ecx, %ecx
je 0x3f4d4
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
movq 0x28(%rax), %rax
movslq %edx, %rcx
movq (%rax,%rcx,8), %rsi
addq $0x40, %rsi
jmp 0x3f4db
leaq 0x5a0165(%rip), %rsi    # 0x5df640
leaq 0x8(%rsp), %rdi
callq 0xd43ee
cmpl $0x0, 0x34(%rbx)
jle 0x3f567
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
xorl %r12d, %r12d
leaq 0x5a0142(%rip), %r13    # 0x5df640
leaq 0x8(%rsp), %r14
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rax
movl 0x34(%rax), %ecx
movq %r13, %r15
testl %ecx, %ecx
je 0x3f52d
movl %ecx, %edx
shrl $0x1f, %edx
addl %ecx, %edx
sarl %edx
movq 0x28(%rax), %rax
movslq %edx, %rcx
movq (%rax,%rcx,8), %r15
addq $0x40, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x9c174
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movq 0x38(%rbx), %rax
movsd %xmm1, (%rsp)
movsd %xmm1, (%rax,%r12,8)
movq %r14, %rdi
movq %r15, %rsi
callq 0xd4746
incq %r12
movslq 0x34(%rbx), %rax
cmpq %rax, %r12
jl 0x3f503
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::~GSVScan()
GSVScan::
~GSVScan(void)
{
  // Remove scan from survey
  if (survey) survey->RemoveScan(this);

  // Delete scanlines
  while (NScanlines()) delete Scanline(0);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x18d493(%rip), %rax    # 0x1ccaa8
movq %rax, (%rdi)
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x3f629
movq %rbx, %rsi
callq 0x3f29e
movl 0x34(%rbx), %eax
testl %eax, %eax
je 0x3f644
movq 0x28(%rbx), %rcx
movq (%rcx), %rdi
testq %rdi, %rdi
je 0x3f62c
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3f629
leaq 0x38(%rbx), %rdi
callq 0xbe790
addq $0x28, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0xf8bea
movq %rax, %rdi
callq 0x3964d
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::SceneIndex() const
int GSVScan::
SceneIndex(void) const
{
  // Get convenient variables
  GSVRun *run = Run();
  if (!run) return -1;
  GSVScene *scene = run->Scene();
  if (!scene) return -1;

  // Compute scene index
  int scene_index = RunIndex();
  for (int ir = 0; ir < run->SceneIndex(); ir++) {
    GSVRun *r = scene->Run(ir);
    scene_index += r->NScans();
  }

  // Return scene index
  return scene_index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x18(%rdi), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x3f71d
callq 0x3ef5c
testq %rax, %rax
je 0x3f71d
movq %rax, %r14
movq 0x8(%rax), %r12
testq %r12, %r12
je 0x3f71d
movq %r15, %rdi
callq 0x3f72c
movl %eax, %ebx
cmpl $0x0, 0x10(%r14)
jle 0x3f71d
xorl %r15d, %r15d
movq 0x8(%r12), %rax
movq (%rax,%r15,8), %rdi
callq 0x37dfe
addl %eax, %ebx
incq %r15
movslq 0x10(%r14), %rax
cmpq %rax, %r15
jl 0x3f701
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::RunIndex() const
int GSVScan::
RunIndex(void) const
{
  // Get convenient variables
  GSVSegment *segment = Segment();
  if (!segment) return -1;
  GSVRun *run = Run();
  if (!run) return -1;

  // Compute run index
  int run_index = SegmentIndex();
  for (int i = 0; i < segment->RunIndex(); i++) {
    GSVSegment *s = run->Segment(i);
    run_index += s->NScans();
  }

  // Return run index
  return run_index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x18(%rdi), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x3f78c
movq 0x8(%rdi), %r12
testq %r12, %r12
je 0x3f78c
callq 0x3ef5c
testq %rax, %rax
je 0x3f78c
movq %rax, %r14
movq %r15, %rdi
callq 0x3f79a
movl %eax, %ebx
cmpl $0x0, 0x18(%r12)
jle 0x3f78c
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x398b2
addl %eax, %ebx
incq %r15
movslq 0x18(%r12), %rax
cmpq %rax, %r15
jl 0x3f770
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::NPoints() const
int GSVScan::
NPoints(void) const
{
  // Return number of points in all scanlines
  int npoints = 0;
  for (int i = 0; i < NScanlines(); i++) 
    npoints += Scanline(i)->NPoints();
  return npoints;
}

// Assembly:
movslq 0x34(%rdi), %rcx
testq %rcx, %rcx
jle 0x3f82f
movq 0x28(%rdi), %rdx
xorl %esi, %esi
xorl %eax, %eax
movq (%rdx,%rsi,8), %rdi
addl 0x30(%rdi), %eax
incq %rsi
cmpq %rsi, %rcx
jne 0x3f81f
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::MaxSweepIndex() const
int GSVScan::
MaxSweepIndex(void) const
{
  // Initialize result
  int max_sweep_index = -1;

  // Find maximum sweep index of any point in any scanline
  for (int i = 0; i < NScanlines(); i++) {
    GSVScanline *scanline = Scanline(i);
    int m = scanline->SweepIndex();
    if (m > max_sweep_index) max_sweep_index = m;
  }

  // Return result
  return max_sweep_index;
}

// Assembly:
movslq 0x34(%rdi), %rcx
testq %rcx, %rcx
jle 0x3f85e
movq 0x28(%rdi), %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
movl 0x80(%rdi), %edi
cmpl %eax, %edi
cmovgl %edi, %eax
incq %rsi
cmpq %rsi, %rcx
jne 0x3f846
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::MaxBeamIndex() const
int GSVScan::
MaxBeamIndex(void) const
{
  // Initialize result
  int max_beam_index = -1;

  // Find maximum beam index of any point in any scanline
  for (int i = 0; i < NScanlines(); i++) {
    GSVScanline *scanline = Scanline(i);
    int m = scanline->MaxBeamIndex();
    if (m > max_beam_index) max_beam_index = m;
  }

  // Return result
  return max_beam_index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x0, 0x34(%rdi)
jle 0x3f89a
movq %rdi, %r14
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq 0x28(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x40de2
cmpl %ebx, %eax
cmovgl %eax, %ebx
incq %r15
movslq 0x34(%r14), %rax
cmpq %rax, %r15
jl 0x3f87a
jmp 0x3f89f
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::FindScanlineBeforeTimestamp(double, int, int) const
GSVScanline *GSVScan::
FindScanlineBeforeTimestamp(RNScalar timestamp, int imin, int imax) const
{
  // Binary search
  int i = (imin + imax) / 2;
  if (i == imin) return Scanline(imin);
  assert(i < imax);
  GSVScanline *scanline = Scanline(i);
  RNScalar t = scanline->Timestamp();
  if (t > timestamp) return FindScanlineBeforeTimestamp(timestamp, imin, i);
  else if (t < timestamp) return FindScanlineBeforeTimestamp(timestamp, i, imax);
  else return scanline;
}

// Assembly:
movq 0x28(%rdi), %rcx
movl %edx, %edi
movl %edi, %edx
leal (%rdx,%rsi), %eax
movl %eax, %edi
shrl $0x1f, %edi
addl %eax, %edi
sarl %edi
cmpl %esi, %edi
je 0x3f915
movslq %edi, %rax
movq (%rcx,%rax,8), %rax
movsd 0x78(%rax), %xmm1
ucomisd %xmm0, %xmm1
ja 0x3f8e8
ucomisd %xmm1, %xmm0
movl %edi, %esi
ja 0x3f8e6
retq
movslq %esi, %rax
movq (%rcx,%rax,8), %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::ReadPoints()
int GSVScan::
ReadPoints(void) 
{
  // Check read counter
  if (++read_count > 1) return 1;

  // Get the scene filename
  if (NScanlines() == 0) return 1;
  GSVSegment *segment = Segment();
  if (!segment) return 0;
  GSVRun *run = segment->Run();
  if (!run) return 0;
  GSVScene *scene = run->Scene();
  if (!scene) return 0;
  const char *filename = scene->Filename();
  if (!filename) return 0;

  // Open file
  FILE *fp = fopen(filename, "rb");
  if (!fp) {
    RNFail("Unable to open GSV scene file: %s\n", filename);
    return 0;
  }

  // Read scanlines
  for (int i = 0; i < NScanlines(); i++) {
    GSVScanline *scanline = Scanline(i);
    if (!scanline->ReadPoints(fp)) return 0;
  }

  // Close file 
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl 0x24(%rdi), %eax
incl %eax
movl %eax, 0x24(%rdi)
movl $0x1, %ebx
cmpl $0x1, %eax
ja 0x40254
movq %rdi, %r14
cmpl $0x0, 0x34(%rdi)
je 0x40254
movq 0x18(%r14), %rax
xorl %ebx, %ebx
testq %rax, %rax
je 0x40254
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x40254
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x40254
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x40254
movq 0x18(%rax), %r12
testq %r12, %r12
je 0x40254
leaq 0x10c9ca(%rip), %rsi    # 0x14cbbb
movq %r12, %rdi
callq 0x27b20
testq %rax, %rax
je 0x40241
movq %rax, %r15
cmpl $0x0, 0x34(%r14)
jle 0x40232
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x28(%r14), %rax
movq (%rax,%r12,8), %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x42836
testl %eax, %eax
je 0x40254
incq %r12
movslq 0x34(%r14), %rax
cmpq %rax, %r12
jl 0x4020d
movq %r15, %rdi
callq 0x27920
movl $0x1, %ebx
jmp 0x40254
leaq 0x10c8bc(%rip), %rdi    # 0x14cb04
xorl %ebx, %ebx
movq %r12, %rsi
xorl %eax, %eax
callq 0xfb6f2
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::ReleasePoints()
int GSVScan::
ReleasePoints(void) 
{
  // Check read counter
  if (--read_count > 0) return 1;

  // Release points
  for (int i = 0; i < NScanlines(); i++) {
    GSVScanline *scanline = Scanline(i);
    if (!scanline->ReleasePoints()) return 0;
  }

  // Return success
  return 1;
}

// Assembly:
decl 0x24(%rdi)
movl $0x1, %eax
je 0x4026d
retq
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x34(%rdi)
jle 0x402a3
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x42aba
movl %eax, %ecx
testl %eax, %eax
je 0x4029c
incq %r14
movslq 0x34(%rbx), %rax
cmpq %rax, %r14
jl 0x4027d
xorl %eax, %eax
testl %ecx, %ecx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::Draw(gaps::RNFlags) const
void GSVScan::
Draw(RNFlags flags) const
{
  if (flags & GSV_DRAW_POINTS_WITH_LASER_INDEX_COLOR) {
    // Draw points  colored by laser index
    const int ncolors = 3;
    GLfloat color[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
    int laser_index = (Laser()) ? Laser()->RunIndex() : 0;
    RNLoadRgb(color[laser_index % ncolors]);
    for (int i = 0; i < NScanlines(); i++) {
      GSVScanline *scanline = Scanline(i);
      scanline->Draw(flags);
    }
  }
  else if (flags & GSV_DRAW_MESHES_WITHOUT_COLOR) {
    glEnable(GL_CULL_FACE);
    static GSVMesh *last_mesh = NULL;
    static const GSVScan *last_scan = NULL;
    if (this != last_scan) {
      if (last_mesh) delete last_mesh;
      last_mesh = Mesh();
      last_scan = this;
    }
    if (last_mesh) last_mesh->Draw();
    glDisable(GL_CULL_FACE);
  }
  else {
    // Draw scanlines
    for (int i = 0; i < NScanlines(); i++) {
      GSVScanline *scanline = Scanline(i);
      scanline->Draw(flags);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
testb $0x1, %r14b
jne 0x403f9
btl $0x10, %r14d
jb 0x40487
cmpl $0x0, 0x34(%rbx)
jle 0x4047d
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x10(%rax)
incq %r15
movslq 0x34(%rbx), %rax
cmpq %rax, %r15
jl 0x403d7
jmp 0x4047d
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x3f800000, %eax       # imm = 0x3F800000
movl %eax, (%rsp)
movl %eax, 0x10(%rsp)
movl %eax, 0x20(%rsp)
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x40448
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x40448
movslq 0x10(%rax), %rax
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
cltq
jmp 0x4044a
xorl %eax, %eax
leaq (%rax,%rax,2), %rax
leaq (%rsp,%rax,4), %rdi
callq 0x27380
cmpl $0x0, 0x34(%rbx)
jle 0x4047d
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x10(%rax)
incq %r15
movslq 0x34(%rbx), %rax
cmpq %rax, %r15
jl 0x40460
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movl $0xb44, %edi            # imm = 0xB44
callq 0x27880
movq 0x19b2b0(%rip), %rdi    # 0x1db748
cmpq %rbx, 0x19b2b1(%rip)    # 0x1db750
je 0x404c5
testq %rdi, %rdi
je 0x404ac
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, %rdi
callq 0x3ff84
movq %rax, %rdi
movq %rax, 0x19b28a(%rip)    # 0x1db748
movq %rbx, 0x19b28b(%rip)    # 0x1db750
testq %rdi, %rdi
je 0x404d8
movq (%rdi), %rax
movl $0x772, %esi            # imm = 0x772
callq *0x120(%rax)
movl $0xb44, %edi            # imm = 0xB44
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x27200
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::Print(_IO_FILE*, char const*, char const*) const
void GSVScan::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print scan header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Scan %d:", survey_index);
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

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

   // Print scanlines
  for (int i = 0; i < NScanlines(); i++) {
    GSVScanline *scanline = Scanline(i);
    scanline->Print(fp, indented_prefix, suffix);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x40517
movq 0x1949fc(%rip), %rax    # 0x1d4f10
movq (%rax), %r15
testq %r12, %r12
je 0x40527
movq %r12, %rdi
movq %r15, %rsi
callq 0x27a90
movl 0x20(%r14), %edx
leaq 0x10cd3f(%rip), %rsi    # 0x14d271
movq %r15, %rdi
xorl %eax, %eax
callq 0x27e00
testq %rbx, %rbx
je 0x4054c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27a90
movl $0xa, %edi
movq %r15, %rsi
callq 0x27c30
leaq 0x10c494(%rip), %rsi    # 0x14c9f4
movq %rsp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x27140
cmpl $0x0, 0x34(%r14)
jle 0x4059d
xorl %r13d, %r13d
movq %rsp, %r12
movq 0x28(%r14), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq *0x18(%rax)
incq %r13
movslq 0x34(%r14), %rax
cmpq %rax, %r13
jl 0x4057a
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScan.cpp
// Function: gaps::GSVScan::UpdateBBox()
void GSVScan::
UpdateBBox(void) 
{
  // Read points (assumes all scanlines are in memory or not) 
  RNBoolean read_points = FALSE;
  if (NScanlines() > 0) {
    GSVScanline *scanline = Scanline(0);
    if (scanline->DoesBBoxNeedUpdate()) {
      ReadPoints();
      read_points = TRUE;
    }
  }

  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NScanlines(); i++) {
    bbox.Union(Scanline(i)->BBox());
  }

  // Release points
  if (read_points) {
    ReleasePoints();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movb $0x1, %bpl
cmpl $0x0, 0x34(%rdi)
jle 0x405dc
movq 0x28(%rbx), %rax
movq (%rax), %rdi
callq 0x4277e
testl %eax, %eax
je 0x405dc
movq %rbx, %rdi
callq 0x40188
xorl %ebp, %ebp
leaq 0x40(%rbx), %rdi
leaq 0x19e3b1(%rip), %r14    # 0x1de998
leaq 0x8(%r14), %rsi
callq 0xd4746
leaq 0x58(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0xd4746
cmpl $0x0, 0x34(%rbx)
jle 0x40647
leaq 0x38(%rbx), %r14
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %r15
movq %r15, %rdi
callq 0x4277e
testl %eax, %eax
je 0x40629
movq %r15, %rdi
callq 0x42798
addq $0x88, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0xbe428
incq %r12
movslq 0x34(%rbx), %rax
cmpq %rax, %r12
jl 0x4060d
testb %bpl, %bpl
je 0x40655
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x40262
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::RunIndex() const
int GSVScanline::
RunIndex(void) const
{
  // Get convenient variables
  GSVSegment *segment = Segment();
  if (!segment) return -1;
  GSVRun *run = segment->Run();
  if (!run) return -1;

  // Compute run index
  int run_index = SegmentIndex();
  for (int i = 0; i < segment->RunIndex(); i++) {
    GSVSegment *s = run->Segment(i);
    run_index += s->NScanlines();
  }

  // Return runindex
  return run_index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x8(%rdi), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x40ca9
callq 0x3f6ac
testq %rax, %rax
je 0x40ca9
movq %rax, %r14
movq 0x10(%rax), %r12
testq %r12, %r12
je 0x40ca9
movq %r15, %rdi
callq 0x40cb8
movl %eax, %ebx
cmpl $0x0, 0x18(%r14)
jle 0x40ca9
xorl %r15d, %r15d
movq 0x18(%r12), %rax
movq (%rax,%r15,8), %rdi
callq 0x39910
addl %eax, %ebx
incq %r15
movslq 0x18(%r14), %rax
cmpq %rax, %r15
jl 0x40c8d
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::SegmentIndex() const
int GSVScanline::
SegmentIndex(void) const
{
  // Get convenient variables
  GSVSegment *segment = Segment();
  if (!segment) return -1;
  GSVSurvey *survey = Survey();
  if (!survey) return -1;

  // Compute segment index
  int segment_index = SurveyIndex();
  for (int i = 0; i < survey->SegmentIndex(); i++) {
    GSVSurvey *s = segment->Survey(i);
    segment_index += s->NScanlines();
  }

  // Return segment index
  return segment_index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x8(%rdi), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x40d21
callq 0x3f6ac
testq %rax, %rax
je 0x40d21
movq %rax, %r14
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x40d21
movq 0x18(%rax), %r12
testq %r12, %r12
je 0x40d21
movq %r15, %rdi
callq 0x40da8
movl %eax, %ebx
cmpl $0x0, 0x10(%r12)
jle 0x40d21
xorl %r15d, %r15d
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x3efa8
addl %eax, %ebx
incq %r15
movslq 0x10(%r12), %rax
cmpq %rax, %r15
jl 0x40d05
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::LaserIndex() const
int GSVScanline::
LaserIndex(void) const
{
  // Get convenient variables
  GSVLaser *laser = Laser();
  if (!laser) return -1;
  GSVSurvey *survey = Survey();
  if (!survey) return -1;

  // Compute laser index
  int laser_index = SurveyIndex();
  for (int i = 0; i < survey->LaserIndex(); i++) {
    GSVSurvey *s = laser->Survey(i);
    laser_index += s->NScanlines();
  }

  // Return laser index
  return laser_index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x8(%rdi), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x40d99
callq 0x3f69a
testq %rax, %rax
je 0x40d99
movq %rax, %r14
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x40d99
movq 0x18(%rax), %r12
testq %r12, %r12
je 0x40d99
movq %r15, %rdi
callq 0x40da8
movl %eax, %ebx
cmpl $0x0, 0x20(%r12)
jle 0x40d99
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x3efa8
addl %eax, %ebx
incq %r15
movslq 0x20(%r12), %rax
cmpq %rax, %r15
jl 0x40d7d
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::MaxBeamIndex() const
int GSVScanline::
MaxBeamIndex(void) const
{
  // Check first and last points
  if (npoints == 0) return -1;
  int i0 = points[0].BeamIndex();
  int i1 = points[npoints-1].BeamIndex();
  return (i0 > i1) ? i0 : i1;
}

// Assembly:
movslq 0x30(%rdi), %rax
testq %rax, %rax
je 0x40e09
movq 0x28(%rdi), %rcx
movzbl 0x46(%rcx), %edx
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
movzbl -0xa(%rcx,%rax), %eax
cmpb %al, %dl
cmoval %edx, %eax
movzbl %al, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::EstimatedGroundZ() const
RNCoord GSVScanline::
EstimatedGroundZ(void) const
{
  // Get convenient variables
  GSVLaser *laser = Laser();
  const double vlp16_laser_height = 2.0;
  const int sick_scan_ground_index = 25;
  const int sick_radius = 1;

  // Check device
  if ((laser->DeviceType() == GSV_SICK_LASER) &&
      (NPoints() > 0) &&
      (NPoints() > sick_scan_ground_index+sick_radius) &&
      points) {

    // Get three points around scan_ground_index
    R3Point p0 = PointPosition(NPoints() - sick_scan_ground_index - sick_radius);
    R3Point p1 = PointPosition(NPoints() - sick_scan_ground_index);
    R3Point p2 = PointPosition(NPoints() - sick_scan_ground_index + sick_radius);

    // Find median Z coordinate
    RNCoord z;
    if (p0.Z() < p1.Z()) {
      if (p1.Z() < p2.Z()) {
        z = p1.Z();
      }
      else {
        if (p0.Z() < p2.Z()) z = p2.Z();
        else z = p0.Z();
      }
    }
    else {
      if (p0.Z() < p2.Z()) {
        z = p0.Z();
      }
      else {
        if (p1.Z() < p2.Z()) z = p2.Z();
        else z = p1.Z();
      }
    }
  
    // Return estimate of ground Z coordinate
    return z;
  }
  else {
    const GSVPose& pose = Pose();
    const R3Point& viewpoint = pose.Viewpoint();
    return viewpoint.Z() - vlp16_laser_height;
  }

  // Should not get here
  return RN_UNKNOWN;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x3f69a
cmpl $0x2, 0x28(%rax)
jne 0x40e4a
movslq 0x30(%rbx), %rax
testq %rax, %rax
jle 0x40e4a
cmpl $0x1b, %eax
setb %dl
movq 0x28(%rbx), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
je 0x40e61
movsd 0x50(%rbx), %xmm0
addsd 0x10c429(%rip), %xmm0   # 0x14d280
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
movsd -0x820(%rcx,%rax), %xmm0
movsd -0x818(%rcx,%rax), %xmm1
movsd -0x810(%rcx,%rax), %xmm2
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0xd43de
movslq 0x30(%rbx), %rax
movq 0x28(%rbx), %rcx
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
movsd -0x7d0(%rcx,%rax), %xmm0
movsd -0x7c8(%rcx,%rax), %xmm1
movsd -0x7c0(%rcx,%rax), %xmm2
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0xd43de
movslq 0x30(%rbx), %rax
movq 0x28(%rbx), %rcx
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
movsd -0x780(%rcx,%rax), %xmm0
movsd -0x778(%rcx,%rax), %xmm1
movsd -0x770(%rcx,%rax), %xmm2
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xd43de
movsd 0x10(%r14), %xmm1
movsd 0x10(%r15), %xmm2
ucomisd %xmm1, %xmm2
movsd 0x10(%rbx), %xmm3
jbe 0x40f3d
ucomisd %xmm2, %xmm3
movapd %xmm2, %xmm0
ja 0x40e57
ucomisd %xmm1, %xmm3
movapd %xmm3, %xmm0
ja 0x40e57
movapd %xmm1, %xmm0
jmp 0x40e57
ucomisd %xmm1, %xmm3
movapd %xmm1, %xmm0
ja 0x40e57
ucomisd %xmm2, %xmm3
movapd %xmm3, %xmm0
ja 0x40e57
movapd %xmm2, %xmm0
jmp 0x40e57
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::PointAngle(int) const
RNAngle GSVScanline::
PointAngle(int point_index) const
{
  // Return angle of laser when point was sampled (0 - PI)
  const R3Point& position = PointPosition(point_index);
  const R3Point& viewpoint = pose.Viewpoint();
  const R3Vector& towards = pose.Towards();
  const R3Vector& up = pose.Up();
  R3Vector right = towards % up;
  R3Vector v = position - viewpoint;
  RNLength distance = v.Length();
  if (RNIsZero(distance)) return 0;
  v /= distance;
  RNScalar dot = -(v.Dot(up));
  RNAngle angle = acos(dot);
  if (v.Dot(right) > 0) angle = RN_PI_OVER_TWO + angle;
  else angle = RN_PI_OVER_TWO - angle;
  return angle;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movslq %esi, %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %rcx
movsd (%rax,%rcx), %xmm0
movsd 0x8(%rax,%rcx), %xmm1
movsd 0x10(%rax,%rcx), %xmm2
leaq 0x78(%rsp), %r14
movq %r14, %rdi
callq 0xd43de
leaq 0x38(%rbx), %r15
addq $0x40, %rbx
leaq 0x60(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x450fa
leaq 0x48(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x45140
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xd57a6
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xd463a
movq %r15, %rdi
callq 0xd4f78
leaq 0x19545c(%rip), %rax    # 0x1d6458
movsd (%rax), %xmm2
movapd 0x10bcb8(%rip), %xmm1   # 0x14ccc0
xorpd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4101c
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm2
jae 0x41086
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xd5a44
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xd50fe
xorpd 0x10bc82(%rip), %xmm0   # 0x14ccc0
callq 0x278b0
movapd %xmm0, (%rsp)
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0xd50fe
leaq 0x1172ac(%rip), %rax    # 0x158308
movapd 0x10bc5c(%rip), %xmm2   # 0x14ccc0
movapd (%rsp), %xmm3
xorpd %xmm3, %xmm2
xorpd %xmm1, %xmm1
cmpltsd %xmm0, %xmm1
andpd %xmm1, %xmm3
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
addsd (%rax), %xmm1
movapd %xmm1, %xmm0
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::SetPoints(gaps::GSVPoint const*, int)
void GSVScanline::
SetPoints(const GSVPoint *points, int npoints) 
{
  // Delete previous points
  if (this->points) delete [] this->points;

  // Reset everything
  this->npoints = npoints;
  this->points = NULL;
  this->bbox = R3null_box;

  // Copy points
  if (points && (npoints > 0)) {
    // Allocate points 
    this->points = new GSVPoint [ npoints ];
    if (!this->points) {
      RNAbort("Unable to allocate points for scanline\n");
    }
    
    // Copy points
    for (int i = 0; i < npoints; i++) {
      this->points[i] = points[i];
    }

    // Update bounding box
    for (int i = 0; i < npoints; i++) {
      bbox.Union(this->points[i].Position());
    }
  }

  // Set read count
  read_count = 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x410c0
callq 0x27ca0
movl %ebp, 0x30(%rbx)
movq $0x0, 0x28(%rbx)
leaq 0x90(%rbx), %rdi
leaq 0x19d8bf(%rip), %r15    # 0x1de998
leaq 0x8(%r15), %rsi
callq 0xd4746
leaq 0xa8(%rbx), %rdi
addq $0x20, %r15
movq %r15, %rsi
callq 0xd4746
testq %r14, %r14
sete %al
testl %ebp, %ebp
setle %cl
orb %al, %cl
jne 0x411bf
leaq 0x88(%rbx), %r15
movl %ebp, %eax
movq %rax, 0x8(%rsp)
shlq $0x4, %rax
leaq (%rax,%rax,4), %r12
movq %r12, %rdi
callq 0x27040
movq %rax, %r13
xorl %ebp, %ebp
movq %r13, %rdi
addq %rbp, %rdi
callq 0x45524
addq $0x50, %rbp
cmpq %rbp, %r12
jne 0x4112b
movq %r13, 0x28(%rbx)
xorl %eax, %eax
leaq (%r14,%rax), %rsi
movq 0x28(%rbx), %rcx
leaq (%rcx,%rax), %rdi
movzwl 0x4c(%r14,%rax), %edx
movw %dx, 0x4c(%rcx,%rax)
movl 0x48(%r14,%rax), %edx
movl %edx, 0x48(%rcx,%rax)
movl $0x9, %ecx
rep  movsq (%rsi), %es:(%rdi)
addq $0x50, %rax
cmpq %rax, %r12
jne 0x41145
movq 0x8(%rsp), %rax
shlq $0x4, %rax
leaq (%rax,%rax,4), %r12
xorl %r13d, %r13d
leaq 0x10(%rsp), %r14
movq 0x28(%rbx), %rax
movsd (%rax,%r13), %xmm0
movsd 0x8(%rax,%r13), %xmm1
movsd 0x10(%rax,%r13), %xmm2
movq %r14, %rdi
callq 0xd43de
movq %r15, %rdi
movq %r14, %rsi
callq 0xbe362
addq $0x50, %r13
cmpq %r13, %r12
jne 0x4118b
movl $0x1, 0x20(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r13, %rdi
movq %r12, %rsi
callq 0x28330
movq %rbx, %rdi
callq 0x28150
nop
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScanline.cpp
// Function: gaps::GSVScanline::SetPose(gaps::GSVPose const&)
void GSVScanline::
SetPose(const GSVPose& pose)
{
  // Update points
  if ((NPoints() > 0) && (points) && (!(this->pose.Orientation().IsZero()))) {
    // Determine transformation of points
    R4Matrix matrix = R4identity_matrix;
    matrix.Translate(pose.Viewpoint().Vector());
    matrix.Multiply(pose.Orientation().Matrix());
    matrix.Multiply(this->pose.Orientation().Inverse().Matrix());
    matrix.Translate(-this->pose.Viewpoint().Vector());
    R3Affine transformation(matrix, 0);
    
    // Transform points
    for (int i = 0; i < npoints; i++) {
      points[i].Transform(transformation);
    }
  }

  // Set pose
  this->pose = pose;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x30(%rdi)
jle 0x4137a
cmpq $0x0, 0x28(%rbx)
je 0x4137a
movupd 0x58(%rbx), %xmm0
movupd 0x68(%rbx), %xmm1
xorpd %xmm2, %xmm2
cmpneqpd %xmm2, %xmm1
cmpneqpd %xmm2, %xmm0
shufps $0x88, %xmm1, %xmm0     # xmm0 = xmm0[0,2],xmm1[0,2]
movmskps %xmm0, %eax
testl %eax, %eax
je 0x4137a
leaq 0x58(%rbx), %r12
leaq 0x110226(%rip), %rsi    # 0x151470
leaq 0x1b8(%rsp), %r15
movq %r15, %rdi
callq 0xc295a
movsd 0x8(%r14), %xmm0
movsd 0x10(%r14), %xmm1
movsd 0x18(%r14), %xmm2
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0xd4e72
movq %r15, %rdi
movq %r13, %rsi
callq 0xc3a94
leaq 0x20(%r14), %rsi
leaq 0x138(%rsp), %r13
movq %r13, %rdi
callq 0xc20ca
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xc494b
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc453e
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0xc224a
leaq 0x138(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0xc20ca
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xc494b
movq %r15, %rdi
movq %r13, %rsi
callq 0xc453e
movsd 0x40(%rbx), %xmm0
movsd 0x48(%rbx), %xmm1
movsd 0x50(%rbx), %xmm2
leaq 0x138(%rsp), %r12
movq %r12, %rdi
callq 0xd4e72
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0xd5aac
movq %r15, %rdi
movq %r13, %rsi
callq 0xc3a94
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xc0676
cmpl $0x0, 0x30(%rbx)
jle 0x41370
xorl %r12d, %r12d
leaq 0x28(%rsp), %r15
xorl %r13d, %r13d
movq 0x28(%rbx), %rdi
addq %r12, %rdi
movq %r15, %rsi
callq 0x42ae0
incq %r13
movslq 0x30(%rbx), %rax
addq $0x50, %r12
cmpq %rax, %r13
jl 0x41351
leaq 0x28(%rsp), %rdi
callq 0xc06c4
leaq 0x40(%rbx), %rdi
leaq 0x8(%r14), %rsi
callq 0xd4746
leaq 0x58(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0xc1a58
movq %rbx, %rdi
callq 0x413c6
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xc06c4
movq %rbx, %rdi
callq 0x28150