// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro7/macro7.c
// Function: pseudoOperators
BOOL pseudoOperators( PSEUDO_T val )
{
  int     count;
  int     delim;
  int     index;
  int     ix;
  WORD32  length;
  int     level;
  int     lexstartsave;
  int     pack;
  int     pos;
  int     radixprev;
  BOOL    status;
  SYM_T  *sym;
  WORD32  value;
  WORD32  word;
  int     width;
  static int mask_tab[19] = { 0000000,
          0000001, 0000003, 0000007, 0000017, 0000037, 0000077,
          0000177, 0000377, 0000777, 0001777, 0003777, 0007777,
          0017777, 0037777, 0077777, 0177777, 0377777, 0777777 };

  status = TRUE;
  switch( (PSEUDO_T) val )
  {
  case DECIMAL:
    radix = 10;
    break;

  case DEFINE:
    count = 0;
    index = 0;
    lexstartsave = lexstart;
    while(( line[lexstart] != '<' ) && ( !isdone( line[lexstart] )) &&
          ( count < MAC_MAX_ARGS ))
    {
      if ( !isalpha( line[lexstart] ) && ( index == 0 ))
      {
        index = lexstart;
      }
      lexemeToName( &mac_arg_name[count++][0], lexstart, lexterm );
      nextLexeme();
    }
    if( count == 0 )                 /* No macro name.                        */
    {
      errorMessage( &no_macro_name, lexstartsave );
      index = 1;
    }
    else if( index )                 /* Bad argument name.                    */
    {
      errorMessage( &bad_dummy_arg, index );
    }
    else if( mac_count >= MAC_TABLE_LENGTH )
    {
      errorMessage( &macro_table_full, lexstartsave );
      index = 1;
    }
    else
    {
      value = mac_count;
      mac_count++;                  /* Value is entry in mac_bodies.         */
      defineSymbol( &mac_arg_name[0][0], value, MACRO, lexstartsave );
    }
    if( isend( line[lexstart] ) || ( line[lexstart] == '/' ))
    {
      readLine();
      nextLexeme();
    }
    if( index )
    {
      conditionFalse();             /* On error skip macro body.             */
    }
    else if( line[lexstart] == '<' )
    {
      /* Invariant: line[cc] is the next unexamined character.                */
      index = lexstart + 1;
      length = 0;
      level = 1;
      while( level > 0 )
      {
        if( end_of_input )
        {
          break;
        }
        if( isend( line[cc] ) || ( line[cc] == '/' ))
        {
          length = copyMacLine( length, index, cc, count - 1 );
          readLine();
          index = 0;
        }
        else
        {
          switch( line[cc] )
          {
          case '>':
            level--;
            cc++;
            break;

          case '<':
            level++;
            cc++;
            break;

          default:
            cc++;
            break;
          } /* end switch                                                     */
        } /* end if                                                           */
      } /* end while                                                          */
      length = copyMacLine( length, index, cc - 1, count - 1 );
      if( length < 0 )
      {
        errorMessage (&macro_too_long, lexstart );
      }
      else if( length == 0 )
      {
        mac_bodies[value] = NULL;
      }
      else
      {
        mac_bodies[value] = (char *) malloc( length + 1 );
        if( mac_bodies[value] )
        {
           strncpy( mac_bodies[value], mac_buffer, length );
           *( mac_bodies[value] + length ) = 0;
        }
        else
        {
           errorMessage( &no_virtual_memory, lexstart );
        }
      }
      nextLexeme();
    }
    else
    {
      errorMessage( &lt_expected, lexstart );
    } /* end if                                                               */
    break;
      
  case EJECT:
    page_lineno = LIST_LINES_PER_PAGE;  /* This will force a page break.      */
    status = FALSE;             /* This will force reading of next line       */
    break;

  case IFDEF:
    if( isalpha( line[lexstart] ))
    {
      sym = evalSymbol();
      nextLexeme();
      if( M_DEFINED_CONDITIONALLY( sym->type ))
      {
        conditionTrue();
      }
      else
      {
        conditionFalse();
      }
    }
    else
    {
      errorLexeme( &label_syntax, lexstart );
    }
    break;

  case IFNDEF:
    if( isalpha( line[lexstart] ))
    {
      sym = evalSymbol();
      nextLexeme();
      if( M_DEFINED_CONDITIONALLY( sym->type ))
      {
        conditionFalse();
      }
      else
      {
        conditionTrue();
      }
    }
    else
    {
      errorLexeme( &label_syntax, lexstart );
    }
    break;

  case IFNZERO:
    if( (getExpr())->val == 0 )
    {
      conditionFalse();
    }
    else
    {
      conditionTrue();
    }
    break;

  case IFZERO:
    if( (getExpr())->val == 0 )
    {
      conditionTrue();
    }
    else
    {
      conditionFalse();
    }
    break;

  case LIST:
    listfile = listsave;
    break;

  case NOLIST:
    listfile = NULL;
    break;

  case OCTAL:
    radix = 8;
    break;

  case START:
    if( !isdone( line[lexstart] ))
    {
      start_addr = (getExpr())->val & 077777;
      nextLexeme();
    }
    printLine( line, 0, start_addr, LINE_VAL );
    status = FALSE;
    break;

  case TEXT:
    delim = line[lexstart];
    pack = 0;
    count = 0;
    index = lexstart + 1;
    while( line[index] != delim && !isend( line[index] ))
    {
      pack = ( pack << 6 ) | ( line[index] & 077 );
      count++;
      if( count > 2 )
      {
        punchOutObject( clc, pack );
        incrementClc();
        count = 0;
        pack = 0;
      }
      index++;
    }

    if( count == 2 )
    {
      punchOutObject( clc, pack << 6 );
    }
    else if (count == 1)
    {
      punchOutObject( clc, pack << 12 );
    }
    else
    {
      punchOutObject( clc, 0 );
    }
    incrementClc();

    if( isend( line[index] ))
    {
      cc = index;
      lexterm = cc;
      errorMessage( &text_string, cc );
    }
    else
    {
      cc = index + 1;
      lexterm = cc;
    }
    nextLexeme();
    break;

  case TITLE:
    delim = line[lexstart];
    ix = lexstart + 1;
    /* Find string delimiter.                                                 */
    do
    {
      if( list_title[ix] == delim && list_title[ix + 1] == delim )
      {
        ix++;
      }
      ix++;
    } while( line[ix] != delim && !isend(line[ix]) );

    if( !isend( line[ix] ) )
    {
      count = 0;
      ix = lexstart + 1;
      do
      {
        if( list_title[ix] == delim && list_title[ix + 1] == delim )
        {
          ix++;
        }
        list_title[count] = line[ix];
        count++;
        ix++;
      } while( line[ix] != delim && !isend(line[ix]) );

      if( strlen( list_title ) > TITLELEN )
      {
        list_title[TITLELEN] = '\0';
      }

      cc = ix + 1;
      lexterm = cc;
      page_lineno = LIST_LINES_PER_PAGE;/* Force top of page for new titles.  */
      list_title_set = TRUE;
    }
    else
    {
      cc = ix;
      lexterm = cc;
      errorMessage( &text_string, cc );
    }

    nextLexeme();
    break;

  case VFD:
    pos = 0;
    word = 0;
    radixprev = radix;
    while( !isdone (line[lexstart] ))
    {
      lexstartsave = lexstart;
      radix = 10;
  	  width = (getExpr())->val;     /* Get field width.                       */ 
      radix = radixprev;
      if( (width <= 0) || ((width + pos) > 18) || (line[lexstart] != ':') )
      {
        errorMessage( &illegal_vfd_value, lexstartsave );
      }
      nextLexBlank();               /* Skip colon.                            */
      value = (getExpr())->val;     /* Get field value.                       */
      if( line[lexterm] == ',' ) cc++;
      nextLexeme();                 /* Advance to next field.                 */
      pos = pos + width;
	  if( pos <= 18 )
	  {
        word = word | ((value & mask_tab[width]) << (18 - pos));
	  }
    }
    punchOutObject( clc, word );
    incrementClc();
    break;

  default:
    break;
  } /* end switch for pseudo-ops                                              */
  return( status );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb $0x1, %bl
cmpl $0xd, %edi
ja 0x4605
movl %edi, %eax
leaq 0x2150(%rip), %rcx      # 0x6074
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
leaq 0x1005e(%rip), %rbp     # 0x13f90
jmpq *%rax
movl $0xa, 0x10046(%rip)     # 0x13f84
jmp 0x4605
movslq 0x101c6(%rip), %rax     # 0x14110
leaq (%rax,%rbp), %r14
incq %r14
movb -0x1(%r14), %r15b
leal 0x2(%rax), %ebp
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%r14), %esi
cmpb %r15b, %sil
je 0x3f9c
testl %esi, %esi
je 0x3f9c
cmpl $0xa, %esi
je 0x3f9c
shll $0x6, %ecx
andl $0x3f, %esi
orl %ecx, %esi
cmpl $0x2, %eax
jge 0x3f7f
incl %eax
jmp 0x3f93
movl 0x83cb(%rip), %edi      # 0xc350
callq 0x4616
callq 0x463f
xorl %esi, %esi
xorl %eax, %eax
incl %ebp
incq %r14
movl %esi, %ecx
jmp 0x3f5c
movl 0x83ae(%rip), %edi      # 0xc350
cmpl $0x1, %eax
je 0x434e
xorl %esi, %esi
cmpl $0x2, %eax
jne 0x4353
shll $0x6, %ecx
jmp 0x4351
callq 0x2170
movq (%rax), %rax
movslq 0x10143(%rip), %rsi     # 0x14110
movsbq (%rsi,%rbp), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
je 0x40a5
callq 0x3ea6
movq %rax, %r14
callq 0x368c
movl (%r14), %eax
movl 0x80ed(%rip), %ecx      # 0xc0e0
cmpl $0x1, %ecx
sete %dl
testb %dl, %al
jne 0x428a
andl $0x1, %eax
xorl $0x2, %ecx
orl %eax, %ecx
je 0x428a
jmp 0x4316
movslq 0x100f5(%rip), %rcx     # 0x14110
movzbl (%rcx,%rbp), %eax
leal 0x1(%rcx), %edx
leaq 0x10297(%rip), %rcx     # 0x142c0
movl %edx, %esi
movslq %esi, %rdi
cmpb %al, (%rdi,%rcx)
jne 0x4040
cmpb %al, 0x1(%rdi,%rcx)
leaq 0x1(%rdi), %rsi
cmovel %esi, %edi
movl %edi, %esi
movslq %esi, %rsi
movzbl 0x1(%rsi,%rbp), %edi
incq %rsi
cmpb %al, %dil
je 0x432c
testl %edi, %edi
je 0x4339
cmpl $0xa, %edi
jne 0x402b
jmp 0x4339
movl $0x8, 0xff14(%rip)      # 0x13f84
jmp 0x4605
movl $0x3c, 0xff01(%rip)     # 0x13f80
xorl %ebx, %ebx
jmp 0x4605
callq 0x2170
movq (%rax), %rax
movslq 0x1007b(%rip), %rsi     # 0x14110
movsbq (%rsi,%rbp), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0x42e8
leaq 0x5d34(%rip), %rdi      # 0x9de0
callq 0x3d11
jmp 0x4605
movq 0x816b(%rip), %rax      # 0xc228
movq %rax, 0x815c(%rip)      # 0xc220
jmp 0x4605
xorl %r14d, %r14d
leaq 0x104ad(%rip), %r12     # 0x14580
movl 0x10036(%rip), %r13d    # 0x14110
movl %r13d, 0x4(%rsp)
xorl %r15d, %r15d
movslq %r13d, %rax
movzbl (%rax,%rbp), %ebx
cmpq $0x3c, %rbx
ja 0x40ff
movabsq $0x1000800000000401, %rax # imm = 0x1000800000000401
btq %rbx, %rax
jb 0x4153
cmpb $0x9, %bl
je 0x4153
cmpq $0x13, %r14
ja 0x4153
callq 0x2170
movl %r13d, %ecx
testl %r15d, %r15d
je 0x411a
movl %r15d, %ecx
movsbq %bl, %rdx
movq (%rax), %rax
movzwl (%rax,%rdx,2), %eax
btl $0xa, %eax
cmovael %ecx, %r15d
incq %r14
movl 0xffea(%rip), %edx      # 0x14120
movq %r12, %rdi
movl %r13d, %esi
callq 0x3bd4
callq 0x368c
movl 0xffc3(%rip), %r13d     # 0x14110
addq $0x7, %r12
jmp 0x40e2
testq %r14, %r14
je 0x4320
testl %r15d, %r15d
je 0x439e
leaq 0x5dc4(%rip), %rdi      # 0x9f30
movl %r15d, %esi
jmp 0x43bd
callq 0x37cd
cmpl $0x0, 0x5e14(%rip)      # 0x9f94
jne 0x4316
jmp 0x428a
xorl %r13d, %r13d
movl 0xfdef(%rip), %r12d     # 0x13f84
movl $0x0, 0x4(%rsp)
movslq 0xff6c(%rip), %r15      # 0x14110
movzbl (%r15,%rbp), %eax
cmpq $0x2f, %rax
ja 0x41c3
movabsq $0x800000000601, %rcx   # imm = 0x800000000601
btq %rax, %rcx
jb 0x425f
movl $0xa, 0xfdb7(%rip)      # 0x13f84
callq 0x37cd
movl 0x5dbb(%rip), %r14d     # 0x9f94
movl %r12d, 0xfda4(%rip)     # 0x13f84
testl %r14d, %r14d
setle %al
addl %r14d, %r13d
cmpl $0x13, %r13d
setge %cl
orb %al, %cl
jne 0x4201
movslq 0xff15(%rip), %rax      # 0x14110
cmpb $0x3a, (%rax,%rbp)
je 0x4210
leaq 0x5cc8(%rip), %rdi      # 0x9ed0
movl %r15d, %esi
callq 0x4944
callq 0x3d4f
callq 0x37cd
movl 0x5d74(%rip), %ebx      # 0x9f94
movslq 0xfef9(%rip), %rax      # 0x14120
cmpb $0x2c, (%rax,%rbp)
jne 0x4233
incl 0xfee9(%rip)            # 0x1411c
callq 0x368c
cmpl $0x12, %r13d
jg 0x419d
movslq %r14d, %rax
leaq 0x1e64(%rip), %rcx      # 0x60b0
andl (%rcx,%rax,4), %ebx
movb $0x12, %cl
subb %r13b, %cl
shll %cl, %ebx
orl %ebx, 0x4(%rsp)
jmp 0x419d
movl 0x80eb(%rip), %edi      # 0xc350
movl 0x4(%rsp), %esi
callq 0x4616
callq 0x463f
jmp 0x4603
callq 0x37cd
cmpl $0x0, 0x5d10(%rip)      # 0x9f94
je 0x4316
callq 0x5047
jmp 0x4605
movslq 0xfe75(%rip), %rax      # 0x14110
movzbl (%rax,%rbp), %eax
cmpq $0x2f, %rax
ja 0x4501
movabsq $0x800000000601, %rcx   # imm = 0x800000000601
btq %rax, %rcx
jae 0x4501
movl 0x8091(%rip), %edx      # 0xc354
leaq 0xfcc6(%rip), %rdi      # 0x13f90
xorl %ebx, %ebx
pushq $0x1
popq %rcx
xorl %esi, %esi
callq 0x39a7
jmp 0x4605
andq $0x0, 0x7f3d(%rip)      # 0xc220
jmp 0x4605
callq 0x3ea6
movq %rax, %r14
callq 0x368c
movl (%r14), %eax
movl 0x7de2(%rip), %ecx      # 0xc0e0
cmpl $0x1, %ecx
sete %dl
testb %dl, %al
jne 0x4316
andl $0x1, %eax
xorl $0x2, %ecx
orl %eax, %ecx
jne 0x428a
callq 0x50ca
jmp 0x4605
leaq 0x5bf9(%rip), %rdi      # 0x9f20
jmp 0x43b9
testl %eax, %eax
je 0x4339
cmpl $0xa, %eax
jne 0x454b
movl %esi, 0xfddd(%rip)      # 0x1411c
movl %esi, 0xfddb(%rip)      # 0x14120
leaq 0x5ba4(%rip), %rdi      # 0x9ef0
jmp 0x4381
shll $0xc, %ecx
movl %ecx, %esi
callq 0x4616
callq 0x463f
movzbl (%r14), %eax
cmpl $0xa, %eax
je 0x436a
testl %eax, %eax
jne 0x4390
decl %ebp
movl %ebp, 0xfdaa(%rip)      # 0x1411c
movl %ebp, 0xfda8(%rip)      # 0x14120
leaq 0x5b71(%rip), %rdi      # 0x9ef0
movl %ebp, %esi
callq 0x4944
callq 0x368c
jmp 0x4605
movl %ebp, 0xfd86(%rip)      # 0x1411c
movl %ebp, 0xfd84(%rip)      # 0x14120
jmp 0x4386
movslq 0x7fb7(%rip), %r15      # 0xc35c
cmpq $0x400, %r15            # imm = 0x400
jl 0x4521
leaq 0x5ba7(%rip), %rdi      # 0x9f60
movl 0x4(%rsp), %esi
callq 0x4944
xorl %r12d, %r12d
xorl %r15d, %r15d
movslq 0xfd41(%rip), %rax      # 0x14110
movzbl (%rax,%rbp), %eax
cmpq $0x2f, %rax
ja 0x43f3
movabsq $0x800000000401, %rcx   # imm = 0x800000000401
btq %rax, %rcx
jae 0x43f3
callq 0x33be
callq 0x368c
testb %r12b, %r12b
je 0x4489
movslq 0xfd0d(%rip), %rsi      # 0x14110
cmpb $0x3c, (%rsi,%rbp)
jne 0x4493
incl %esi
decq %r14
pushq $0x1
popq %r13
xorl %r12d, %r12d
cmpb $0x0, 0xfb68(%rip)      # 0x13f88
setne %al
movl 0xfcf3(%rip), %edx      # 0x1411c
movslq %edx, %rdx
testl %r13d, %r13d
jle 0x44a4
testb $0x1, %al
jne 0x44a4
movzbl (%rdx,%rbp), %eax
testl %eax, %eax
je 0x4472
cmpl $0xa, %eax
je 0x4472
cmpl $0x3e, %eax
je 0x4463
cmpl $0x3c, %eax
je 0x445e
cmpl $0x2f, %eax
je 0x4472
incq %rdx
movl %edx, 0xfcc2(%rip)      # 0x1411c
xorl %eax, %eax
jmp 0x442c
incl %r13d
jmp 0x4466
decl %r13d
incl %edx
movl %edx, 0xfcae(%rip)      # 0x1411c
xorl %eax, %eax
jmp 0x4429
movl %r12d, %edi
movl %r14d, %ecx
callq 0x4e17
movl %eax, %r12d
callq 0x33be
xorl %esi, %esi
jmp 0x4419
callq 0x5047
jmp 0x4603
leaq 0x5a66(%rip), %rdi      # 0x9f00
callq 0x4944
jmp 0x4603
decl %edx
movl %r12d, %edi
movl %r14d, %ecx
callq 0x4e17
testl %eax, %eax
js 0x45cf
je 0x45de
movl %eax, %r14d
leal 0x1(%r14), %edi
callq 0x2110
movq %rax, %r12
leaq 0x5b7b(%rip), %rax      # 0xa050
movq %r12, (%rax,%r15,8)
testq %r12, %r12
je 0x45ec
movl %r14d, %r14d
leaq 0x10124(%rip), %rsi     # 0x14610
movq %r12, %rdi
movq %r14, %rdx
callq 0x2050
movb $0x0, (%r12,%r14)
jmp 0x45fe
callq 0x37cd
movl $0x7fff, %eax           # imm = 0x7FFF
andl 0x5a83(%rip), %eax      # 0x9f94
movl %eax, 0x7e3d(%rip)      # 0xc354
callq 0x368c
jmp 0x42bd
leal 0x1(%r15), %eax
movl %eax, 0x7e31(%rip)      # 0xc35c
leaq 0x1004e(%rip), %rdi     # 0x14580
movl %r15d, %esi
movl $0x101, %edx            # imm = 0x101
movl 0x4(%rsp), %ecx
callq 0x2973
movb $0x1, %r12b
jmp 0x43c8
movq %rcx, %rsi
movslq %edx, %rdi
cmpb %al, (%rdi,%rcx)
jne 0x456a
movslq %edx, %rdi
cmpb %al, 0x1(%rdi,%rcx)
leaq 0x1(%rdi), %r14
cmovnel %edx, %r14d
movslq %r14d, %rdi
jmp 0x456d
movl %edx, %r14d
movb (%rdi,%rbp), %dl
movb %dl, (%rsi)
movslq %r14d, %rdx
movzbl 0x1(%rdx,%rbp), %edi
cmpb %al, %dil
je 0x458e
cmpl $0xa, %edi
je 0x458e
incq %rdx
incq %rsi
testl %edi, %edi
jne 0x454e
leaq 0xfd2b(%rip), %rdi      # 0x142c0
callq 0x20a0
cmpq $0x40, %rax
jb 0x45a7
movb $0x0, 0xfd58(%rip)      # 0x142ff
addl $0x2, %r14d
movl %r14d, 0xfb6a(%rip)     # 0x1411c
movl %r14d, 0xfb67(%rip)     # 0x14120
movl $0x3c, 0xf9bd(%rip)     # 0x13f80
movb $0x1, 0xf9b2(%rip)      # 0x13f7c
jmp 0x4386
movl 0xfb3b(%rip), %esi      # 0x14110
leaq 0x5964(%rip), %rdi      # 0x9f40
jmp 0x45f9
leaq 0x5a6b(%rip), %rax      # 0xa050
andq $0x0, (%rax,%r15,8)
jmp 0x45fe
movl 0xfb1e(%rip), %esi      # 0x14110
leaq 0x5957(%rip), %rdi      # 0x9f50
callq 0x4944
callq 0x368c
movb $0x1, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq