// File: tomfunkhouser[P]gaps/apps/msh2prp/msh2prp.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, "-debug")) print_debug = 1;
      else if (!strcmp(*argv, "-basic")) { compute_basic_properties = 1; }
      else if (!strcmp(*argv, "-coordinate")) { compute_coordinate_properties = 1; }
      else if (!strcmp(*argv, "-curvature")) { compute_curvature_properties = 1; }
      else if (!strcmp(*argv, "-volume")) { compute_volume_properties = 1; }
      else if (!strcmp(*argv, "-boundary")) { compute_boundary_properties = 1; }
      else if (!strcmp(*argv, "-laplacian")) { compute_laplacian_properties = 1; }
      else if (!strcmp(*argv, "-dijkstra")) { compute_dijkstra_distance_properties = 1; }
      else if (!strcmp(*argv, "-dijkstra_statistics")) { compute_dijkstra_distance_properties = 1; }
      else if (!strcmp(*argv, "-dijkstra_histogram")) { compute_dijkstra_histogram_properties = 1; }
      else if (!strcmp(*argv, "-raytrace")) { compute_raytrace_properties = 1; }
      else if (!strcmp(*argv, "-solidtexture")) { compute_solidtexture_properties = 1; }
      else if (!strcmp(*argv, "-output_mesh")) { argv++; argc--; output_mesh_name = *argv; }
      else if (!strcmp(*argv, "-map")) { argv++; argc--; input_map_name = *argv; }
      else if (!strcmp(*argv, "-mturk_semantic_segmentation")) {
        argv++; argc--; input_mturk_segmentation_name = *argv; 
        argv++; argc--; input_mturk_annotation_name = *argv;         
        argv++; argc--; input_mturk_label_mapping_name = *argv;         
      }
      else if (!strcmp(*argv, "-all")) { 
        compute_basic_properties = 1;
        compute_coordinate_properties = 1;
        compute_curvature_properties = 1;
        compute_volume_properties = 1;
        compute_boundary_properties = 1;
        // compute_laplacian_properties = 1;
        compute_dijkstra_distance_properties = 1;
        compute_dijkstra_histogram_properties = 1;
        compute_raytrace_properties = 1;
      }
      else { 
        RNFail("Invalid program argument: %s", *argv); 
        exit(1); 
      }
      argv++; argc--;
    }
    else {
      if (!input_mesh_name) input_mesh_name = *argv;
      else if (!output_properties_name) output_properties_name = *argv;
      else { RNFail("Invalid program argument: %s", *argv); exit(1); }
      argv++; argc--;
    }
  }

  // Check input filename
  if (!input_mesh_name || !output_properties_name) {
    RNFail("Usage: msh2prp meshfile propertiesfile [options]\n");
    return 0;
  }

  // Return OK status 
  return 1;
}

