LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::NImages() const
int GSVScene::
NImages(void) const
{
  // Return number of images in scene
  int count = 0;
  for (int i = 0; i < NRuns(); i++) {
    GSVRun *run = Run(i);
    count += run->NImages();
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x3163d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x36190
addl %eax, %ebp
incq %r14
jmp 0x31620
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::NLasers() const
int GSVScene::
NLasers(void) const
{
  // Return number of lasers in scene
  int count = 0;
  for (int ir = 0; ir < NRuns(); ir++) {
    GSVRun *run = Run(ir);
    count += run->NLasers();
  }
  return count;
}

// Assembly:
movl 0x14(%rdi), %ecx
movq 0x8(%rdi), %rdx
xorl %esi, %esi
testl %ecx, %ecx
cmovlel %esi, %ecx
xorl %eax, %eax
cmpq %rsi, %rcx
je 0x31665
movq (%rdx,%rsi,8), %rdi
addl 0x44(%rdi), %eax
incq %rsi
jmp 0x31654
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::NSurveys() const
int GSVScene::
NSurveys(void) const
{
  // Return number of surveys in scene
  int count = 0;
  for (int i = 0; i < NRuns(); i++) {
    GSVRun *run = Run(i);
    count += run->NSurveys();
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x3168f
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x361c0
addl %eax, %ebp
incq %r14
jmp 0x31672
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::NScans() const
int GSVScene::
NScans(void) const
{
  // Return number of scans in scene
  int count = 0;
  for (int i = 0; i < NRuns(); i++) {
    GSVRun *run = Run(i);
    count += run->NScans();
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x316bf
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x361e2
addl %eax, %ebp
incq %r14
jmp 0x316a2
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::NScanlines() const
int GSVScene::
NScanlines(void) const
{
  // Return number of scanlines in scene
  int count = 0;
  for (int i = 0; i < NRuns(); i++) {
    GSVRun *run = Run(i);
    count += run->NScanlines();
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x316ef
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x36212
addl %eax, %ebp
incq %r14
jmp 0x316d2
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::NPoints() const
int GSVScene::
NPoints(void) const
{
  // Return number of points in all runs
  int npoints = 0;
  for (int i = 0; i < NRuns(); i++) 
    npoints += Run(i)->NPoints();
  return npoints;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x3171f
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x36242
addl %eax, %ebp
incq %r14
jmp 0x31702
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::RemoveRun(gaps::GSVRun*)
void GSVScene::
RemoveRun(GSVRun *run)
{
  // Just checking
  assert(run->scene_index >= 0);
  assert(run->scene_index < runs.NEntries());
  assert(run->scene == this);

  // Remove run
  RNArrayEntry *entry = runs.KthEntry(run->scene_index);
  GSVRun *tail = runs.Tail();
  tail->scene_index = run->scene_index;
  runs.EntryContents(entry) = tail;
  runs.RemoveTail();
  run->scene_index = -1;
  run->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x8(%rdi), %rax
movslq 0x10(%rsi), %rcx
movq 0x8(%rdi), %rdx
movslq 0x14(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rsi
movl %ecx, 0x10(%rsi)
movq %rsi, (%rdx,%rcx,8)
movq %rax, %rdi
callq 0x35d92
orl $-0x1, 0x10(%rbx)
andq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::Draw(gaps::RNFlags) const
void GSVScene::
Draw(RNFlags flags) const
{
  // Draw runs
  for (int i = 0; i < NRuns(); i++) {
    GSVRun *run = Run(i);
    run->Draw(flags);
  }
}

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

  // Print scene header
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "%s", "GSVScene");
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

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

   // Print runs
  for (int i = 0; i < NRuns(); i++) {
    GSVRun *run = Run(i);
    run->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 0x317ce
movq 0x18c775(%rip), %rax    # 0x1bdf40
movq (%rax), %r15
testq %r12, %r12
je 0x317de
movq %r12, %rdi
movq %r15, %rsi
callq 0x27aa0
leaq 0xfa206(%rip), %rdi     # 0x12b9eb
movq %r15, %rsi
callq 0x27aa0
testq %rbx, %rbx
je 0x317fd
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27aa0
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x27c30
leaq 0xfa1e5(%rip), %rsi     # 0x12b9f4
xorl %ebp, %ebp
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x27140
movslq 0x14(%r14), %rax
cmpq %rax, %rbp
jge 0x31846
movq 0x8(%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 0x31821
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/GSVScene.cpp
// Function: gaps::GSVScene::CreateCacheDataDirectory(char const*, gaps::GSVRun*) const
int GSVScene::
CreateCacheDataDirectory(const char *subdirectory, GSVRun *run) const
{
  // Check cache directory name
  if (!cache_data_directory_name) return 0;

  // Create the cache subdirectory
  if (subdirectory && (strlen(subdirectory) > 0)) {
    char cmd[4096];
    if (run->Name()) sprintf(cmd, "mkdir -p %s/%s/%s", cache_data_directory_name, subdirectory, run->Name());
    else sprintf(cmd, "mkdir -p %s/%s/Run%d", cache_data_directory_name, subdirectory, run->SceneIndex());
    system(cmd);
  }
  else if (run) {
    char cmd[4096];
    if (run->Name()) sprintf(cmd, "mkdir -p %s/run_data/%s", cache_data_directory_name, run->Name());
    else sprintf(cmd, "mkdir -p %s/run_data/Run%d", cache_data_directory_name, run->SceneIndex());
    system(cmd);
  }
  else {
    char cmd[4096];
    sprintf(cmd, "mkdir -p %s", cache_data_directory_name);
    system(cmd);
  }

  // Return success
  return 1;
}

// Assembly:
movq %rdx, %rax
movq 0x28(%rdi), %rdx
testq %rdx, %rdx
je 0x31916
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rsi, %rcx
testq %rsi, %rsi
je 0x318f5
cmpb $0x0, (%rcx)
je 0x318f5
movq 0x48(%rax), %r8
testq %r8, %r8
je 0x31932
leaq 0xfa110(%rip), %rsi     # 0x12b9f9
movq %rsp, %rdi
xorl %eax, %eax
callq 0x27140
jmp 0x3195d
testq %rax, %rax
je 0x31919
movq 0x48(%rax), %rcx
testq %rcx, %rcx
je 0x31949
leaq 0xfa116(%rip), %rsi     # 0x12ba20
movq %rsp, %rdi
xorl %eax, %eax
callq 0x27140
jmp 0x3195d
xorl %eax, %eax
retq
leaq 0xfa133(%rip), %rsi     # 0x12ba53
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x27140
movq %rbx, %rdi
jmp 0x31960
movl 0x10(%rax), %r8d
leaq 0xfa0ce(%rip), %rsi     # 0x12ba0b
movq %rsp, %rdi
xorl %eax, %eax
callq 0x27140
jmp 0x3195d
movl 0x10(%rax), %ecx
leaq 0xfa0e5(%rip), %rsi     # 0x12ba38
movq %rsp, %rdi
xorl %eax, %eax
callq 0x27140
movq %rsp, %rdi
callq 0x277d0
pushq $0x1
popq %rax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::UpdateBBox()
void GSVScene::
UpdateBBox(void) 
{
  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NRuns(); i++) {
    bbox.Union(Run(i)->BBox());
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
leaq 0x196033(%rip), %rsi    # 0x1c79b8
movq %r14, %rdi
callq 0x30d44
xorl %r15d, %r15d
movslq 0x14(%rbx), %rax
cmpq %rax, %r15
jge 0x319b6
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x35d9c
movq %r14, %rdi
movq %rax, %rsi
callq 0xad3ba
incq %r15
jmp 0x31990
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::UpdateNormals()
void GSVScene::
UpdateNormals(void) 
{
  // Update normals
  for (int i = 0; i < NRuns(); i++) {
    GSVRun *run = Run(i);
    run->UpdateNormals();
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x31a57
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x365e8
incq %r14
jmp 0x31a3c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::InvalidateNormals()
void GSVScene::
InvalidateNormals(void) 
{
  // Invalidate normals
  for (int i = 0; i < NRuns(); i++) {
    GSVRun *run = Run(i);
    run->InvalidateNormals();
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x31a85
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x36616
incq %r14
jmp 0x31a6a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::UpdatePointIdentifiers()
void GSVScene::
UpdatePointIdentifiers(void) 
{
  // Update all point identifiers
  int point_identifier = 0;
  for (int ir = 0; ir < NRuns(); ir++) {
    GSVRun *run = Run(ir);
    for (int is = 0; is < run->NSegments(); is++) {
      GSVSegment *segment = run->Segment(is);
      for (int iu = 0; iu < segment->NSurveys(); iu++) {
        GSVSurvey *survey = segment->Survey(iu);
        for (int ia = 0; ia < survey->NScans(); ia++) {
          GSVScan *scan = survey->Scan(ia);
          scan->ReadPoints();
          for (int ie = 0; ie < scan->NScanlines(); ie++) {
            GSVScanline *scanline = scan->Scanline(ie);
            for (int ik = 0; ik < scanline->NPoints(); ik++) {
              scanline->SetPointIdentifier(ik, point_identifier++);
            }
          }
          scan->ReleasePoints();
        }
      }
    }
  }

  // Just checking
  assert(point_identifier == NPoints());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %r15d, %r15d
xorl %ecx, %ecx
xorl %ebp, %ebp
movq %rdi, (%rsp)
movslq 0x14(%rdi), %rax
cmpq %rax, %rcx
jge 0x31b9b
movq 0x8(%rdi), %rax
movq %rcx, 0x8(%rsp)
movq (%rax,%rcx,8), %rcx
xorl %edx, %edx
movq %rcx, 0x10(%rsp)
movslq 0x24(%rcx), %rax
cmpq %rax, %rdx
jge 0x31b8a
movq 0x18(%rcx), %rax
movq %rdx, 0x18(%rsp)
movq (%rax,%rdx,8), %rcx
xorl %r13d, %r13d
movq %rcx, 0x20(%rsp)
movslq 0x2c(%rcx), %rax
cmpq %rax, %r13
jge 0x31b78
movq 0x20(%rcx), %rax
movq (%rax,%r13,8), %rbx
xorl %r12d, %r12d
movslq 0x34(%rbx), %rax
cmpq %rax, %r12
jge 0x31b6b
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %r14
movq %r14, %rdi
callq 0x3d614
movl 0x34(%r14), %eax
testl %eax, %eax
cmovlel %r15d, %eax
xorl %ecx, %ecx
cmpq %rax, %rcx
je 0x31b5e
movq 0x28(%r14), %rdx
movq (%rdx,%rcx,8), %rdx
movl 0x30(%rdx), %esi
testl %esi, %esi
cmovlel %r15d, %esi
imulq $0x50, %rsi, %rsi
xorl %edi, %edi
cmpq %rdi, %rsi
je 0x31b59
movq 0x28(%rdx), %r8
movl %ebp, 0x38(%r8,%rdi)
incl %ebp
addq $0x50, %rdi
jmp 0x31b43
incq %rcx
jmp 0x31b27
movq %r14, %rdi
callq 0x3d6e4
incq %r12
jmp 0x31b02
incq %r13
movq 0x20(%rsp), %rcx
jmp 0x31aea
movq 0x18(%rsp), %rdx
incq %rdx
movq 0x10(%rsp), %rcx
jmp 0x31ac8
movq 0x8(%rsp), %rcx
incq %rcx
movq (%rsp), %rdi
jmp 0x31aa7
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/GSVScene.cpp
// Function: gaps::GSVScene::WriteFile(char const*) const
int GSVScene::
WriteFile(const char *filename) const
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    RNFail("Filename %s has no extension (e.g., .gsv)\n", filename);
    return 0;
  }

  // Write file of appropriate type
  if (!strncmp(extension, ".gsv", 4)) return WriteGSVFile(filename);

  // Did not recognize extension
  RNFail("Unable to write file %s (unrecognized extension: %s)\n", filename, extension);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x27a30
testq %rax, %rax
je 0x31dae
movq %rax, %r15
leaq 0xf9779(%rip), %rsi     # 0x12b502
pushq $0x4
popq %rdx
movq %rax, %rdi
callq 0x27400
testl %eax, %eax
je 0x31dc7
leaq 0xf9d2f(%rip), %rdi     # 0x12bace
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe434a
jmp 0x31dbf
leaq 0xf9caa(%rip), %rdi     # 0x12ba5f
movq %rbx, %rsi
xorl %eax, %eax
callq 0xe434a
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::ReadGSVFile(char const*, int)
int GSVScene::
ReadGSVFile(const char *filename, RNBoolean read_points)
{
  // Get version
  int major_version = GetGSVMajorVersion(filename);
  
  // Open file
  FILE *fp = fopen(filename, "rb");
  if (!fp) {
    RNFail("Unable to open GSV scene file: %s\n", filename);
    return 0;
  }

  // Read file
  if (major_version < 1) {
    if (!ReadGSVStreamFromOldVersion(fp)) return 0;
  }
  else {
    if (!ReadGSVStream(fp)) return 0;
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
callq 0x325ce
movl %eax, %ebp
leaq 0xf9656(%rip), %rsi     # 0x12bbbb
movq %r15, %rdi
callq 0x27b20
testq %rax, %rax
je 0x3258a
movq %rax, %rbx
testl %ebp, %ebp
jle 0x3259f
movq (%r14), %rax
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq *0x58(%rax)
jmp 0x325ad
leaq 0xf9573(%rip), %rdi     # 0x12bb04
xorl %ebp, %ebp
movq %r15, %rsi
xorl %eax, %eax
callq 0xe434a
jmp 0x325c0
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x326e6
testl %eax, %eax
je 0x325be
pushq $0x1
popq %rbp
movq %rbx, %rdi
callq 0x27930
jmp 0x325c0
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::GetGSVMajorVersion(char const*)
int GSVScene::
GetGSVMajorVersion(const char *filename)
{
  // Open file
  FILE *fp = fopen(filename, "rb");
  if (!fp) {
    RNFail("Unable to open GSV scene file: %s\n", filename);
    return 0;
  }

  // Read magic keyword
  char magic[16] = { '\0' };
  if (fread(magic, sizeof(char), 16, fp) != (unsigned int) 16) {
    RNFail("Unable to read first bytes from GSV scene file\n");
    fclose(fp);
    return 0;
  }

  // Check magic keyword
  if (strcmp(magic, "GSV")) {
    RNFail("Invalid file format for GSV scene file\n");
    fclose(fp);
    return 0;
  }

  // Read header
  int dummy0, major_version;
  unsigned long long dummy1;
  fread(&dummy0, sizeof(int), 1, fp);
  fread(&dummy0, sizeof(int), 1, fp);
  fread(&dummy1, sizeof(unsigned long long), 1, fp);
  fread(&dummy0, sizeof(int), 1, fp);
  fread(&major_version, sizeof(int), 1, fp);

  // Close file
  fclose(fp);

  // Return major version
  return major_version;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
leaq 0xf95d7(%rip), %rsi     # 0x12bbbb
movq %r14, %rdi
callq 0x27b20
testq %rax, %rax
je 0x326a0
movq %rax, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
pushq $0x1
popq %rsi
pushq $0x10
popq %rdx
movq %rax, %rcx
callq 0x27ee0
cmpq $0x10, %rax
jne 0x326b5
cmpl $0x565347, 0x10(%rsp)   # imm = 0x565347
jne 0x326be
leaq 0xc(%rsp), %r12
pushq $0x4
popq %r14
pushq $0x1
popq %r15
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x27ee0
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x27ee0
leaq 0x28(%rsp), %rdi
pushq $0x8
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x27ee0
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x27ee0
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x27ee0
movq %rbx, %rdi
callq 0x27930
movl (%r12), %ebp
jmp 0x326d6
leaq 0xf945d(%rip), %rdi     # 0x12bb04
xorl %ebp, %ebp
movq %r14, %rsi
xorl %eax, %eax
callq 0xe434a
jmp 0x326d6
leaq 0xf9505(%rip), %rdi     # 0x12bbc1
jmp 0x326c5
leaq 0xf952c(%rip), %rdi     # 0x12bbf1
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xe434a
movq %rbx, %rdi
callq 0x27930
movl %ebp, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::WriteGSVFile(char const*) const
int GSVScene::
WriteGSVFile(const char *filename) const
{
  // Open file
  FILE *fp = fopen(filename, "wb");
  if (!fp) {
    RNFail("Unable to open GSV scene file: %s\n", filename);
    return 0;
  }

  // Write file
  if (!WriteGSVStream(fp)) return 0;

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xf8444(%rip), %rsi     # 0x12bbbe
movq %rbx, %rdi
callq 0x27b20
testq %rax, %rax
je 0x337a7
movq %rax, %r14
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x60(%rax)
testl %eax, %eax
je 0x337bc
movq %r14, %rdi
callq 0x27930
pushq $0x1
popq %rbp
jmp 0x337be
leaq 0xf8356(%rip), %rdi     # 0x12bb04
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xe434a
jmp 0x337be
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::ReadScanlinePointsFromOldVersion(_IO_FILE*, gaps::GSVScanline*)
int GSVScene::
ReadScanlinePointsFromOldVersion(FILE *fp, GSVScanline *scanline)
{
  // Get current file offset
  scanline->file_offset = RNFileTell(fp);

  // Read number of points
  int npoints;
  fread(&npoints, sizeof(int), 1, fp);
  if (npoints == 0) return 1;

  // Allocate points
  GSVPoint *points = new GSVPoint [ npoints ];
  if (!points) return 0;
  
  // Read positions
  for (int i = 0; i < npoints; i++) {
    R3Point position;
    fread(&position, sizeof(R3Point), 1, fp);
    points[i].SetPosition(position);
  }

  // Set points
  scanline->SetPoints(points, npoints);

  // Delete positions
  delete [] points;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rsi, %rdi
callq 0xe3997
movq %rax, 0x18(%r15)
leaq 0x1c(%rsp), %rbx
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rbp
movq %r14, %rcx
callq 0x27ee0
movslq (%rbx), %rbx
testq %rbx, %rbx
je 0x35d69
pushq $0x50
popq %rcx
movq %rbx, %rax
mulq %rcx
pushq $-0x1
popq %r13
cmovnoq %rax, %r13
movq %r13, %rdi
callq 0x27040
movq %rax, %r12
movq %rbx, 0x8(%rsp)
imulq $0x50, %rbx, %rbx
xorl %r14d, %r14d
leaq (%r12,%r14), %rdi
callq 0x42260
addq $0x50, %r14
cmpq %r14, %rbx
jne 0x35cdf
movq %r15, 0x10(%rsp)
xorl %r15d, %r15d
movq 0x8(%rsp), %rcx
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
imulq $0x50, %rax, %r14
leaq 0x20(%rsp), %r13
pushq $0x1
popq %rbx
cmpq %r15, %r14
je 0x35d4f
movq %r13, %rdi
callq 0xc0dfa
movq %r13, %rdi
pushq $0x18
popq %rsi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x27ee0
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%r12,%r15)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%r12,%r15)
addq $0x50, %r15
jmp 0x35d14
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movq 0x8(%rsp), %rdx
callq 0x3e3b2
movq %r12, %rdi
callq 0x27ca0
pushq $0x1
popq %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r12, %rdi
movq %r13, %rsi
callq 0x28360
movq %rbx, %rdi
callq 0x28170
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/./GSVRun.h
// Function: gaps::GSVRun::BBox() const
inline const R3Box& GSVRun::
BBox(void) const
{
  // Return bounding box
  if (bbox.XMin() == FLT_MAX) 
    ((GSVRun *) this)->UpdateBBox();
  return bbox;
}

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

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

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

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

// Assembly:
pushq %rbx
movq %rdi, %rbx
movsd 0x40(%rdi), %xmm0
ucomisd 0xf51cb(%rip), %xmm0    # 0x12b028
jne 0x35e69
jp 0x35e69
movq %rbx, %rdi
callq 0x3d9f6
addq $0x38, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/./GSVPanorama.h
// Function: gaps::GSVPanorama::Viewpoint() const
inline const R3Point& GSVPanorama::
Viewpoint(void) const
{
  // Return (average) viewpoint
  if (viewpoint.X() == FLT_MAX) 
    ((GSVPanorama *) this)->UpdatePose();
  return viewpoint;
}

// Assembly:
pushq %rbx
leaq 0x28(%rdi), %rbx
movsd 0x28(%rdi), %xmm0
ucomisd 0xf5182(%rip), %xmm0    # 0x12b028
jne 0x35eaf
jp 0x35eaf
callq 0x3a6de
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::~GSVRun()
GSVRun::
~GSVRun(void)
{
  // Remove run from scene
  if (scene) scene->RemoveRun(this);

  // Delete segments
  while (NSegments() > 0) delete Segment(0);

  // Delete cameras
  while (NCameras() > 0) delete Camera(0);

  // Delete lasers
  while (NLasers() > 0) delete Laser(0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x17f89e(%rip), %rax    # 0x1b58d8
movq %rax, (%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x3604e
movq %rbx, %rsi
callq 0x3173a
leaq 0x18(%rbx), %r14
cmpl $0x0, 0x24(%rbx)
jle 0x3606b
movq (%r14), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x36052
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x36052
leaq 0x28(%rbx), %r15
cmpl $0x0, 0x34(%rbx)
jle 0x36088
movq (%r15), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3606f
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3606f
leaq 0x38(%rbx), %r12
cmpl $0x0, 0x44(%rbx)
jle 0x360a6
movq (%r12), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3608c
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3608c
movq 0x48(%rbx), %rdi
callq 0x27b40
addq $0x50, %rbx
movq %rbx, %rdi
callq 0xad65a
movq %r12, %rdi
callq 0xe1d40
movq %r15, %rdi
callq 0xe1d40
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe1d40
movq %rax, %rdi
callq 0x376d2
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::Segment(char const*) const
GSVSegment *GSVRun::
Segment(const char *name) const
{
  // Return segment with matching name
  for (int i = 0; i < NSegments(); i++) {
    GSVSegment *segment = Segment(i);
    if (!segment->Name()) continue;
    if (!strcmp(segment->Name(), name)) return segment;
  }

  // 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 0x3613b
movq (%r12,%r13,8), %r14
movq 0x88(%r14), %rdi
testq %rdi, %rdi
je 0x36136
movq %rbx, %rsi
callq 0x27db0
testl %eax, %eax
je 0x3613e
incq %r13
jmp 0x36115
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/GSVRun.cpp
// Function: gaps::GSVRun::NTapestries() const
int GSVRun::
NTapestries(void) const
{
  // Return number of tapestries in run
  int count = 0;
  for (int is = 0; is < NSegments(); is++) {
    GSVSegment *segment = Segment(is);
    count += segment->NTapestries();
  }
  return count;
}

// Assembly:
movl 0x24(%rdi), %ecx
movq 0x18(%rdi), %rdx
xorl %esi, %esi
testl %ecx, %ecx
cmovlel %esi, %ecx
xorl %eax, %eax
cmpq %rsi, %rcx
je 0x3616d
movq (%rdx,%rsi,8), %rdi
addl 0x3c(%rdi), %eax
incq %rsi
jmp 0x3615c
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::NPanoramas() const
int GSVRun::
NPanoramas(void) const
{
  // Return number of panoramas in run
  int count = 0;
  for (int is = 0; is < NSegments(); is++) {
    GSVSegment *segment = Segment(is);
    count += segment->NPanoramas();
  }
  return count;
}

// Assembly:
movl 0x24(%rdi), %ecx
movq 0x18(%rdi), %rdx
xorl %esi, %esi
testl %ecx, %ecx
cmovlel %esi, %ecx
xorl %eax, %eax
cmpq %rsi, %rcx
je 0x3618f
movq (%rdx,%rsi,8), %rdi
addl 0x4c(%rdi), %eax
incq %rsi
jmp 0x3617e
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::NImages() const
int GSVRun::
NImages(void) const
{
  // Return number of images in run
  int count = 0;
  for (int is = 0; is < NSegments(); is++) {
    GSVSegment *segment = Segment(is);
    count += segment->NImages();
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x361b9
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x37912
addl %eax, %ebp
incq %r14
jmp 0x3619c
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::NSurveys() const
int GSVRun::
NSurveys(void) const
{
  // Return number of surveys in run
  int count = 0;
  for (int is = 0; is < NSegments(); is++) {
    GSVSegment *segment = Segment(is);
    count += segment->NSurveys();
  }
  return count;
}

// Assembly:
movl 0x24(%rdi), %ecx
movq 0x18(%rdi), %rdx
xorl %esi, %esi
testl %ecx, %ecx
cmovlel %esi, %ecx
xorl %eax, %eax
cmpq %rsi, %rcx
je 0x361e1
movq (%rdx,%rsi,8), %rdi
addl 0x2c(%rdi), %eax
incq %rsi
jmp 0x361d0
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::NScans() const
int GSVRun::
NScans(void) const
{
  // Return number of scans in run
  int count = 0;
  for (int is = 0; is < NSegments(); is++) {
    GSVSegment *segment = Segment(is);
    count += segment->NScans();
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x3620b
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3796a
addl %eax, %ebp
incq %r14
jmp 0x361ee
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::NScanlines() const
int GSVRun::
NScanlines(void) const
{
  // Return number of scanlines in run
  int count = 0;
  for (int is = 0; is < NSegments(); is++) {
    GSVSegment *segment = Segment(is);
    count += segment->NScanlines();
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x3623b
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x379c2
addl %eax, %ebp
incq %r14
jmp 0x3621e
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::NPoints() const
int GSVRun::
NPoints(void) const
{
  // Return number of points in all segments
  int npoints = 0;
  for (int i = 0; i < NSegments(); i++) 
    npoints += Segment(i)->NPoints();
  return npoints;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x3626b
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x37b88
addl %eax, %ebp
incq %r14
jmp 0x3624e
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::RemoveSegment(gaps::GSVSegment*)
void GSVRun::
RemoveSegment(GSVSegment *segment)
{
  // Just checking
  assert(segment->run_index >= 0);
  assert(segment->run_index < segments.NEntries());
  assert(segment->run == this);

  // Remove segment
  RNArrayEntry *entry = segments.KthEntry(segment->run_index);
  GSVSegment *tail = segments.Tail();
  tail->run_index = segment->run_index;
  segments.EntryContents(entry) = tail;
  segments.RemoveTail();
  segment->run_index = -1;
  segment->run = NULL;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x18, %rdi
movslq 0x18(%rsi), %rax
movq 0x18(%r14), %rcx
movslq 0x24(%r14), %rdx
movq -0x8(%rcx,%rdx,8), %rdx
movl %eax, 0x18(%rdx)
movq %rdx, (%rcx,%rax,8)
callq 0x35d92
orl $-0x1, 0x18(%rbx)
andq $0x0, 0x10(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x36292
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::RemoveCamera(gaps::GSVCamera*)
void GSVRun::
RemoveCamera(GSVCamera *camera)
{
  // Just checking
  assert(camera->run_index >= 0);
  assert(camera->run_index < cameras.NEntries());
  assert(camera->run == this);

  // Remove camera
  RNArrayEntry *entry = cameras.KthEntry(camera->run_index);
  GSVCamera *tail = cameras.Tail();
  tail->run_index = camera->run_index;
  cameras.EntryContents(entry) = tail;
  cameras.RemoveTail();
  camera->run_index = -1;
  camera->run = NULL;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x28, %rdi
movslq 0x10(%rsi), %rax
movq 0x28(%r14), %rcx
movslq 0x34(%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 0x36292
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::RemoveLaser(gaps::GSVLaser*)
void GSVRun::
RemoveLaser(GSVLaser *laser)
{
  // Just checking
  assert(laser->run_index >= 0);
  assert(laser->run_index < lasers.NEntries());
  assert(laser->run == this);

  // Remove laser
  RNArrayEntry *entry = lasers.KthEntry(laser->run_index);
  GSVLaser *tail = lasers.Tail();
  tail->run_index = laser->run_index;
  lasers.EntryContents(entry) = tail;
  lasers.RemoveTail();
  laser->run_index = -1;
  laser->run = NULL;

  // Invalidate bounding box
  InvalidateBBox();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x38, %rdi
movslq 0x10(%rsi), %rax
movq 0x38(%r14), %rcx
movslq 0x44(%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 0x36292
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::Draw(gaps::RNFlags) const
void GSVRun::
Draw(RNFlags flags) const
{
  // Draw segments
  for (int i = 0; i < NSegments(); i++) {
    GSVSegment *segment = Segment(i);
    segment->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 0x36489
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
incq %r15
jmp 0x3646a
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::Print(_IO_FILE*, char const*, char const*) const
void GSVRun::
Print(FILE *fp, const char *prefix, const char *suffix) const
{
  // Check fp
  if (!fp) fp = stdout;

  // Print run 
  if (prefix) fprintf(fp, "%s", prefix);
  fprintf(fp, "Run %d:", scene_index);
  if (suffix) fprintf(fp, "%s", suffix);
  fprintf(fp, "\n");

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

   // Print segments
  for (int i = 0; i < NSegments(); i++) {
    GSVSegment *segment = Segment(i);
    segment->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 0x364bc
movq 0x187a87(%rip), %rax    # 0x1bdf40
movq (%rax), %r15
testq %r12, %r12
je 0x364cc
movq %r12, %rdi
movq %r15, %rsi
callq 0x27aa0
movl 0x10(%r14), %edx
leaq 0xf57f9(%rip), %rsi     # 0x12bcd0
movq %r15, %rdi
xorl %eax, %eax
callq 0x27e20
testq %rbx, %rbx
je 0x364f1
movq %rbx, %rdi
movq %r15, %rsi
callq 0x27aa0
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x27c30
leaq 0xf54f1(%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 0x3653a
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 0x36515
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/GSVRun.cpp
// Function: gaps::GSVRun::UpdateBBox()
void GSVRun::
UpdateBBox(void) 
{
  // Update bounding box
  bbox = R3null_box;
  for (int i = 0; i < NSegments(); i++) bbox.Union(Segment(i)->BBox());
  for (int i = 0; i < NLasers(); i++) bbox.Union(Laser(i)->BBox());
  for (int i = 0; i < NCameras(); i++) bbox.Union(Camera(i)->BBox());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x50(%rdi), %r14
leaq 0x191459(%rip), %rsi    # 0x1c79b8
movq %r14, %rdi
callq 0x30d44
xorl %r15d, %r15d
movslq 0x24(%rbx), %rax
cmpq %rax, %r15
jge 0x36590
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x35e26
movq %r14, %rdi
movq %rax, %rsi
callq 0xad3ba
incq %r15
jmp 0x3656a
xorl %r15d, %r15d
movslq 0x44(%rbx), %rax
cmpq %rax, %r15
jge 0x365b9
movq 0x38(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x35e00
movq %r14, %rdi
movq %rax, %rsi
callq 0xad3ba
incq %r15
jmp 0x36593
xorl %r15d, %r15d
movslq 0x34(%rbx), %rax
cmpq %rax, %r15
jge 0x365e2
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x35dd4
movq %r14, %rdi
movq %rax, %rsi
callq 0xad3ba
incq %r15
jmp 0x365bc
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::UpdateNormals()
void GSVRun::
UpdateNormals(void) 
{
  // Update normals
  for (int i = 0; i < NSegments(); i++) {
    GSVSegment *segment = Segment(i);
    segment->UpdateNormals();
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x3660d
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3826a
incq %r14
jmp 0x365f2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVRun.cpp
// Function: gaps::GSVRun::InvalidateNormals()
void GSVRun::
InvalidateNormals(void) 
{
  // Invalidate normals
  for (int i = 0; i < NSegments(); i++) {
    GSVSegment *segment = Segment(i);
    segment->InvalidateNormals();
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x24(%rbx), %rax
cmpq %rax, %r14
jge 0x3663b
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x38a1a
incq %r14
jmp 0x36620
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::~GSVSegment()
GSVSegment::
~GSVSegment(void)
{
  // Remove segment from scene
  assert(scene_index == -1);

  // Remove segment from run
  if (run) run->RemoveSegment(this);

  // Delete surveys
  while (NSurveys() > 0) delete Survey(0);

  // Delete tapestries
  while (NTapestries() > 0) delete Tapestry(0);

  // Delete panoramas
  while (NPanoramas() > 0) delete Panorama(0);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x17e118(%rip), %rax    # 0x1b5918
movq %rax, (%rdi)
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x37814
movq %rbx, %rsi
callq 0x36320
leaq 0x20(%rbx), %r14
cmpl $0x0, 0x2c(%rbx)
jle 0x37831
movq (%r14), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x37818
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x37818
leaq 0x30(%rbx), %r15
cmpl $0x0, 0x3c(%rbx)
jle 0x3784e
movq (%r15), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x37835
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x37835
leaq 0x40(%rbx), %r12
cmpl $0x0, 0x4c(%rbx)
jle 0x3786c
movq (%r12), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x37852
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x37852
movq 0x88(%rbx), %rdi
callq 0x27b40
addq $0x50, %rbx
movq %rbx, %rdi
callq 0xad65a
movq %r12, %rdi
callq 0xe1d40
movq %r15, %rdi
callq 0xe1d40
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe1d40
movq %rax, %rdi
callq 0x376d2
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::NImages() const
int GSVSegment::
NImages(void) const
{
  // Return number of images in segment
  int count = 0;
  for (int i = 0; i < NTapestries(); i++) {
    GSVTapestry *tapestry = Tapestry(i);
    count += tapestry->NImages();
  }
  return count;
}

// Assembly:
movl 0x3c(%rdi), %ecx
movq 0x30(%rdi), %rdx
xorl %esi, %esi
testl %ecx, %ecx
cmovlel %esi, %ecx
xorl %eax, %eax
cmpq %rsi, %rcx
je 0x37933
movq (%rdx,%rsi,8), %rdi
addl 0x34(%rdi), %eax
incq %rsi
jmp 0x37922
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::Image(int) const
GSVImage *GSVSegment::
Image(int image_index) const
{
  // Return image
  for (int i = 0; i < NTapestries(); i++) {
    GSVTapestry *tapestry = Tapestry(i);
    if (image_index >= tapestry->NImages()) image_index -= tapestry->NImages();
    else return tapestry->Image(image_index);
  }

  // Index too high
  return NULL;
}

// Assembly:
movl 0x3c(%rdi), %ecx
movq 0x30(%rdi), %rdx
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
xorl %edi, %edi
cmpq %rdi, %rcx
je 0x37969
movq (%rdx,%rdi,8), %r9
movl %esi, %r8d
subl 0x34(%r9), %r8d
jl 0x3795e
incq %rdi
movl %r8d, %esi
jmp 0x37944
movq 0x28(%r9), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::NScans() const
int GSVSegment::
NScans(void) const
{
  // Return number of scans in segment
  int count = 0;
  for (int i = 0; i < NSurveys(); i++) {
    GSVSurvey *survey = Survey(i);
    count += survey->NScans();
  }
  return count;
}

// Assembly:
movl 0x2c(%rdi), %ecx
movq 0x20(%rdi), %rdx
xorl %esi, %esi
testl %ecx, %ecx
cmovlel %esi, %ecx
xorl %eax, %eax
cmpq %rsi, %rcx
je 0x3798b
movq (%rdx,%rsi,8), %rdi
addl 0x34(%rdi), %eax
incq %rsi
jmp 0x3797a
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::Scan(int) const
GSVScan *GSVSegment::
Scan(int scan_index) const
{
  // Return scan
  for (int i = 0; i < NSurveys(); i++) {
    GSVSurvey *survey = Survey(i);
    if (scan_index >= survey->NScans()) scan_index -= survey->NScans();
    else return survey->Scan(scan_index);
  }

  // Index too high
  return NULL;
}

// Assembly:
movl 0x2c(%rdi), %ecx
movq 0x20(%rdi), %rdx
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
xorl %edi, %edi
cmpq %rdi, %rcx
je 0x379c1
movq (%rdx,%rdi,8), %r9
movl %esi, %r8d
subl 0x34(%r9), %r8d
jl 0x379b6
incq %rdi
movl %r8d, %esi
jmp 0x3799c
movq 0x28(%r9), %rax
movslq %esi, %rcx
movq (%rax,%rcx,8), %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::NScanlines() const
int GSVSegment::
NScanlines(void) const
{
  // Return number of scanlines in segment
  int count = 0;
  for (int i = 0; i < NSurveys(); i++) {
    GSVSurvey *survey = Survey(i);
    count += survey->NScanlines();
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jge 0x379eb
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3c75a
addl %eax, %ebp
incq %r14
jmp 0x379ce
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::Scanline(int) const
GSVScanline *GSVSegment::
Scanline(int scanline_index) const
{
  // Return scanline
  for (int i = 0; i < NSurveys(); i++) {
    GSVSurvey *survey = Survey(i);
    if (scanline_index >= survey->NScanlines()) scanline_index -= survey->NScanlines();
    else return survey->Scanline(scanline_index);
  }

  // Index too high
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
xorl %r12d, %r12d
movslq 0x2c(%r14), %rax
cmpq %rax, %r12
jge 0x37a2e
movq 0x20(%r14), %rax
movq (%rax,%r12,8), %r15
movq %r15, %rdi
callq 0x3c75a
movq %r15, %rdi
cmpl %eax, %ebx
jl 0x37a3c
callq 0x3c75a
subl %eax, %ebx
incq %r12
jmp 0x37a02
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3c77c
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::Panorama(char const*) const
GSVPanorama *GSVSegment::
Panorama(const char *name) const
{
  // Return panorama with matching name
  for (int i = 0; i < NPanoramas(); i++) {
    GSVPanorama *panorama = Panorama(i);
    if (!panorama->Name()) continue;
    if (!strcmp(panorama->Name(), name)) return panorama;
  }

  // None found
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movslq 0x4c(%rdi), %r15
movq 0x40(%rdi), %r12
xorl %r13d, %r13d
cmpq %r15, %r13
jge 0x37a88
movq (%r12,%r13,8), %r14
movq 0x78(%r14), %rdi
testq %rdi, %rdi
je 0x37a83
movq %rbx, %rsi
callq 0x27db0
testl %eax, %eax
je 0x37a8b
incq %r13
jmp 0x37a65
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::FindPanoramaBeforeTimestamp(double, int, int) const
GSVPanorama *GSVSegment::
FindPanoramaBeforeTimestamp(RNScalar timestamp, int imin, int imax) const
{
  // Binary search
  int i = (imin + imax) / 2;
  if (i == imin) return Panorama(imin);
  assert(i < imax);
  GSVPanorama *panorama = Panorama(i);
  RNScalar t = panorama->Timestamp();
  if (t > timestamp) return FindPanoramaBeforeTimestamp(timestamp, imin, i);
  else if (t < timestamp) return FindPanoramaBeforeTimestamp(timestamp, i, imax);
  else return panorama;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebx
movsd %xmm0, (%rsp)
movq %rdi, %r15
pushq $0x2
popq %r13
movl %r14d, %ebp
movl %ebp, %r14d
leal (%r14,%rbx), %eax
cltd
idivl %r13d
movq 0x40(%r15), %rcx
cmpl %ebx, %eax
je 0x37af0
movl %eax, %ebp
cltq
movq (%rcx,%rax,8), %r12
movq %r12, %rdi
callq 0x35eb4
ucomisd (%rsp), %xmm0
ja 0x37ab7
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
movl %ebp, %ebx
ja 0x37ab4
jmp 0x37af7
movslq %ebx, %rax
movq (%rcx,%rax,8), %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVSegment.cpp
// Function: gaps::GSVSegment::FindPanoramaBeforeTimestamp(double) const
GSVPanorama *GSVSegment::
FindPanoramaBeforeTimestamp(RNScalar timestamp) const
{
  // Binary search
  if (NPanoramas() == 0) return NULL;
  if (timestamp <= Panorama(0)->Timestamp()) return Panorama(0);
  if (timestamp >= Panorama(NPanoramas()-1)->Timestamp()) return Panorama(NPanoramas()-1);
  return FindPanoramaBeforeTimestamp(timestamp, 0, NPanoramas()-1);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
cmpl $0x0, 0x4c(%rdi)
je 0x37b6b
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq (%rax), %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x35eb4
ucomisd 0x8(%rsp), %xmm0
jae 0x37b6f
movslq 0x4c(%rbx), %rax
movq 0x40(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rdi
callq 0x35eb4
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movslq 0x4c(%rbx), %rdx
jae 0x37b78
decl %edx
movq %rbx, %rdi
xorl %esi, %esi
addq $0x10, %rsp
popq %rbx
jmp 0x37a98
xorl %eax, %eax
jmp 0x37b81
movq 0x40(%rbx), %rax
movq (%rax), %rax
jmp 0x37b81
movq 0x40(%rbx), %rax
movq -0x8(%rax,%rdx,8), %rax
addq $0x10, %rsp
popq %rbx
retq
nop