// File: /workspace/github_c_makefile_star2_O0/AK6DN[P]dec-utilities-for-pdp/macro8x/macro8x.c
// Function: onePass
void onePass()
{
  BOOL    blanks;
  int     ix;
  int     jx;
  char    name[SYMLEN];
  WORD32  newclc;
  BOOL    scanning_line;
  WORD32  start;
  SYM_T  *sym;
  WORD32  term;
  WORD32  val;

  clc = 0200;                   /* Default starting address is 200 octal.     */
  field = 0;
  fieldlc = 0200;
  reloc = 0;
  for( ix = 0; ix < TOTAL_PAGES; ix++ )
  {
    lit_loc[ix] = lit_base[ix] = 00200;
  }
  mac_count = 0;               /* No macros defined.                          */
  mac_ptr = NULL;              /* Not in a macro.                             */
  for( ix = 0; ix < MAC_TABLE_LENGTH; ix++)
  {
    if ( mac_bodies[ix] )
    {
      free( mac_bodies[ix] );
    }
  }
  cp.error = FALSE;
  pz.error = FALSE;
  listed = TRUE;
  lgm_flag = TRUE;
  lineno = 0;
  list_pageno = 0;
  list_lineno = 0;
  list_title_set = FALSE;
  page_lineno = LIST_LINES_PER_PAGE;    /* Force top of page for new titles.  */
  radix = 8;                    /* Initial radix is octal (base 8).           */

  /* Now open the first input file.                                           */
  filix_curr = filix_start;     /* Initialize pointer to input files.         */
  if(( infile = fopen( save_argv[filix_curr], "r" )) == NULL )
  {
    fprintf( stderr, "%s: cannot open \"%s\"\n", save_argv[0], save_argv[filix_curr] );
    exit( -1 );
  }

  while( TRUE )
  {
    readLine();
    nextLexeme();

    scanning_line = TRUE;
    while( scanning_line )
    {
      if( is_end( line[lexstart] ))
      {
        scanning_line = FALSE;
      }
      else
      {
        switch( line[lexstart] )
        {
        case '/':
          scanning_line = FALSE;
          break;

        case ';':
          nextLexeme();
          break;

        case '$':
          endOfBinary();
          fclose( infile );
          return;

        case '*':
          nextLexeme();             /* Skip '*', (set origin symbol)          */
          newclc = ((getExpr())->val & 07777 ) | field;
          /* Do not change Current Location Counter if an error occurred.     */
          if( !error_in_line )
          {
            if(( newclc & 07600 ) != ( clc & 07600 ))
            {
              /* Current page has changed.                                    */
              punchLiteralPool( &cp, clc - 1 );
            }
            clc = newclc - reloc;
            fieldlc = clc & 07777;

            if( !rim_mode )
            {
              /* Not rim mode, put out origin.                                */
              punchOrigin( clc );
            }
            printLine( line, 0, fieldlc, LINE_VAL );
          }
          break;

        default:
          switch( line[lexterm] )
          {
          case ',':
            if( is_alpha( line[lexstart] ))
            {
              /* Use lookup so symbol will not be counted as reference.       */
              sym = lookup( lexemeToName( name, lexstart, lexterm ));
              if( M_DEFINED( sym->type ))
              {
                if( sym->val != (clc & 07777) && pass == 2 )
                {
                  errorSymbol( &duplicate_label, sym->name, lexstart );
                }
                sym->type = sym->type | DUPLICATE;
              }
              /* Must call define on pass 2 to generate concordance.          */
              defineLexeme( lexstart, lexterm, ( clc+reloc ), LABEL );
            }
            else
            {
              errorLexeme( &label_syntax, lexstart );
            }
            nextLexeme();           /* skip label                             */
            nextLexeme();           /* skip comma                             */
            break;

          case '=':
            if( is_alpha( line[lexstart] ))
            {
              start = lexstart;
              term = lexterm;
              delimiter = line[lexterm];
              nextLexBlank();       /* skip symbol                            */
              nextLexeme();       /* skip trailing =                        */
              val = getExprs();
              defineLexeme( start, term, val, DEFINED );
              printLine( line, 0, val, LINE_VAL );
            }
            else
            {
              errorLexeme( &symbol_syntax, lexstartprev );
              nextLexeme();         /* skip symbol                            */
              nextLexeme();         /* skip trailing =                        */
              getExprs();           /* skip expression                        */
            }
            break;

          default:
            if( is_alpha( line[lexstart] ))
            {
              sym = evalSymbol();
              val = sym->val;
              if( M_MACRO( sym->type ))
              {                     /* Find arguments.                       */
                blanks = TRUE;      /* Expecting blanks.                     */
                for( jx = 0; !is_done( line[cc] ) && ( jx < MAC_MAX_ARGS ); cc++ )
                {
                  if(( line[cc] == ',' ) || is_blank( line[cc] )) blanks = TRUE;
                  else if( blanks )
                  {
                     mac_arg_pos[jx++] = cc;
                     blanks = FALSE;
                  }
                } /* end for                                                 */                
                for( ; jx < MAC_MAX_ARGS; jx++ )
                {
                  mac_arg_pos[jx] = 0;
                }
                for( jx = 0; jx < LINELEN; jx++ )
                {
                  mac_line[jx] = line[jx];
                }
                mac_cc = cc;       /* Save line and position in line.        */
                mac_ptr = mac_bodies[val];
                if( mac_ptr ) scanning_line = FALSE;
                else nextLexeme();
              } /* end if macro                                              */
              else if( M_PSEUDO( sym->type ))
              {
                nextLexeme();         /* Skip symbol                          */
                scanning_line = pseudoOperators( (PSEUDO_T)val & 07777 );
              }
              else
              {
                /* Identifier is not a pseudo-op, interpret as load value     */
                punchOutObject( clc, getExprs() & 07777 );
                incrementClc();
              }
            }
            else
            {
              /* Identifier is a value, interpret as load value               */
              punchOutObject( clc, getExprs() & 07777 );
              incrementClc();
            }
            break;
          } /* end switch                                                     */
          break;
        } /* end switch                                                       */
      } /* end if                                                             */
    } /* end while( scanning_line )                                           */
  } /* end while( TRUE )                                                      */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq $0x80, 0x160cd(%rip) # 0x19050
movq $0x0, 0x160ca(%rip) # 0x19058
movq $0x80, 0x160c7(%rip) # 0x19060
movq $0x0, 0x160c4(%rip) # 0x19068
movl $0x0, -0x8(%rbp)
cmpl $0x100, -0x8(%rbp)      # imm = 0x100
jge 0x2fe5
movslq -0x8(%rbp), %rcx
leaq 0x160b1(%rip), %rax     # 0x19070
movq $0x80, (%rax,%rcx,8)
movslq -0x8(%rbp), %rcx
leaq 0x1689e(%rip), %rax     # 0x19870
movq $0x80, (%rax,%rcx,8)
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2fab
movq $0x0, 0x17080(%rip) # 0x1a070
movq $0x0, 0x1707d(%rip) # 0x1a078
movl $0x0, -0x8(%rbp)
cmpl $0x400, -0x8(%rbp)      # imm = 0x400
jge 0x303e
movslq -0x8(%rbp), %rcx
leaq 0xbd2a(%rip), %rax      # 0xed40
cmpq $0x0, (%rax,%rcx,8)
je 0x3031
movslq -0x8(%rbp), %rcx
leaq 0xbd18(%rip), %rax      # 0xed40
movq (%rax,%rcx,8), %rdi
callq 0x2030
jmp 0x3033
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x3002
movq $0x0, 0x17037(%rip) # 0x1a080
movq $0x0, 0x17434(%rip) # 0x1a488
movq $0x1, 0x17831(%rip) # 0x1a890
movb $0x1, 0x17832(%rip)     # 0x1a898
movl $0x0, 0x1782c(%rip)     # 0x1a89c
movl $0x0, 0x17826(%rip)     # 0x1a8a0
movl $0x0, 0x17820(%rip)     # 0x1a8a4
movb $0x0, 0x1781d(%rip)     # 0x1a8a8
movl $0x3c, 0x17817(%rip)    # 0x1a8ac
movq $0x8, 0x17810(%rip) # 0x1a8b0
movl 0x15e9a(%rip), %eax     # 0x18f40
movl %eax, 0x1780c(%rip)     # 0x1a8b8
movq 0xbc75(%rip), %rax      # 0xed28
movslq 0x177fe(%rip), %rcx     # 0x1a8b8
movq (%rax,%rcx,8), %rdi
leaq 0x717f(%rip), %rsi      # 0xa244
callq 0x2150
movq %rax, 0x15e67(%rip)     # 0x18f38
cmpq $0x0, %rax
jne 0x3115
movq 0x9f1a(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq 0xbc40(%rip), %rax      # 0xed28
movq (%rax), %rdx
movq 0xbc36(%rip), %rax      # 0xed28
movslq 0x177bf(%rip), %rcx     # 0x1a8b8
movq (%rax,%rcx,8), %rcx
leaq 0x7711(%rip), %rsi      # 0xa815
movb $0x0, %al
callq 0x2110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2180
jmp 0x3117
callq 0x4010
callq 0x4550
movb $0x1, -0x21(%rbp)
cmpb $0x0, -0x21(%rbp)
je 0x3736
movq 0x17b72(%rip), %rcx     # 0x1aca8
leaq 0x17783(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x315d
movq 0x17b5b(%rip), %rcx     # 0x1aca8
leaq 0x1776c(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x3166
movb $0x0, -0x21(%rbp)
jmp 0x3731
movq 0x17b3b(%rip), %rax     # 0x1aca8
leaq 0x1774c(%rip), %rcx     # 0x1a8c0
movsbl (%rax,%rcx), %eax
addl $-0x24, %eax
movl %eax, %ecx
movq %rcx, -0x50(%rbp)
subl $0x17, %eax
ja 0x3284
movq -0x50(%rbp), %rax
leaq 0x6ec3(%rip), %rcx      # 0xa058
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, -0x21(%rbp)
jmp 0x372f
callq 0x4550
jmp 0x372f
callq 0x4770
movq 0x15d7b(%rip), %rdi     # 0x18f38
callq 0x20a0
addq $0x70, %rsp
popq %rbp
retq
callq 0x4550
callq 0x47b0
movq 0x10(%rax), %rax
andq $0xfff, %rax            # imm = 0xFFF
orq 0x15e75(%rip), %rax     # 0x19058
movq %rax, -0x20(%rbp)
cmpb $0x0, 0x17ac2(%rip)     # 0x1acb0
jne 0x327f
movq -0x20(%rbp), %rax
andq $0xf80, %rax            # imm = 0xF80
movq 0x15e4b(%rip), %rcx     # 0x19050
andq $0xf80, %rcx            # imm = 0xF80
cmpq %rcx, %rax
je 0x3228
movq 0x15e38(%rip), %rsi     # 0x19050
subq $0x1, %rsi
leaq 0x16e5d(%rip), %rdi     # 0x1a080
callq 0x4ae0
movq -0x20(%rbp), %rax
subq 0x15e35(%rip), %rax     # 0x19068
movq %rax, 0x15e16(%rip)     # 0x19050
movq 0x15e0f(%rip), %rax     # 0x19050
andq $0xfff, %rax            # imm = 0xFFF
movq %rax, 0x15e12(%rip)     # 0x19060
cmpb $0x0, 0xbadf(%rip)      # 0xed34
jne 0x3263
movq 0x15df2(%rip), %rdi     # 0x19050
callq 0x4c20
movq 0x15df6(%rip), %rdx     # 0x19060
leaq 0x1764f(%rip), %rdi     # 0x1a8c0
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %ecx
callq 0x4c60
jmp 0x372f
movq 0x17a2d(%rip), %rax     # 0x1acb8
leaq 0x1762e(%rip), %rcx     # 0x1a8c0
movsbl (%rax,%rcx), %eax
movl %eax, -0x54(%rbp)
subl $0x2c, %eax
je 0x32b1
jmp 0x32a0
movl -0x54(%rbp), %eax
subl $0x3d, %eax
je 0x33aa
jmp 0x346d
callq 0x2190
movq (%rax), %rax
movq 0x179e8(%rip), %rdx     # 0x1aca8
leaq 0x175f9(%rip), %rcx     # 0x1a8c0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x3388
leaq -0x13(%rbp), %rdi
movq 0x179bd(%rip), %rsi     # 0x1aca8
movq 0x179c6(%rip), %rdx     # 0x1acb8
callq 0x5090
movq %rax, %rdi
callq 0x4ee0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x3360
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x15d30(%rip), %rcx     # 0x19050
andq $0xfff, %rcx            # imm = 0xFFF
cmpq %rcx, %rax
je 0x3351
cmpq $0x2, 0xda9c(%rip)      # 0x10dd0
jne 0x3351
movq -0x38(%rbp), %rsi
addq $0x4, %rsi
movq 0x17963(%rip), %rdx     # 0x1aca8
leaq 0xb624(%rip), %rdi      # 0xe970
callq 0x5140
movq -0x38(%rbp), %rax
movl (%rax), %ecx
orl $0x21, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq 0x17941(%rip), %rdi     # 0x1aca8
movq 0x1794a(%rip), %rsi     # 0x1acb8
movq 0x15cdb(%rip), %rdx     # 0x19050
addq 0x15cec(%rip), %rdx     # 0x19068
movl $0x9, %ecx
callq 0x5210
jmp 0x339b
movq 0x17919(%rip), %rsi     # 0x1aca8
leaq 0xb61a(%rip), %rdi      # 0xe9b0
callq 0x5260
callq 0x4550
callq 0x4550
jmp 0x372d
callq 0x2190
movq (%rax), %rax
movq 0x178ef(%rip), %rdx     # 0x1aca8
leaq 0x17500(%rip), %rcx     # 0x1a8c0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x3446
movq 0x178cc(%rip), %rax     # 0x1aca8
movq %rax, -0x30(%rbp)
movq 0x178d1(%rip), %rax     # 0x1acb8
movq %rax, -0x40(%rbp)
movq 0x178c6(%rip), %rcx     # 0x1acb8
leaq 0x174c7(%rip), %rax     # 0x1a8c0
movb (%rax,%rcx), %al
movb %al, 0x178be(%rip)      # 0x1acc0
callq 0x52b0
callq 0x4550
callq 0x5320
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movl $0x1, %ecx
callq 0x5210
movq -0x48(%rbp), %rdx
leaq 0x1748a(%rip), %rdi     # 0x1a8c0
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %ecx
callq 0x4c60
jmp 0x3468
movq 0x1787b(%rip), %rsi     # 0x1acc8
leaq 0xb58c(%rip), %rdi      # 0xe9e0
callq 0x5260
callq 0x4550
callq 0x4550
callq 0x5320
jmp 0x372d
callq 0x2190
movq (%rax), %rax
movq 0x1782c(%rip), %rdx     # 0x1aca8
leaq 0x1743d(%rip), %rcx     # 0x1a8c0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x3703
callq 0x5560
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
andl $0x101, %eax            # imm = 0x101
cmpl $0x101, %eax            # imm = 0x101
jne 0x36ae
movb $0x1, -0x1(%rbp)
movl $0x0, -0xc(%rbp)
movq 0x177f7(%rip), %rcx     # 0x1acd0
leaq 0x173e0(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, -0x55(%rbp)
je 0x354c
movq 0x177db(%rip), %rcx     # 0x1acd0
leaq 0x173c4(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x55(%rbp)
je 0x354c
movq 0x177bf(%rip), %rcx     # 0x1acd0
leaq 0x173a8(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x55(%rbp)
je 0x354c
movq 0x177a3(%rip), %rcx     # 0x1acd0
leaq 0x1738c(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x3b, %ecx
movb %al, -0x55(%rbp)
je 0x354c
cmpl $0x14, -0xc(%rbp)
setl %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x3558
jmp 0x3617
movq 0x17771(%rip), %rcx     # 0x1acd0
leaq 0x1735a(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0x2c, %eax
je 0x35cb
movq 0x1775a(%rip), %rcx     # 0x1acd0
leaq 0x17343(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x35cb
movq 0x17743(%rip), %rcx     # 0x1acd0
leaq 0x1732c(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
je 0x35cb
movq 0x1772c(%rip), %rcx     # 0x1acd0
leaq 0x17315(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0xc, %eax
je 0x35cb
movq 0x17715(%rip), %rcx     # 0x1acd0
leaq 0x172fe(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0x3e, %eax
jne 0x35d1
movb $0x1, -0x1(%rbp)
jmp 0x35fe
cmpb $0x0, -0x1(%rbp)
je 0x35fc
movq 0x176f2(%rip), %rax     # 0x1acd0
movl %eax, %edx
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc(%rbp)
movslq %eax, %rcx
leaq 0xb69b(%rip), %rax      # 0xec90
movl %edx, (%rax,%rcx,4)
movb $0x0, -0x1(%rbp)
jmp 0x35fe
jmp 0x3600
movq 0x176c9(%rip), %rax     # 0x1acd0
addq $0x1, %rax
movq %rax, 0x176be(%rip)     # 0x1acd0
jmp 0x34d2
jmp 0x3619
cmpl $0x14, -0xc(%rbp)
jge 0x363c
movslq -0xc(%rbp), %rcx
leaq 0xb666(%rip), %rax      # 0xec90
movl $0x0, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3619
movl $0x0, -0xc(%rbp)
cmpl $0xfa, -0xc(%rbp)
jge 0x3673
movslq -0xc(%rbp), %rcx
leaq 0x17269(%rip), %rax     # 0x1a8c0
movb (%rax,%rcx), %dl
movslq -0xc(%rbp), %rcx
leaq 0x1767b(%rip), %rax     # 0x1ace0
movb %dl, (%rax,%rcx)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3643
movq 0x17656(%rip), %rax     # 0x1acd0
movq %rax, 0x17a47(%rip)     # 0x1b0c8
movq -0x48(%rbp), %rcx
leaq 0xb6b4(%rip), %rax      # 0xed40
movq (%rax,%rcx,8), %rax
movq %rax, 0x169e1(%rip)     # 0x1a078
cmpq $0x0, 0x169d9(%rip)     # 0x1a078
je 0x36a7
movb $0x0, -0x21(%rbp)
jmp 0x36ac
callq 0x4550
jmp 0x3701
movq -0x38(%rbp), %rax
movl (%rax), %eax
andl $0x43, %eax
cmpl $0x43, %eax
jne 0x36d7
callq 0x4550
movq -0x48(%rbp), %rax
movl %eax, %edi
andl $0xfff, %edi            # imm = 0xFFF
callq 0x55e0
movb %al, -0x21(%rbp)
jmp 0x36ff
movq 0x15972(%rip), %rax     # 0x19050
movq %rax, -0x60(%rbp)
callq 0x5320
movq -0x60(%rbp), %rdi
movq %rax, %rsi
andq $0xfff, %rsi            # imm = 0xFFF
callq 0x6e90
callq 0x6ee0
jmp 0x3701
jmp 0x372b
movq 0x15946(%rip), %rax     # 0x19050
movq %rax, -0x68(%rbp)
callq 0x5320
movq -0x68(%rbp), %rdi
movq %rax, %rsi
andq $0xfff, %rsi            # imm = 0xFFF
callq 0x6e90
callq 0x6ee0
jmp 0x372d
jmp 0x372f
jmp 0x3731
jmp 0x3125
jmp 0x3117
nopl (%rax,%rax)