// File: /workspace/github_c_makefile_star2_O3/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, 0xc450(%rip)      # 0xed20
movq %rax, 0x145c1(%rip)     # 0x16e98
movq %rax, 0x145a2(%rip)     # 0x16e80
movq %rax, 0x145a3(%rip)     # 0x16e88
movq %rax, 0x14504(%rip)     # 0x16df0
movq %rax, 0x14505(%rip)     # 0x16df8
cmpl $0x2, %edi
jl 0x297c
movslq %edi, %rcx
movl $0x1, %eax
leaq 0x5705(%rip), %rdx      # 0x8010
movq (%r14,%rax,8), %rbx
cmpb $0x2d, (%rbx)
jne 0x2990
leaq 0x1(%rbx), %rsi
movzbl (%rsi), %edi
leal -0x6d(%rdi), %r8d
cmpl $0xb, %r8d
ja 0x2937
movslq (%rdx,%r8,4), %rdi
addq %rdx, %rdi
jmpq *%rdi
movb $0x0, 0xa35d(%rip)      # 0xcc92
jmp 0x2967
cmpl $0x64, %edi
jne 0x296c
movb $0x1, 0xa352(%rip)      # 0xcc95
jmp 0x2967
movb $0x1, 0xa34a(%rip)      # 0xcc96
jmp 0x2967
movb $0x1, 0xa33e(%rip)      # 0xcc93
jmp 0x2967
movb $0x1, 0xa339(%rip)      # 0xcc97
jmp 0x2967
movb $0x1, 0xa32d(%rip)      # 0xcc94
incq %rsi
jmp 0x2918
testl %edi, %edi
jne 0x2b2c
incq %rax
cmpq %rcx, %rax
jne 0x290b
movq 0xa315(%rip), %rbx      # 0xcc98
testq %rbx, %rbx
jne 0x299d
movq %r14, %rdi
callq 0x22ad
movl %eax, 0x1450a(%rip)     # 0x16ea0
movq %rbx, 0xa2fb(%rip)      # 0xcc98
movq %rbx, %rdi
callq 0x20b0
cmpq $0x7c, %rax
jge 0x2b37
movq %rax, %r12
decq %r12
movb -0x1(%rbx,%rax), %cl
movl %ecx, %edx
andb $-0x2, %dl
movq %r12, %r14
cmpb $0x2e, %dl
je 0x29df
testq %r14, %r14
js 0x29df
cmpb $0x5c, %cl
je 0x29df
movb -0x1(%rbx,%r14), %cl
decq %r14
movl %ecx, %edx
andb $-0x2, %dl
jmp 0x29c1
cmpb $0x5c, %cl
je 0x29ec
movzbl %cl, %ecx
cmpl $0x2f, %ecx
jne 0x29ef
movq %rax, %r14
leaq 0x1437a(%rip), %r15     # 0x16d70
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
xorl %ebp, %ebp
movb %bpl, (%r14,%r15)
cmpb %bpl, 0xa283(%rip)      # 0xcc94
leaq 0x5e51(%rip), %rax      # 0x8869
leaq 0x5e45(%rip), %r13      # 0x8864
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 0x143bd(%rip), %r15     # 0x16e00
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 0xc22f(%rip), %r15      # 0xeca0
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 0x14411(%rip), %r15     # 0x16eb0
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 0x2af0
cmpb $0x3a, 0x1(%rbx)
jne 0x2af0
cmpb $0x5c, 0x2(%rbx)
je 0x2af0
movb $0x5c, 0x1(%rbx)
movq 0xa1a8(%rip), %rbx      # 0xcc98
movb (%rbx,%r12), %al
cmpb $0x2f, %al
je 0x2b0b
testq %r12, %r12
js 0x2b0b
cmpb $0x5c, %al
je 0x2b0b
movb -0x1(%rbx,%r12), %al
decq %r12
jmp 0x2af4
leaq (%rbx,%r12), %rsi
incq %rsi
leaq 0x14417(%rip), %rdi     # 0x16f30
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2070
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22d4
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2283