// File: /workspace/github_c_makefile_star2_O2/AK6DN[P]dec-utilities-for-pdp/palbart/palbart.c
// Function: onePass
void onePass()
{
  char    name[SYMLEN];
  WORD16  newclc;
  BOOL    scanning_line;
  int     start;
  SYM_T  *sym;
  int     term;
  WORD16  val;

  clc = 0200;                   /* Default starting address is 200 octal.     */
  field = 0;
  fieldlc = clc & 07777;
  reloc = 0;
  clearLiteralTable();
  listed = TRUE;
  lineno = 0;
  list_pageno = 0;
  list_lineno = 0;
  last_xref_lexstart = 0;
  last_xref_lineno = 0;
  list_title_set = FALSE;
  radix = 8;                    /* Initial radix is octal (base 8).           */

  if( !rim_mode )
  {
    /* Put out initial origin if not in rim mode.                             */
    punchOrigin( clc );
  }

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

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

        case ';':
          nextLexeme();
          break;

        case '$':
          endOfBinary();
          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, 0 );
            }
            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( 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 & 07777) != ( ( clc+reloc ) & 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( isalpha( line[lexstart] ))
            {
              start = lexstart;
              term = lexterm;
              delimiter = line[lexterm];
              nextLexBlank();       /* skip symbol                            */
              nextLexeme();         /* skip trailing =, allow blank           */
              delimiter = line[lexterm];
              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( isalpha( line[lexstart] ))
            {
              sym = evalSymbol();
              val = sym->val;
              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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movw $0x80, %ax
movw %ax, 0xa820(%rip)       # 0xd750
andw $0x0, 0xa81a(%rip)      # 0xd752
movw %ax, 0xa815(%rip)       # 0xd754
andw $0x0, 0xa80f(%rip)      # 0xd756
callq 0x3783
andl $0x0, 0xa809(%rip)      # 0xd75c
andl $0x0, 0xa806(%rip)      # 0xd760
andl $0x0, 0xa803(%rip)      # 0xd764
andl $0x0, 0xa800(%rip)      # 0xd768
movb $0x1, 0xa7e9(%rip)      # 0xd758
andl $0x0, 0xa7f6(%rip)      # 0xd76c
movb $0x0, 0xa7f3(%rip)      # 0xd770
movw $0x8, 0xa7ec(%rip)      # 0xd772
cmpb $0x0, 0x83b0(%rip)      # 0xb33d
jne 0x2f9b
movswl 0xa7ba(%rip), %edi      # 0xd750
callq 0x37e1
leaq 0xa7de(%rip), %rbx      # 0xd780
pushq $0x1
popq %rbp
callq 0x37fd
callq 0x3907
movb $0x1, %al
testb %al, %al
je 0x2fa5
movslq 0xa848(%rip), %r12      # 0xd804
movzbl (%r12,%rbx), %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x2fb1
cmpl $0xa, %ecx
je 0x2fb1
cmpl $0x2a, %ecx
je 0x304f
cmpl $0x2f, %ecx
je 0x2fb1
cmpl $0x3b, %ecx
je 0x2faa
cmpl $0x24, %ecx
je 0x324c
movsbq %cl, %r13
movslq 0xa81d(%rip), %r15      # 0xd80c
movzbl (%r15,%rbx), %r14d
callq 0x21a0
movq (%rax), %rax
movzwl (%rax,%r13,2), %eax
cmpl $0x3d, %r14d
je 0x30e3
cmpl $0x2c, %r14d
je 0x3183
btl $0xa, %eax
jae 0x310f
callq 0x429c
movl (%rax), %ecx
notl %ecx
testb $0x43, %cl
jne 0x310f
movzwl 0xc(%rax), %r14d
callq 0x3907
andl $0xfff, %r14d           # imm = 0xFFF
movl %r14d, %edi
callq 0x431e
jmp 0x2fb1
callq 0x3907
callq 0x3a6c
cmpb $0x0, 0xa7a8(%rip)      # 0xd808
movb $0x1, %al
jne 0x2fb1
movzwl 0x828c(%rip), %r14d     # 0xb2fc
andl $0xfff, %r14d           # imm = 0xFFF
orw 0xa6d3(%rip), %r14w     # 0xd752
movzwl 0xa6ca(%rip), %eax      # 0xd750
xorw %r14w, %ax
testw $0xf80, %ax             # imm = 0xF80
je 0x309e
leaq 0x85b9(%rip), %rdi      # 0xb650
xorl %esi, %esi
callq 0x3c84
subw 0xa6b0(%rip), %r14w     # 0xd756
movw %r14w, 0xa6a2(%rip)     # 0xd750
movl %r14d, %eax
andl $0xfff, %eax            # imm = 0xFFF
movw %ax, 0xa697(%rip)       # 0xd754
cmpb $0x0, 0x8279(%rip)      # 0xb33d
jne 0x30d6
movswl %r14w, %edi
callq 0x37e1
movzwl 0xa67e(%rip), %eax      # 0xd754
movswl %ax, %edx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x3177
btl $0xa, %eax
jb 0x3135
movl 0xa725(%rip), %esi      # 0xd814
leaq 0x8082(%rip), %rdi      # 0xb178
callq 0x411d
callq 0x3907
callq 0x3907
callq 0x41ab
jmp 0x2faf
movswl 0xa639(%rip), %r14d     # 0xd750
callq 0x41ab
andl $0xfff, %eax            # imm = 0xFFF
movl %r14d, %edi
movl %eax, %esi
callq 0x4ed1
callq 0x4f0c
jmp 0x2faf
movb $0x3d, 0xa6d4(%rip)     # 0xd810
callq 0x415b
callq 0x3907
movslq 0xa6bf(%rip), %rax      # 0xd80c
movb (%rax,%rbx), %al
movb %al, 0xa6ba(%rip)       # 0xd810
callq 0x41ab
movswl %ax, %r14d
movl %r12d, %edi
movl %r15d, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x40e2
movq %rbx, %rdi
xorl %esi, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x3db1
jmp 0x2faf
btl $0xa, %eax
jb 0x319d
leaq 0x7fb8(%rip), %rdi      # 0xb148
movl %r12d, %esi
callq 0x411d
jmp 0x3242
leaq 0x1(%rsp), %r14
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x3fde
movq %r14, %rdi
callq 0x3ed0
movq %rax, %r12
movl (%rax), %edx
movzwl 0xa58c(%rip), %eax      # 0xd750
movzwl 0xa58b(%rip), %ecx      # 0xd756
testb $0x1, %dl
je 0x3229
movzwl %ax, %esi
movzwl %cx, %edi
addl %esi, %edi
movzwl 0xc(%r12), %esi
movl $0xfff, %r8d            # imm = 0xFFF
andl %r8d, %esi
andl %r8d, %edi
cmpl %esi, %edi
je 0x3222
cmpl $0x2, 0x81eb(%rip)      # 0xb3e0
jne 0x3222
movq %r12, %rsi
addq $0x4, %rsi
movl 0xa600(%rip), %edx      # 0xd804
leaq 0x7efd(%rip), %rdi      # 0xb108
callq 0x4045
movl (%r12), %edx
movzwl 0xa535(%rip), %eax      # 0xd750
movzwl 0xa534(%rip), %ecx      # 0xd756
orl $0x21, %edx
movl %edx, (%r12)
movl 0xa5d5(%rip), %edi      # 0xd804
movl 0xa5d7(%rip), %esi      # 0xd80c
addl %eax, %ecx
movswl %cx, %edx
pushq $0x9
popq %rcx
callq 0x40e2
callq 0x3907
jmp 0x2faa
callq 0x39f1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq