// File: /workspace/github_cpp_makefile_star2_O1/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 0x272c1
movq %rsi, %r13
movl %edi, %ebp
leaq 0xba32a(%rip), %rbx     # 0xe1224
leal -0x1(%rbp), %r14d
leaq 0x8(%r13), %r15
movq 0x8(%r13), %r12
cmpb $0x2d, (%r12)
jne 0x27151
movq %r12, %rdi
movq %rbx, %rsi
callq 0x21cf0
testl %eax, %eax
je 0x27172
movq %r12, %rdi
leaq 0xba2f9(%rip), %rsi     # 0xe1227
callq 0x21cf0
testl %eax, %eax
je 0x27184
movq %r12, %rdi
leaq 0xba2ea(%rip), %rsi     # 0xe122f
callq 0x21cf0
testl %eax, %eax
je 0x271a2
movq %r12, %rdi
leaq 0xba2da(%rip), %rsi     # 0xe1236
callq 0x21cf0
testl %eax, %eax
je 0x271cf
movq %r12, %rdi
leaq 0xba2d2(%rip), %rsi     # 0xe1245
callq 0x21cf0
testl %eax, %eax
je 0x271db
movq %r12, %rdi
leaq 0xba2c2(%rip), %rsi     # 0xe124c
callq 0x21cf0
testl %eax, %eax
je 0x271f1
movq %r12, %rdi
leaq 0xba2b4(%rip), %rsi     # 0xe1255
callq 0x21cf0
testl %eax, %eax
je 0x271fa
movq %r12, %rdi
leaq 0xba2af(%rip), %rsi     # 0xe1267
callq 0x21cf0
testl %eax, %eax
je 0x27203
movq %r12, %rdi
leaq 0xba2a0(%rip), %rsi     # 0xe126f
callq 0x21cf0
testl %eax, %eax
je 0x2720c
movq %r12, %rdi
leaq 0xba28f(%rip), %rsi     # 0xe1275
callq 0x21cf0
testl %eax, %eax
je 0x27218
movq %r12, %rdi
leaq 0xba288(%rip), %rsi     # 0xe1285
callq 0x21cf0
testl %eax, %eax
je 0x27230
movq %r12, %rdi
leaq 0xba27e(%rip), %rsi     # 0xe1292
callq 0x21cf0
testl %eax, %eax
je 0x2726a
movq %r12, %rdi
leaq 0xba26f(%rip), %rsi     # 0xe129a
callq 0x21cf0
testl %eax, %eax
jne 0x272fb
movq 0x10(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x8(%rsp)
movq 0x18(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x10(%rsp)
movq 0x20(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x40(%rsp)
movq 0x28(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x48(%rsp)
movq 0x30(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x38(%rsp)
movq 0x38(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x30(%rsp)
movq 0x40(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x28(%rsp)
movq 0x48(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x20(%rsp)
addl $-0xa, %ebp
movq 0x50(%r13), %rdi
addq $0x50, %r13
callq 0x21b80
movsd %xmm0, 0x18(%rsp)
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x40(%rsp), %xmm2
callq 0x7aafa
leaq 0x1247d4(%rip), %rdi    # 0x14b8c0
movq %r14, %rsi
callq 0x7ae68
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x12478e(%rip)   # 0x14b890
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x124788(%rip)   # 0x14b898
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x124782(%rip)   # 0x14b8a0
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x12477c(%rip)   # 0x14b8a8
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x124776(%rip)   # 0x14b8b0
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x124770(%rip)   # 0x14b8b8
movb $0x1, 0x1248a1(%rip)    # 0x14b9f0
jmp 0x271b4
cmpq $0x0, 0x12489f(%rip)    # 0x14b9f8
je 0x2717b
cmpq $0x0, 0x12489d(%rip)    # 0x14ba00
jne 0x272fb
movq %r12, 0x124890(%rip)    # 0x14ba00
jmp 0x271ba
movb $0x1, 0x12485f(%rip)    # 0x14b9d8
jmp 0x271ba
movq %r12, 0x124876(%rip)    # 0x14b9f8
jmp 0x271ba
addl $-0x2, %ebp
movq 0x10(%r13), %rax
addq $0x10, %r13
movq %rax, 0x12484a(%rip)    # 0x14b9e0
movl $0x1, 0x1247c0(%rip)    # 0x14b960
jmp 0x271b4
addl $-0x2, %ebp
movq 0x10(%r13), %rax
addq $0x10, %r13
movq %rax, 0x1247e4(%rip)    # 0x14b998
movq %r13, %r15
movl %ebp, %r14d
movl %r14d, %ebp
movq %r15, %r13
cmpl $0x1, %r14d
jg 0x26efa
jmp 0x272c1
movl $0x0, 0x11f7cf(%rip)    # 0x1469a8
jmp 0x271ba
movl $0x1, 0x11f7bb(%rip)    # 0x1469a0
movl $0x0, 0x11f7b5(%rip)    # 0x1469a4
jmp 0x271ba
movb $0x1, 0x12476c(%rip)    # 0x14b964
jmp 0x271ba
movb $0x1, 0x1247e7(%rip)    # 0x14b9e8
jmp 0x271ba
movb $0x1, 0x1247e2(%rip)    # 0x14b9ec
jmp 0x271ba
movl $0x1, 0x12472e(%rip)    # 0x14b944
jmp 0x271ba
addl $-0x2, %ebp
movq 0x10(%r13), %rdi
addq $0x10, %r13
callq 0x21ed0
movl %eax, 0x1247a6(%rip)    # 0x14b9d4
jmp 0x271b4
movq 0x10(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x8(%rsp)
addl $-0x3, %ebp
movq 0x18(%r13), %rdi
addq $0x18, %r13
callq 0x21b80
movsd 0x8(%rsp), %xmm1
movsd %xmm1, 0x12467b(%rip)   # 0x14b8d8
movsd %xmm0, 0x12467b(%rip)   # 0x14b8e0
jmp 0x271b4
movq 0x10(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x8(%rsp)
movq 0x18(%r13), %rdi
callq 0x21b80
movsd %xmm0, 0x10(%rsp)
addl $-0x4, %ebp
movq 0x20(%r13), %rdi
addq $0x20, %r13
callq 0x21b80
movsd 0x8(%rsp), %xmm1
movsd %xmm1, 0x124642(%rip)   # 0x14b8e8
movsd 0x10(%rsp), %xmm1
movsd %xmm1, 0x12463c(%rip)   # 0x14b8f0
movsd %xmm0, 0x12463c(%rip)   # 0x14b8f8
jmp 0x271b4
cmpq $0x0, 0x12472f(%rip)    # 0x14b9f8
je 0x272da
movl $0x1, %ebx
cmpq $0x0, 0x124728(%rip)    # 0x14ba00
jne 0x272ea
leaq 0xb9fde(%rip), %rdi     # 0xe12bf
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x8fd7a
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb9fa0(%rip), %rdi     # 0xe12a2
movq %r12, %rsi
xorl %eax, %eax
callq 0x8fd7a
movl $0x1, %edi
callq 0x21af0