// File: tomfunkhouser[P]gaps/apps/sflview/sflview.cpp
// Function: ParseArgs(int, char**)
static int 
ParseArgs(int argc, char **argv)
{
  // Parse arguments
  argc--; argv++;
  while (argc > 0) {
    if ((*argv)[0] == '-') {
      if (!strcmp(*argv, "-v")) print_verbose = 1;
      else if (!strcmp(*argv, "-pixel_database")) { 
        argv++; argc--; pixel_database = *argv;
      }
      else if (!strcmp(*argv, "-image_directory")) { 
        argv++; argc--; image_directory = *argv;
      }
      else if (!strcmp(*argv, "-depth_scale")) { 
        argv++; argc--; depth_scale = atof(*argv);
      }
      else if (!strcmp(*argv, "-depth_exponent")) { 
        argv++; argc--; depth_exponent = atof(*argv);
      }
      else if (!strcmp(*argv, "-window")) { 
        argv++; argc--; GLUTwindow_width = atoi(*argv); 
        argv++; argc--; GLUTwindow_height = atoi(*argv); 
      }
      else if (!strcmp(*argv, "-background")) { 
        argv++; argc--; background_color[0] = atof(*argv); 
        argv++; argc--; background_color[1] = atof(*argv); 
        argv++; argc--; background_color[2] = atof(*argv); 
      }
      else if (!strcmp(*argv, "-origin")) { 
        RNCoord x, y, z;
        argv++; argc--; x = atof(*argv); 
        argv++; argc--; y = atof(*argv); 
        argv++; argc--; z = atof(*argv);
        initial_world_origin.Reset(x, y, z);
      }
      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_eye = R3Point(x, y, z);
        initial_camera_towards.Reset(tx, ty, tz);
        initial_camera_up.Reset(ux, uy, uz);
        initial_camera = TRUE;
      }
      else { 
        RNFail("Invalid program argument: %s", *argv); 
        exit(1); 
      }
      argv++; argc--;
    }
    else {
      if (!scene_name) scene_name = *argv;
      else if (!database_name) database_name = *argv;
      else if (!model_name) model_name = *argv;
      else { RNFail("Invalid program argument: %s", *argv); exit(1); }
      argv++; argc--;
    }
  }

  // Check surfels name
  if (!scene_name || !database_name) {
    RNFail("Usage: sflview scenefile databasefile [options]\n");
    return FALSE;
  }

  // Return OK status 
  return 1;
}

