// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x40, 0xa53e(%rip)     # 0xd3a0
movl $0x40, 0xa538(%rip)     # 0xd3a4
movl $0x1f00, 0xa532(%rip)   # imm = 0x1F00
movl $0x0, 0xa52c(%rip)      # 0xd3ac
movq $0x0, 0xa525(%rip) # 0xd3b0
movl $0x0, -0x8(%rbp)
cmpl $0x400, -0x8(%rbp)      # imm = 0x400
jge 0x2ece
movslq -0x8(%rbp), %rcx
leaq 0x81fa(%rip), %rax      # 0xb0a0
cmpq $0x0, (%rax,%rcx,8)
je 0x2ec1
movslq -0x8(%rbp), %rcx
leaq 0x81e8(%rip), %rax      # 0xb0a0
movq (%rax,%rcx,8), %rdi
callq 0x2030
jmp 0x2ec3
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2e92
movl $0x0, 0xa4e0(%rip)      # 0xd3b8
movl $0x1, 0x120da(%rip)     # 0x14fbc
movl $0x0, 0x120d4(%rip)     # 0x14fc0
movl $0x0, 0x120ce(%rip)     # 0x14fc4
movl $0x0, 0x120c8(%rip)     # 0x14fc8
movb $0x0, 0x120c5(%rip)     # 0x14fcc
movl $0x3c, 0x120bf(%rip)    # 0x14fd0
movl $0x8, 0x120b9(%rip)     # 0x14fd4
movb $0x0, 0x120b6(%rip)     # 0x14fd8
movl 0xa368(%rip), %eax      # 0xd290
movl %eax, 0x120ae(%rip)     # 0x14fdc
movq 0x8153(%rip), %rax      # 0xb088
movslq 0x120a0(%rip), %rcx     # 0x14fdc
movq (%rax,%rcx,8), %rdi
leaq 0x4195(%rip), %rsi      # 0x70dc
callq 0x2130
movq %rax, 0xa335(%rip)      # 0xd288
cmpq $0x0, %rax
jne 0x2f97
movq 0x7098(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movq 0x811e(%rip), %rax      # 0xb088
movq (%rax), %rdx
movq 0x8114(%rip), %rax      # 0xb088
movslq 0x12061(%rip), %rcx     # 0x14fdc
movq (%rax,%rcx,8), %rcx
leaq 0x462f(%rip), %rsi      # 0x75b5
movb $0x0, %al
callq 0x2100
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2160
jmp 0x2f99
callq 0x3cf0
callq 0x41d0
movb $0x1, -0x19(%rbp)
cmpb $0x0, -0x19(%rbp)
je 0x360f
cmpb $0x0, 0x12020(%rip)     # 0x14fd8
je 0x2fd1
callq 0x44b0
movq 0xa2c2(%rip), %rdi      # 0xd288
callq 0x2090
addq $0x50, %rsp
popq %rbp
retq
movslq 0x12188(%rip), %rcx     # 0x15160
leaq 0x12001(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x2fff
movslq 0x12171(%rip), %rcx     # 0x15160
leaq 0x11fea(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x3008
movb $0x0, -0x19(%rbp)
jmp 0x360a
movslq 0x12151(%rip), %rax     # 0x15160
leaq 0x11fca(%rip), %rcx     # 0x14fe0
movsbl (%rax,%rcx), %eax
movl %eax, -0x34(%rbp)
subl $0x9, %eax
je 0x3037
jmp 0x3024
movl -0x34(%rbp), %eax
subl $0x2f, %eax
jne 0x3041
jmp 0x302e
movb $0x0, -0x19(%rbp)
jmp 0x3608
callq 0x41d0
jmp 0x3608
movl 0x12119(%rip), %eax     # 0x15160
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x12111(%rip), %eax     # 0x15164
jge 0x30f7
movslq -0xc(%rbp), %rcx
leaq 0x11f7c(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x30e5
movslq -0xc(%rbp), %rcx
leaq 0x11f68(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0xc, %eax
je 0x30e5
movslq -0xc(%rbp), %rcx
leaq 0x11f54(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x3e, %eax
je 0x30e5
movslq -0xc(%rbp), %rcx
leaq 0x11f40(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
je 0x30e5
movslq -0xc(%rbp), %rcx
leaq 0x11f2c(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x30e5
movslq -0xc(%rbp), %rcx
leaq 0x11f18(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x30e5
movslq -0xc(%rbp), %rcx
leaq 0x11f04(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x30e7
jmp 0x30f7
jmp 0x30e9
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x304a
movslq -0xc(%rbp), %rcx
leaq 0x11ede(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
jne 0x3177
callq 0x4500
movl 0xc(%rax), %eax
andl $0x7fff, %eax           # imm = 0x7FFF
movl %eax, -0x18(%rbp)
cmpb $0x0, 0x12046(%rip)     # 0x15168
jne 0x312d
movl -0x18(%rbp), %eax
movl %eax, 0xa273(%rip)      # 0xd3a0
movl -0x18(%rbp), %edx
leaq 0x11ea9(%rip), %rdi     # 0x14fe0
xorl %esi, %esi
movl $0x1, %ecx
callq 0x4870
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, 0x1201d(%rip)     # 0x1516c
callq 0x41d0
movslq 0x12005(%rip), %rcx     # 0x15160
leaq 0x11e7e(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x3172
callq 0x41d0
jmp 0x3154
jmp 0x3608
movslq 0x11ff2(%rip), %rax     # 0x15170
leaq 0x11e5b(%rip), %rcx     # 0x14fe0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
subl $0x2c, %eax
je 0x31a4
jmp 0x3193
movl -0x38(%rbp), %eax
subl $0x3d, %eax
je 0x32a0
jmp 0x3377
callq 0x2170
movq (%rax), %rax
movslq 0x11fad(%rip), %rdx     # 0x15160
leaq 0x11e26(%rip), %rcx     # 0x14fe0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x3261
leaq -0x13(%rbp), %rdi
movl 0x11f83(%rip), %esi     # 0x15160
movl 0x11f8d(%rip), %edx     # 0x15170
callq 0x4c00
movq %rax, %rdi
callq 0x4a40
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x3243
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
cmpl 0xa191(%rip), %eax      # 0xd3a0
je 0x3234
cmpl $0x2, 0x9f18(%rip)      # 0xd130
jne 0x3234
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
movl 0x11f38(%rip), %edx     # 0x15160
leaq 0x7b71(%rip), %rdi      # 0xada0
callq 0x4ca0
movq -0x28(%rbp), %rax
movl (%rax), %ecx
orl $0x21, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl 0x11f17(%rip), %edi     # 0x15160
movl 0x11f21(%rip), %esi     # 0x15170
movl 0xa14b(%rip), %edx      # 0xd3a0
movl $0x9, %ecx
callq 0x4d70
jmp 0x3273
movl 0x11ef9(%rip), %esi     # 0x15160
leaq 0x7b72(%rip), %rdi      # 0xade0
callq 0x4db0
callq 0x41d0
callq 0x41d0
movslq 0x11edc(%rip), %rcx     # 0x15160
leaq 0x11d55(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x329b
callq 0x41d0
jmp 0x327d
jmp 0x3606
callq 0x2170
movq (%rax), %rax
movslq 0x11eb1(%rip), %rdx     # 0x15160
leaq 0x11d2a(%rip), %rcx     # 0x14fe0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x3331
movl 0x11e8f(%rip), %eax     # 0x15160
movl %eax, -0x20(%rbp)
movl 0x11e96(%rip), %eax     # 0x15170
movl %eax, -0x2c(%rbp)
movslq 0x11e8c(%rip), %rcx     # 0x15170
leaq 0x11cf5(%rip), %rax     # 0x14fe0
movb (%rax,%rcx), %al
movb %al, 0x11e80(%rip)      # 0x15174
callq 0x4e00
callq 0x41d0
callq 0x4e60
movl %eax, -0x30(%rbp)
movl -0x20(%rbp), %edi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
movl $0x1, %ecx
callq 0x4d70
movl -0x30(%rbp), %edx
leaq 0x11cbd(%rip), %rdi     # 0x14fe0
xorl %esi, %esi
movl $0x1, %ecx
callq 0x4870
jmp 0x3352
movl 0x11e41(%rip), %esi     # 0x15178
leaq 0x7ad2(%rip), %rdi      # 0xae10
callq 0x4db0
callq 0x41d0
callq 0x41d0
callq 0x4e60
jmp 0x3354
movslq 0x11e05(%rip), %rcx     # 0x15160
leaq 0x11c7e(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x3372
callq 0x41d0
jmp 0x3354
jmp 0x3606
callq 0x2170
movq (%rax), %rax
movslq 0x11dda(%rip), %rdx     # 0x15160
leaq 0x11c53(%rip), %rcx     # 0x14fe0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x35e1
callq 0x5000
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0x101, %eax            # imm = 0x101
cmpl $0x101, %eax            # imm = 0x101
jne 0x3594
movb $0x1, -0x1(%rbp)
movl $0x0, -0xc(%rbp)
movslq 0x11d8b(%rip), %rcx     # 0x1516c
leaq 0x11bf8(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, -0x39(%rbp)
je 0x3454
movslq 0x11d6f(%rip), %rcx     # 0x1516c
leaq 0x11bdc(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x3454
movslq 0x11d53(%rip), %rcx     # 0x1516c
leaq 0x11bc0(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x39(%rbp)
je 0x3454
movslq 0x11d37(%rip), %rcx     # 0x1516c
leaq 0x11ba4(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x39(%rbp)
je 0x3454
cmpl $0x14, -0xc(%rbp)
setl %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x3460
jmp 0x3502
movslq 0x11d05(%rip), %rcx     # 0x1516c
leaq 0x11b72(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x2c, %eax
je 0x34bc
movslq 0x11cee(%rip), %rcx     # 0x1516c
leaq 0x11b5b(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x34bc
movslq 0x11cd7(%rip), %rcx     # 0x1516c
leaq 0x11b44(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0xc, %eax
je 0x34bc
movslq 0x11cc0(%rip), %rcx     # 0x1516c
leaq 0x11b2d(%rip), %rax     # 0x14fe0
movsbl (%rax,%rcx), %eax
cmpl $0x3e, %eax
jne 0x34c2
movb $0x1, -0x1(%rbp)
jmp 0x34ec
cmpb $0x0, -0x1(%rbp)
je 0x34ea
movl 0x11c9e(%rip), %edx     # 0x1516c
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xc(%rbp)
movslq %eax, %rcx
leaq 0x7b1d(%rip), %rax      # 0xb000
movl %edx, (%rax,%rcx,4)
movb $0x0, -0x1(%rbp)
jmp 0x34ec
jmp 0x34ee
movl 0x11c78(%rip), %eax     # 0x1516c
addl $0x1, %eax
movl %eax, 0x11c6f(%rip)     # 0x1516c
jmp 0x33da
jmp 0x3504
cmpl $0x14, -0xc(%rbp)
jge 0x3527
movslq -0xc(%rbp), %rcx
leaq 0x7aeb(%rip), %rax      # 0xb000
movl $0x0, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3504
movl $0x0, -0xc(%rbp)
cmpl $0x60, -0xc(%rbp)
jge 0x355b
movslq -0xc(%rbp), %rcx
leaq 0x11aa1(%rip), %rax     # 0x14fe0
movb (%rax,%rcx), %dl
movslq -0xc(%rbp), %rcx
leaq 0x11c33(%rip), %rax     # 0x15180
movb %dl, (%rax,%rcx)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x352e
movl 0x11c0b(%rip), %eax     # 0x1516c
movl %eax, 0x11d99(%rip)     # 0x15300
movslq -0x30(%rbp), %rcx
leaq 0x7b2e(%rip), %rax      # 0xb0a0
movq (%rax,%rcx,8), %rax
movq %rax, 0x9e33(%rip)      # 0xd3b0
cmpq $0x0, 0x9e2b(%rip)      # 0xd3b0
je 0x358d
movb $0x0, -0x19(%rbp)
jmp 0x3592
callq 0x41d0
jmp 0x35df
movq -0x28(%rbp), %rax
movl (%rax), %eax
andl $0x43, %eax
cmpl $0x43, %eax
jne 0x35ba
callq 0x41d0
movl -0x30(%rbp), %edi
andl $0x3ffff, %edi          # imm = 0x3FFFF
callq 0x5080
movb %al, -0x19(%rbp)
jmp 0x35dd
movl 0x9de0(%rip), %eax      # 0xd3a0
movl %eax, -0x40(%rbp)
callq 0x4e60
movl -0x40(%rbp), %edi
movl %eax, %esi
andl $0x3ffff, %esi          # imm = 0x3FFFF
callq 0x5c80
callq 0x5cc0
jmp 0x35df
jmp 0x3604
movl 0x9db9(%rip), %eax      # 0xd3a0
movl %eax, -0x44(%rbp)
callq 0x4e60
movl -0x44(%rbp), %edi
movl %eax, %esi
andl $0x3ffff, %esi          # imm = 0x3FFFF
callq 0x5c80
callq 0x5cc0
jmp 0x3606
jmp 0x3608
jmp 0x360a
jmp 0x2fa7
jmp 0x2f99
nopw %cs:(%rax,%rax)