// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rsi, %r14
movl %edi, %r13d
leaq 0xa345c(%rip), %rbx     # 0xc9224
cmpl $0x2, %r13d
jl 0x26198
leal -0x1(%r13), %r15d
leaq 0x8(%r14), %rbp
movq (%rbp), %r12
cmpb $0x2d, (%r12)
jne 0x2602a
cmpb $0x76, 0x1(%r12)
jne 0x25dfd
cmpb $0x0, 0x2(%r12)
je 0x26094
movq %r12, %rdi
movq %rbx, %rsi
callq 0x21d10
testl %eax, %eax
je 0x2605a
movq %r12, %rdi
leaq 0xa3412(%rip), %rsi     # 0xc922c
callq 0x21d10
testl %eax, %eax
je 0x2607c
movq %r12, %rdi
leaq 0xa3402(%rip), %rsi     # 0xc9233
callq 0x21d10
testl %eax, %eax
je 0x2609d
movq %r12, %rdi
leaq 0xa33fa(%rip), %rsi     # 0xc9242
callq 0x21d10
testl %eax, %eax
je 0x260a6
movq %r12, %rdi
leaq 0xa33ea(%rip), %rsi     # 0xc9249
callq 0x21d10
testl %eax, %eax
je 0x260b9
movq %r12, %rdi
leaq 0xa33dc(%rip), %rsi     # 0xc9252
callq 0x21d10
testl %eax, %eax
je 0x260c2
movq %r12, %rdi
leaq 0xa33d7(%rip), %rsi     # 0xc9264
callq 0x21d10
testl %eax, %eax
je 0x260cb
movq %r12, %rdi
leaq 0xa33c8(%rip), %rsi     # 0xc926c
callq 0x21d10
testl %eax, %eax
je 0x260d4
movq %r12, %rdi
leaq 0xa33b7(%rip), %rsi     # 0xc9272
callq 0x21d10
testl %eax, %eax
je 0x260e9
movq %r12, %rdi
leaq 0xa33b0(%rip), %rsi     # 0xc9282
callq 0x21d10
testl %eax, %eax
je 0x26105
movq %r12, %rdi
leaq 0xa33a6(%rip), %rsi     # 0xc928f
callq 0x21d10
testl %eax, %eax
je 0x26140
movq %r12, %rdi
leaq 0xa3397(%rip), %rsi     # 0xc9297
callq 0x21d10
testl %eax, %eax
jne 0x261d2
movq 0x10(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x8(%rsp)
movq 0x18(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x10(%rsp)
movq 0x20(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x40(%rsp)
movq 0x28(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x48(%rsp)
movq 0x30(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x38(%rsp)
movq 0x38(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x30(%rsp)
movq 0x40(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x28(%rsp)
movq 0x48(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x20(%rsp)
addl $-0xa, %r13d
movq 0x50(%r14), %rdi
addq $0x50, %r14
callq 0x21b70
movsd %xmm0, 0x18(%rsp)
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x40(%rsp), %xmm2
callq 0x6f6cc
leaq 0x11391e(%rip), %rdi    # 0x1398e0
movq %r15, %rsi
callq 0x6f9b6
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x1138d8(%rip)   # 0x1398b0
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x1138d2(%rip)   # 0x1398b8
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x1138cc(%rip)   # 0x1398c0
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x1138c6(%rip)   # 0x1398c8
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x1138c0(%rip)   # 0x1398d0
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x1138ba(%rip)   # 0x1398d8
movb $0x1, 0x1139eb(%rip)    # 0x139a10
jmp 0x25dc8
cmpq $0x0, 0x1139e6(%rip)    # 0x139a18
je 0x2604e
cmpq $0x0, 0x1139e4(%rip)    # 0x139a20
jne 0x261d2
movq %r12, 0x1139d7(%rip)    # 0x139a20
jmp 0x260de
movq %r12, 0x1139c3(%rip)    # 0x139a18
jmp 0x260de
addl $-0x2, %r13d
movq 0x10(%r14), %rax
addq $0x10, %r14
movq %rax, 0x113993(%rip)    # 0x139a00
movl $0x1, 0x113909(%rip)    # 0x139980
jmp 0x25dc8
addl $-0x2, %r13d
movq 0x10(%r14), %rax
addq $0x10, %r14
movq %rax, 0x113929(%rip)    # 0x1399b8
jmp 0x25dc8
movb $0x1, 0x11395d(%rip)    # 0x1399f8
jmp 0x260de
andl $0x0, 0x10e924(%rip)    # 0x1349c8
jmp 0x260de
andl $0x0, 0x10e917(%rip)    # 0x1349c4
movl $0x1, 0x10e909(%rip)    # 0x1349c0
jmp 0x260de
movb $0x1, 0x1138c4(%rip)    # 0x139984
jmp 0x260de
movb $0x1, 0x11393f(%rip)    # 0x139a08
jmp 0x260de
movb $0x1, 0x11393a(%rip)    # 0x139a0c
jmp 0x260de
movl $0x1, 0x113886(%rip)    # 0x139964
movq %rbp, %r14
movl %r15d, %r13d
jmp 0x25dc8
addl $-0x2, %r13d
movq 0x10(%r14), %rdi
addq $0x10, %r14
callq 0x21ed0
movl %eax, 0x1138f4(%rip)    # 0x1399f4
jmp 0x25dc8
movq 0x10(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x8(%rsp)
addl $-0x3, %r13d
movq 0x18(%r14), %rdi
addq $0x18, %r14
callq 0x21b70
movsd 0x8(%rsp), %xmm1
movsd %xmm1, 0x1137c5(%rip)   # 0x1398f8
movsd %xmm0, 0x1137c5(%rip)   # 0x139900
jmp 0x25dc8
movq 0x10(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x8(%rsp)
movq 0x18(%r14), %rdi
callq 0x21b70
movsd %xmm0, 0x10(%rsp)
addl $-0x4, %r13d
movq 0x20(%r14), %rdi
addq $0x20, %r14
callq 0x21b70
movsd 0x8(%rsp), %xmm1
movsd %xmm1, 0x11378b(%rip)   # 0x139908
movsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x113785(%rip)   # 0x139910
movsd %xmm0, 0x113785(%rip)   # 0x139918
jmp 0x25dc8
cmpq $0x0, 0x113878(%rip)    # 0x139a18
je 0x261b1
cmpq $0x0, 0x113876(%rip)    # 0x139a20
je 0x261b1
pushq $0x1
popq %rbx
jmp 0x261c1
leaq 0xa3104(%rip), %rdi     # 0xc92bc
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x82696
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa30c6(%rip), %rdi     # 0xc929f
movq %r12, %rsi
xorl %eax, %eax
callq 0x82696
pushq $0x1
popq %rdi
callq 0x21ae0