// Assembly:
subq $0x18, %rsp
movl %edi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x10(%rsp)
jle 0x14f8b
movq 0x8(%rsp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x14f15
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f591(%rip), %rsi    # 0x1740c5
callq 0x11990
cmpl $0x0, %eax
jne 0x14b4d
movl $0x1, 0x1b5bf8(%rip)    # 0x1ca740
jmp 0x14efa
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f56c(%rip), %rsi    # 0x1740c8
callq 0x11990
cmpl $0x0, %eax
jne 0x14b75
movl $0x1, 0x1b5bd4(%rip)    # 0x1ca744
jmp 0x14ef8
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f54b(%rip), %rsi    # 0x1740cf
callq 0x11990
cmpl $0x0, %eax
jne 0x14b9d
movl $0x1, 0x1b5bb0(%rip)    # 0x1ca748
jmp 0x14ef6
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f52a(%rip), %rsi    # 0x1740d6
callq 0x11990
cmpl $0x0, %eax
jne 0x14bc5
movl $0x1, 0x1b5b8c(%rip)    # 0x1ca74c
jmp 0x14ef4
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f50e(%rip), %rsi    # 0x1740e2
callq 0x11990
cmpl $0x0, %eax
jne 0x14bed
movl $0x1, 0x1b5b68(%rip)    # 0x1ca750
jmp 0x14ef2
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f4f1(%rip), %rsi    # 0x1740ed
callq 0x11990
cmpl $0x0, %eax
jne 0x14c15
movl $0x1, 0x1b5b44(%rip)    # 0x1ca754
jmp 0x14ef0
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f4d1(%rip), %rsi    # 0x1740f5
callq 0x11990
cmpl $0x0, %eax
jne 0x14c3d
movl $0x1, 0x1b5b20(%rip)    # 0x1ca758
jmp 0x14eee
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f4b3(%rip), %rsi    # 0x1740ff
callq 0x11990
cmpl $0x0, %eax
jne 0x14c65
movl $0x1, 0x1b5afc(%rip)    # 0x1ca75c
jmp 0x14eec
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f496(%rip), %rsi    # 0x17410a
callq 0x11990
cmpl $0x0, %eax
jne 0x14c8d
movl $0x1, 0x1b5ad8(%rip)    # 0x1ca760
jmp 0x14eea
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f478(%rip), %rsi    # 0x174114
callq 0x11990
cmpl $0x0, %eax
jne 0x14cb5
movl $0x1, 0x1b5ab0(%rip)    # 0x1ca760
jmp 0x14ee8
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f465(%rip), %rsi    # 0x174129
callq 0x11990
cmpl $0x0, %eax
jne 0x14cdd
movl $0x1, 0x1b5a8c(%rip)    # 0x1ca764
jmp 0x14ee6
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f451(%rip), %rsi    # 0x17413d
callq 0x11990
cmpl $0x0, %eax
jne 0x14d05
movl $0x1, 0x1b5a68(%rip)    # 0x1ca768
jmp 0x14ee4
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f433(%rip), %rsi    # 0x174147
callq 0x11990
cmpl $0x0, %eax
jne 0x14d2d
movl $0x1, 0x1b5a44(%rip)    # 0x1ca76c
jmp 0x14ee2
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f419(%rip), %rsi    # 0x174155
callq 0x11990
cmpl $0x0, %eax
jne 0x14d73
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1b59ca(%rip)    # 0x1ca738
jmp 0x14ee0
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f3e0(%rip), %rsi    # 0x174162
callq 0x11990
cmpl $0x0, %eax
jne 0x14db9
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1b59bc(%rip)    # 0x1ca770
jmp 0x14ede
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f39f(%rip), %rsi    # 0x174167
callq 0x11990
cmpl $0x0, %eax
jne 0x14e4f
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1b597e(%rip)    # 0x1ca778
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1b595e(%rip)    # 0x1ca780
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1b593e(%rip)    # 0x1ca788
jmp 0x14edc
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x15f326(%rip), %rsi    # 0x174184
callq 0x11990
cmpl $0x0, %eax
jne 0x14eba
movl $0x1, 0x1b58d6(%rip)    # 0x1ca748
movl $0x1, 0x1b58d0(%rip)    # 0x1ca74c
movl $0x1, 0x1b58ca(%rip)    # 0x1ca750
movl $0x1, 0x1b58c4(%rip)    # 0x1ca754
movl $0x1, 0x1b58be(%rip)    # 0x1ca758
movl $0x1, 0x1b58bc(%rip)    # 0x1ca760
movl $0x1, 0x1b58b6(%rip)    # 0x1ca764
movl $0x1, 0x1b58b0(%rip)    # 0x1ca768
jmp 0x14eda
movq 0x8(%rsp), %rax
movq (%rax), %rsi
leaq 0x15f2c0(%rip), %rdi    # 0x174189
movb $0x0, %al
callq 0xedb00
movl $0x1, %edi
callq 0x11820
jmp 0x14edc
jmp 0x14ede
jmp 0x14ee0
jmp 0x14ee2
jmp 0x14ee4
jmp 0x14ee6
jmp 0x14ee8
jmp 0x14eea
jmp 0x14eec
jmp 0x14eee
jmp 0x14ef0
jmp 0x14ef2
jmp 0x14ef4
jmp 0x14ef6
jmp 0x14ef8
jmp 0x14efa
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x14f86
cmpq $0x0, 0x1b580b(%rip)    # 0x1ca728
jne 0x14f30
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1b57fa(%rip)    # 0x1ca728
jmp 0x14f6d
cmpq $0x0, 0x1b57f8(%rip)    # 0x1ca730
jne 0x14f4b
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1b57e7(%rip)    # 0x1ca730
jmp 0x14f6b
movq 0x8(%rsp), %rax
movq (%rax), %rsi
leaq 0x15f22f(%rip), %rdi    # 0x174189
movb $0x0, %al
callq 0xedb00
movl $0x1, %edi
callq 0x11820
jmp 0x14f6d
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x14b06
cmpq $0x0, 0x1b5795(%rip)    # 0x1ca728
je 0x14f9f
cmpq $0x0, 0x1b5793(%rip)    # 0x1ca730
jne 0x14fb7
leaq 0x15f200(%rip), %rdi    # 0x1741a6
movb $0x0, %al
callq 0xedb00
movl $0x0, 0x14(%rsp)
jmp 0x14fbf
movl $0x1, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopl (%rax,%rax)