// File: tomfunkhouser[P]gaps/apps/confview/confview.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, "-read_all_channels")) read_all_channels = TRUE; 
      else if (!strcmp(*argv, "-mesh")) { argc--; argv++; input_mesh_filename = *argv; }
      else if (!strcmp(*argv, "-obbs")) { argc--; argv++; input_obbs_filename = *argv; }
      else if (!strcmp(*argv, "-segmentation")) { argc--; argv++; input_segmentation_filename = *argv; }
      else if (!strcmp(*argv, "-overlap_file")) { argc--; argv++; input_overlap_filename = *argv; }
      else if (!strcmp(*argv, "-overlap_matrix")) { argc--; argv++; input_overlap_matrix = *argv; }
      else if (!strcmp(*argv, "-load_every_kth_image")) { argc--; argv++; load_every_kth_image = atoi(*argv); }
      else if (!strcmp(*argv, "-texel_spacing")) { argc--; argv++; texel_spacing = 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[0] = atof(*argv); 
        argv++; argc--; background[1] = atof(*argv); 
        argv++; argc--; background[2] = atof(*argv);
      }
      else {
        RNFail("Invalid program argument: %s", *argv);
        exit(1);
      }
      argv++; argc--;
    }
    else {
      if (!input_configuration_filename) input_configuration_filename = *argv;
      else if (!output_configuration_filename) output_configuration_filename = *argv;
      else { RNFail("Invalid program argument: %s", *argv); exit(1); }
      argv++; argc--;
    }
  }

  // Check filenames
  if (!input_configuration_filename) {
    RNFail("Usage: confview inputconfigurationfile [outputconfigurationfile] [options]\n");
    return 0;
  }

  // Return OK status 
  return 1;
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
cmpl $0x0, 0x20(%rsp)
jle 0x2d233
movq 0x18(%rsp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2d1bd
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a73f(%rip), %rsi    # 0x1c7513
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2cded
movl $0x1, 0x20efe8(%rip)    # 0x23bdd0
jmp 0x2d1a2
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a71a(%rip), %rsi    # 0x1c7516
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2ce15
movl $0x1, 0x20f080(%rip)    # 0x23be90
jmp 0x2d1a0
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a705(%rip), %rsi    # 0x1c7529
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2ce5b
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20f002(%rip)    # 0x23be58
jmp 0x2d19e
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a6c5(%rip), %rsi    # 0x1c752f
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2cea1
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20efcc(%rip)    # 0x23be68
jmp 0x2d19c
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a685(%rip), %rsi    # 0x1c7535
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2cee7
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20ef7e(%rip)    # 0x23be60
jmp 0x2d19a
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a64d(%rip), %rsi    # 0x1c7543
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2cf2d
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20ef50(%rip)    # 0x23be78
jmp 0x2d198
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a615(%rip), %rsi    # 0x1c7551
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2cf73
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20ef02(%rip)    # 0x23be70
jmp 0x2d196
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a5df(%rip), %rsi    # 0x1c7561
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2cfbd
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x250c0
movl %eax, 0x208b78(%rip)    # 0x235b30
jmp 0x2d194
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a5ab(%rip), %rsi    # 0x1c7577
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2d009
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x24d30
movsd %xmm0, 0x20ee84(%rip)   # 0x23be88
jmp 0x2d192
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a56e(%rip), %rsi    # 0x1c7586
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2d07f
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x250c0
movl %eax, 0x208a8e(%rip)    # 0x235adc
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x250c0
movl %eax, 0x208a66(%rip)    # 0x235ae0
jmp 0x2d190
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x19a500(%rip), %rsi    # 0x1c758e
callq 0x24ef0
cmpl $0x0, %eax
jne 0x2d16e
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x24d30
movsd %xmm0, (%rsp)
leaq 0x20ebe2(%rip), %rdi    # 0x23bcb0
xorl %esi, %esi
callq 0x2f790
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x24d30
movsd %xmm0, 0x8(%rsp)
leaq 0x20eb9f(%rip), %rdi    # 0x23bcb0
movl $0x1, %esi
callq 0x2f790
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rdi
callq 0x24d30
movsd %xmm0, 0x10(%rsp)
leaq 0x20eb58(%rip), %rdi    # 0x23bcb0
movl $0x2, %esi
callq 0x2f790
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x2d18e
movq 0x18(%rsp), %rax
movq (%rax), %rsi
leaq 0x19a41d(%rip), %rdi    # 0x1c759a
movb $0x0, %al
callq 0x12c6b0
movl $0x1, %edi
callq 0x24c90
jmp 0x2d190
jmp 0x2d192
jmp 0x2d194
jmp 0x2d196
jmp 0x2d198
jmp 0x2d19a
jmp 0x2d19c
jmp 0x2d19e
jmp 0x2d1a0
jmp 0x2d1a2
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x2d22e
cmpq $0x0, 0x20ec8b(%rip)    # 0x23be50
jne 0x2d1d8
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20ec7a(%rip)    # 0x23be50
jmp 0x2d215
cmpq $0x0, 0x20eba8(%rip)    # 0x23bd88
jne 0x2d1f3
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20eb97(%rip)    # 0x23bd88
jmp 0x2d213
movq 0x18(%rsp), %rax
movq (%rax), %rsi
leaq 0x19a398(%rip), %rdi    # 0x1c759a
movb $0x0, %al
callq 0x12c6b0
movl $0x1, %edi
callq 0x24c90
jmp 0x2d215
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x18(%rsp)
movl 0x20(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x2cda6
cmpq $0x0, 0x20ec15(%rip)    # 0x23be50
jne 0x2d255
leaq 0x19a373(%rip), %rdi    # 0x1c75b7
movb $0x0, %al
callq 0x12c6b0
movl $0x0, 0x24(%rsp)
jmp 0x2d25d
movl $0x1, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)