// Assembly:
subq $0xa8, %rsp
movl %edi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
cmpl $0x0, 0xa0(%rsp)
jle 0x2e6d8
movq 0x98(%rsp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2e62d
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x21340f(%rip), %rsi    # 0x2412f1
callq 0x28f20
cmpl $0x0, %eax
jne 0x2defb
movl $0x1, 0x2a460a(%rip)    # 0x2d2500
jmp 0x2e603
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x2133e7(%rip), %rsi    # 0x2412f4
callq 0x28f20
cmpl $0x0, %eax
jne 0x2df53
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x2a45a2(%rip)    # 0x2d24f0
jmp 0x2e601
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x21339f(%rip), %rsi    # 0x241304
callq 0x28f20
cmpl $0x0, %eax
jne 0x2dfab
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x2a4552(%rip)    # 0x2d24f8
jmp 0x2e5ff
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x213358(%rip), %rsi    # 0x241315
callq 0x28f20
cmpl $0x0, %eax
jne 0x2e009
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x295aec(%rip)   # 0x2c3af0
jmp 0x2e5fd
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x213307(%rip), %rsi    # 0x241322
callq 0x28f20
cmpl $0x0, %eax
jne 0x2e067
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x295a96(%rip)   # 0x2c3af8
jmp 0x2e5fb
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x2132b9(%rip), %rsi    # 0x241332
callq 0x28f20
cmpl $0x0, %eax
jne 0x2e0fe
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x290f0
movl %eax, 0x295a22(%rip)    # 0x2c3ae0
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x290f0
movl %eax, 0x2959eb(%rip)    # 0x2c3ae4
jmp 0x2e5f9
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x21322a(%rip), %rsi    # 0x24133a
callq 0x28f20
cmpl $0x0, %eax
jne 0x2e222
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x8(%rsp)
leaq 0x2a42d8(%rip), %rdi    # 0x2d2438
xorl %esi, %esi
callq 0x2f720
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x10(%rsp)
leaq 0x2a4285(%rip), %rdi    # 0x2d2438
movl $0x1, %esi
callq 0x2f720
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x18(%rsp)
leaq 0x2a422f(%rip), %rdi    # 0x2d2438
movl $0x2, %esi
callq 0x2f720
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x2e5f7
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x213112(%rip), %rsi    # 0x241346
callq 0x28f20
cmpl $0x0, %eax
jne 0x2e328
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x90(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x88(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x80(%rsp)
movsd 0x90(%rsp), %xmm0
movsd 0x88(%rsp), %xmm1
movsd 0x80(%rsp), %xmm2
leaq 0x2a417a(%rip), %rdi    # 0x2d2498
callq 0x2f740
jmp 0x2e5f5
movq 0x98(%rsp), %rax
movq (%rax), %rdi
leaq 0x213014(%rip), %rsi    # 0x24134e
callq 0x28f20
cmpl $0x0, %eax
jne 0x2e5d0
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x78(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x70(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x68(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x60(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x58(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x50(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x48(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x40(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movq (%rax), %rdi
callq 0x28d50
movsd %xmm0, 0x38(%rsp)
movsd 0x78(%rsp), %xmm0
movsd 0x70(%rsp), %xmm1
movsd 0x68(%rsp), %xmm2
leaq 0x20(%rsp), %rdi
callq 0x1622c0
leaq 0x2a3ed2(%rip), %rdi    # 0x2d2450
leaq 0x20(%rsp), %rsi
callq 0x162950
movsd 0x60(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
leaq 0x2a3ec7(%rip), %rdi    # 0x2d2468
callq 0x2f780
movsd 0x48(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd 0x38(%rsp), %xmm2
leaq 0x2a3ec1(%rip), %rdi    # 0x2d2480
callq 0x2f780
movl $0x1, 0x2a3efa(%rip)    # 0x2d24c8
jmp 0x2e5f3
movq 0x98(%rsp), %rax
movq (%rax), %rsi
leaq 0x212d74(%rip), %rdi    # 0x241356
movb $0x0, %al
callq 0x1a7770
movl $0x1, %edi
callq 0x28cb0
jmp 0x2e5f5
jmp 0x2e5f7
jmp 0x2e5f9
jmp 0x2e5fb
jmp 0x2e5fd
jmp 0x2e5ff
jmp 0x2e601
jmp 0x2e603
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
jmp 0x2e6d3
cmpq $0x0, 0x2a3e9b(%rip)    # 0x2d24d0
jne 0x2e64b
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x2a3e87(%rip)    # 0x2d24d0
jmp 0x2e6ae
cmpq $0x0, 0x2a3e85(%rip)    # 0x2d24d8
jne 0x2e669
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x2a3e71(%rip)    # 0x2d24d8
jmp 0x2e6ac
cmpq $0x0, 0x2a3e6f(%rip)    # 0x2d24e0
jne 0x2e687
movq 0x98(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x2a3e5b(%rip)    # 0x2d24e0
jmp 0x2e6aa
movq 0x98(%rsp), %rax
movq (%rax), %rsi
leaq 0x212cbd(%rip), %rdi    # 0x241356
movb $0x0, %al
callq 0x1a7770
movl $0x1, %edi
callq 0x28cb0
jmp 0x2e6ac
jmp 0x2e6ae
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
jmp 0x2deab
cmpq $0x0, 0x2a3df0(%rip)    # 0x2d24d0
je 0x2e6ec
cmpq $0x0, 0x2a3dee(%rip)    # 0x2d24d8
jne 0x2e707
leaq 0x212c80(%rip), %rdi    # 0x241373
movb $0x0, %al
callq 0x1a7770
movl $0x0, 0xa4(%rsp)
jmp 0x2e712
movl $0x1, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)