LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::NPoints() const
int GSVSegment::
NPoints(void) const
{
  // Return number of points in all surveys
  int npoints = 0;
  for (int i = 0; i < NSurveys(); i++) 
    npoints += Survey(i)->NPoints();
  return npoints;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jge 0x37bb1
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3c900
addl %eax, %ebp
incq %r14
jmp 0x37b94
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::Viewpoint(double) const
R3Point GSVSegment::
Viewpoint(RNScalar timestamp) const
{  
  // Return "viewpoint" of the car at timestamp
  if (NPanoramas() == 0) return R3zero_point;
  GSVPanorama *panorama0 = FindPanoramaBeforeTimestamp(timestamp);
  if (!panorama0) return R3zero_point;
  int i0 = panorama0->SegmentIndex();
  if (i0 >= NPanoramas()-1) return panorama0->Viewpoint();
  GSVPanorama *panorama1 = Panorama(i0 + 1);
  RNScalar t0 = panorama0->Timestamp();
  RNScalar t1 = panorama1->Timestamp();
  if (t1 <= t0) return panorama0->Viewpoint();
  RNScalar t = (timestamp - t0) / (t1 - t0);
  if (t <= 0) return panorama0->Viewpoint();
  else if (t >= 1) return panorama1->Viewpoint();
  return (1 - t) * panorama0->Viewpoint() + t * panorama1->Viewpoint();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x4c(%rsi)
je 0x37cb6
movq %rsi, %r15
movq %rsi, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x37b0a
testq %rax, %rax
je 0x37cb6
movq %rax, %r14
movslq 0x10(%rax), %rax
movl 0x4c(%r15), %ecx
decl %ecx
cmpl %ecx, %eax
jge 0x37cc2
movq 0x40(%r15), %rcx
movq 0x8(%rcx,%rax,8), %r15
movq %r14, %rdi
callq 0x35eb4
movsd %xmm0, (%rsp)
movq %r15, %rdi
callq 0x35eb4
movsd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
jae 0x37cc2
movsd 0x8(%rsp), %xmm1
subsd %xmm2, %xmm1
subsd %xmm2, %xmm0
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jae 0x37cc2
ucomisd 0xf3422(%rip), %xmm1    # 0x12b070
jae 0x37ce2
movsd 0xf3414(%rip), %xmm0    # 0x12b070
subsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rdi
movsd %xmm1, 0x8(%rsp)
callq 0x35e94
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
movsd (%rsp), %xmm0
callq 0xc1570
movq %r15, %rdi
callq 0x35e94
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
movsd 0x8(%rsp), %xmm0
callq 0xc1570
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xc152a
jmp 0x37cd5
leaq 0x5909a3(%rip), %rsi    # 0x5c8660
movq %rbx, %rdi
jmp 0x37cd0
movq %r14, %rdi
callq 0x35e94
movq %rbx, %rdi
movq %rax, %rsi
callq 0xc0e0c
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
jmp 0x37cc5
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::Front(double) const
R3Vector GSVSegment::
Front(RNScalar timestamp) const
{
  // Interpolate panorama front vectors
  if (NPanoramas() == 0) return R3zero_vector;
  GSVPanorama *panorama0 = FindPanoramaBeforeTimestamp(timestamp);
  if (!panorama0) return R3zero_vector;
  int i0 = panorama0->SegmentIndex();
  if (i0 >= NPanoramas()-1) return panorama0->Front();
  GSVPanorama *panorama1 = Panorama(i0 + 1);
  RNScalar t0 = panorama0->Timestamp();
  RNScalar t1 = panorama1->Timestamp();
  if (t1 <= t0) return panorama0->Front();
  RNScalar t = (timestamp - t0) / (t1 - t0);
  if (t <= 0) return panorama0->Front();
  else if (t >= 1) return panorama1->Front();
  R3Vector front = (1 - t) * panorama0->Front() + t * panorama1->Front();

  // Make sure orhtogonal to positive z (up)
  front[2] = 0; front.Normalize();

  // Return front direction of the car at timestamp
  return front;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x4c(%rsi)
je 0x37df7
movq %rsi, %r15
movq %rsi, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x37b0a
testq %rax, %rax
je 0x37df7
movq %rax, %r14
movslq 0x10(%rax), %rax
movl 0x4c(%r15), %ecx
decl %ecx
cmpl %ecx, %eax
jge 0x37e03
movq 0x40(%r15), %rcx
movq 0x8(%rcx,%rax,8), %r15
movq %r14, %rdi
callq 0x35eb4
movsd %xmm0, (%rsp)
movq %r15, %rdi
callq 0x35eb4
movsd (%rsp), %xmm2
ucomisd %xmm0, %xmm2
jae 0x37e03
movsd 0x8(%rsp), %xmm1
subsd %xmm2, %xmm1
subsd %xmm2, %xmm0
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jae 0x37e03
ucomisd 0xf32ee(%rip), %xmm1    # 0x12b070
jae 0x37e23
movsd 0xf32e0(%rip), %xmm0    # 0x12b070
subsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rdi
movsd %xmm1, 0x8(%rsp)
callq 0x38ae4
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
movsd (%rsp), %xmm0
callq 0xc1cb2
movq %r15, %rdi
callq 0x38ae4
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
movsd 0x8(%rsp), %xmm0
callq 0xc1cb2
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xc1f42
andq $0x0, 0x10(%rbx)
movq %rbx, %rdi
callq 0xc18be
jmp 0x37e16
leaq 0xfde9a(%rip), %rsi     # 0x135c98
movq %rbx, %rdi
jmp 0x37e11
movq %r14, %rdi
callq 0x38ae4
movq %rbx, %rdi
movq %rax, %rsi
callq 0xc15cc
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
jmp 0x37e06
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::Right(double) const
R3Vector GSVSegment::
Right(RNScalar timestamp) const
{
  // Return vector to right of car
  R3Vector front = Front(timestamp);
  R3Vector up = Up(timestamp);
  R3Vector right = front % up;
  right.Normalize();
  return right;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x37ce8
leaq 0xfdeb0(%rip), %rsi     # 0x135cf8
movq %rsp, %r15
movq %r15, %rdi
callq 0xc15cc
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xc1c6e
movq %rbx, %rdi
callq 0xc18be
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::RemoveSurvey(gaps::GSVSurvey*)
void GSVSegment::
RemoveSurvey(GSVSurvey *survey)
{
  // Just checking
  assert(survey->segment_index >= 0);
  assert(survey->segment_index < surveys.NEntries());
  assert(survey->segment == this);

  // Remove laser survey
  RNArrayEntry *entry = surveys.KthEntry(survey->segment_index);
  GSVSurvey *tail = surveys.Tail();
  tail->segment_index = survey->segment_index;
  surveys.EntryContents(entry) = tail;
  surveys.RemoveTail();
  survey->segment_index = -1;
  survey->segment = NULL;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x20, %rdi
movslq 0x10(%rsi), %rax
movq 0x20(%r14), %rcx
movslq 0x2c(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rdx
movl %eax, 0x10(%rdx)
movq %rdx, (%rcx,%rax,8)
callq 0x35d92
orl $-0x1, 0x10(%rbx)
andq $0x0, 0x8(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x37e96
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::RemoveTapestry(gaps::GSVTapestry*)
void GSVSegment::
RemoveTapestry(GSVTapestry *tapestry)
{
  // Just checking
  assert(tapestry->segment_index >= 0);
  assert(tapestry->segment_index < tapestries.NEntries());
  assert(tapestry->segment == this);

  // Remove camera tapestry
  RNArrayEntry *entry = tapestries.KthEntry(tapestry->segment_index);
  GSVTapestry *tail = tapestries.Tail();
  tail->segment_index = tapestry->segment_index;
  tapestries.EntryContents(entry) = tail;
  tapestries.RemoveTail();
  tapestry->segment_index = -1;
  tapestry->segment = NULL;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x30, %rdi
movslq 0x10(%rsi), %rax
movq 0x30(%r14), %rcx
movslq 0x3c(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rdx
movl %eax, 0x10(%rdx)
movq %rdx, (%rcx,%rax,8)
callq 0x35d92
orl $-0x1, 0x10(%rbx)
andq $0x0, 0x8(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x37e96
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::RemovePanorama(gaps::GSVPanorama*)
void GSVSegment::
RemovePanorama(GSVPanorama *panorama)
{
  // Just checking
  assert(panorama->segment_index >= 0);
  assert(panorama->segment_index < panoramas.NEntries());
  assert(panorama->segment == this);

  // Remove camera panorama
  RNArrayEntry *entry = panoramas.KthEntry(panorama->segment_index);
  GSVPanorama *tail = panoramas.Tail();
  tail->segment_index = panorama->segment_index;
  panoramas.EntryContents(entry) = tail;
  panoramas.RemoveTail();
  panorama->segment_index = -1;
  panorama->segment = NULL;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x40, %rdi
movslq 0x10(%rsi), %rax
movq 0x40(%r14), %rcx
movslq 0x4c(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rdx
movl %eax, 0x10(%rdx)
movq %rdx, (%rcx,%rax,8)
callq 0x35d92
orl $-0x1, 0x10(%rbx)
andq $0x0, 0x8(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x37e96
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::Draw(gaps::RNFlags) const
void GSVSegment::
Draw(RNFlags flags) const
{
  // Draw surveys
  for (int i = 0; i < NSurveys(); i++) {
    GSVSurvey *survey = Survey(i);
    survey->Draw(flags);
  }

  // Draw tapestries
  for (int i = 0; i < NTapestries(); i++) {
    GSVTapestry *tapestry = Tapestry(i);
    tapestry->Draw(flags);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movslq 0x2c(%r14), %rax
cmpq %rax, %r15
jge 0x38093
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
incq %r15
jmp 0x38074
xorl %r15d, %r15d
movslq 0x3c(%r14), %rax
cmpq %rax, %r15
jge 0x380b5
movq 0x30(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
incq %r15
jmp 0x38096
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::Print(_IO_FILE*, char const*, char const*) const
void GSVSegment::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print segment 
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Segment %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);
  }

  // Print tapestries
  for (int i = 0; i < NTapestries(); i++) {
    GSVTapestry *tapestry = Tapestry(i);
    tapestry->Print(fp, indented_prefix, suffix);
  }

  // Print panorama
  for (int i = 0; i < NPanoramas(); i++) {
    GSVPanorama *panorama = Panorama(i);
    panorama->Print(fp, indented_prefix, suffix);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x380e8
movq 0x185e5b(%rip), %rax    # 0x1bdf40
movq (%rax), %r15
testq %r12, %r12
je 0x380f8
movq %r12, %rdi
movq %r15, %rsi
callq 0x27aa0
movl 0x18(%r14), %edx
leaq 0xf3dcd(%rip), %rsi     # 0x12bed0
movq %r15, %rdi
xorl %eax, %eax
callq 0x27e20
testq %rbx, %rbx
je 0x3811d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27aa0
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x27c30
leaq 0xf38c5(%rip), %rsi     # 0x12b9f4
xorl %ebp, %ebp
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x27140
movslq 0x2c(%r14), %rax
cmpq %rax, %rbp
jge 0x38166
movq 0x20(%r14), %rax
movq (%rax,%rbp,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq *0x18(%rax)
incq %rbp
jmp 0x38141
xorl %r13d, %r13d
movq %rsp, %r12
movslq 0x3c(%r14), %rax
cmpq %rax, %r13
jge 0x38191
movq 0x30(%r14), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq *0x18(%rax)
incq %r13
jmp 0x3816c
xorl %r13d, %r13d
movq %rsp, %r12
movslq 0x4c(%r14), %rax
cmpq %rax, %r13
jge 0x381bc
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq *0x18(%rax)
incq %r13
jmp 0x38197
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::UpdateBBox()
void GSVSegment::
UpdateBBox(void) 
{
  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NSurveys(); i++) bbox.Union(Survey(i)->BBox());
  for (int i = 0; i < NTapestries(); i++) bbox.Union(Tapestry(i)->BBox());
  for (int i = 0; i < NPanoramas(); i++) bbox.Union(Panorama(i)->Viewpoint());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x50(%rdi), %r14
leaq 0x18f7d7(%rip), %rsi    # 0x1c79b8
movq %r14, %rdi
callq 0x30d44
xorl %r15d, %r15d
movslq 0x2c(%rbx), %rax
cmpq %rax, %r15
jge 0x38212
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x38b16
movq %r14, %rdi
movq %rax, %rsi
callq 0xad3ba
incq %r15
jmp 0x381ec
xorl %r15d, %r15d
movslq 0x3c(%rbx), %rax
cmpq %rax, %r15
jge 0x3823b
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x38b3c
movq %r14, %rdi
movq %rax, %rsi
callq 0xad3ba
incq %r15
jmp 0x38215
xorl %r15d, %r15d
movslq 0x4c(%rbx), %rax
cmpq %rax, %r15
jge 0x38264
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x35e94
movq %r14, %rdi
movq %rax, %rsi
callq 0xad308
incq %r15
jmp 0x3823e
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::InvalidateNormals()
void GSVSegment::
InvalidateNormals(void)
{
  // Invalidate all normals
  for (int iu = 0; iu < NSurveys(); iu++) {
    GSVSurvey *survey = Survey(iu);
    for (int ia = 0; ia < survey->NScans(); ia++) {
      GSVScan *scan = survey->Scan(ia);
      for (int ie = 0; ie < scan->NScanlines(); ie++) {
        GSVScanline *scanline = scan->Scanline(ie);
        if (!scanline->ArePointsResident()) continue;
        for (int ik = 0; ik < scanline->NPoints(); ik++) {
          GSVPoint& point = (GSVPoint&) scanline->Point(ik);
          point.SetNormal(R3zero_vector);
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %ecx, %ecx
leaq 0xfd267(%rip), %r14     # 0x135c98
movq %rdi, 0x8(%rsp)
movslq 0x2c(%rdi), %rax
cmpq %rax, %rcx
jge 0x38ad4
movq 0x20(%rdi), %rax
movq %rcx, 0x10(%rsp)
movq (%rax,%rcx,8), %rcx
xorl %edx, %edx
movq %rcx, 0x18(%rsp)
movslq 0x34(%rcx), %rax
cmpq %rax, %rdx
jge 0x38ac2
movq 0x28(%rcx), %rax
movq %rdx, 0x20(%rsp)
movq (%rax,%rdx,8), %rbp
xorl %ebx, %ebx
movslq 0x34(%rbp), %rax
cmpq %rax, %rbx
jge 0x38ab3
movq 0x28(%rbp), %rax
movq (%rax,%rbx,8), %r15
cmpq $0x0, 0x28(%r15)
je 0x38aae
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq 0x30(%r15), %rax
cmpq %rax, %r13
jge 0x38aae
movq 0x28(%r15), %rdi
addq %r12, %rdi
movq %r14, %rsi
callq 0x38d1a
incq %r13
addq $0x50, %r12
jmp 0x38a8d
incq %rbx
jmp 0x38a6f
movq 0x20(%rsp), %rdx
incq %rdx
movq 0x18(%rsp), %rcx
jmp 0x38a57
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x8(%rsp), %rdi
jmp 0x38a36
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/./GSVSurvey.h
// Function: gaps::GSVSurvey::BBox() const
inline const R3Box& GSVSurvey::
BBox(void) const
{
  // Return bounding box
  if (bbox.XMin() == FLT_MAX) 
    ((GSVSurvey *) this)->UpdateBBox();
  return bbox;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movsd 0x48(%rdi), %xmm0
ucomisd 0xf2501(%rip), %xmm0    # 0x12b028
jne 0x38b33
jp 0x38b33
movq %rbx, %rdi
callq 0x3cb56
addq $0x40, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/./GSVTapestry.h
// Function: gaps::GSVTapestry::BBox() const
inline const R3Box& GSVTapestry::
BBox(void) const
{
  // Return bounding box
  if (bbox.XMin() == FLT_MAX) 
    ((GSVTapestry *) this)->UpdateBBox();
  return bbox;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movsd 0x40(%rdi), %xmm0
ucomisd 0xf24db(%rip), %xmm0    # 0x12b028
jne 0x38b59
jp 0x38b59
movq %rbx, %rdi
callq 0x3c184
addq $0x38, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/../../pkgs/R3Shapes/R3Kdtree.cpp
// Function: gaps::R3Kdtree<gaps::GSVPoint const*>::FindAll(gaps::GSVPoint const*, double, double, int (*)(gaps::GSVPoint const*, gaps::GSVPoint const*, void*), void*, gaps::RNArray<gaps::GSVPoint const*>&) const
int R3Kdtree<PtrType>::
FindAll(PtrType query_point,
  RNScalar min_distance, RNScalar max_distance, 
  int (*IsCompatible)(PtrType, PtrType, void *), void *compatible_data, 
  RNArray<PtrType>& points) const
{
  // Check root
  if (!root) return 0;

  // Use squared distances for efficiency
  if (max_distance < 0) return 0;
  if (min_distance < 0) min_distance = 0;
  RNLength min_distance_squared = min_distance * min_distance;
  RNLength max_distance_squared = max_distance * max_distance;

  // Search nodes recursively
  FindAll(root, bbox, 
    query_point, Position(query_point), 
    min_distance_squared, max_distance_squared, 
    IsCompatible, compatible_data, 
    points);

  // Return number of points
  return points.NEntries();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq 0x50(%rdi), %rbp
testq %rbp, %rbp
sete %cl
xorpd %xmm2, %xmm2
ucomisd %xmm1, %xmm2
seta %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x38d0b
movq %r8, %rbx
movq %rsi, %r12
movq %rdi, %r13
maxsd %xmm0, %xmm2
mulsd %xmm2, %xmm2
movsd %xmm2, (%rsp)
mulsd %xmm1, %xmm1
movsd %xmm1, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x38e02
movq %r13, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
leaq 0x10(%rsp), %r8
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movq %r15, %r9
pushq %rbx
pushq %r14
callq 0x391ca
addq $0x10, %rsp
movl 0xc(%rbx), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVCamera.cpp
// Function: gaps::GSVCamera::~GSVCamera()
GSVCamera::
~GSVCamera(void)
{
  // Remove camera from run
  if (run) run->RemoveCamera(this);

  // Remove camera tapestries from this camera
  while (NTapestries() > 0) RemoveTapestry(Tapestry(0));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x17c358(%rip), %rax    # 0x1b5958
movq %rax, (%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x39614
movq %rbx, %rsi
callq 0x36384
leaq 0x18(%rbx), %r14
cmpl $0x0, 0x24(%rbx)
jle 0x3962f
movq 0x18(%rbx), %rax
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x39658
jmp 0x39618
addq $0x88, %rbx
movq %rbx, %rdi
callq 0xad65a
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe1d40
jmp 0x3964f
movq %rax, %rdi
callq 0x376d2
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVCamera.cpp
// Function: gaps::GSVCamera::RemoveTapestry(gaps::GSVTapestry*)
void GSVCamera::
RemoveTapestry(GSVTapestry *tapestry)
{
  // Just checking
  assert(tapestry->camera_index >= 0);
  assert(tapestry->camera_index < tapestries.NEntries());
  assert(tapestry->camera == this);

  // Remove tapestry
  RNArrayEntry *entry = tapestries.KthEntry(tapestry->camera_index);
  GSVTapestry *tail = tapestries.Tail();
  tail->camera_index = tapestry->camera_index;
  tapestries.EntryContents(entry) = tail;
  tapestries.RemoveTail();
  tapestry->camera_index = -1;
  tapestry->camera = NULL;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x18, %rdi
movslq 0x20(%rsi), %rax
movq 0x18(%r14), %rcx
movslq 0x24(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rdx
movl %eax, 0x20(%rdx)
movq %rdx, (%rcx,%rax,8)
callq 0x35d92
orl $-0x1, 0x20(%rbx)
andq $0x0, 0x18(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3971e
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVCamera.cpp
// Function: gaps::GSVCamera::Draw(gaps::RNFlags) const
void GSVCamera::
Draw(RNFlags flags) const
{
  // Draw tapestries
  for (int i = 0; i < NTapestries(); i++) {
    GSVTapestry *tapestry = Tapestry(i);
    tapestry->Draw(flags);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jge 0x3982b
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
incq %r15
jmp 0x3980c
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVCamera.cpp
// Function: gaps::GSVCamera::Print(_IO_FILE*, char const*, char const*) const
void GSVCamera::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print camera header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Camera %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 tapestries
  for (int i = 0; i < NTapestries(); i++) {
    GSVTapestry *tapestry = Tapestry(i);
    tapestry->Print(fp, indented_prefix, suffix);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x3985e
movq 0x1846e5(%rip), %rax    # 0x1bdf40
movq (%rax), %r15
testq %r12, %r12
je 0x3986e
movq %r12, %rdi
movq %r15, %rsi
callq 0x27aa0
movl 0x10(%r14), %edx
leaq 0xf26af(%rip), %rsi     # 0x12bf28
movq %r15, %rdi
xorl %eax, %eax
callq 0x27e20
testq %rbx, %rbx
je 0x39893
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27aa0
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x27c30
leaq 0xf214f(%rip), %rsi     # 0x12b9f4
xorl %ebp, %ebp
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x27140
movslq 0x24(%r14), %rax
cmpq %rax, %rbp
jge 0x398dc
movq 0x18(%r14), %rax
movq (%rax,%rbp,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq *0x18(%rax)
incq %rbp
jmp 0x398b7
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVCamera.cpp
// Function: gaps::GSVCamera::UpdateBBox()
void GSVCamera::
UpdateBBox(void) 
{
  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NTapestries(); i++) {
    bbox.Union(Tapestry(i)->BBox());
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x88(%rdi), %r14
leaq 0x18e0b4(%rip), %rsi    # 0x1c79b8
movq %r14, %rdi
callq 0x30d44
xorl %r15d, %r15d
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jge 0x39935
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x38b3c
movq %r14, %rdi
movq %rax, %rsi
callq 0xad3ba
incq %r15
jmp 0x3990f
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVCamera.cpp
// Function: gaps::GSVCamera::DistortedPosition(gaps::R2Point const&) const
R2Point GSVCamera::
DistortedPosition(const R2Point& undistorted_image_position) const
{
  // Check focal lengths
  if (RNIsNegativeOrZero(focal_x) || RNIsNegativeOrZero(focal_y))
    return R2Point(-1,-1);
  
  // Check if there is no distortion
  if ((k1 == 0) && (k2 == 0) && (k3 == 0) && (p1 == 0) && (p2 == 0))
    return undistorted_image_position;
  
  // Undistorted_position and distorted position are both given in pixel coordinates 
  double delta_x = undistorted_image_position.X() - center_x;
  double delta_y = undistorted_image_position.Y() - center_y;
  double dir_x = delta_x / focal_x;
  double dir_y = delta_y / focal_y;
  return DistortedPositionFromUndistortedNormalizedPosition(dir_x, dir_y);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movsd 0x38(%rsi), %xmm2
leaq 0x1858fe(%rip), %rax    # 0x1bf478
movsd (%rax), %xmm0
ucomisd %xmm2, %xmm0
jae 0x39bd0
movsd 0x40(%rsi), %xmm3
ucomisd %xmm3, %xmm0
jae 0x39bd0
movupd 0x58(%rsi), %xmm0
movupd 0x68(%rsi), %xmm1
xorpd %xmm4, %xmm4
cmpneqpd %xmm4, %xmm1
cmpneqpd %xmm4, %xmm0
shufps $0x88, %xmm1, %xmm0     # xmm0 = xmm0[0,2],xmm1[0,2]
movmskps %xmm0, %eax
testl %eax, %eax
jne 0x39be9
movsd 0x78(%rsi), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x39be9
jp 0x39be9
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xdb262
jmp 0x39be4
movsd 0xf1490(%rip), %xmm0    # 0x12b068
movq %rbx, %rdi
movapd %xmm0, %xmm1
callq 0xdb258
movq %rbx, %rax
popq %rbx
retq
movsd (%rdx), %xmm0
movsd 0x8(%rdx), %xmm1
subsd 0x48(%rsi), %xmm0
subsd 0x50(%rsi), %xmm1
divsd %xmm2, %xmm0
divsd %xmm3, %xmm1
movq %rbx, %rdi
callq 0x3993c
jmp 0x39be4
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVPanorama.cpp
// Function: gaps::GSVPanorama::~GSVPanorama()
GSVPanorama::
~GSVPanorama(void)
{
  // Remove panorama from segment
  if (segment) segment->RemovePanorama(this);

  // Delete images 
  while (NImages() > 0) delete Image(0);

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x17b5ec(%rip), %rax    # 0x1b5998
movq %rax, (%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x3a3c0
movq %rbx, %rsi
callq 0x37fec
leaq 0x18(%rbx), %r14
cmpl $0x0, 0x24(%rbx)
jle 0x3a3dd
movq (%r14), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3a3c4
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3a3c4
movq 0x78(%rbx), %rdi
callq 0x27b40
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe1d40
movq %rax, %rdi
callq 0x376d2
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVPanorama.cpp
// Function: gaps::GSVPanorama::Image(char const*) const
GSVImage *GSVPanorama::
Image(const char *name) const
{
  // Return image with matching name
  for (int i = 0; i < NImages(); i++) {
    GSVImage *image = Image(i);
    if (!image->Name()) continue;
    if (!strcmp(image->Name(), name)) return image;
  }

  // None found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movslq 0x24(%rdi), %r15
movq 0x18(%rdi), %r12
xorl %r13d, %r13d
cmpq %r15, %r13
jge 0x3a509
movq (%r12,%r13,8), %r14
movq 0xb8(%r14), %rdi
testq %rdi, %rdi
je 0x3a504
movq %rbx, %rsi
callq 0x27db0
testl %eax, %eax
je 0x3a50c
incq %r13
jmp 0x3a4e3
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVPanorama.cpp
// Function: gaps::GSVPanorama::InsertImage(gaps::GSVImage*)
void GSVPanorama::
InsertImage(GSVImage *image)
{
  // Just checking
  assert(image->panorama_index == -1);
  assert(image->panorama == NULL);

  // Insert image
  image->panorama = this;
  image->panorama_index = images.NEntries();
  images.Insert(image);

  // Invalidate stuff
  viewpoint.Reset(FLT_MAX, FLT_MAX, FLT_MAX);
  timestamp = -1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq %rdi, 0x18(%rsi)
addq $0x18, %rdi
movl 0x24(%rbx), %eax
movl %eax, 0x20(%rsi)
callq 0x3110a
movaps 0xf1a18(%rip), %xmm0    # 0x12bf80
movups %xmm0, 0x28(%rbx)
movabsq $0x47efffffe0000000, %rax # imm = 0x47EFFFFFE0000000
movq %rax, 0x38(%rbx)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x70(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVPanorama.cpp
// Function: gaps::GSVPanorama::RemoveImage(gaps::GSVImage*)
void GSVPanorama::
RemoveImage(GSVImage *image)
{
  // Just checking
  assert(image->panorama_index >= 0);
  assert(image->panorama_index < images.NEntries());
  assert(image->panorama == this);

  // Remove image
  RNArrayEntry *entry = images.KthEntry(image->panorama_index);
  GSVImage *tail = images.Tail();
  tail->panorama_index = image->panorama_index;
  images.EntryContents(entry) = tail;
  images.RemoveTail();
  image->panorama_index = -1;
  image->panorama = NULL;

  // Invalidate stuff
  viewpoint.Reset(FLT_MAX, FLT_MAX, FLT_MAX);
  timestamp = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x18, %rdi
movslq 0x20(%rsi), %rax
movq 0x18(%r14), %rcx
movslq 0x24(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rdx
movl %eax, 0x20(%rdx)
movq %rdx, (%rcx,%rax,8)
callq 0x35d92
orl $-0x1, 0x20(%rbx)
andq $0x0, 0x18(%rbx)
movaps 0xf19bb(%rip), %xmm0    # 0x12bf80
movups %xmm0, 0x28(%r14)
movabsq $0x47efffffe0000000, %rax # imm = 0x47EFFFFFE0000000
movq %rax, 0x38(%r14)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x70(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVPanorama.cpp
// Function: gaps::GSVPanorama::Draw(gaps::RNFlags) const
void GSVPanorama::
Draw(RNFlags flags) const
{
  // Draw images
  for (int i = 0; i < NImages(); i++) {
    GSVImage *image = Image(i);
    image->Draw(flags);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movslq 0x24(%r14), %rax
cmpq %rax, %r15
jge 0x3a61b
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
incq %r15
jmp 0x3a5fc
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVPanorama.cpp
// Function: gaps::GSVPanorama::Print(_IO_FILE*, char const*, char const*) const
void GSVPanorama::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print panorama header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Panorama %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 images
  for (int i = 0; i < NImages(); i++) {
    GSVImage *image = Image(i);
    image->Print(fp, indented_prefix, suffix);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
jne 0x3a64e
movq 0x1838f5(%rip), %rax    # 0x1bdf40
movq (%rax), %r15
testq %r12, %r12
je 0x3a65e
movq %r12, %rdi
movq %r15, %rsi
callq 0x27aa0
movl 0x10(%r14), %edx
leaq 0xf1927(%rip), %rsi     # 0x12bf90
movq %r15, %rdi
xorl %eax, %eax
callq 0x27e20
testq %rbx, %rbx
je 0x3a683
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27aa0
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x27c30
leaq 0xf135f(%rip), %rsi     # 0x12b9f4
xorl %ebp, %ebp
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x27140
movslq 0x24(%r14), %rax
cmpq %rax, %rbp
jge 0x3a6cc
movq 0x18(%r14), %rax
movq (%rax,%rbp,8), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq *0x18(%rax)
incq %rbp
jmp 0x3a6a7
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVPanorama.cpp
// Function: gaps::GSVPanorama::UpdateTimestamp()
void GSVPanorama::
UpdateTimestamp(void) 
{
  // Update timestamp
  timestamp = 0;
  if (NImages() > 0) {
    for (int i = 0; i < NImages(); i++) 
      timestamp += Image(i)->Timestamp();
    timestamp /= NImages();
  }
}

// Assembly:
andq $0x0, 0x70(%rdi)
movl 0x24(%rdi), %eax
testl %eax, %eax
jle 0x3a9e9
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
pushq $-0x1
popq %rbp
movslq %eax, %rcx
cmpq %rcx, %r14
jge 0x3a9d8
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
movl %ebp, %esi
callq 0x3adba
addsd 0x70(%rbx), %xmm0
movsd %xmm0, 0x70(%rbx)
incq %r14
movl 0x24(%rbx), %eax
jmp 0x3a9af
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::~GSVImage()
GSVImage::
~GSVImage(void)
{
  // Remove image from tapestry
  if (tapestry) tapestry->RemoveImage(this);

  // Remove image from panorama
  if (panorama) panorama->RemoveImage(this);

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

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x17af1b(%rip), %rax    # 0x1b59d8
movq %rax, (%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x3aad1
movq %rbx, %rsi
callq 0x3c050
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x3aae2
movq %rbx, %rsi
callq 0x3a58a
movq 0xb8(%rbx), %rdi
callq 0x27b40
leaq 0x68(%rbx), %rdi
callq 0x41e6a
addq $0x28, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x41e6a
movq %rax, %rdi
callq 0x376d2
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::SceneIndex() const
int GSVImage::
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->NImages();
  }

  // Return scene index
  return scene_index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
callq 0x3ab34
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x3abb7
movq %rax, %r14
movq 0x8(%rax), %r12
testq %r12, %r12
je 0x3abb7
movq %r15, %rdi
callq 0x3abc6
movl %eax, %ebx
xorl %r15d, %r15d
movslq 0x10(%r14), %rax
cmpq %rax, %r15
jge 0x3abb7
movq 0x8(%r12), %rax
movq (%rax,%r15,8), %rdi
callq 0x36190
addl %eax, %ebx
incq %r15
jmp 0x3ab99
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::Pose(int) const
GSVPose GSVImage::
Pose(int column_index) const
{
  // Return pose estimate for given column
  int ncolumns = Width();
  if (ncolumns <= 0) return GSVPose(0,0,0,0,0,0,0);
  if (column_index < 0) column_index = ncolumns/2;
  RNScalar t = (RNScalar) column_index / (RNScalar) (ncolumns-1);
  R3Point viewpoint = (1-t)*pose0.Viewpoint() + t*pose1.Viewpoint();
  R3Quaternion orientation = R3QuaternionSlerp(pose0.Orientation(), pose1.Orientation(), t);
  return GSVPose(viewpoint, orientation);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3ac8e
testl %eax, %eax
jle 0x3ad8a
movl %eax, %ecx
shrl %ecx
testl %ebp, %ebp
cmovnsl %ebp, %ecx
cvtsi2sd %ecx, %xmm1
decl %eax
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd 0xf0354(%rip), %xmm0    # 0x12b070
subsd %xmm1, %xmm0
leaq 0x30(%r14), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xc1570
leaq 0x70(%r14), %rsi
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movsd (%rsp), %xmm0
callq 0xc1570
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xc152a
leaq 0x48(%r14), %rsi
addq $0x88, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
movsd (%rsp), %xmm0
callq 0xb0615
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x41d1e
jmp 0x3ada8
xorps %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
xorps %xmm3, %xmm3
xorps %xmm4, %xmm4
xorps %xmm5, %xmm5
xorps %xmm6, %xmm6
movq %rbx, %rdi
callq 0x41e10
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::Timestamp(int) const
RNScalar GSVImage::
Timestamp(int column_index) const
{
  // Return timestamp estimate for given column
  int ncolumns = Width();
  if (ncolumns <= 0) return -1;
  if (column_index < 0) column_index = ncolumns/2;
  RNScalar t = (RNScalar) column_index / (RNScalar) (ncolumns-1);
  return (1-t)*timestamp0 + t*timestamp1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x3ac8e
testl %eax, %eax
jle 0x3ae04
movl %eax, %ecx
shrl %ecx
testl %ebp, %ebp
cmovnsl %ebp, %ecx
cvtsi2sd %ecx, %xmm1
decl %eax
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd 0xf0286(%rip), %xmm0    # 0x12b070
subsd %xmm1, %xmm0
mulsd 0xb0(%rbx), %xmm1
mulsd 0xa8(%rbx), %xmm0
addsd %xmm1, %xmm0
jmp 0x3ae0c
movsd 0xf025c(%rip), %xmm0    # 0x12b068
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::UndistortedImage() const
RNAngle GSVImage::
YFov(void) const
{
  // Return field of view in vertical direction
  GSVCamera *camera = Camera();
  if (!camera) return 0;
  return camera->YFov();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1428, %rsp           # imm = 0x1428
movq 0x18(%rdi), %r14
testq %r14, %r14
je 0x3b15b
movq %rdi, %rbx
movl 0x20(%rdi), %r13d
movq %r14, %rdi
callq 0x3a494
movl %eax, %ebp
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x3b15b
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x3b15b
movl 0x18(%rax), %r14d
movq 0x48(%r15), %rsi
testq %rsi, %rsi
je 0x3af9a
leaq 0x20(%rsp), %rdi
callq 0x27880
jmp 0x3afb1
movl 0x10(%r15), %edx
leaq 0xf0aa8(%rip), %rsi     # 0x12ba4d
leaq 0x20(%rsp), %rdi
xorl %eax, %eax
callq 0x27140
movq 0x8(%r15), %r12
testq %r12, %r12
je 0x3b15b
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x3b15b
movl %r14d, 0x14(%rsp)
movq 0x18(%rax), %r14
testq %r14, %r14
je 0x3b15b
movq 0x28(%r12), %rdx
testq %rdx, %rdx
je 0x3b065
movl %r13d, (%rsp)
leaq 0xf100f(%rip), %rsi     # 0x12c001
leaq 0x420(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movl 0x14(%rsp), %r8d
movl %ebp, %r9d
xorl %eax, %eax
callq 0x27140
leaq 0x420(%rsp), %rdi
callq 0xe391c
testl %eax, %eax
je 0x3b065
pushq $0x18
popq %rdi
callq 0x27940
movq %rax, %rbx
movq %rax, %rdi
callq 0xdbae0
leaq 0x420(%rsp), %rsi
movq %rbx, %rdi
callq 0xdbafc
testl %eax, %eax
jne 0x3b15d
leaq 0xf0fed(%rip), %rdi     # 0x12c03e
leaq 0x420(%rsp), %rsi
xorl %eax, %eax
callq 0xe434a
jmp 0x3b148
movq %r14, 0x18(%rsp)
movq %rbx, %rdi
callq 0x3ae14
testq %rax, %rax
je 0x3b15b
movq %rax, %r14
pushq $0x18
popq %rdi
callq 0x27940
movq %rax, %rbx
movl (%r14), %esi
movl 0x4(%r14), %edx
pushq $0x3
popq %rcx
movq %rax, %rdi
callq 0xdbdea
movq 0x18(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x39c6c
testl %eax, %eax
je 0x3b13a
cmpq $0x0, 0x28(%r12)
je 0x3b125
leaq 0xf0fbc(%rip), %rsi     # 0x12c07e
movq %r12, %rdi
movq %r15, %rdx
callq 0x318b8
testl %eax, %eax
je 0x3b125
movq 0x28(%r12), %rdx
movl %r13d, (%rsp)
leaq 0xf0f20(%rip), %rsi     # 0x12c001
leaq 0x420(%rsp), %r15
leaq 0x20(%rsp), %rcx
movq %r15, %rdi
movl 0x14(%rsp), %r8d
movl %ebp, %r9d
xorl %eax, %eax
callq 0x27140
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdda22
testl %eax, %eax
jne 0x3b125
leaq 0xf0f7b(%rip), %rdi     # 0x12c091
leaq 0x420(%rsp), %rsi
xorl %eax, %eax
callq 0xe434a
movq %r14, %rdi
callq 0xdc02c
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x27960
jmp 0x3b15d
leaq 0xf0f22(%rip), %rdi     # 0x12c063
xorl %eax, %eax
callq 0xe434a
movq %rbx, %rdi
callq 0xdc02c
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x27960
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x1428, %rsp           # imm = 0x1428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3b174
movq %rax, %r14
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x27960
movq %r14, %rdi
callq 0x28170
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::DistortedPosition(gaps::R2Point const&) const
R2Point GSVImage::
DistortedPosition(const R2Point& undistorted_image_position) const
{
  // Return the position after distortion by the camera lens
  GSVCamera *camera = Camera();
  if (camera) return camera->DistortedPosition(undistorted_image_position);
  else return undistorted_image_position;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x3b22a
movq 0x18(%rax), %rsi
testq %rsi, %rsi
je 0x3b22a
movq %rbx, %rdi
callq 0x39b6a
jmp 0x3b235
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xdb262
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::UndistortedPosition(gaps::R2Point const&) const
R2Point GSVImage::
UndistortedPosition(const R2Point& distorted_image_position) const
{
  // Return the position after the inverse of distortion by the camera lens
  GSVCamera *camera = Camera();
  if (camera) return camera->UndistortedPosition(distorted_image_position);
  else return distorted_image_position;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x3b25a
movq 0x18(%rax), %rsi
testq %rsi, %rsi
je 0x3b25a
movq %rbx, %rdi
callq 0x39c0e
jmp 0x3b265
movq %rbx, %rdi
movq %rdx, %rsi
callq 0xdb262
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::UndistortedPosition(gaps::R3Point const&, int) const
R2Point GSVImage::
UndistortedPosition(const R3Point& world_position, int column_index) const
{
  // Get camera info
  GSVCamera *camera = Camera();
  if (!camera) return 0;
  RNCoord xcenter = camera->XCenter();
  RNCoord ycenter = camera->YCenter();
  RNAngle xfocal = camera->XFocal();
  RNAngle yfocal = camera->YFocal();

  // Transform world point into column's camera coordinate system
  const GSVPose& column_pose = Pose(column_index);
  R3CoordSystem cs(column_pose.Viewpoint(), R3Triad(column_pose.Towards(), column_pose.Up()));
  R3Point camera_position = cs.InverseMatrix() * world_position;
  if (RNIsPositiveOrZero(camera_position.Z())) return R2Point(-1,-1);

  // Compute coordinates of projection
  RNCoord x = xcenter + camera_position.X() * xfocal / -(camera_position.Z());
  RNCoord y = ycenter + camera_position.Y() * yfocal / -(camera_position.Z());
  
  // Fill in point projected onto image
  return R2Point(x, y);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x170, %rsp            # imm = 0x170
movq %rdi, %rbx
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x3b3a3
movq 0x18(%rax), %rax
testq %rax, %rax
je 0x3b3a3
movq %rdx, %r14
movsd 0x48(%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x50(%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x38(%rax), %xmm0
movsd %xmm0, (%rsp)
movsd 0x40(%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movl %ecx, %edx
callq 0x3acd2
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x41e74
leaq 0x38(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x41eba
leaq 0x90(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0xb0020
leaq 0x58(%rsp), %rsi
leaq 0x110(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0xafbbe
leaq 0x90(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xafc48
leaq 0x20(%rsp), %rdi
leaq 0x90(%rsp), %rsi
movq %r14, %rdx
callq 0xb2fc7
movsd 0x30(%rsp), %xmm2
leaq 0x184124(%rip), %rax    # 0x1bf478
movsd (%rax), %xmm1
xorpd 0xf0960(%rip), %xmm1    # 0x12bcc0
ucomisd %xmm1, %xmm2
jae 0x3b3af
movsd (%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
divsd %xmm2, %xmm1
movsd 0x18(%rsp), %xmm0
subsd %xmm1, %xmm0
movsd 0x8(%rsp), %xmm3
mulsd 0x28(%rsp), %xmm3
divsd %xmm2, %xmm3
movsd 0x10(%rsp), %xmm1
subsd %xmm3, %xmm1
movq %rbx, %rdi
callq 0xdb258
jmp 0x3b3c3
movq %rbx, %rdi
xorl %esi, %esi
callq 0xdb276
jmp 0x3b3cd
movsd 0xefcb1(%rip), %xmm0    # 0x12b068
movq %rbx, %rdi
movapd %xmm0, %xmm1
callq 0xdb258
leaq 0x50(%rsp), %rdi
callq 0x41e6a
movq %rbx, %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r14
popq %r15
retq
jmp 0x3b3e5
jmp 0x3b3e5
jmp 0x3b3e5
jmp 0x3b3e5
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x41e6a
movq %rbx, %rdi
callq 0x28170
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::DistortedPosition(gaps::R3Point const&) const
R2Point GSVImage::
DistortedPosition(const R3Point& world_position) const
{
  // Return position of 3D point in distorted image
  R2Point undistorted_position = UndistortedPosition(world_position);
  if (undistorted_position == R2Point(-1,-1)) return undistorted_position;
  return DistortedPosition(undistorted_position);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3b3fa
leaq 0x18(%rsp), %r12
movsd 0xef9bb(%rip), %xmm0    # 0x12b068
movq %r12, %rdi
movaps %xmm0, %xmm1
callq 0xdb258
movq %r15, %rdi
movq %r12, %rsi
callq 0xdb528
testl %eax, %eax
je 0x3b6d6
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0xdb262
jmp 0x3b6e6
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3b20a
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVImage.cpp
// Function: gaps::GSVImage::Print(_IO_FILE*, char const*, char const*) const
void GSVImage::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print image header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Image %d:", panorama_index);
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

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

  // Print image stuff
  // ???
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
testq %rsi, %rsi
jne 0x3b9ef
movq 0x182554(%rip), %rax    # 0x1bdf40
movq (%rax), %r14
testq %rbx, %rbx
je 0x3b9ff
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27aa0
movl 0x20(%r12), %edx
leaq 0xf06b0(%rip), %rsi     # 0x12c0bb
movq %r14, %rdi
xorl %eax, %eax
callq 0x27e20
testq %r15, %r15
je 0x3ba25
movq %r15, %rdi
movq %r14, %rsi
callq 0x27aa0
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x27c30
leaq 0xeffbd(%rip), %rsi     # 0x12b9f4
movq %rsp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x27140
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVTapestry.cpp
// Function: gaps::GSVTapestry::~GSVTapestry()
GSVTapestry::
~GSVTapestry(void)
{
  // Remove tapestry from segment
  if (segment) segment->RemoveTapestry(this);

  // Remove tapestry from camera
  if (camera) camera->RemoveTapestry(this);

  // Delete images
  while (NImages()) delete Image(0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x179e72(%rip), %rax    # 0x1b5a18
movq %rax, (%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x3bbba
movq %rbx, %rsi
callq 0x37f88
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x3bbcb
movq %rbx, %rsi
callq 0x39658
leaq 0x28(%rbx), %r14
cmpl $0x0, 0x34(%rbx)
je 0x3bbe8
movq (%r14), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3bbcf
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3bbcf
addq $0x38, %rbx
movq %rbx, %rdi
callq 0xad65a
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe1d40
movq %rax, %rdi
callq 0x376d2
nop