// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/grd2txt/grd2txt.cpp
// Function: main
static int 
ParseArgs(int argc, char **argv)
{
  // Check number of arguments
  if (argc < 2) {
    printf("Usage: grd2txt gridfile [txtfile] [-v]\n");
    exit(0);
  }

  // Parse arguments
  argc--; argv++;
  while (argc > 0) {
    if ((*argv)[0] == '-') {
      if (!strcmp(*argv, "-v")) { 
        print_verbose = 1; 
      }
      else { 
        RNFail("Invalid program argument: %s", *argv); 
        exit(1); 
      }
    }
    else {
      if (!grid_name) grid_name = *argv;
      else if (!txt_name) txt_name = *argv;
      else { 
        RNFail("Invalid program argument: %s", *argv); 
        exit(1); 
      }
    }
    argv++; argc--;
  }

  // Check grid filename
  if (!grid_name) {
    RNFail("You did not specify a grid file.\n");
    return 0;
  }

  // Return OK status 
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x2, %edi
jl 0x1061c
movq 0xca7f1(%rip), %r14     # 0xdac08
cmpq $0x0, 0xca7f1(%rip)     # 0xdac10
sete %cl
addq $0x8, %rsi
cmpl $0x2, %edi
jl 0x1047d
movq (%rsi), %rax
cmpb $0x2d, (%rax)
jne 0x10456
cmpb $0x76, 0x1(%rax)
jne 0x10603
cmpb $0x0, 0x2(%rax)
jne 0x10603
movb $0x1, 0xca7ca(%rip)     # 0xdac18
addq $0x8, %rsi
decl %edi
jmp 0x10426
decl %edi
testq %r14, %r14
jne 0x10469
movq %rax, 0xca7a4(%rip)     # 0xdac08
movq %rax, %r14
jmp 0x10422
testb $0x1, %cl
je 0x10603
movq %rax, 0xca797(%rip)     # 0xdac10
xorl %ecx, %ecx
jmp 0x10422
testq %r14, %r14
je 0x1062f
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x6573a
movq %rbx, %rdi
callq 0x1066c
movl $0x250, %edi            # imm = 0x250
callq 0xe450
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x10690
movq %rbx, %rdi
movq %r14, %rsi
callq 0x16e28
testl %eax, %eax
je 0x1063f
cmpb $0x1, 0xca748(%rip)     # 0xdac18
jne 0x1053b
leaq 0x82c17(%rip), %rdi     # 0x930f0
callq 0xe720
leaq 0x8(%rsp), %rdi
callq 0x65774
leaq 0x82b70(%rip), %rdi     # 0x9305f
movb $0x1, %al
callq 0xe070
movl 0x238(%rbx), %esi
movl 0x23c(%rbx), %edx
movl 0x240(%rbx), %ecx
leaq 0x82b67(%rip), %rdi     # 0x93076
xorl %eax, %eax
callq 0xe070
movq %rbx, %rdi
callq 0x10674
leaq 0x82b68(%rip), %rdi     # 0x9308d
movb $0x1, %al
callq 0xe070
movq 0xc9a4d(%rip), %rax     # 0xd9f80
movq (%rax), %rdi
callq 0xe540
movq 0xca6ce(%rip), %r14     # 0xdac10
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x6573a
movq %r15, %rdi
callq 0x1066c
movq 0xc9a22(%rip), %r12     # 0xd9f80
testq %r14, %r14
je 0x10586
leaq 0x874ba(%rip), %rsi     # 0x97a24
movq %r14, %rdi
callq 0xe550
movq %rax, %r15
testq %rax, %rax
jne 0x1058a
leaq 0x82b1b(%rip), %rdi     # 0x9309c
jmp 0x10646
movq (%r12), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1a4ce
testq %r14, %r14
je 0x105a2
movq %r15, %rdi
callq 0xe440
cmpb $0x1, 0xca66f(%rip)     # 0xdac18
jne 0x105ec
leaq 0x82b4c(%rip), %rdi     # 0x930fe
callq 0xe720
leaq 0x8(%rsp), %rdi
callq 0x65774
leaq 0x82a97(%rip), %rdi     # 0x9305f
movb $0x1, %al
callq 0xe070
movl 0x24c(%rbx), %esi
leaq 0x82adc(%rip), %rdi     # 0x930b8
xorl %eax, %eax
callq 0xe070
movq (%r12), %rdi
callq 0xe540
cmpl $0x0, 0x24c(%rbx)
je 0x10650
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x829fa(%rip), %rdi     # 0x93004
movq %rax, %rsi
xorl %eax, %eax
callq 0x67b42
pushq $0x1
popq %rdi
callq 0xe570
leaq 0x82aa6(%rip), %rdi     # 0x930c9
callq 0xe720
xorl %edi, %edi
callq 0xe570
leaq 0x829eb(%rip), %rdi     # 0x93021
xorl %eax, %eax
callq 0x67b42
jmp 0x10650
leaq 0x829fd(%rip), %rdi     # 0x93043
movq %r14, %rsi
xorl %eax, %eax
callq 0x67b42
pushq $-0x1
jmp 0x10616
movq %rax, %r14
movl $0x250, %esi            # imm = 0x250
movq %rbx, %rdi
callq 0xe460
movq %r14, %rdi
callq 0xe810