// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, 0xe506(%rip) # 0x10dc0
movq $0x0, 0x16673(%rip) # 0x18f38
movq $0x0, 0x16650(%rip) # 0x18f20
movq $0x0, 0x1664d(%rip) # 0x18f28
movq $0x0, 0x165aa(%rip) # 0x18e90
movq $0x0, 0x165a7(%rip) # 0x18e98
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rax
movslq -0x4(%rbp), %rcx
cmpq %rcx, %rax
jge 0x2ae0
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2aae
movq $0x1, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x2aac
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl $-0x64, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x14, %eax
ja 0x29c5
movq -0x30(%rbp), %rax
leaq 0x7690(%rip), %rcx      # 0xa004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, 0xc3b1(%rip)      # 0xed35
jmp 0x2a99
movb $0x0, 0xc3a2(%rip)      # 0xed32
jmp 0x2a99
movb $0x1, 0xc398(%rip)      # 0xed34
jmp 0x2a99
movb $0x1, 0xc38b(%rip)      # 0xed33
jmp 0x2a99
movb $0x1, 0xc382(%rip)      # 0xed36
jmp 0x2a99
movb $0x1, 0xc377(%rip)      # 0xed37
jmp 0x2a99
movq 0xa62c(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x7cf3(%rip), %rsi      # 0xa6dc
movb $0x0, %al
callq 0x2110
movq 0xa601(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x7cf1(%rip), %rsi      # 0xa6f2
movb $0x0, %al
callq 0x2110
movq 0xa5e9(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x7cf3(%rip), %rsi      # 0xa70c
movb $0x0, %al
callq 0x2110
movq 0xa5d1(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x7cfa(%rip), %rsi      # 0xa72b
movb $0x0, %al
callq 0x2110
movq 0xa5b9(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x7d01(%rip), %rsi      # 0xa74a
movb $0x0, %al
callq 0x2110
movq 0xa5a1(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x7d12(%rip), %rsi      # 0xa773
movb $0x0, %al
callq 0x2110
movq 0xa589(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x7d21(%rip), %rsi      # 0xa79a
movb $0x0, %al
callq 0x2110
movq 0xa571(%rip), %rax      # 0xcff8
movq (%rax), %rdi
callq 0x2140
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2180
jmp 0x2a9b
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x292a
jmp 0x2acd
movq -0x20(%rbp), %rax
movl %eax, 0x16488(%rip)     # 0x18f40
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0xc26d(%rip)      # 0xed38
jmp 0x2ae0
jmp 0x2acf
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x28f9
cmpq $0x0, 0xc250(%rip)      # 0xed38
jne 0x2b13
movq 0xa507(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x7cc0(%rip), %rsi      # 0xa7c2
movb $0x0, %al
callq 0x2110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2180
movq 0xc21e(%rip), %rdi      # 0xed38
callq 0x20b0
movq %rax, -0x18(%rbp)
cmpq $0x7b, -0x18(%rbp)
jle 0x2b5a
movq 0xa4c7(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq 0xc1f6(%rip), %rcx      # 0xed38
leaq 0x7c97(%rip), %rsi      # 0xa7e0
movb $0x0, %al
callq 0x2110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2180
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x28(%rbp)
movq 0xc1cb(%rip), %rax      # 0xed38
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x2e, %ecx
movb %al, -0x31(%rbp)
je 0x2bbc
movq 0xc1b2(%rip), %rax      # 0xed38
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, -0x31(%rbp)
je 0x2bbc
movq 0xc199(%rip), %rax      # 0xed38
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x5c, %ecx
movb %al, -0x31(%rbp)
je 0x2bbc
cmpq $0x0, -0x28(%rbp)
setge %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x2bc5
jmp 0x2bd3
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2b66
movq 0xc15e(%rip), %rax      # 0xed38
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
subl $0x2e, %eax
je 0x2c00
jmp 0x2bec
movl -0x38(%rbp), %eax
subl $0x2f, %eax
je 0x2c02
jmp 0x2bf6
movl -0x38(%rbp), %eax
subl $0x5c, %eax
je 0x2c02
jmp 0x2c0c
jmp 0x2c0e
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x2c0e
jmp 0x2c0e
movq 0xc123(%rip), %rsi      # 0xed38
movq -0x28(%rbp), %rdx
leaq 0x161f0(%rip), %rdi     # 0x18e10
callq 0x2040
movq -0x28(%rbp), %rcx
leaq 0x161e0(%rip), %rax     # 0x18e10
movb $0x0, (%rax,%rcx)
movzbl 0xc0f9(%rip), %ecx      # 0xed34
leaq 0x7bbf(%rip), %rsi      # 0xa801
leaq 0x7bb3(%rip), %rax      # 0xa7fc
cmpl $0x0, %ecx
cmovneq %rax, %rsi
leaq 0x161b9(%rip), %rdi     # 0x18e10
callq 0x2160
movq 0xc0d5(%rip), %rsi      # 0xed38
movq -0x28(%rbp), %rdx
leaq 0x16232(%rip), %rdi     # 0x18ea0
callq 0x2040
movq -0x28(%rbp), %rcx
leaq 0x16222(%rip), %rax     # 0x18ea0
movb $0x0, (%rax,%rcx)
leaq 0x16217(%rip), %rdi     # 0x18ea0
leaq 0x7b76(%rip), %rsi      # 0xa806
callq 0x2160
movq 0xc09c(%rip), %rsi      # 0xed38
movq -0x28(%rbp), %rdx
leaq 0xe099(%rip), %rdi      # 0x10d40
callq 0x2040
movq -0x28(%rbp), %rcx
leaq 0xe089(%rip), %rax      # 0x10d40
movb $0x0, (%rax,%rcx)
leaq 0xe07e(%rip), %rdi      # 0x10d40
leaq 0x7b42(%rip), %rsi      # 0xa80b
callq 0x2160
movq 0xc063(%rip), %rsi      # 0xed38
movq -0x28(%rbp), %rdx
leaq 0x16270(%rip), %rdi     # 0x18f50
callq 0x2040
movq -0x28(%rbp), %rcx
leaq 0x16260(%rip), %rax     # 0x18f50
movb $0x0, (%rax,%rcx)
leaq 0x16255(%rip), %rdi     # 0x18f50
leaq 0x7b0e(%rip), %rsi      # 0xa810
callq 0x2160
callq 0x2190
movq (%rax), %rax
movq 0xc022(%rip), %rcx      # 0xed38
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x2d55
movq 0xc007(%rip), %rax      # 0xed38
movsbl 0x1(%rax), %eax
cmpl $0x3a, %eax
jne 0x2d55
movq 0xbff7(%rip), %rax      # 0xed38
movsbl 0x2(%rax), %eax
cmpl $0x5c, %eax
je 0x2d55
movq 0xbfe7(%rip), %rax      # 0xed38
movb $0x5c, 0x1(%rax)
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x28(%rbp)
movq 0xbfd0(%rip), %rax      # 0xed38
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, -0x39(%rbp)
je 0x2d9e
movq 0xbfb7(%rip), %rax      # 0xed38
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x5c, %ecx
movb %al, -0x39(%rbp)
je 0x2d9e
cmpq $0x0, -0x28(%rbp)
setge %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x2da7
jmp 0x2db5
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2d61
movq 0xbf7c(%rip), %rsi      # 0xed38
movq -0x28(%rbp), %rax
addq $0x1, %rax
addq %rax, %rsi
leaq 0x16202(%rip), %rdi     # 0x18fd0
callq 0x2070
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)