// File: tomfunkhouser[P]gaps/apps/grdview/grdview.cpp
// Function: ParseArgs(int, char**)
static int 
ParseArgs(int argc, char **argv)
{
  // Check number of arguments
  if ((argc == 2) && (*argv[1] == '-')) {
    printf("Usage: symsam [options]\n");
    exit(0);
  }

  // Parse arguments
  argc--; argv++;
  while (argc > 0) {
    if ((*argv)[0] == '-') {
      if (!strcmp(*argv, "-v")) print_verbose = 1; 
      else if (!strcmp(*argv, "-show_points")) show_points = 1; 
      else if (!strcmp(*argv, "-show_text")) show_text = 1; 
      else if (!strcmp(*argv, "-show_isosurface")) show_isosurface = 1; 
      else if (!strcmp(*argv, "-show_axes")) show_axes = 1; 
      else if (!strcmp(*argv, "-dont_show_isosurface")) show_isosurface = 0; 
      else if (!strcmp(*argv, "-grid_threshold")) {
        argc--; argv++; grid_threshold = atof(*argv); 
      }
      else if (!strcmp(*argv, "-camera")) { 
        RNCoord x, y, z, tx, ty, tz, ux, uy, uz;
        argv++; argc--; x = atof(*argv); 
        argv++; argc--; y = atof(*argv); 
        argv++; argc--; z = atof(*argv); 
        argv++; argc--; tx = atof(*argv); 
        argv++; argc--; ty = atof(*argv); 
        argv++; argc--; tz = atof(*argv); 
        argv++; argc--; ux = atof(*argv); 
        argv++; argc--; uy = atof(*argv); 
        argv++; argc--; uz = atof(*argv); 
        initial_camera_origin = R3Point(x, y, z);
        initial_camera_towards.Reset(tx, ty, tz);
        initial_camera_up.Reset(ux, uy, uz);
        initial_camera = TRUE;
      }
      else if (!strcmp(*argv, "-background")) { 
        argc--; argv++; background_color[0] = atof(*argv); 
        argc--; argv++; background_color[1] = atof(*argv); 
        argc--; argv++; background_color[2] = atof(*argv); 
      }
      else if (!strcmp(*argv, "-image")) { 
        argc--; argv++; image_name = *argv; 
      }
      else { 
        RNFail("Invalid program argument: %s", *argv); 
        exit(1); 
      }
      argv++; argc--;
    }
    else {
      if (!grid_name) grid_name = *argv;
      else { 
        RNFail("Invalid program argument: %s", *argv); 
        exit(1); 
      }
      argv++; argc--;
    }
  }

  // Check pdb filename
  if (!grid_name) {
    RNFail("You did not specify a pdb file.\n");
    return 0;
  }

  // Return OK status 
  return 1;
}

// Assembly:
subq $0x78, %rsp
movl %edi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
cmpl $0x2, 0x70(%rsp)
jne 0x25a6a
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x25a6a
leaq 0x139807(%rip), %rdi    # 0x15f263
movb $0x0, %al
callq 0x20070
xorl %edi, %edi
callq 0x209e0
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
cmpl $0x0, 0x70(%rsp)
jle 0x25f95
movq 0x68(%rsp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x25f3c
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x1397cb(%rip), %rsi    # 0x15f27c
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25aca
movl $0x1, 0x19c84b(%rip)    # 0x1c2310
jmp 0x25f21
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x1397a6(%rip), %rsi    # 0x15f27f
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25af2
movl $0x1, 0x19c74b(%rip)    # 0x1c2238
jmp 0x25f1f
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x13978b(%rip), %rsi    # 0x15f28c
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25b1a
movl $0x1, 0x19c733(%rip)    # 0x1c2248
jmp 0x25f1d
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x13976e(%rip), %rsi    # 0x15f297
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25b42
movl $0x1, 0x18dd97(%rip)    # 0x1b38d4
jmp 0x25f1b
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x139757(%rip), %rsi    # 0x15f2a8
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25b6a
movl $0x1, 0x19c6ff(%rip)    # 0x1c2264
jmp 0x25f19
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x13973a(%rip), %rsi    # 0x15f2b3
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25b92
movl $0x0, 0x18dd47(%rip)    # 0x1b38d4
jmp 0x25f17
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x139728(%rip), %rsi    # 0x15f2c9
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25be2
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18dcf3(%rip)   # 0x1b38d0
jmp 0x25f15
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x1396e8(%rip), %rsi    # 0x15f2d9
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25e03
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x60(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x58(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x50(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x48(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x40(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x38(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x30(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x28(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x20(%rsp)
movsd 0x60(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
leaq 0x8(%rsp), %rdi
callq 0x63bd0
leaq 0x19c432(%rip), %rdi    # 0x1c21e0
leaq 0x8(%rsp), %rsi
callq 0x64260
movsd 0x48(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd 0x38(%rsp), %xmm2
leaq 0x19c427(%rip), %rdi    # 0x1c21f8
callq 0x26fe0
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
leaq 0x19c421(%rip), %rdi    # 0x1c2210
callq 0x26fe0
movl $0x1, 0x19c516(%rip)    # 0x1c2314
jmp 0x25f13
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x1394cf(%rip), %rsi    # 0x15f2e1
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25eac
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x18da42(%rip)   # 0x1b3890
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x18da1c(%rip)   # 0x1b3898
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rdi
callq 0x20a60
movsd %xmm0, 0x18d9f6(%rip)   # 0x1b38a0
jmp 0x25f11
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0x139432(%rip), %rsi    # 0x15f2ed
callq 0x20bc0
cmpl $0x0, %eax
jne 0x25eef
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x19c3e3(%rip)    # 0x1c22d0
jmp 0x25f0f
movq 0x68(%rsp), %rax
movq (%rax), %rsi
leaq 0x1393f6(%rip), %rdi    # 0x15f2f4
movb $0x0, %al
callq 0xed040
movl $0x1, %edi
callq 0x209e0
jmp 0x25f11
jmp 0x25f13
jmp 0x25f15
jmp 0x25f17
jmp 0x25f19
jmp 0x25f1b
jmp 0x25f1d
jmp 0x25f1f
jmp 0x25f21
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
jmp 0x25f90
cmpq $0x0, 0x19c3c4(%rip)    # 0x1c2308
jne 0x25f57
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x19c3b3(%rip)    # 0x1c2308
jmp 0x25f77
movq 0x68(%rsp), %rax
movq (%rax), %rsi
leaq 0x13938e(%rip), %rdi    # 0x15f2f4
movb $0x0, %al
callq 0xed040
movl $0x1, %edi
callq 0x209e0
movq 0x68(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x68(%rsp)
movl 0x70(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x70(%rsp)
jmp 0x25a83
cmpq $0x0, 0x19c36b(%rip)    # 0x1c2308
jne 0x25fb7
leaq 0x13936b(%rip), %rdi    # 0x15f311
movb $0x0, %al
callq 0xed040
movl $0x0, 0x74(%rsp)
jmp 0x25fbf
movl $0x1, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax,%rax)