// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, 0xb5f6(%rip)      # 0xdd10
andq $0x0, 0x13766(%rip)     # 0x15e88
andq $0x0, 0x13746(%rip)     # 0x15e70
andq $0x0, 0x13746(%rip)     # 0x15e78
andq $0x0, 0x136a6(%rip)     # 0x15de0
movq %rsi, %r15
andq $0x0, 0x136a3(%rip)     # 0x15de8
movslq %edi, %rcx
pushq $0x1
popq %rax
leaq 0x48be(%rip), %rdx      # 0x7010
cmpq %rcx, %rax
jge 0x27c9
movq (%r15,%rax,8), %rbx
cmpb $0x2d, (%rbx)
jne 0x27f5
leaq 0x1(%rbx), %rsi
movzbl (%rsi), %edi
leal -0x6d(%rdi), %r8d
cmpl $0xb, %r8d
ja 0x2787
movslq (%rdx,%r8,4), %rdi
addq %rdx, %rdi
jmpq *%rdi
movb $0x0, 0x94fd(%rip)      # 0xbc82
jmp 0x27b7
cmpl $0x64, %edi
jne 0x27bc
movb $0x1, 0x94f2(%rip)      # 0xbc85
jmp 0x27b7
movb $0x1, 0x94ea(%rip)      # 0xbc86
jmp 0x27b7
movb $0x1, 0x94de(%rip)      # 0xbc83
jmp 0x27b7
movb $0x1, 0x94d9(%rip)      # 0xbc87
jmp 0x27b7
movb $0x1, 0x94cd(%rip)      # 0xbc84
incq %rsi
jmp 0x2768
testl %edi, %edi
jne 0x298e
incq %rax
jmp 0x2752
movq 0x94b8(%rip), %rbx      # 0xbc88
testq %rbx, %rbx
jne 0x2802
movq 0x781c(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movq (%r15), %rdx
leaq 0x5011(%rip), %rsi      # 0x77fa
xorl %eax, %eax
callq 0x2120
jmp 0x2a41
movl %eax, 0x13695(%rip)     # 0x15e90
movq %rbx, 0x9486(%rip)      # 0xbc88
movq %rbx, %rdi
callq 0x20b0
cmpq $0x7c, %rax
jge 0x2a49
movq %rax, %r15
leaq -0x1(%rax), %r13
movq %r13, %rsi
movzbl (%rbx,%rsi), %ecx
movl %ecx, %edx
andb $-0x2, %dl
cmpb $0x2e, %dl
je 0x283b
testq %rsi, %rsi
js 0x283b
cmpb $0x5c, %cl
je 0x283b
decq %rsi
jmp 0x281e
cmpl $0x2f, %ecx
movq %rax, (%rsp)
je 0x284c
cmpl $0x5c, %ecx
je 0x284c
movq %rsi, %r15
leaq 0x1350d(%rip), %r12     # 0x15d60
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2040
xorl %ebp, %ebp
movb %bpl, (%r15,%r12)
cmpb %bpl, 0x9416(%rip)      # 0xbc84
leaq 0x4fc4(%rip), %rax      # 0x7839
leaq 0x4fb8(%rip), %r14      # 0x7834
cmoveq %rax, %r14
movq %r12, %rdi
callq 0x20b0
movl (%r14), %ecx
movl %ecx, (%rax,%r12)
movb 0x4(%r14), %cl
movb %cl, 0x4(%rax,%r12)
leaq 0x13551(%rip), %r12     # 0x15df0
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2040
movb %bpl, (%r15,%r12)
movq %r12, %rdi
callq 0x20b0
movb %bpl, 0x4(%rax,%r12)
movl $0x74736c2e, (%rax,%r12) # imm = 0x74736C2E
leaq 0xb3c3(%rip), %r12      # 0xdc90
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2040
movb %bpl, (%r15,%r12)
movq %r12, %rdi
callq 0x20b0
movb %bpl, 0x4(%rax,%r12)
movl $0x7272652e, (%rax,%r12) # imm = 0x7272652E
leaq 0x135a5(%rip), %r12     # 0x15ea0
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2040
movb %bpl, (%r15,%r12)
movq %r12, %rdi
callq 0x20b0
movb %bpl, 0x4(%rax,%r12)
movl $0x6d72702e, (%rax,%r12) # imm = 0x6D72702E
callq 0x2190
movq (%rax), %rax
movsbq (%rbx), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0x293b
movq (%rsp), %rax
jmp 0x2956
cmpb $0x3a, 0x1(%rbx)
movq (%rsp), %rax
jne 0x2956
cmpb $0x5c, 0x2(%rbx)
je 0x2956
movb $0x5c, 0x1(%rbx)
movq 0x9332(%rip), %rbx      # 0xbc88
addq %rax, %rbx
movb -0x1(%rbx), %al
cmpb $0x2f, %al
je 0x2971
testq %r13, %r13
js 0x2971
cmpb $0x5c, %al
je 0x2971
decq %r13
decq %rbx
jmp 0x2959
leaq 0x135a8(%rip), %rdi     # 0x15f20
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2070
movq 0x7663(%rip), %r12      # 0x9ff8
movq (%r12), %rdi
movq (%r15), %rdx
leaq 0x4d71(%rip), %rsi      # 0x7714
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2120
movq (%r12), %rcx
leaq 0x4d72(%rip), %rdi      # 0x772a
pushq $0x19
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x2180
movq (%r12), %rcx
leaq 0x4d73(%rip), %rdi      # 0x7744
pushq $0x1e
popq %r14
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r12), %rcx
leaq 0x4d78(%rip), %rdi      # 0x7763
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r12), %rcx
leaq 0x4d81(%rip), %rdi      # 0x7782
pushq $0x28
popq %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r12), %rcx
leaq 0x4d94(%rip), %rdi      # 0x77ab
pushq $0x26
popq %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r12), %rcx
leaq 0x4da5(%rip), %rdi      # 0x77d2
pushq $0x27
popq %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r12), %rdi
callq 0x2140
pushq $-0x1
popq %rdi
callq 0x2170
movq 0x75a8(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movq (%r15), %rdx
leaq 0x4dbb(%rip), %rsi      # 0x7818
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2120
jmp 0x2a41