// File: /workspace/github_cpp_makefile_star2_O1/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 0x33526
movq %rax, %r15
leaq 0x11b9db(%rip), %rsi    # 0x14ee90
movl $0x4, %edx
movq %rax, %rdi
callq 0x273f0
testl %eax, %eax
je 0x3353e
leaq 0x11b5ad(%rip), %rsi    # 0x14ea7a
movl $0x4, %edx
movq %r15, %rdi
callq 0x273f0
testl %eax, %eax
je 0x3354e
leaq 0x11b59a(%rip), %rsi    # 0x14ea7f
movl $0x4, %edx
movq %r15, %rdi
callq 0x273f0
testl %eax, %eax
je 0x3355e
leaq 0x11aff8(%rip), %rsi    # 0x14e4f5
movl $0x4, %edx
movq %r15, %rdi
callq 0x273f0
testl %eax, %eax
je 0x3356e
leaq 0x11b56f(%rip), %rdi    # 0x14ea84
xorl %ebp, %ebp
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0xfd64a
jmp 0x3357e
leaq 0x11b522(%rip), %rdi    # 0x14ea4f
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0xfd64a
jmp 0x3365e
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *0x30(%rax)
jmp 0x3357c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *0x28(%rax)
jmp 0x3357c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *0x38(%rax)
jmp 0x3357c
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *0x40(%rax)
movl %eax, %ebp
testl %ebp, %ebp
je 0x335b3
movq %r14, %rdi
callq 0xfd4a7
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 0x335ba
movb $0x0, (%rax)
jmp 0x335c0
xorl %ebx, %ebx
jmp 0x3365e
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 0xfc978
testl %eax, %eax
je 0x335f7
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x330c4
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x27870
movq %r15, %rdi
movl $0x2f, %esi
callq 0x27a20
testq %rax, %rax
je 0x3361c
movb $0x0, (%rax)
jmp 0x33622
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 0xfc978
testl %eax, %eax
je 0x33659
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x330fa
movl $0x1, %ebx
movl %ebx, %eax
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
popq %r15
popq %rbp
retq