// File: /workspace/github_c_makefile_star2_O0/AK6DN[P]dec-utilities-for-pdp/palbart/palbart.c
// Function: main
int main( int argc, char *argv[] )
{
  int     ix;
  int     space;

  /* Set the default values for global symbols.                               */
  binary_data_output = FALSE;
  fltg_input = FALSE;
  literals_ok = TRUE;
  perm_redef_error = FALSE;
  print_permanent_symbols = FALSE;
  rim_mode = FALSE;
  dollar_not_required = FALSE;
  additional_enabled = FALSE;
  symtab_print = FALSE;
  xref = FALSE;
  pathname = NULL;

  /* Get the options and pathnames                                            */
  getArgs( argc, argv );

  /* Setup the error file in case symbol table overflows while installing the */
  /* permanent symbols.                                                       */
  errorfile = fopen( errorpathname, "w" );
  if (errorfile == NULL) {
    fprintf( stderr, "Could not open error file %s: %s\n", errorpathname, strerror(errno));
    exit( -1 );

  }
  errors = 0;
  save_error_count = 0;
  pass = 0;             /* This is required for symbol table initialization.  */
  symtab = (SYM_T *) malloc( sizeof( SYM_T ) * SYMBOL_TABLE_SIZE );

  if( symtab == NULL )
  {
    fprintf( stderr, "Could not allocate memory for symbol table.\n");
    exit( -1 );
  }

  /* Place end marker in symbol table.                                        */
  symtab[0] = sym_undefined;
  symbol_top = 0;
  number_of_fixed_symbols = symbol_top;
  fixed_symbols = &symtab[symbol_top - 1];

  /* Enter the pseudo-ops into the symbol table                               */
  for( ix = 0; ix < DIM( pseudo ) - 
        (additional_enabled ? 0 : NUMBER_ADDITIONAL_PSEUDO) ; ix++ )
  {
    defineSymbol( pseudo[ix].name, pseudo[ix].val, pseudo[ix].type, 0 );
  }

  /* Enter the predefined symbols into the table.                             */
  /* Also make them part of the permanent symbol table.                       */
  for( ix = 0; ix < DIM( really_permanent_symbols ); ix++ )
  {
    defineSymbol( really_permanent_symbols[ix].name,
                  really_permanent_symbols[ix].val,
                  really_permanent_symbols[ix].type | DEFFIX , 0 );
  }

  /* Enter the predefined symbols into the table.                             */
  /* Also make them part of the permanent symbol table.                       */
  for( ix = 0; ix < DIM( permanent_symbols ); ix++ )
  {
    defineSymbol( permanent_symbols[ix].name,
                  permanent_symbols[ix].val,
                  permanent_symbols[ix].type | DEFFIX , 0 );
  }

  number_of_fixed_symbols = symbol_top;
  fixed_symbols = &symtab[symbol_top - 1];

  /* Do pass one of the assembly                                              */
  checksum = 0;
  pass = 1;
  page_lineno = LIST_LINES_PER_PAGE;
  onePass();
  errors_pass_1 = errors;

  /* Set up for pass two                                                      */
  rewind( infile );
  /*Opened in main errorfile = fopen( errorpathname, "w" );*/
  objectfile = fopen( objectpathname, "wb" );
  if (objectfile == NULL) {
    fprintf( stderr, "Could not open object file %s: %s\n", objectpathname, strerror(errno));
    exit( -1 );

  }
  objectsave = objectfile;

  listfile = fopen( listpathname, "w" );
  if (listfile == NULL) {
    fprintf( stderr, "Could not open list file %s: %s\n", listpathname, strerror(errno));
    exit( -1 );

  }
  listsave = NULL;

  punchLeader( 0 );
  checksum = 0;

  /* Do pass two of the assembly                                              */
  errors = 0;
  save_error_count = 0;
  page_lineno = LIST_LINES_PER_PAGE;

  if( xref )
  {
    /* Get the amount of space that will be required for the concordance.     */
    for( space = 0, ix = 0; ix < symbol_top; ix++ )
    {
      symtab[ix].xref_index = space;    /* Index into concordance table.      */
      space += symtab[ix].xref_count + 1;
      symtab[ix].xref_count = 0;        /* Clear the count for pass 2.        */

    }
    /* Allocate the necessary space.                                          */
    xreftab = (WORD16 *) malloc( sizeof( WORD16 ) * space );

    /* Clear the cross reference space.                                       */
    for( ix = 0; ix < space; ix++ )
    {
      xreftab[ix] = 0;
    }
  }
  pass = 2;
  onePass();

  /* Undo effects of NOPUNCH for any following checksum                       */
  objectfile = objectsave;
  punchChecksum();

  /* Works great for trailer.                                                 */
  punchLeader( 8 );

  /* undo effects of XLIST for any following output to listing file.          */
  if( listfile == NULL )
  {
    listfile = listsave;
  }

  /* Display value of error counter.                                          */
  if( errors == 0 )
  {
    fprintf( listfile, "\n      %s %s %s\n", s_no, s_detected, s_errors );
  }
  else
  {
    fprintf( errorfile, "\n      %d %s %s\n", errors, s_detected,
                                        ( errors == 1 ? s_error : s_errors ));
    fprintf( listfile, "\n      %d %s %s\n", errors, s_detected,
                                        ( errors == 1 ? s_error : s_errors ));
    fprintf( stderr,   "      %d %s %s\n", errors, s_detected,
                                        ( errors == 1 ? s_error : s_errors ));
  }
  /* Display value of link counter.                                          */
  if( links == 0 )
  {
    fprintf( listfile, "      %s %s %s\n", s_no, s_links, s_generated );
  }
  else
  {
    fprintf( errorfile, "      %d %s %s\n", links, 
                                        ( links == 1 ? s_link : s_links ), 
                                        s_generated);
    fprintf( listfile, "      %d %s %s\n", links, 
                                        ( links == 1 ? s_link : s_links ), 
                                        s_generated);
    fprintf( stderr, "      %d %s %s\n", links, 
                                        ( links == 1 ? s_link : s_links ), 
                                        s_generated);
  }

  if( symtab_print )
  {
    printSymbolTable();
  }

  if( print_permanent_symbols )
  {
    printPermanentSymbolTable();
  }

  if( xref )
  {
    printCrossReference();
  }

  fclose( objectfile );
  fclose( listfile );
  fclose( errorfile );
  if( errors == 0 && errors_pass_1 == 0 )
  {
    remove( errorpathname );
  }

  return( errors != 0 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, 0xb0cb(%rip)      # 0xd3a8
movb $0x0, 0xb0c5(%rip)      # 0xd3a9
movb $0x1, 0xb0bf(%rip)      # 0xd3aa
movb $0x0, 0xb0b9(%rip)      # 0xd3ab
movb $0x0, 0xb0b3(%rip)      # 0xd3ac
movb $0x0, 0xb0ad(%rip)      # 0xd3ad
movb $0x0, 0xb0a7(%rip)      # 0xd3ae
movb $0x0, 0xb0a1(%rip)      # 0xd3af
movb $0x0, 0xb09b(%rip)      # 0xd3b0
movb $0x0, 0xb095(%rip)      # 0xd3b1
movq $0x0, 0xb091(%rip) # 0xd3b8
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2a90
leaq 0xb086(%rip), %rdi      # 0xd3c0
leaq 0x7205(%rip), %rsi      # 0x9546
callq 0x2150
movq %rax, 0xb0f3(%rip)      # 0xd440
cmpq $0x0, 0xb0eb(%rip)      # 0xd440
jne 0x2397
movq 0x9c9a(%rip), %rax      # 0xbff8
movq (%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x21a0
movq -0x20(%rbp), %rdi
movq %rax, %rcx
leaq 0x7377(%rip), %rsi      # 0x96f6
leaq 0xb03a(%rip), %rdx      # 0xd3c0
movb $0x0, %al
callq 0x2120
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2190
movl $0x0, 0xb0a7(%rip)      # 0xd448
movl $0x0, 0xb0a1(%rip)      # 0xd44c
movl $0x0, 0xb09b(%rip)      # 0xd450
movl $0x18000, %edi          # imm = 0x18000
callq 0x2130
movq %rax, 0xb092(%rip)      # 0xd458
cmpq $0x0, 0xb08a(%rip)      # 0xd458
jne 0x23f2
movq 0x9c21(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x7337(%rip), %rsi      # 0x9718
movb $0x0, %al
callq 0x2120
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2190
movq 0xb05f(%rip), %rax      # 0xd458
movq 0xaf90(%rip), %rcx      # 0xd390
movq %rcx, (%rax)
movq 0xaf8e(%rip), %rcx      # 0xd398
movq %rcx, 0x8(%rax)
movq 0xaf8b(%rip), %rcx      # 0xd3a0
movq %rcx, 0x10(%rax)
movl $0x0, 0xb03d(%rip)      # 0xd460
movl 0xb037(%rip), %eax      # 0xd460
movl %eax, 0xb035(%rip)      # 0xd464
movq 0xb022(%rip), %rax      # 0xd458
movl 0xb024(%rip), %ecx      # 0xd460
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0xb018(%rip)      # 0xd468
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movzbl 0xaf4d(%rip), %esi      # 0xd3af
movl $0x2, %ecx
xorl %edx, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
movslq %ecx, %rdx
movl $0x1e, %ecx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0x24d4
movslq -0x14(%rbp), %rax
leaq 0x9c76(%rip), %rdi      # 0xc100
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
movslq -0x14(%rbp), %rcx
leaq 0x9c60(%rip), %rax      # 0xc100
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0xc(%rax), %ax
movslq -0x14(%rbp), %rdx
leaq 0x9c4a(%rip), %rcx      # 0xc100
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %edx
xorl %ecx, %ecx
movswl %ax, %esi
callq 0x3250
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2457
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq $0x2, %rax
jae 0x253d
movslq -0x14(%rbp), %rax
leaq 0x9ee0(%rip), %rdi      # 0xc3d0
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
movslq -0x14(%rbp), %rcx
leaq 0x9eca(%rip), %rax      # 0xc3d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0xc(%rax), %ax
movslq -0x14(%rbp), %rdx
leaq 0x9eb4(%rip), %rcx      # 0xc3d0
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %edx
orl $0x3, %edx
xorl %ecx, %ecx
movswl %ax, %esi
callq 0x3250
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x24db
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq $0x87, %rax
jae 0x25a8
movslq -0x14(%rbp), %rax
leaq 0x9ea5(%rip), %rdi      # 0xc400
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
movslq -0x14(%rbp), %rcx
leaq 0x9e8f(%rip), %rax      # 0xc400
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0xc(%rax), %ax
movslq -0x14(%rbp), %rdx
leaq 0x9e79(%rip), %rcx      # 0xc400
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %edx
orl $0x3, %edx
xorl %ecx, %ecx
movswl %ax, %esi
callq 0x3250
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2544
movl 0xaeb2(%rip), %eax      # 0xd460
movl %eax, 0xaeb0(%rip)      # 0xd464
movq 0xae9d(%rip), %rax      # 0xd458
movl 0xae9f(%rip), %ecx      # 0xd460
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0xae93(%rip)      # 0xd468
movw $0x0, 0xae92(%rip)      # 0xd470
movl $0x1, 0xae68(%rip)      # 0xd450
movl $0x37, 0xae82(%rip)     # 0xd474
callq 0x34a0
movl 0xae4b(%rip), %eax      # 0xd448
movl %eax, 0xae75(%rip)      # 0xd478
movq 0xae76(%rip), %rdi      # 0xd480
callq 0x20b0
leaq 0xae7a(%rip), %rdi      # 0xd490
leaq 0x7128(%rip), %rsi      # 0x9745
callq 0x2150
movq %rax, 0xaee7(%rip)      # 0xd510
cmpq $0x0, 0xaedf(%rip)      # 0xd510
jne 0x2673
movq 0x99be(%rip), %rax      # 0xbff8
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x21a0
movq -0x28(%rbp), %rdi
movq %rax, %rcx
leaq 0x70ed(%rip), %rsi      # 0x9748
leaq 0xae2e(%rip), %rdx      # 0xd490
movb $0x0, %al
callq 0x2120
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2190
movq 0xae96(%rip), %rax      # 0xd510
movq %rax, 0xae97(%rip)      # 0xd518
leaq 0xae98(%rip), %rdi      # 0xd520
leaq 0x6eb7(%rip), %rsi      # 0x9546
callq 0x2150
movq %rax, 0xaf05(%rip)      # 0xd5a0
cmpq $0x0, 0xaefd(%rip)      # 0xd5a0
jne 0x26e5
movq 0x994c(%rip), %rax      # 0xbff8
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x2030
movl (%rax), %edi
callq 0x21a0
movq -0x30(%rbp), %rdi
movq %rax, %rcx
leaq 0x709e(%rip), %rsi      # 0x976b
leaq 0xae4c(%rip), %rdx      # 0xd520
movb $0x0, %al
callq 0x2120
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2190
movq $0x0, 0xaeb8(%rip) # 0xd5a8
xorl %edi, %edi
callq 0x3960
movw $0x0, 0xad70(%rip)      # 0xd470
movl $0x0, 0xad3e(%rip)      # 0xd448
movl $0x0, 0xad38(%rip)      # 0xd44c
movl $0x37, 0xad56(%rip)     # 0xd474
cmpb $0x0, 0xac8c(%rip)      # 0xd3b1
je 0x27de
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0xad1e(%rip), %eax      # 0xd460
jge 0x279e
movl -0x18(%rbp), %ecx
movq 0xad0a(%rip), %rax      # 0xd458
movslq -0x14(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq 0xacf5(%rip), %rax      # 0xd458
movslq -0x14(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
addl $0x1, %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movq 0xacd7(%rip), %rax      # 0xd458
movslq -0x14(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x14(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2739
movslq -0x18(%rbp), %rdi
shlq %rdi
callq 0x2130
movq %rax, 0xadff(%rip)      # 0xd5b0
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x27dc
movq 0xade9(%rip), %rax      # 0xd5b0
movslq -0x14(%rbp), %rcx
movw $0x0, (%rax,%rcx,2)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x27b8
jmp 0x27de
movl $0x2, 0xac68(%rip)      # 0xd450
callq 0x34a0
movq 0xad24(%rip), %rax      # 0xd518
movq %rax, 0xad15(%rip)      # 0xd510
callq 0x39d0
movl $0x8, %edi
callq 0x3960
cmpq $0x0, 0xad8e(%rip)      # 0xd5a0
jne 0x2822
movq 0xad8d(%rip), %rax      # 0xd5a8
movq %rax, 0xad7e(%rip)      # 0xd5a0
cmpl $0x0, 0xac1f(%rip)      # 0xd448
jne 0x285a
movq 0xad6e(%rip), %rdi      # 0xd5a0
leaq 0x6f53(%rip), %rsi      # 0x978c
leaq 0xa87e(%rip), %rdx      # 0xd0be
leaq 0xa861(%rip), %rcx      # 0xd0a8
leaq 0xa869(%rip), %r8       # 0xd0b7
movb $0x0, %al
callq 0x2120
jmp 0x2914
movq 0xabdf(%rip), %rdi      # 0xd440
movl 0xabe1(%rip), %edx      # 0xd448
movl 0xabdb(%rip), %ecx      # 0xd448
leaq 0xa843(%rip), %r8       # 0xd0b7
leaq 0xa836(%rip), %rax      # 0xd0b1
cmpl $0x1, %ecx
cmoveq %rax, %r8
leaq 0x6f14(%rip), %rsi      # 0x979d
leaq 0xa818(%rip), %rcx      # 0xd0a8
movb $0x0, %al
callq 0x2120
movq 0xad02(%rip), %rdi      # 0xd5a0
movl 0xaba4(%rip), %edx      # 0xd448
movl 0xab9e(%rip), %ecx      # 0xd448
leaq 0xa806(%rip), %r8       # 0xd0b7
leaq 0xa7f9(%rip), %rax      # 0xd0b1
cmpl $0x1, %ecx
cmoveq %rax, %r8
leaq 0x6ed7(%rip), %rsi      # 0x979d
leaq 0xa7db(%rip), %rcx      # 0xd0a8
movb $0x0, %al
callq 0x2120
movq 0x971d(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movl 0xab64(%rip), %edx      # 0xd448
movl 0xab5e(%rip), %ecx      # 0xd448
leaq 0xa7c6(%rip), %r8       # 0xd0b7
leaq 0xa7b9(%rip), %rax      # 0xd0b1
cmpl $0x1, %ecx
cmoveq %rax, %r8
leaq 0x6e98(%rip), %rsi      # 0x979e
leaq 0xa79b(%rip), %rcx      # 0xd0a8
movb $0x0, %al
callq 0x2120
cmpl $0x0, 0xac9d(%rip)      # 0xd5b8
jne 0x294c
movq 0xac7c(%rip), %rdi      # 0xd5a0
leaq 0x6e62(%rip), %rsi      # 0x978d
leaq 0xa78c(%rip), %rdx      # 0xd0be
leaq 0xa7c6(%rip), %rcx      # 0xd0ff
leaq 0xa7b0(%rip), %r8       # 0xd0f0
movb $0x0, %al
callq 0x2120
jmp 0x2a06
movq 0xaaed(%rip), %rdi      # 0xd440
movl 0xac5f(%rip), %edx      # 0xd5b8
movl 0xac59(%rip), %esi      # 0xd5b8
leaq 0xa799(%rip), %rcx      # 0xd0ff
leaq 0xa78d(%rip), %rax      # 0xd0fa
cmpl $0x1, %esi
cmoveq %rax, %rcx
leaq 0x6e23(%rip), %rsi      # 0x979e
leaq 0xa76e(%rip), %r8       # 0xd0f0
movb $0x0, %al
callq 0x2120
movq 0xac10(%rip), %rdi      # 0xd5a0
movl 0xac22(%rip), %edx      # 0xd5b8
movl 0xac1c(%rip), %esi      # 0xd5b8
leaq 0xa75c(%rip), %rcx      # 0xd0ff
leaq 0xa750(%rip), %rax      # 0xd0fa
cmpl $0x1, %esi
cmoveq %rax, %rcx
leaq 0x6de6(%rip), %rsi      # 0x979e
leaq 0xa731(%rip), %r8       # 0xd0f0
movb $0x0, %al
callq 0x2120
movq 0x962b(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movl 0xabe2(%rip), %edx      # 0xd5b8
movl 0xabdc(%rip), %esi      # 0xd5b8
leaq 0xa71c(%rip), %rcx      # 0xd0ff
leaq 0xa710(%rip), %rax      # 0xd0fa
cmpl $0x1, %esi
cmoveq %rax, %rcx
leaq 0x6da6(%rip), %rsi      # 0x979e
leaq 0xa6f1(%rip), %r8       # 0xd0f0
movb $0x0, %al
callq 0x2120
cmpb $0x0, 0xa9a3(%rip)      # 0xd3b0
je 0x2a14
callq 0x3a10
cmpb $0x0, 0xa991(%rip)      # 0xd3ac
je 0x2a22
callq 0x3c40
cmpb $0x0, 0xa988(%rip)      # 0xd3b1
je 0x2a30
callq 0x3e10
movq 0xaad9(%rip), %rdi      # 0xd510
callq 0x2090
movq 0xab5d(%rip), %rdi      # 0xd5a0
callq 0x2090
movq 0xa9f1(%rip), %rdi      # 0xd440
callq 0x2090
cmpl $0x0, 0xa9ed(%rip)      # 0xd448
jne 0x2a72
cmpl $0x0, 0xaa14(%rip)      # 0xd478
jne 0x2a72
leaq 0xa953(%rip), %rdi      # 0xd3c0
callq 0x2050
cmpl $0x0, 0xa9cf(%rip)      # 0xd448
setne %al
andb $0x1, %al
movzbl %al, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)