// File: /workspace/github_c_makefile_star2_O1/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:
movw $0x80, %ax
movw %ax, 0xa703(%rip)       # 0xd760
xorl %ecx, %ecx
movw %cx, 0xa6fc(%rip)       # 0xd762
movw %ax, 0xa6f7(%rip)       # 0xd764
movw %cx, 0xa6f2(%rip)       # 0xd766
movl $0x2, %eax
leaq 0x85e0(%rip), %rcx      # 0xb660
movl $0x800080, -0x2(%rax,%rcx) # imm = 0x800080
addq $0x104, %rax            # imm = 0x104
cmpq $0x2082, %rax           # imm = 0x2082
jne 0x3080
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0xa6a2(%rip)     # 0xd750
movaps %xmm0, 0xa68b(%rip)     # 0xd740
movaps %xmm0, 0xa674(%rip)     # 0xd730
movaps %xmm0, 0xa65d(%rip)     # 0xd720
movaps %xmm0, 0xa646(%rip)     # 0xd710
movaps %xmm0, 0xa62f(%rip)     # 0xd700
movaps %xmm0, 0xa618(%rip)     # 0xd6f0
movaps %xmm0, 0xa601(%rip)     # 0xd6e0
movb $0x1, 0xa682(%rip)      # 0xd768
xorl %eax, %eax
movl %eax, 0xa67e(%rip)      # 0xd76c
movl %eax, 0xa67c(%rip)      # 0xd770
movl %eax, 0xa67a(%rip)      # 0xd774
movl %eax, 0xa678(%rip)      # 0xd778
movl %eax, 0xa676(%rip)      # 0xd77c
movb $0x0, 0xa673(%rip)      # 0xd780
movw $0x8, 0xa66c(%rip)      # 0xd782
cmpb $0x0, 0x8230(%rip)      # 0xb34d
jne 0x3130
movl $0x42, %edi
callq 0x6a41
xorl %edi, %edi
callq 0x6a41
leaq 0xa659(%rip), %rbx      # 0xd790
leaq 0x11(%rsp), %r14
callq 0x3a5d
callq 0x3b84
movslq 0xa6c7(%rip), %rbp      # 0xd814
movzbl (%rbp,%rbx), %eax
cmpl $0x29, %eax
jg 0x31dd
testl %eax, %eax
je 0x313c
cmpl $0xa, %eax
je 0x313c
cmpl $0x24, %eax
je 0x348a
movsbq %al, %r13
movslq 0xa6a4(%rip), %r15      # 0xd81c
movzbl (%r15,%rbx), %r12d
callq 0x21c0
movq (%rax), %rax
movzwl (%rax,%r13,2), %eax
cmpl $0x3d, %r12d
je 0x3293
cmpl $0x2c, %r12d
je 0x33b4
btl $0xa, %eax
jae 0x32d7
callq 0x45e2
movl (%rax), %ecx
notl %ecx
testb $0x43, %cl
jne 0x32d7
movzwl 0xc(%rax), %ebp
callq 0x3b84
andl $0xfff, %ebp            # imm = 0xFFF
movl %ebp, %edi
callq 0x466a
testb %al, %al
jne 0x3146
jmp 0x313c
cmpl $0x2a, %eax
je 0x31f9
cmpl $0x3b, %eax
je 0x3141
cmpl $0x2f, %eax
jne 0x316d
jmp 0x313c
callq 0x3b84
callq 0x3cfb
cmpb $0x0, 0xa60e(%rip)      # 0xd818
jne 0x3146
movzwl 0x80f5(%rip), %ebp      # 0xb30c
andl $0xfff, %ebp            # imm = 0xFFF
orw 0xa53e(%rip), %bp       # 0xd762
movzwl 0xa535(%rip), %eax      # 0xd760
xorw %bp, %ax
testl $0xf80, %eax            # imm = 0xF80
je 0x3243
leaq 0x8424(%rip), %rdi      # 0xb660
xorl %esi, %esi
callq 0x3f8c
subw 0xa51c(%rip), %bp       # 0xd766
movw %bp, 0xa50f(%rip)       # 0xd760
movl %ebp, %eax
andl $0xfff, %eax            # imm = 0xFFF
movw %ax, 0xa505(%rip)       # 0xd764
cmpb $0x0, 0x80e7(%rip)      # 0xb34d
jne 0x3282
movl %ebp, %edi
shrl $0x6, %edi
andl $0x3f, %edi
orl $0x40, %edi
callq 0x6a41
andl $0x3f, %ebp
movl %ebp, %edi
callq 0x6a41
movswl 0xa4db(%rip), %edx      # 0xd764
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x33a5
btl $0xa, %eax
jb 0x3352
movl 0xa580(%rip), %r12d     # 0xd824
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x430d
leaq 0x7ed0(%rip), %rdi      # 0xb188
movq %r14, %rsi
movl %r12d, %edx
callq 0x4382
callq 0x3b84
callq 0x3b84
callq 0x44e8
jmp 0x3146
movswl 0xa482(%rip), %ebp      # 0xd760
callq 0x44e8
movl %eax, %r15d
movl $0xfff, %r12d           # imm = 0xFFF
andl %r12d, %r15d
movzwl 0xa46c(%rip), %eax      # 0xd762
orw %bp, %ax
addw 0xa466(%rip), %ax       # 0xd766
movswl %ax, %esi
movq %rbx, %rdi
movl %r15d, %edx
movl $0x2, %ecx
callq 0x40b8
movl %ebp, %edi
movl %r15d, %esi
callq 0x69fc
movswl 0xa43c(%rip), %edi      # 0xd760
callq 0x6738
movzwl 0xa430(%rip), %eax      # 0xd760
movl %eax, %ecx
andl $0x7000, %ecx           # imm = 0x7000
incl %eax
andl %r12d, %eax
movw %ax, 0xa420(%rip)       # 0xd764
orl %ecx, %eax
movw %ax, 0xa413(%rip)       # 0xd760
jmp 0x3146
movb %r12b, 0xa4c7(%rip)     # 0xd820
callq 0x4498
callq 0x3b84
movslq 0xa4b2(%rip), %rax      # 0xd81c
movb (%rax,%rbx), %al
movb %al, 0xa4ad(%rip)       # 0xd820
callq 0x44e8
movl %eax, %r12d
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x430d
movswl %bp, %ecx
movswl %r12w, %ebp
movq %r14, %rdi
movl %ebp, %esi
movl $0x1, %edx
callq 0x2f0e
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl $0x1, %ecx
callq 0x40b8
jmp 0x3146
btl $0xa, %eax
jb 0x33dd
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x430d
leaq 0x7d8a(%rip), %rdi      # 0xb158
movq %r14, %rsi
movl %ebp, %edx
callq 0x4382
jmp 0x3480
leaq 0xa(%rsp), %r12
movq %r12, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x430d
movq %r12, %rdi
callq 0x41de
testb $0x1, (%rax)
je 0x3446
movq %rax, %r15
movzwl 0xc(%rax), %eax
movl $0xfff, %esi            # imm = 0xFFF
andl %esi, %eax
movzwl 0xa34f(%rip), %ecx      # 0xd760
movzwl 0xa34e(%rip), %edx      # 0xd766
addl %ecx, %edx
andl %esi, %edx
cmpl %eax, %edx
je 0x3442
cmpl $0x2, 0x7fc9(%rip)      # 0xb3f0
jne 0x3442
movq %r15, %rsi
addq $0x4, %rsi
movl 0xa3de(%rip), %edx      # 0xd814
leaq 0x7cdb(%rip), %rdi      # 0xb118
callq 0x4382
orb $0x21, (%r15)
movl 0xa3c8(%rip), %ebp      # 0xd814
movl 0xa3ca(%rip), %edx      # 0xd81c
movzwl 0xa30c(%rip), %r15d     # 0xd766
addw 0xa2fe(%rip), %r15w     # 0xd760
movq %r14, %rdi
movl %ebp, %esi
callq 0x430d
movswl %r15w, %esi
movswl %bp, %ecx
movq %r14, %rdi
movl $0x9, %edx
callq 0x2f0e
callq 0x3b84
jmp 0x3141
callq 0x3c7c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq