// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/GSV/GSVScene.cpp
// Function: gaps::GSVScene::ReadFile(char const*, int)
int GSVScene::
ReadFile(const char *filename, RNBoolean read_points)
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    RNFail("Filename %s has no extension (e.g., .gsv)\n", filename);
    return 0;
  }

  // Read file of appropriate type
  int status = 0;
  if (!strncmp(extension, ".txt", 4)) status = ReadASCIIFile(filename, read_points);
  else if (!strncmp(extension, ".lsr", 4)) status = ReadLaserFile(filename, read_points);
  else if (!strncmp(extension, ".gsf", 4)) status = ReadGSFFile(filename, read_points);
  else if (!strncmp(extension, ".gsv", 4)) status = ReadGSVFile(filename, read_points);
  else RNFail("Unrecognized file extension %s in %s\n", extension, filename); 
  if (status == 0) return 0;

  // Remember filename
  this->filename = RNStrdup(filename);

  // Set raw directory name
  char buffer[2048];
  strcpy(buffer, filename);
  char *bufferp = strrchr(buffer, '/');
  if (bufferp) *bufferp = '\0';
  else strcpy(buffer, ".");
  strcat(buffer, "/raw_data");
  if (RNFileExists(buffer)) {
    SetRawDataDirectoryName(buffer);
  }

  // Set cache directory name
  strcpy(buffer, filename);
  bufferp = strrchr(buffer, '/');
  if (bufferp) *bufferp = '\0';
  else strcpy(buffer, ".");
  strcat(buffer, "/gsv_data");
  if (RNFileExists(buffer)) {
    SetCacheDataDirectoryName(buffer);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x2e, %esi
callq 0x27a20
testq %rax, %rax
je 0x33371
movq %rax, %r15
leaq 0x119b94(%rip), %rsi    # 0x14ce91
movl $0x4, %edx
movq %rax, %rdi
callq 0x273f0
testl %eax, %eax
je 0x33389
leaq 0x119775(%rip), %rsi    # 0x14ca8a
movl $0x4, %edx
movq %r15, %rdi
callq 0x273f0
testl %eax, %eax
je 0x33390
leaq 0x119762(%rip), %rsi    # 0x14ca8f
movl $0x4, %edx
movq %r15, %rdi
callq 0x273f0
testl %eax, %eax
je 0x33397
leaq 0x1191bd(%rip), %rsi    # 0x14c502
movl $0x4, %edx
movq %r15, %rdi
callq 0x273f0
testl %eax, %eax
je 0x3339e
leaq 0x119737(%rip), %rdi    # 0x14ca94
xorl %ebx, %ebx
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0xfb6f2
jmp 0x33491
leaq 0x1196e7(%rip), %rdi    # 0x14ca5f
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0xfb6f2
jmp 0x33491
movl $0x30, %eax
jmp 0x333a3
movl $0x28, %eax
jmp 0x333a3
movl $0x38, %eax
jmp 0x333a3
movl $0x40, %eax
movq (%rbx), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *(%rcx,%rax)
testl %eax, %eax
je 0x333e6
movq %r14, %rdi
callq 0xfb553
movq %rax, 0x18(%rbx)
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x27870
movq %r15, %rdi
movl $0x2f, %esi
callq 0x27a20
testq %rax, %rax
je 0x333ed
movb $0x0, (%rax)
jmp 0x333f3
xorl %ebx, %ebx
jmp 0x33491
movw $0x2e, (%rsp)
movq %rsp, %r15
movq %r15, %rdi
callq 0x273a0
movabsq $0x7461645f7761722f, %rcx # imm = 0x7461645F7761722F
movq %rcx, (%rsp,%rax)
movw $0x61, 0x8(%rsp,%rax)
movq %r15, %rdi
callq 0xfaac4
testl %eax, %eax
je 0x3342a
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x32f02
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x27870
movq %r15, %rdi
movl $0x2f, %esi
callq 0x27a20
testq %rax, %rax
je 0x3344f
movb $0x0, (%rax)
jmp 0x33455
movw $0x2e, (%rsp)
movq %rsp, %r14
movq %r14, %rdi
callq 0x273a0
movabsq $0x7461645f7673672f, %rcx # imm = 0x7461645F7673672F
movq %rcx, (%rsp,%rax)
movw $0x61, 0x8(%rsp,%rax)
movq %r14, %rdi
callq 0xfaac4
testl %eax, %eax
je 0x3348c
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x32f38
movl $0x1, %ebx
movl %ebx, %eax
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop