// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movw $0x80, 0xc30f(%rip)     # 0xf7c0
movw $0x0, 0xc308(%rip)      # 0xf7c2
movswl 0xc2ff(%rip), %eax      # 0xf7c0
andl $0xfff, %eax            # imm = 0xFFF
movw %ax, 0xc2f7(%rip)       # 0xf7c4
movw $0x0, 0xc2f0(%rip)      # 0xf7c6
callq 0x4070
movb $0x1, 0xc2e6(%rip)      # 0xf7c8
movl $0x0, 0xc2e0(%rip)      # 0xf7cc
movl $0x0, 0xc2da(%rip)      # 0xf7d0
movl $0x0, 0xc2d4(%rip)      # 0xf7d4
movl $0x0, 0xc2ce(%rip)      # 0xf7d8
movl $0x0, 0xc2c8(%rip)      # 0xf7dc
movb $0x0, 0xc2c5(%rip)      # 0xf7e0
movw $0x8, 0xc2be(%rip)      # 0xf7e2
cmpb $0x0, 0x9e82(%rip)      # 0xd3ad
jne 0x3539
movswl 0xc28c(%rip), %edi      # 0xf7c0
callq 0x40f0
jmp 0x353b
callq 0x4130
callq 0x4330
movb $0x1, -0xb(%rbp)
cmpb $0x0, -0xb(%rbp)
je 0x3959
movslq 0xc31a(%rip), %rcx      # 0xf874
leaq 0xc28f(%rip), %rax      # 0xf7f0
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x3581
movslq 0xc303(%rip), %rcx      # 0xf874
leaq 0xc278(%rip), %rax      # 0xf7f0
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x358a
movb $0x0, -0xb(%rbp)
jmp 0x3954
movslq 0xc2e3(%rip), %rax      # 0xf874
leaq 0xc258(%rip), %rcx      # 0xf7f0
movsbl (%rax,%rcx), %eax
addl $-0x24, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x17, %eax
ja 0x368c
movq -0x28(%rbp), %rax
leaq 0x5b9f(%rip), %rcx      # 0x9158
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, -0xb(%rbp)
jmp 0x3952
callq 0x4330
jmp 0x3952
callq 0x4530
addq $0x30, %rsp
popq %rbp
retq
callq 0x4330
callq 0x45c0
movswl 0xc(%rax), %eax
andl $0xfff, %eax            # imm = 0xFFF
movswl 0xc1c8(%rip), %ecx      # 0xf7c2
orl %ecx, %eax
movw %ax, -0xa(%rbp)
cmpb $0x0, 0xc271(%rip)      # 0xf878
jne 0x3687
movswl -0xa(%rbp), %eax
andl $0xf80, %eax            # imm = 0xF80
movswl 0xc1a7(%rip), %ecx      # 0xf7c0
andl $0xf80, %ecx            # imm = 0xF80
cmpl %ecx, %eax
je 0x3631
leaq 0xa096(%rip), %rdi      # 0xd6c0
xorl %esi, %esi
callq 0x4a40
movswl -0xa(%rbp), %eax
movswl 0xc18a(%rip), %ecx      # 0xf7c6
subl %ecx, %eax
movw %ax, 0xc17b(%rip)       # 0xf7c0
movswl 0xc174(%rip), %eax      # 0xf7c0
andl $0xfff, %eax            # imm = 0xFFF
movw %ax, 0xc16c(%rip)       # 0xf7c4
cmpb $0x0, 0x9d4e(%rip)      # 0xd3ad
jne 0x366d
movswl 0xc158(%rip), %edi      # 0xf7c0
callq 0x40f0
leaq 0xc17c(%rip), %rdi      # 0xf7f0
xorl %esi, %esi
movl $0x1, %ecx
movswl 0xc142(%rip), %edx      # 0xf7c4
callq 0x4bf0
jmp 0x3952
movslq 0xc1e9(%rip), %rax      # 0xf87c
leaq 0xc156(%rip), %rcx      # 0xf7f0
movsbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
subl $0x2c, %eax
je 0x36b9
jmp 0x36a8
movl -0x2c(%rbp), %eax
subl $0x3d, %eax
je 0x37bc
jmp 0x3891
callq 0x21b0
movq (%rax), %rax
movslq 0xc1ac(%rip), %rdx      # 0xf874
leaq 0xc121(%rip), %rcx      # 0xf7f0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x379b
leaq -0x7(%rbp), %rdi
movl 0xc182(%rip), %esi      # 0xf874
movl 0xc184(%rip), %edx      # 0xf87c
callq 0x4f90
movq %rax, %rdi
callq 0x4dd0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x3770
movq -0x18(%rbp), %rax
movswl 0xc(%rax), %eax
andl $0xfff, %eax            # imm = 0xFFF
movswl 0xc095(%rip), %ecx      # 0xf7c0
movswl 0xc094(%rip), %edx      # 0xf7c6
addl %edx, %ecx
andl $0xfff, %ecx            # imm = 0xFFF
cmpl %ecx, %eax
je 0x3761
cmpl $0x2, 0x9d0b(%rip)      # 0xd450
jne 0x3761
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
movl 0xc11f(%rip), %edx      # 0xf874
leaq 0x99ac(%rip), %rdi      # 0xd108
callq 0x5030
movq -0x18(%rbp), %rax
movl (%rax), %ecx
orl $0x21, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl 0xc0fe(%rip), %edi      # 0xf874
movl 0xc100(%rip), %esi      # 0xf87c
movswl 0xc03d(%rip), %eax      # 0xf7c0
movswl 0xc03c(%rip), %ecx      # 0xf7c6
addl %ecx, %eax
movl $0x9, %ecx
movswl %ax, %edx
callq 0x5100
jmp 0x37ad
movl 0xc0d3(%rip), %esi      # 0xf874
leaq 0x99a0(%rip), %rdi      # 0xd148
callq 0x5150
callq 0x4330
callq 0x4330
jmp 0x3950
callq 0x21b0
movq (%rax), %rax
movslq 0xc0a9(%rip), %rdx      # 0xf874
leaq 0xc01e(%rip), %rcx      # 0xf7f0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x386b
movl 0xc083(%rip), %eax      # 0xf874
movl %eax, -0x10(%rbp)
movl 0xc082(%rip), %eax      # 0xf87c
movl %eax, -0x1c(%rbp)
movslq 0xc078(%rip), %rcx      # 0xf87c
leaq 0xbfe5(%rip), %rax      # 0xf7f0
movb (%rax,%rcx), %al
movb %al, 0xc06c(%rip)       # 0xf880
callq 0x51a0
callq 0x4330
movslq 0xc057(%rip), %rcx      # 0xf87c
leaq 0xbfc4(%rip), %rax      # 0xf7f0
movb (%rax,%rcx), %al
movb %al, 0xc04b(%rip)       # 0xf880
callq 0x5210
movw %ax, -0x1e(%rbp)
movl -0x10(%rbp), %edi
movl -0x1c(%rbp), %esi
movl $0x1, %ecx
movswl -0x1e(%rbp), %edx
callq 0x5100
leaq 0xbf97(%rip), %rdi      # 0xf7f0
xorl %esi, %esi
movl $0x1, %ecx
movswl -0x1e(%rbp), %edx
callq 0x4bf0
jmp 0x388c
movl 0xc013(%rip), %esi      # 0xf884
leaq 0x9900(%rip), %rdi      # 0xd178
callq 0x5150
callq 0x4330
callq 0x4330
callq 0x5210
jmp 0x3950
callq 0x21b0
movq (%rax), %rax
movslq 0xbfd4(%rip), %rdx      # 0xf874
leaq 0xbf49(%rip), %rcx      # 0xf7f0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x3924
callq 0x53d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movw 0xc(%rax), %ax
movw %ax, -0x1e(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0x43, %eax
cmpl $0x43, %eax
jne 0x38f8
callq 0x4330
movswl -0x1e(%rbp), %edi
andl $0xfff, %edi            # imm = 0xFFF
callq 0x5480
movb %al, -0xb(%rbp)
jmp 0x3922
movw 0xbec1(%rip), %ax       # 0xf7c0
movw %ax, -0x2e(%rbp)
callq 0x5210
movw -0x2e(%rbp), %cx
cwtl
andl $0xfff, %eax            # imm = 0xFFF
movswl %cx, %edi
movswl %ax, %esi
callq 0x6700
callq 0x6760
jmp 0x394e
movw 0xbe95(%rip), %ax       # 0xf7c0
movw %ax, -0x30(%rbp)
callq 0x5210
movw -0x30(%rbp), %cx
cwtl
andl $0xfff, %eax            # imm = 0xFFF
movswl %cx, %edi
movswl %ax, %esi
callq 0x6700
callq 0x6760
jmp 0x3950
jmp 0x3952
jmp 0x3954
jmp 0x3549
jmp 0x353b
nop