// File: /workspace/github_c_makefile_star2_O1/AK6DN[P]dec-utilities-for-pdp/macro8x/macro8x.c
// Function: getArgs
void getArgs( int argc, char *argv[] )
{
  WORD32  len;
  WORD32  ix, jx;

  /* Set the defaults                                                         */
  errorfile = NULL;
  infile = NULL;
  listfile = NULL;
  listsave = NULL;
  objectfile = NULL;
  objectsave = NULL;

  for( ix = 1; ix < argc; ix++ )
  {
    if( argv[ix][0] == '-' )
    {
      for( jx = 1; argv[ix][jx] != 0; jx++ )
      {
        switch( argv[ix][jx] )
        {
        case 'd':
          symtab_print = TRUE;
          break;

        case 'm':
          nomac_exp = FALSE;
          break;

        case 'r':
          rim_mode = TRUE;
          break;

        case 'p':
          print_permanent_symbols = TRUE;
          break;

        case 'x':
          xref = TRUE;
          break;

        case 'u':
          memmap = TRUE;
          break;

        default:
          fprintf( stderr, "%s: unknown flag: %s\n", argv[0], argv[ix] );
          fprintf( stderr, " -d -- dump symbol table\n" );
          fprintf( stderr, " -m -- print macro expansions\n" );
          fprintf( stderr, " -r -- output rim format file\n" );
          fprintf( stderr, " -p -- output permanent symbols to file\n" );
          fprintf( stderr, " -x -- output cross reference to file\n" );
          fprintf( stderr, " -u -- output memory usage map to file\n" );
          fflush( stderr );
          exit( -1 );
        } /* end switch                                                       */
      } /* end for                                                            */
    }
    else
    {
      filix_start = ix;
      pathname = argv[ix];
      break;
    }
  } /* end for                                                                */

  if( pathname == NULL )
  {
    fprintf( stderr, "%s:  no input file specified\n", argv[0] );
    exit( -1 );
  }

  len = strlen( pathname );
  if( len > NAMELEN - 5 )
  {
    fprintf( stderr, "%s: pathname \"%s\" too long\n", argv[0], pathname );
    exit( -1 );
  }

  /* Now make the pathnames                                                   */
  /* Find last '.', if it exists.                                             */
  jx = len - 1;
  while( pathname[jx] != '.'  && pathname[jx] != '/'
      && pathname[jx] != '\\' && jx >= 0 )
  {
    jx--;
  }

  switch( pathname[jx] )
  {
  case '.':
    break;

  case '/':
  case '\\':
    jx = len;
    break;

  default:
    break;
  }

  /* Add the pathname extensions.                                             */
  strncpy( objectpathname, pathname, jx );
  objectpathname[jx] = '\0';
  strcat( objectpathname, rim_mode ? ".rim" : ".bin" );

  strncpy( listpathname, pathname, jx );
  listpathname[jx] = '\0';
  strcat( listpathname, ".lst" );

  strncpy( errorpathname, pathname, jx );
  errorpathname[jx] = '\0';
  strcat( errorpathname, ".err" );

  strncpy( permpathname, pathname, jx );
  permpathname[jx] = '\0';
  strcat( permpathname, ".prm" );

  /* Extract the filename from the path.                                      */
  if( is_alpha( pathname[0] ) && pathname[1] == ':' && pathname[2] != '\\' )
  {
    pathname[1] = '\\';         /* MS-DOS style pathname                      */
  }

  jx = len - 1;
  while( pathname[jx] != '/' && pathname[jx] != '\\' && jx >= 0 )
  {
    jx--;
  }
  strcpy( filename, &pathname[jx + 1] );

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
xorl %eax, %eax
movq %rax, 0xb453(%rip)      # 0xdd20
movq %rax, 0x135c4(%rip)     # 0x15e98
movq %rax, 0x135a5(%rip)     # 0x15e80
movq %rax, 0x135a6(%rip)     # 0x15e88
movq %rax, 0x13507(%rip)     # 0x15df0
movq %rax, 0x13508(%rip)     # 0x15df8
cmpl $0x2, %edi
jl 0x2992
movslq %edi, %rcx
movl $0x1, %eax
leaq 0x4708(%rip), %rdx      # 0x7010
movq (%r14,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x2985
movl $0x1, %edi
movq (%r14,%rax,8), %rsi
movzbl (%rsi,%rdi), %r8d
leal -0x6d(%r8), %r9d
cmpl $0xb, %r9d
ja 0x293c
movslq (%rdx,%r9,4), %r8
addq %rdx, %r8
jmpq *%r8
movb $0x0, 0x9358(%rip)      # 0xbc92
jmp 0x296d
cmpl $0x64, %r8d
jne 0x2972
movb $0x1, 0x934c(%rip)      # 0xbc95
jmp 0x296d
movb $0x1, 0x9344(%rip)      # 0xbc96
jmp 0x296d
movb $0x1, 0x9338(%rip)      # 0xbc93
jmp 0x296d
movb $0x1, 0x9333(%rip)      # 0xbc97
jmp 0x296d
movb $0x1, 0x9327(%rip)      # 0xbc94
incq %rdi
jmp 0x2916
testl %r8d, %r8d
jne 0x2b33
incq %rax
cmpq %rcx, %rax
jne 0x2908
jmp 0x2992
movl %eax, 0x13515(%rip)     # 0x15ea0
movq %rsi, 0x9306(%rip)      # 0xbc98
movq 0x92ff(%rip), %rbx      # 0xbc98
testq %rbx, %rbx
je 0x2b3b
movq %rbx, %rdi
callq 0x20b0
cmpq $0x7c, %rax
jge 0x2b43
movq %rax, %r12
decq %r12
movb -0x1(%rbx,%rax), %cl
movl %ecx, %edx
andb $-0x2, %dl
movq %r12, %r14
cmpb $0x2e, %dl
je 0x29e4
testq %r14, %r14
js 0x29e4
cmpb $0x5c, %cl
je 0x29e4
movb -0x1(%rbx,%r14), %cl
decq %r14
movl %ecx, %edx
andb $-0x2, %dl
jmp 0x29c6
cmpb $0x5c, %cl
je 0x29f1
movzbl %cl, %ecx
cmpl $0x2f, %ecx
jne 0x29f4
movq %rax, %r14
leaq 0x13375(%rip), %r15     # 0x15d70
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
xorl %ebp, %ebp
movb %bpl, (%r14,%r15)
cmpb %bpl, 0x927e(%rip)      # 0xbc94
leaq 0x4df0(%rip), %rax      # 0x780d
leaq 0x4de4(%rip), %r13      # 0x7808
cmoveq %rax, %r13
movq %r15, %rdi
callq 0x20b0
movl (%r13), %ecx
movl %ecx, (%rax,%r15)
movb 0x4(%r13), %cl
movb %cl, 0x4(%rax,%r15)
leaq 0x133b8(%rip), %r15     # 0x15e00
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
movb %bpl, (%r14,%r15)
movq %r15, %rdi
callq 0x20b0
movb %bpl, 0x4(%rax,%r15)
movl $0x74736c2e, (%rax,%r15) # imm = 0x74736C2E
leaq 0xb22a(%rip), %r15      # 0xdca0
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
movb %bpl, (%r14,%r15)
movq %r15, %rdi
callq 0x20b0
movb %bpl, 0x4(%rax,%r15)
movl $0x7272652e, (%rax,%r15) # imm = 0x7272652E
leaq 0x1340c(%rip), %r15     # 0x15eb0
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
movb %bpl, (%r14,%r15)
movq %r15, %rdi
callq 0x20b0
movb %bpl, 0x4(%rax,%r15)
movl $0x6d72702e, (%rax,%r15) # imm = 0x6D72702E
callq 0x21a0
movq (%rax), %rax
movsbq (%rbx), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
je 0x2aee
cmpb $0x3a, 0x1(%rbx)
jne 0x2aee
cmpb $0x5c, 0x2(%rbx)
je 0x2aee
movb $0x5c, 0x1(%rbx)
movq 0x91a3(%rip), %rax      # 0xbc98
movb (%rax,%r12), %cl
cmpb $0x2f, %cl
je 0x2b12
testq %r12, %r12
js 0x2b12
cmpb $0x5c, %cl
je 0x2b12
movb -0x1(%rax,%r12), %cl
decq %r12
jmp 0x2af9
leaq (%rax,%r12), %rsi
incq %rsi
leaq 0x13410(%rip), %rdi     # 0x15f30
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2070
movq %r14, %rdi
callq 0x22d4
movq %r14, %rdi
callq 0x22ad
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2283