// File: /workspace/github_cpp_makefile_star2_O1/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 0x1e6d3
movq %rax, %r15
leaq 0x83d9a(%rip), %rsi     # 0xa235d
movl $0x4, %edx
movq %rax, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e6eb
leaq 0x83d83(%rip), %rsi     # 0xa2362
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e6ff
leaq 0x83d6c(%rip), %rsi     # 0xa2367
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e710
leaq 0x83d55(%rip), %rsi     # 0xa236c
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e721
leaq 0x83d3e(%rip), %rsi     # 0xa2371
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e732
leaq 0x83d27(%rip), %rsi     # 0xa2376
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e743
leaq 0x83d0e(%rip), %rsi     # 0xa2379
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e754
leaq 0x83cf7(%rip), %rsi     # 0xa237e
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e765
leaq 0x83ce0(%rip), %rsi     # 0xa2383
movl $0x4, %edx
movq %r15, %rdi
callq 0xe210
testl %eax, %eax
je 0x1e776
leaq 0x83cc9(%rip), %rdi     # 0xa2388
xorl %ebp, %ebp
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x72a1e
jmp 0x1e7ad
leaq 0x83c58(%rip), %rdi     # 0xa2332
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %eax, %eax
callq 0xe070
jmp 0x1e7ad
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x188(%rax)
jmp 0x1e785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x190(%rax)
jmp 0x1e785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x198(%rax)
jmp 0x1e785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1a0(%rax)
jmp 0x1e785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1a8(%rax)
jmp 0x1e785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1b0(%rax)
jmp 0x1e785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1b8(%rax)
jmp 0x1e785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1c0(%rax)
jmp 0x1e785
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x1c8(%rax)
testl %eax, %eax
je 0x1e7ab
movl $0x1, %ebp
cmpb $0x0, 0x78(%r14)
jne 0x1e7ad
addq $0x78, %r14
movl $0x7f, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe240
jmp 0x1e7ad
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq