// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro7/macro7.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 = 0100;                  /* Default starting address is 100 octal.     */
  start_addr = 0100;           /* No starting address.                       */
  lit_loc = LIT_BASE;          /* Literal pool base.                         */
  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;
  listed = 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.                                           */
  end_of_input = FALSE;
  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( end_of_input )
      {
        endOfBinary();
        fclose( infile );
        return;
      }
      if( isend( line[lexstart] ))
      {
        scanning_line = FALSE;
      }
      else
      {
        switch( line[lexstart] )
        {
        case '/':
          scanning_line = FALSE;
          break;

        case '\t':
          nextLexeme();
          break;

        default:
          for( jx = lexstart; jx < maxcc; jx++ )
          {
            if( is_blank( line[jx] ) || isdone( line[jx] )) break;
          }
          if( line[jx] == '/')
          {
            newclc = (getExpr())->val & 077777;
            /* Do not change Current Location Counter if an error occurred.   */
            if( !error_in_line )
            {
              clc = newclc;
            }
            printLine( line, 0, newclc, LINE_VAL );
            cc = jx + 1;
            nextLexeme();
            while( line[lexstart] == '\t' ) nextLexeme();
            break;
          }

          switch( line[lexterm] )
          {
          case ',':
            if( isalpha( 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 && 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, LABEL );
            }
            else
            {
              errorLexeme( &label_syntax, lexstart );
            }
            nextLexeme();           /* skip label                             */
            nextLexeme();           /* skip comma                             */
            while( line[lexstart] == '\t' ) nextLexeme();
            break;

          case '=':
            if( isalpha( 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                        */
            }
            while( line[lexstart] == '\t' ) nextLexeme();
            break;

          default:
            if( isalpha( line[lexstart] ))
            {
              sym = evalSymbol();
              val = sym->val;
              if( M_MACRO( sym->type ))
              {                     /* Find arguments.                       */
                blanks = TRUE;      /* Expecting blanks.                     */
                for( jx = 0; !isdone( 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 & 0777777 );
              }
              else
              {
                /* Identifier is not a pseudo-op, interpret as load value     */
                punchOutObject( clc, getExprs() & 0777777 );
                incrementClc();
              }
            }
            else
            {
              /* Identifier is a value, interpret as load value               */
              punchOutObject( clc, getExprs() & 0777777 );
              incrementClc();
            }
            break;
          } /* end switch                                                     */
          break;
        } /* end switch                                                       */
      } /* end if                                                             */
    } /* end while( scanning_line )                                           */
  } /* end while( TRUE )                                                      */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $0x40
popq %rax
andl $0x0, 0x9913(%rip)      # 0xc35c
movl %eax, 0x9901(%rip)      # 0xc350
andq $0x0, 0x9909(%rip)      # 0xc360
movl %eax, 0x98f7(%rip)      # 0xc354
movl $0x1f00, 0x98f1(%rip)   # imm = 0x1F00
xorl %ebx, %ebx
leaq 0x75e0(%rip), %r14      # 0xa050
cmpq $0x2000, %rbx           # imm = 0x2000
je 0x2a88
movq (%rbx,%r14), %rdi
callq 0x2040
addq $0x8, %rbx
jmp 0x2a70
andl $0x0, 0x98d9(%rip)      # 0xc368
andl $0x0, 0x114da(%rip)     # 0x13f70
movl $0x1, 0x114cc(%rip)     # 0x13f6c
andl $0x0, 0x114cd(%rip)     # 0x13f74
andl $0x0, 0x114ca(%rip)     # 0x13f78
xorl %eax, %eax
movb %al, 0x114c6(%rip)      # 0x13f7c
movl $0x3c, 0x114c0(%rip)    # 0x13f80
movl $0x8, 0x114ba(%rip)     # 0x13f84
movb %al, 0x114b8(%rip)      # 0x13f88
movslq 0x9769(%rip), %rax      # 0xc240
movl %eax, 0x114af(%rip)     # 0x13f8c
movq 0x7554(%rip), %rcx      # 0xa038
movq (%rcx,%rax,8), %rdi
leaq 0x3649(%rip), %rsi      # 0x6138
callq 0x2130
movq %rax, 0x973d(%rip)      # 0xc238
testq %rax, %rax
je 0x2ea8
leaq 0x11485(%rip), %rbx     # 0x13f90
movabsq $0x4000800100001601, %rbp # imm = 0x4000800100001601
callq 0x33be
callq 0x368c
movb $0x1, %al
testb %al, %al
je 0x2b15
cmpb $0x0, 0x1145c(%rip)     # 0x13f88
jne 0x2e88
movslq 0x115d7(%rip), %r14     # 0x14110
movzbl (%r14,%rbx), %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x2b21
cmpl $0x9, %ecx
je 0x2b1a
cmpl $0xa, %ecx
je 0x2b21
cmpl $0x2f, %ecx
je 0x2b21
movsbq %cl, %r13
movslq 0x115b6(%rip), %rax     # 0x14114
cmpl %r14d, %eax
movl %r14d, %r15d
cmovgl %eax, %r15d
movq %r14, %rcx
cmpq %rax, %rcx
jge 0x2b88
movzbl (%rcx,%rbx), %edx
cmpq $0x3e, %rdx
ja 0x2b80
btq %rdx, %rbp
jb 0x2b85
incq %rcx
jmp 0x2b6b
movl %ecx, %r15d
movslq %r15d, %rax
cmpb $0x2f, (%rax,%rbx)
je 0x2ce1
movq %rbp, %r12
movslq 0x11581(%rip), %r15     # 0x14120
movzbl (%r15,%rbx), %ebp
callq 0x2170
movq (%rax), %rax
movzwl (%rax,%r13,2), %eax
cmpl $0x3d, %ebp
je 0x2d30
cmpl $0x2c, %ebp
je 0x2d5c
btl $0xa, %eax
movq %r12, %rbp
jae 0x2d7d
callq 0x3ea6
movslq 0xc(%rax), %r14
movl (%rax), %eax
notl %eax
testw $0x101, %ax             # imm = 0x101
leaq 0x11548(%rip), %r10     # 0x14130
jne 0x2c64
movslq 0x1152b(%rip), %rax     # 0x1411c
movq %rax, %rcx
addq %rbx, %rcx
movb $0x1, %sil
xorl %edx, %edx
movzbl (%rcx), %r8d
cmpq $0x2f, %r8
ja 0x2c16
movabsq $0x800000000401, %rdi   # imm = 0x800000000401
btq %r8, %rdi
jb 0x2c85
cmpl $0x9, %r8d
je 0x2c85
cmpl $0x13, %edx
jg 0x2c85
cmpl $0x3e, %r8d
ja 0x2c4c
movb $0x1, %dil
movl %r8d, %r8d
movabsq $0x4000100100001000, %r9 # imm = 0x4000100100001000
btq %r8, %r9
jae 0x2c4c
incl %eax
movl %eax, 0x114d7(%rip)     # 0x1411c
incq %rcx
movl %edi, %esi
jmp 0x2bfc
testb %sil, %sil
je 0x2c60
movslq %edx, %rsi
incl %edx
leaq 0x7353(%rip), %rdi      # 0x9fb0
movl %eax, (%rdi,%rsi,4)
xorl %edi, %edi
jmp 0x2c3d
testb $0x43, %al
jne 0x2d7d
callq 0x368c
andl $0x3ffff, %r14d         # imm = 0x3FFFF
movl %r14d, %edi
callq 0x3f05
jmp 0x2b21
movslq %edx, %rcx
leaq 0x7321(%rip), %rdx      # 0x9fb0
leaq (%rdx,%rcx,4), %rdx
cmpq $0x14, %rcx
jge 0x2ca5
andl $0x0, (%rdx)
incq %rcx
addq $0x4, %rdx
jmp 0x2c93
xorl %ecx, %ecx
cmpq $0x60, %rcx
je 0x2cb9
movb (%rcx,%rbx), %dl
movb %dl, (%rcx,%r10)
incq %rcx
jmp 0x2ca7
movl %eax, 0x115f1(%rip)     # 0x142b0
leaq 0x738a(%rip), %rax      # 0xa050
movq (%rax,%r14,8), %rcx
movq %rcx, 0x968f(%rip)      # 0xc360
xorl %eax, %eax
testq %rcx, %rcx
jne 0x2b21
jmp 0x2b1a
callq 0x37cd
movl 0x72a8(%rip), %edx      # 0x9f94
movl $0x7fff, %eax           # imm = 0x7FFF
andl %eax, %edx
cmpb $0x0, 0x1141e(%rip)     # 0x14118
jne 0x2d02
movl %edx, 0x964e(%rip)      # 0xc350
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x1
popq %rcx
callq 0x39a7
incl %r15d
movl %r15d, 0x11403(%rip)    # 0x1411c
callq 0x368c
movslq 0x113eb(%rip), %rax     # 0x14110
cmpb $0x9, (%rax,%rbx)
je 0x2d19
jmp 0x2b1f
btl $0xa, %eax
jb 0x2da2
movl 0x113ec(%rip), %esi     # 0x14128
leaq 0x70cd(%rip), %rdi      # 0x9e10
callq 0x3d11
callq 0x368c
callq 0x368c
callq 0x3d9f
jmp 0x2ddc
btl $0xa, %eax
movq %r12, %rbp
jb 0x2df7
leaq 0x7070(%rip), %rdi      # 0x9de0
movl %r14d, %esi
callq 0x3d11
jmp 0x2e6c
movl 0x95cc(%rip), %r14d     # 0xc350
callq 0x3d9f
andl $0x3ffff, %eax          # imm = 0x3FFFF
movl %r14d, %edi
movl %eax, %esi
callq 0x4616
callq 0x463f
jmp 0x2b1f
movb $0x3d, 0x1137b(%rip)    # 0x14124
callq 0x3d4f
callq 0x368c
callq 0x3d9f
movl %eax, %r13d
movl %r14d, %edi
movl %r15d, %esi
movl %eax, %edx
pushq $0x1
popq %rbp
movl %ebp, %ecx
callq 0x3cd7
movq %rbx, %rdi
xorl %esi, %esi
movl %r13d, %edx
movl %ebp, %ecx
callq 0x39a7
movq %r12, %rbp
movslq 0x1132a(%rip), %rax     # 0x14110
cmpb $0x9, (%rax,%rbx)
jne 0x2b1f
callq 0x368c
jmp 0x2ddf
leaq 0x1(%rsp), %r12
movq %r12, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x3bd4
movq %r12, %rdi
callq 0x3ac8
movq %rax, %r14
movl (%rax), %eax
testb $0x1, %al
je 0x2e52
movl 0xc(%r14), %ecx
cmpl 0x952b(%rip), %ecx      # 0xc350
je 0x2e4c
cmpl $0x2, 0x92b2(%rip)      # 0xc0e0
jne 0x2e4c
movq %r14, %rsi
addq $0x4, %rsi
movl 0x112d3(%rip), %edx     # 0x14110
leaq 0x6f5c(%rip), %rdi      # 0x9da0
callq 0x3c3b
movl (%r14), %eax
orl $0x21, %eax
movl %eax, (%r14)
movl 0x112b8(%rip), %edi     # 0x14110
movl 0x112c2(%rip), %esi     # 0x14120
movl 0x94ec(%rip), %edx      # 0xc350
pushq $0x9
popq %rcx
callq 0x3cd7
callq 0x368c
callq 0x368c
movslq 0x11293(%rip), %rax     # 0x14110
cmpb $0x9, (%rax,%rbx)
je 0x2e71
jmp 0x2b1f
callq 0x3793
movq 0x93a4(%rip), %rdi      # 0xc238
callq 0x2090
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6149(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movq 0x717f(%rip), %rax      # 0xa038
movq (%rax), %rdx
movslq 0x110c9(%rip), %rcx     # 0x13f8c
movq (%rax,%rcx,8), %rcx
leaq 0x3743(%rip), %rsi      # 0x6611
xorl %eax, %eax
callq 0x2100
pushq $-0x1
popq %rdi
callq 0x2150