// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro1/macro1.c
// Function: getArgs
void getArgs( int argc, char *argv[] )
{
  WORD32  len;
  WORD32  ix, jx;

  /* Set the defaults */
  infile = NULL;
  listfile = NULL;
  listsave = NULL;
  objectfile = NULL;
  objectsave = NULL;

  for( ix = 1; ix < argc; )
  {
    if( argv[ix][0] == '-' )
    {
      char *switches = argv[ix++];
      for( jx = 1; switches[jx] != 0; jx++ )
      {
        switch( switches[jx] )
        {
        case 'd':
          symtab_print = TRUE;
          break;

        case 'r':
          rim_mode = TRUE;		/* punch pure rim-mode tapes */
          break;

	case 's':
	  sym_dump = TRUE;
	  break;

        case 'm':
          nomac_exp = FALSE;
          break;

        case 'p':
          print_permanent_symbols = TRUE;
          break;

        case 'x':
          xref = TRUE;
          break;

	case 'S':
	  if (ix <= argc)
	      read_symbols(argv[ix++]);
	  break;

        default:
          fprintf( stderr, "%s: unknown flag: %s\n", argv[0], argv[ix] );
          fprintf( stderr, " -d -- dump symbol table\n" );
          fprintf( stderr, " -m -- output macro expansions\n" );
          fprintf( stderr, " -p -- output permanent symbols to file\n" );
          fprintf( stderr, " -r -- output RIM format file\n" );
          fprintf( stderr, " -s -- output symbol punch tape to file\n" ); 
          fprintf( stderr, " -S file -- read symbol punch tape\n" );
	  fprintf( stderr, " -x -- output cross reference 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");

  strncpy( listpathname, pathname, jx );
  listpathname[jx] = '\0';
  strcat( listpathname, ".lst" );

  strncpy( permpathname, pathname, jx );
  permpathname[jx] = '\0';
  strcat( permpathname, ".prm" );

  strncpy( sympathname, pathname, jx );
  sympathname[jx] = '\0';
  strcat( sympathname, ".sym" );

  /* Extract the filename from the path. */
  if( isalpha( 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 %r12
pushq %rbx
andq $0x0, 0x77d2(%rip)      # 0x9ec0
andq $0x0, 0x77aa(%rip)      # 0x9ea0
andq $0x0, 0x77aa(%rip)      # 0x9ea8
andq $0x0, 0x770a(%rip)      # 0x9e10
andq $0x0, 0x770a(%rip)      # 0x9e18
movq %rsi, %r14
movl %edi, %ebp
pushq $0x1
popq %r15
leaq 0x38e6(%rip), %r12      # 0x6004
cmpl %ebp, %r15d
jge 0x2878
movslq %r15d, %rax
movq (%r14,%rax,8), %rbx
cmpb $0x2d, (%rbx)
jne 0x28a1
incl %r15d
incq %rbx
movzbl (%rbx), %ecx
leal -0x6d(%rcx), %edx
movslq %r15d, %rax
cmpl $0xb, %edx
ja 0x275d
movslq (%r12,%rdx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movb $0x0, 0x7606(%rip)      # 0x9d61
jmp 0x273a
cmpl $0x53, %ecx
je 0x2794
cmpl $0x64, %ecx
jne 0x27a7
movb $0x1, 0x75fa(%rip)      # 0x9d68
jmp 0x273a
movb $0x1, 0x75f2(%rip)      # 0x9d69
jmp 0x273a
movb $0x1, 0x75e3(%rip)      # 0x9d63
jmp 0x273a
movb $0x1, 0x75d7(%rip)      # 0x9d60
jmp 0x273a
movb $0x1, 0x75d0(%rip)      # 0x9d62
jmp 0x273a
cmpl %ebp, %r15d
jg 0x273a
incl %r15d
movq (%r14,%rax,8), %rdi
callq 0x324b
jmp 0x273a
testl %ecx, %ecx
je 0x271e
movq 0x6842(%rip), %r15      # 0x8ff8
movq (%r15), %rdi
movq (%r14), %rdx
movq (%r14,%rax,8), %rcx
leaq 0x3d84(%rip), %rsi      # 0x654b
xorl %eax, %eax
callq 0x2110
movq (%r15), %rcx
leaq 0x3d89(%rip), %rdi      # 0x6561
pushq $0x19
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x2180
movq (%r15), %rcx
leaq 0x3d8b(%rip), %rdi      # 0x657b
pushq $0x1f
popq %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r15), %rcx
leaq 0x3d96(%rip), %rdi      # 0x659b
pushq $0x28
popq %r14
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r15), %rcx
leaq 0x3da6(%rip), %rdi      # 0x65c4
pushq $0x1e
popq %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r15), %rcx
leaq 0x3db0(%rip), %rdi      # 0x65e3
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r15), %rcx
leaq 0x3dc4(%rip), %rdi      # 0x660c
pushq $0x23
popq %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r15), %rcx
leaq 0x3dd3(%rip), %rdi      # 0x6630
pushq $0x26
popq %rsi
movq %rbx, %rdx
callq 0x2180
movq (%r15), %rdi
callq 0x2130
pushq $-0x1
popq %rdi
callq 0x2170
movq 0x74f1(%rip), %rbx      # 0x9d70
testq %rbx, %rbx
jne 0x28af
movq 0x676d(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movq (%r14), %rdx
leaq 0x3dbf(%rip), %rsi      # 0x6657
xorl %eax, %eax
callq 0x2110
jmp 0x2870
movl %r15d, 0x7620(%rip)     # 0x9ec8
movq %rbx, 0x74c1(%rip)      # 0x9d70
movq %rbx, %rdi
callq 0x2090
cmpl $0x7c, %eax
jge 0x2a11
leal -0x1(%rax), %ecx
movslq %ecx, %r12
movq %r12, %rcx
movzbl (%rbx,%rcx), %edx
movl %edx, %esi
andb $-0x2, %sil
cmpb $0x2e, %sil
je 0x28e8
testq %rcx, %rcx
js 0x28e8
cmpb $0x5c, %dl
je 0x28e8
decq %rcx
jmp 0x28c9
cmpl $0x2f, %edx
je 0x28f5
cmpl $0x5c, %edx
je 0x28f5
movq %rcx, %rax
movslq %eax, %r14
leaq 0x7491(%rip), %r15      # 0x9d90
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
xorl %ebp, %ebp
movb %bpl, (%r14,%r15)
movq %r15, %rdi
callq 0x2090
movb %bpl, 0x4(%rax,%r15)
movl $0x6d69722e, (%rax,%r15) # imm = 0x6D69722E
leaq 0x74f1(%rip), %r15      # 0x9e20
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
movb %bpl, (%r14,%r15)
movq %r15, %rdi
callq 0x2090
movb %bpl, 0x4(%rax,%r15)
movl $0x74736c2e, (%rax,%r15) # imm = 0x74736C2E
leaq 0x7573(%rip), %r15      # 0x9ed0
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
movb %bpl, (%r14,%r15)
movq %r15, %rdi
callq 0x2090
movb %bpl, 0x4(%rax,%r15)
movl $0x6d72702e, (%rax,%r15) # imm = 0x6D72702E
leaq 0x75c5(%rip), %r15      # 0x9f50
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2040
movb %bpl, (%r14,%r15)
movq %r15, %rdi
callq 0x2090
movb %bpl, 0x4(%rax,%r15)
movl $0x6d79732e, (%rax,%r15) # imm = 0x6D79732E
callq 0x21b0
movq (%rax), %rax
movsbq (%rbx), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
je 0x29dc
cmpb $0x3a, 0x1(%rbx)
jne 0x29dc
cmpb $0x5c, 0x2(%rbx)
je 0x29dc
movb $0x5c, 0x1(%rbx)
movq 0x7394(%rip), %rbx      # 0x9d70
leaq (%r12,%rbx), %rcx
incq %rcx
movq %rcx, %rsi
movb -0x1(%rcx), %al
cmpb $0x2f, %al
je 0x29fd
testq %r12, %r12
js 0x29fd
decq %r12
leaq -0x1(%rsi), %rcx
cmpb $0x5c, %al
jne 0x29e3
leaq 0x75cc(%rip), %rdi      # 0x9fd0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2070
movq 0x65e0(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movq (%r14), %rdx
leaq 0x3c50(%rip), %rsi      # 0x6675
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2110
jmp 0x2870