// File: tomfunkhouser[P]gaps/apps/mshparam/mshparam.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, "-fit_in_zero_to_one")) fit_in_zero_to_one = 1;
      else if (!strcmp(*argv, "-flatten")) flatten = 1;
      else if (!strcmp(*argv, "-separate_face_segments")) separate_face_segments = 1;
      else if (!strcmp(*argv, "-separate_face_materials")) separate_face_materials = 1;
      else if (!strcmp(*argv, "-output_textures")) { argc--; argv++; output_texture_directory = *argv; }
      else if (!strcmp(*argv, "-texel_spacing")) { argc--; argv++; texel_spacing = atof(*argv); }
      else { fprintf(stderr, "Invalid program argument: %s", *argv); exit(1); }
      argv++; argc--;
    }
    else {
      if (!input_mesh_filename) input_mesh_filename = *argv;
      else if (!output_mesh_filename) output_mesh_filename = *argv;
      else { fprintf(stderr, "Invalid program argument: %s", *argv); exit(1); }
      argv++; argc--;
    }
  }

  // Check filenames
  if (!input_mesh_filename || !output_mesh_filename) {
    fprintf(stderr, "Usage: mshparam inputmesh outputmesh\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 0x127ba
movq 0x8(%rsp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1273a
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x10fab4(%rip), %rsi    # 0x122058
callq 0xf6a0
cmpl $0x0, %eax
jne 0x125bd
movl $0x1, 0x14b768(%rip)    # 0x15dd20
jmp 0x1271f
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x10fa8f(%rip), %rsi    # 0x12205b
callq 0xf6a0
cmpl $0x0, %eax
jne 0x125e5
movl $0x1, 0x14b744(%rip)    # 0x15dd24
jmp 0x1271d
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x10fa7b(%rip), %rsi    # 0x12206f
callq 0xf6a0
cmpl $0x0, %eax
jne 0x1260d
movl $0x1, 0x14b720(%rip)    # 0x15dd28
jmp 0x1271b
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x10fa5c(%rip), %rsi    # 0x122078
callq 0xf6a0
cmpl $0x0, %eax
jne 0x12635
movl $0x1, 0x14b6fc(%rip)    # 0x15dd2c
jmp 0x12719
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x10fa4c(%rip), %rsi    # 0x122090
callq 0xf6a0
cmpl $0x0, %eax
jne 0x1265d
movl $0x1, 0x14b6d8(%rip)    # 0x15dd30
jmp 0x12717
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x10fa3d(%rip), %rsi    # 0x1220a9
callq 0xf6a0
cmpl $0x0, %eax
jne 0x126a0
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x14b67a(%rip)    # 0x15dd18
jmp 0x12715
movq 0x8(%rsp), %rax
movq (%rax), %rdi
leaq 0x10fa0b(%rip), %rsi    # 0x1220ba
callq 0xf6a0
cmpl $0x0, %eax
jne 0x126e9
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0xf610
movsd %xmm0, 0x14ade9(%rip)   # 0x15d4d0
jmp 0x12713
movq 0x14a8d8(%rip), %rax    # 0x15cfc8
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movq (%rax), %rdx
leaq 0x10f9c7(%rip), %rsi    # 0x1220c9
movb $0x0, %al
callq 0xf6d0
movl $0x1, %edi
callq 0xf5e0
jmp 0x12715
jmp 0x12717
jmp 0x12719
jmp 0x1271b
jmp 0x1271d
jmp 0x1271f
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x127b5
cmpq $0x0, 0x14b5c6(%rip)    # 0x15dd08
jne 0x12755
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x14b5b5(%rip)    # 0x15dd08
jmp 0x1279c
cmpq $0x0, 0x14b5b3(%rip)    # 0x15dd10
jne 0x12770
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x14b5a2(%rip)    # 0x15dd10
jmp 0x1279a
movq 0x14a851(%rip), %rax    # 0x15cfc8
movq (%rax), %rdi
movq 0x8(%rsp), %rax
movq (%rax), %rdx
leaq 0x10f940(%rip), %rsi    # 0x1220c9
movb $0x0, %al
callq 0xf6d0
movl $0x1, %edi
callq 0xf5e0
jmp 0x1279c
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x12576
cmpq $0x0, 0x14b546(%rip)    # 0x15dd08
je 0x127ce
cmpq $0x0, 0x14b544(%rip)    # 0x15dd10
jne 0x127f0
movq 0x14a7f3(%rip), %rax    # 0x15cfc8
movq (%rax), %rdi
leaq 0x10f907(%rip), %rsi    # 0x1220e6
movb $0x0, %al
callq 0xf6d0
movl $0x0, 0x14(%rsp)
jmp 0x127f8
movl $0x1, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)