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

  // Read file of appropriate type
  if (!strncmp(extension, ".obj", 4)) {
    if (!ReadObjFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".off", 4)) {
    if (!ReadOffFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".ray", 4))  {
    if (!ReadRayFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".ply", 4)) { 
    if (!ReadPlyFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".cat", 4)) { 
    if (!ReadCattFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".m", 4)) { 
    if (!ReadHoppeFile(filename)) return 0;
  }  
  else if (!strncmp(extension, ".ifs", 4)) { 
    if (!ReadIfsFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".stl", 4))  {
    if (!ReadSTLFile(filename)) return 0;
  }
  else if (!strncmp(extension, ".wrl", 4))  {
    if (!ReadVRMLFile(filename)) return 0;
  }
  else {
    RNFail("Unable to read file %s (unrecognized extension: %s)\n", filename, extension);
    return 0;
  }

  // Set mesh name, if it doesn't already have one
  if (strlen(Name()) == 0) SetName(filename);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movl $0x2e, %esi
callq 0xe4c0
testq %rax, %rax
je 0x1e655
movq %rax, %r15
leaq 0x83e14(%rip), %rsi     # 0xa235d
movl $0x4, %edx
movq %rax, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e66d
leaq 0x83dfd(%rip), %rsi     # 0xa2362
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e681
leaq 0x83de6(%rip), %rsi     # 0xa2367
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e692
leaq 0x83dcf(%rip), %rsi     # 0xa236c
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e6a3
leaq 0x83db8(%rip), %rsi     # 0xa2371
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e6b4
cmpb $0x2e, (%r15)
jne 0x1e5e6
cmpb $0x6d, 0x1(%r15)
jne 0x1e5e6
cmpb $0x0, 0x2(%r15)
je 0x1e6f8
leaq 0x83d89(%rip), %rsi     # 0xa2376
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e6c5
leaq 0x83d72(%rip), %rsi     # 0xa237b
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e6d6
leaq 0x83d5b(%rip), %rsi     # 0xa2380
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e6e7
leaq 0x83d44(%rip), %rdi     # 0xa2385
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x719d2
jmp 0x1e72f
leaq 0x83cd6(%rip), %rdi     # 0xa2332
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xe070
jmp 0x1e72f
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x188(%rax)
jmp 0x1e707
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x190(%rax)
jmp 0x1e707
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x198(%rax)
jmp 0x1e707
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1a0(%rax)
jmp 0x1e707
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1a8(%rax)
jmp 0x1e707
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1b8(%rax)
jmp 0x1e707
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1c0(%rax)
jmp 0x1e707
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1c8(%rax)
jmp 0x1e707
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1b0(%rax)
testl %eax, %eax
je 0x1e72d
movl $0x1, %ebp
cmpb $0x0, 0x78(%r14)
jne 0x1e72f
addq $0x78, %r14
movl $0x7f, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe240
jmp 0x1e72f
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq