// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::ReadLaserFile(char const*, int)
int GSVScene::
ReadLaserFile(const char *filename, RNBoolean read_points)
{
  // Open file
  FILE *fp = fopen(filename, "r");
  if (!fp) {
    RNFail("Unable to open GSV scene file: %s\n", filename);
    return 0;
  }

  // Read run names from file
  int line_count = 0;
  const int buffer_size = 16*1024;
  char buffer[buffer_size];
  while (fgets(buffer, buffer_size, fp)) {
    line_count++;
    if (buffer[0] == '\0') continue;
    if (buffer[0] == '#') continue;
    char run_name[4096];
    if (sscanf(buffer, "%s", run_name) != (unsigned int) 1) {
      RNFail("Unable to read run name from line %d of %s\n", line_count, filename);
      return 0;
    }

    // Create run
    GSVRun *run = new GSVRun(run_name);
    InsertRun(run);

    // Read laser stuff
    const int max_laser_index = 2;
    for (int laser_index = 0; laser_index <= max_laser_index; laser_index++) {
      RNArray<GSVScanline *> scanlines;
      RNArray<GSVScan *> scanline_scans;
      if (!run->ReadLaserObjFile(laser_index, scanlines, scanline_scans, read_points)) return 0;
      if (!run->ReadLaserPoseFile(laser_index, scanlines, scanline_scans)) return 0;
    }
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5048, %rsp           # imm = 0x5048
movl %edx, 0x4(%rsp)
movq %rsi, %r14
movq %rdi, %r15
leaq 0x11b063(%rip), %rsi    # 0x14d0a3
movq %r14, %rdi
callq 0x27b20
testq %rax, %rax
je 0x32160
movq %rax, %rbx
movq %r14, 0x8(%rsp)
leaq 0x40(%rsp), %rbp
leaq 0x30(%rsp), %r14
leaq 0x20(%rsp), %r12
movl $0x0, (%rsp)
movq %r15, 0x18(%rsp)
movq %rax, 0x10(%rsp)
leaq 0x1040(%rsp), %rdi
movl $0x4000, %esi           # imm = 0x4000
movq %rbx, %rdx
callq 0x27fe0
testq %rax, %rax
je 0x3219f
incl (%rsp)
movzbl 0x1040(%rsp), %eax
testl %eax, %eax
je 0x32079
cmpl $0x23, %eax
je 0x32079
leaq 0x1040(%rsp), %rdi
leaq 0x116f71(%rip), %rsi    # 0x14902b
movq %rbp, %rdx
xorl %eax, %eax
callq 0x27900
cmpl $0x1, %eax
jne 0x321ac
movl $0x90, %edi
callq 0x27940
movq %rax, %rbx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x35f68
movq %r15, %rdi
movq %rbx, %rsi
callq 0x31726
xorl %r15d, %r15d
cmpl $0x3, %r15d
je 0x32151
movq %r14, %rdi
callq 0xe1cd2
movq %r12, %rdi
callq 0xe1cd2
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
movq %r12, %rcx
movl 0x4(%rsp), %r8d
callq 0x36f6a
testl %eax, %eax
je 0x32175
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
movq %r12, %rcx
callq 0x37446
movl %eax, %r13d
movq %r12, %rdi
callq 0xe1d40
movq %r14, %rdi
callq 0xe1d40
incl %r15d
testl %r13d, %r13d
jne 0x320f3
jmp 0x32189
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %rbx
jmp 0x32079
leaq 0xf999d(%rip), %rdi     # 0x12bb04
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0xe434a
jmp 0x3218b
leaq 0x20(%rsp), %rdi
callq 0xe1d40
leaq 0x30(%rsp), %rdi
callq 0xe1d40
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x5048, %rsp           # imm = 0x5048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x27930
pushq $0x1
popq %rbx
jmp 0x3218b
leaq 0xf9974(%rip), %rdi     # 0x12bb27
xorl %ebx, %ebx
movl (%rsp), %esi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0xe434a
jmp 0x3218b
movq %rax, %r14
movl $0x90, %esi
movq %rbx, %rdi
callq 0x27960
jmp 0x321f4
movq %rax, %r14
jmp 0x321ea
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0xe1d40
leaq 0x30(%rsp), %rdi
callq 0xe1d40
movq %r14, %rdi
callq 0x28170