// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/prpview/prpview.cpp
// Function: ParseArgs(int, char**)
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, "-points")) { argc--; argv++; points_name = *argv; show_points = 1; }
      else if (!strcmp(*argv, "-image")) { argc--; argv++; image_name = *argv; }
      else if (!strcmp(*argv, "-no_statistics")) { show_statistics = 0; }
      else if (!strcmp(*argv, "-faces")) { show_faces = 1; show_values = 0; }
      else if (!strcmp(*argv, "-redness")) { color_with_redness = 1; }
      else if (!strcmp(*argv, "-flip_color_range")) { flip_color_range = 1; }
      else if (!strcmp(*argv, "-labels")) { color_with_labels = 1; }
      else if (!strcmp(*argv, "-back")) { show_backfacing = 1; }
      else if (!strcmp(*argv, "-property_index")) { 
        argv++; argc--; initial_property_index = atoi(*argv);
      }
      else if (!strcmp(*argv, "-value_range")) { 
        RNScalar min_value, max_value;
        argv++; argc--; min_value = atof(*argv);
        argv++; argc--; max_value = atof(*argv);
        input_value_range.Reset(min_value, max_value);
      }
      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_origin = 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 (!mesh_name) mesh_name = *argv;
      else if (!properties_name) properties_name = *argv;
      else { RNFail("Invalid program argument: %s", *argv); exit(1); }
      argv++; argc--;
    }
  }

  // Check mesh filename
  if (!mesh_name || !properties_name) {
    RNFail("Usage: prpview meshfile propertiesfile.\n");
    return 0;
  }

  // Return OK status 
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpl $0x2, %edi
jl 0x27279
movq %rsi, %r13
movl %edi, %ebp
leaq 0xb8378(%rip), %rbx     # 0xdf224
leal -0x1(%rbp), %r14d
leaq 0x8(%r13), %r15
movq 0x8(%r13), %r12
cmpb $0x2d, (%r12)
jne 0x27100
cmpb $0x76, 0x1(%r12)
jne 0x26ed7
cmpb $0x0, 0x2(%r12)
je 0x27168
movq %r12, %rdi
movq %rbx, %rsi
callq 0x21ce0
testl %eax, %eax
je 0x27130
movq %r12, %rdi
leaq 0xb8338(%rip), %rsi     # 0xdf22c
callq 0x21ce0
testl %eax, %eax
je 0x2714e
movq %r12, %rdi
leaq 0xb8328(%rip), %rsi     # 0xdf233
callq 0x21ce0
testl %eax, %eax
je 0x27171
movq %r12, %rdi
leaq 0xb8320(%rip), %rsi     # 0xdf242
callq 0x21ce0
testl %eax, %eax
je 0x2717d
movq %r12, %rdi
leaq 0xb8310(%rip), %rsi     # 0xdf249
callq 0x21ce0
testl %eax, %eax
je 0x27193
movq %r12, %rdi
leaq 0xb8302(%rip), %rsi     # 0xdf252
callq 0x21ce0
testl %eax, %eax
je 0x2719c
movq %r12, %rdi
leaq 0xb82fd(%rip), %rsi     # 0xdf264
callq 0x21ce0
testl %eax, %eax
je 0x271a5
movq %r12, %rdi
leaq 0xb82ee(%rip), %rsi     # 0xdf26c
callq 0x21ce0
testl %eax, %eax
je 0x271ae
movq %r12, %rdi
leaq 0xb82dd(%rip), %rsi     # 0xdf272
callq 0x21ce0
testl %eax, %eax
je 0x271cd
movq %r12, %rdi
leaq 0xb82d6(%rip), %rsi     # 0xdf282
callq 0x21ce0
testl %eax, %eax
je 0x271e8
movq %r12, %rdi
leaq 0xb82cc(%rip), %rsi     # 0xdf28f
callq 0x21ce0
testl %eax, %eax
je 0x27222
movq %r12, %rdi
leaq 0xb82bd(%rip), %rsi     # 0xdf297
callq 0x21ce0
testl %eax, %eax
jne 0x272b3
movq 0x10(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x8(%rsp)
movq 0x18(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x10(%rsp)
movq 0x20(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x40(%rsp)
movq 0x28(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x48(%rsp)
movq 0x30(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x38(%rsp)
movq 0x38(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x30(%rsp)
movq 0x40(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x28(%rsp)
movq 0x48(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x20(%rsp)
addl $-0xa, %ebp
movq 0x50(%r13), %rdi
addq $0x50, %r13
callq 0x21b70
movsd %xmm0, 0x18(%rsp)
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x40(%rsp), %xmm2
callq 0x79b5a
leaq 0x122825(%rip), %rdi    # 0x1498c0
movq %r14, %rsi
callq 0x79ec2
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x1227df(%rip)   # 0x149890
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x1227d9(%rip)   # 0x149898
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x1227d3(%rip)   # 0x1498a0
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x1227cd(%rip)   # 0x1498a8
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x1227c7(%rip)   # 0x1498b0
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x1227c1(%rip)   # 0x1498b8
movb $0x1, 0x1228f2(%rip)    # 0x1499f0
jmp 0x27160
cmpq $0x0, 0x1228f0(%rip)    # 0x1499f8
je 0x27124
cmpq $0x0, 0x1228ee(%rip)    # 0x149a00
jne 0x272b3
movq %r12, 0x1228e1(%rip)    # 0x149a00
jmp 0x271b8
movq %r12, 0x1228cd(%rip)    # 0x1499f8
jmp 0x271b8
addl $-0x2, %ebp
movq 0x10(%r13), %rax
addq $0x10, %r13
movq %rax, 0x12289e(%rip)    # 0x1499e0
movl $0x1, 0x122814(%rip)    # 0x149960
jmp 0x27160
addl $-0x2, %ebp
movq 0x10(%r13), %rax
addq $0x10, %r13
movq %rax, 0x122838(%rip)    # 0x149998
movq %r13, %r15
movl %ebp, %r14d
jmp 0x271b8
movb $0x1, 0x122869(%rip)    # 0x1499d8
jmp 0x271b8
movl $0x0, 0x11d82d(%rip)    # 0x1449a8
jmp 0x271b8
movl $0x1, 0x11d819(%rip)    # 0x1449a0
movl $0x0, 0x11d813(%rip)    # 0x1449a4
jmp 0x271b8
movb $0x1, 0x1227ca(%rip)    # 0x149964
jmp 0x271b8
movb $0x1, 0x122845(%rip)    # 0x1499e8
jmp 0x271b8
movb $0x1, 0x122840(%rip)    # 0x1499ec
jmp 0x271b8
movl $0x1, 0x12278c(%rip)    # 0x149944
movl %r14d, %ebp
movq %r15, %r13
cmpl $0x1, %r14d
jg 0x26eac
jmp 0x27279
addl $-0x2, %ebp
movq 0x10(%r13), %rdi
addq $0x10, %r13
callq 0x21ec0
movl %eax, 0x1227f1(%rip)    # 0x1499d4
jmp 0x27160
movq 0x10(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x8(%rsp)
addl $-0x3, %ebp
movq 0x18(%r13), %rdi
addq $0x18, %r13
callq 0x21b70
movsd 0x8(%rsp), %xmm1
movsd %xmm1, 0x1226c3(%rip)   # 0x1498d8
movsd %xmm0, 0x1226c3(%rip)   # 0x1498e0
jmp 0x27160
movq 0x10(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x8(%rsp)
movq 0x18(%r13), %rdi
callq 0x21b70
movsd %xmm0, 0x10(%rsp)
addl $-0x4, %ebp
movq 0x20(%r13), %rdi
addq $0x20, %r13
callq 0x21b70
movsd 0x8(%rsp), %xmm1
movsd %xmm1, 0x12268a(%rip)   # 0x1498e8
movsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x122684(%rip)   # 0x1498f0
movsd %xmm0, 0x122684(%rip)   # 0x1498f8
jmp 0x27160
cmpq $0x0, 0x122777(%rip)    # 0x1499f8
je 0x27292
movl $0x1, %ebx
cmpq $0x0, 0x122770(%rip)    # 0x149a00
jne 0x272a2
leaq 0xb8023(%rip), %rdi     # 0xdf2bc
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x8e88e
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb7fe5(%rip), %rdi     # 0xdf29f
movq %r12, %rsi
xorl %eax, %eax
callq 0x8e88e
movl $0x1, %edi
callq 0x21ae0