// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0xe4e0
testq %rax, %rax
je 0x1c3ab
movq %rax, %r15
leaq 0x7705e(%rip), %rsi     # 0x9330d
pushq $0x4
popq %rdx
movq %rax, %rdi
callq 0xe220
testl %eax, %eax
je 0x1c3c3
leaq 0x77049(%rip), %rsi     # 0x93312
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1c3d7
leaq 0x77034(%rip), %rsi     # 0x93317
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1c3e8
leaq 0x7701f(%rip), %rsi     # 0x9331c
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1c3f9
leaq 0x7700a(%rip), %rsi     # 0x93321
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1c40a
cmpb $0x2e, (%r15)
jne 0x1c342
cmpb $0x6d, 0x1(%r15)
jne 0x1c342
cmpb $0x0, 0x2(%r15)
je 0x1c44e
leaq 0x76fdd(%rip), %rsi     # 0x93326
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1c41b
leaq 0x76fc8(%rip), %rsi     # 0x9332b
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1c42c
leaq 0x76fb3(%rip), %rsi     # 0x93330
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0xe220
testl %eax, %eax
je 0x1c43d
leaq 0x76f9e(%rip), %rdi     # 0x93335
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x681ca
jmp 0x1c47a
leaq 0x76f30(%rip), %rdi     # 0x932e2
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xe070
jmp 0x1c47a
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x188(%rax)
jmp 0x1c45d
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x190(%rax)
jmp 0x1c45d
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x198(%rax)
jmp 0x1c45d
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1a0(%rax)
jmp 0x1c45d
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1a8(%rax)
jmp 0x1c45d
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1b8(%rax)
jmp 0x1c45d
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1c0(%rax)
jmp 0x1c45d
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1c8(%rax)
jmp 0x1c45d
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1b0(%rax)
testl %eax, %eax
je 0x1c478
pushq $0x1
popq %rbp
cmpb $0x0, 0x78(%r14)
jne 0x1c47a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x222b0
jmp 0x1c47a
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop