// File: /workspace/github_c_makefile_star2_O3/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, 0xa6d3(%rip)       # 0xd760
xorl %ecx, %ecx
movw %cx, 0xa6cc(%rip)       # 0xd762
movw %ax, 0xa6c7(%rip)       # 0xd764
movw %cx, 0xa6c2(%rip)       # 0xd766
movl $0x2, %eax
leaq 0x85b0(%rip), %rcx      # 0xb660
movl $0x800080, -0x2(%rax,%rcx) # imm = 0x800080
addq $0x104, %rax            # imm = 0x104
cmpq $0x2082, %rax           # imm = 0x2082
jne 0x30b0
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0xa672(%rip)     # 0xd750
movaps %xmm0, 0xa65b(%rip)     # 0xd740
movaps %xmm0, 0xa644(%rip)     # 0xd730
movaps %xmm0, 0xa62d(%rip)     # 0xd720
movaps %xmm0, 0xa616(%rip)     # 0xd710
movaps %xmm0, 0xa5ff(%rip)     # 0xd700
movaps %xmm0, 0xa5e8(%rip)     # 0xd6f0
movaps %xmm0, 0xa5d1(%rip)     # 0xd6e0
movb $0x1, 0xa652(%rip)      # 0xd768
xorl %eax, %eax
movl %eax, 0xa64e(%rip)      # 0xd76c
movl %eax, 0xa64c(%rip)      # 0xd770
movl %eax, 0xa64a(%rip)      # 0xd774
movl %eax, 0xa648(%rip)      # 0xd778
movl %eax, 0xa646(%rip)      # 0xd77c
movb $0x0, 0xa643(%rip)      # 0xd780
movw $0x8, 0xa63c(%rip)      # 0xd782
cmpb $0x0, 0x8200(%rip)      # 0xb34d
jne 0x3160
movl $0x42, %edi
callq 0x6a30
xorl %edi, %edi
callq 0x6a30
leaq 0xa629(%rip), %rbx      # 0xd790
leaq 0x11(%rsp), %r14
callq 0x3ac7
callq 0x3be8
movslq 0xa697(%rip), %rbp      # 0xd814
movzbl (%rbp,%rbx), %eax
cmpl $0x29, %eax
jg 0x320d
testl %eax, %eax
je 0x316c
cmpl $0xa, %eax
je 0x316c
cmpl $0x24, %eax
je 0x34cf
movsbq %al, %r13
movslq 0xa674(%rip), %r15      # 0xd81c
movzbl (%r15,%rbx), %r12d
callq 0x21c0
movq (%rax), %rax
movzwl (%rax,%r13,2), %eax
cmpl $0x3d, %r12d
je 0x32c6
cmpl $0x2c, %r12d
je 0x33e7
btl $0xa, %eax
jae 0x330a
callq 0x4638
movl (%rax), %ecx
notl %ecx
testb $0x43, %cl
jne 0x330a
movzwl 0xc(%rax), %ebp
callq 0x3be8
andl $0xfff, %ebp            # imm = 0xFFF
movl %ebp, %edi
callq 0x46ba
testb %al, %al
jne 0x3176
jmp 0x316c
cmpl $0x2a, %eax
je 0x3229
cmpl $0x3b, %eax
je 0x3171
cmpl $0x2f, %eax
jne 0x319d
jmp 0x316c
callq 0x3be8
callq 0x3d58
cmpb $0x0, 0xa5de(%rip)      # 0xd818
jne 0x3176
movzwl 0x80c5(%rip), %ebp      # 0xb30c
andl $0xfff, %ebp            # imm = 0xFFF
orw 0xa50e(%rip), %bp       # 0xd762
movzwl 0xa505(%rip), %eax      # 0xd760
xorw %bp, %ax
testl $0xf80, %eax            # imm = 0xF80
je 0x3273
leaq 0x83f4(%rip), %rdi      # 0xb660
xorl %esi, %esi
callq 0x3fe1
subw 0xa4ec(%rip), %bp       # 0xd766
movw %bp, 0xa4df(%rip)       # 0xd760
movl %ebp, %eax
andl $0xfff, %eax            # imm = 0xFFF
movw %ax, 0xa4d5(%rip)       # 0xd764
cmpb $0x0, 0x80b7(%rip)      # 0xb34d
jne 0x32b9
movl %ebp, %edi
shrl $0x6, %edi
andl $0x3f, %edi
orl $0x40, %edi
callq 0x6a30
andl $0x3f, %ebp
movl %ebp, %edi
callq 0x6a30
movzwl 0xa4ab(%rip), %eax      # 0xd764
movswl %ax, %edx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x33d8
btl $0xa, %eax
jb 0x3385
movl 0xa54d(%rip), %r12d     # 0xd824
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x4368
leaq 0x7e9d(%rip), %rdi      # 0xb188
movq %r14, %rsi
movl %r12d, %edx
callq 0x43d8
callq 0x3be8
callq 0x3be8
callq 0x453e
jmp 0x3176
movswl 0xa44f(%rip), %ebp      # 0xd760
callq 0x453e
movl %eax, %r15d
movl $0xfff, %r12d           # imm = 0xFFF
andl %r12d, %r15d
movzwl 0xa439(%rip), %eax      # 0xd762
orw %bp, %ax
addw 0xa433(%rip), %ax       # 0xd766
movswl %ax, %esi
movq %rbx, %rdi
movl %r15d, %edx
movl $0x2, %ecx
callq 0x4119
movl %ebp, %edi
movl %r15d, %esi
callq 0x69eb
movswl 0xa409(%rip), %edi      # 0xd760
callq 0x672b
movzwl 0xa3fd(%rip), %eax      # 0xd760
movl %eax, %ecx
andl $0x7000, %ecx           # imm = 0x7000
incl %eax
andl %r12d, %eax
movw %ax, 0xa3ed(%rip)       # 0xd764
orl %ecx, %eax
movw %ax, 0xa3e0(%rip)       # 0xd760
jmp 0x3176
movb $0x3d, 0xa494(%rip)     # 0xd820
callq 0x44ee
callq 0x3be8
movslq 0xa47f(%rip), %rax      # 0xd81c
movb (%rax,%rbx), %al
movb %al, 0xa47a(%rip)       # 0xd820
callq 0x453e
movl %eax, %r12d
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x4368
movswl %bp, %ecx
movswl %r12w, %ebp
movq %r14, %rdi
movl %ebp, %esi
movl $0x1, %edx
callq 0x2f2e
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl $0x1, %ecx
callq 0x4119
jmp 0x3176
btl $0xa, %eax
jb 0x3410
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x4368
leaq 0x7d57(%rip), %rdi      # 0xb158
movq %r14, %rsi
movl %ebp, %edx
callq 0x43d8
jmp 0x34c5
leaq 0xa(%rsp), %r12
movq %r12, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x4368
movq %r12, %rdi
callq 0x423f
movq %rax, %r15
movl (%rax), %ecx
movzwl 0xa32a(%rip), %eax      # 0xd760
movzwl 0xa328(%rip), %r12d     # 0xd766
testb $0x1, %cl
je 0x3498
movzwl %ax, %edx
movzwl %r12w, %esi
addl %edx, %esi
movzwl 0xc(%r15), %edx
movl $0xfff, %edi            # imm = 0xFFF
andl %edi, %edx
andl %edi, %esi
cmpl %edx, %esi
je 0x3492
cmpl $0x2, 0x7f8b(%rip)      # 0xb3f0
jne 0x3492
movq %r15, %rsi
addq $0x4, %rsi
movl 0xa3a0(%rip), %edx      # 0xd814
leaq 0x7c9d(%rip), %rdi      # 0xb118
callq 0x43d8
movl (%r15), %ecx
movzwl 0xa2d6(%rip), %eax      # 0xd760
movzwl 0xa2d4(%rip), %r12d     # 0xd766
orl $0x21, %ecx
movl %ecx, (%r15)
movl 0xa376(%rip), %ebp      # 0xd814
movl 0xa378(%rip), %edx      # 0xd81c
addl %eax, %r12d
movq %r14, %rdi
movl %ebp, %esi
callq 0x4368
movswl %r12w, %esi
movswl %bp, %ecx
movq %r14, %rdi
movl $0x9, %edx
callq 0x2f2e
callq 0x3be8
jmp 0x3171
callq 0x3cd9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq