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

  save_argc = argc;
  save_argv = argv;

  /* Set the default values for global symbols.                               */
  binary_data_output = FALSE;
  fltg_input = FALSE;
  nomac_exp = TRUE;
  print_permanent_symbols = FALSE;
  rim_mode = FALSE;
  symtab_print = FALSE;
  xref = FALSE;
  memmap = FALSE;
  pathname = NULL;
  for( ix = 0; ix < MAC_TABLE_LENGTH; ix++ )
  {
    mac_bodies[ix] = 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" );
  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 ); 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( 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];

  /* clear the memory map 						      */
  for( ix = 0; ix < sizeof(memory_map); ix++ ) memory_map[ix] = FALSE;
  memory_min = sizeof(memory_map)+1;
  memory_max = -memory_min;

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

  /* Set up for pass two                                                      */
  errorfile = fopen( errorpathname, "w" );
  objectfile = fopen( objectpathname, "wb" );
  objectsave = objectfile;

  listfile = fopen( listpathname, "w" );
  listsave = listfile;

  punchLeader( LEADER_LENGTH );
  checksum = 0;

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

  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 = (WORD32 *) malloc( sizeof( WORD32 ) * 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( TRAILER_LENGTH );

  /* undo effects of NOLIST for any following output to listing file.         */
  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 ));
  }

  if( symtab_print )
  {
    printSymbolTable();
  }

  if( print_permanent_symbols )
  {
    printPermanentSymbolTable();
  }

  if( xref )
  {
    printCrossReference();
  }

  if( memmap )
  {
    printMemoryMap();
  }

  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 $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %eax
movl %eax, 0xca61(%rip)      # 0xed20
movq -0x10(%rbp), %rax
movq %rax, 0xca5e(%rip)      # 0xed28
movb $0x0, 0xca5f(%rip)      # 0xed30
movb $0x0, 0xca59(%rip)      # 0xed31
movb $0x1, 0xca53(%rip)      # 0xed32
movb $0x0, 0xca4d(%rip)      # 0xed33
movb $0x0, 0xca47(%rip)      # 0xed34
movb $0x0, 0xca41(%rip)      # 0xed35
movb $0x0, 0xca3b(%rip)      # 0xed36
movb $0x0, 0xca35(%rip)      # 0xed37
movq $0x0, 0xca2b(%rip) # 0xed38
movl $0x0, -0x14(%rbp)
cmpl $0x400, -0x14(%rbp)     # imm = 0x400
jge 0x233b
movslq -0x14(%rbp), %rcx
leaq 0xca18(%rip), %rax      # 0xed40
movq $0x0, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2314
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x28a0
leaq 0xe9f2(%rip), %rdi      # 0x10d40
leaq 0x80dc(%rip), %rsi      # 0xa431
callq 0x2150
movq %rax, 0xea5f(%rip)      # 0x10dc0
movl $0x0, 0xea5d(%rip)      # 0x10dc8
movl $0x0, 0xea57(%rip)      # 0x10dcc
movq $0x0, 0xea50(%rip) # 0x10dd0
movl $0x50000, %edi          # imm = 0x50000
callq 0x2130
movq %rax, 0xea47(%rip)      # 0x10dd8
cmpq $0x0, 0xea3f(%rip)      # 0x10dd8
jne 0x23bd
movq 0xac56(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x82de(%rip), %rsi      # 0xa68a
movb $0x0, %al
callq 0x2110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2180
movq 0xea14(%rip), %rdi      # 0x10dd8
leaq 0xc92d(%rip), %rsi      # 0xecf8
movl $0x28, %edx
callq 0x2120
movl $0x0, 0xea01(%rip)      # 0x10de0
movl 0xe9fb(%rip), %eax      # 0x10de0
movl %eax, 0xe9f9(%rip)      # 0x10de4
movq 0xe9e6(%rip), %rax      # 0x10dd8
movl 0xe9e8(%rip), %ecx      # 0x10de0
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0xe9dc(%rip)      # 0x10de8
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq $0x23, %rax
jae 0x2471
movslq -0x14(%rbp), %rax
leaq 0xacb8(%rip), %rdi      # 0xd0e0
imulq $0x28, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
movslq -0x14(%rbp), %rcx
leaq 0xaca2(%rip), %rax      # 0xd0e0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movslq -0x14(%rbp), %rcx
leaq 0xac8c(%rip), %rax      # 0xd0e0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2de0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2413
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq $0x78, %rax
jae 0x24d9
movslq -0x14(%rbp), %rax
leaq 0xb1d3(%rip), %rdi      # 0xd660
imulq $0x28, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
movslq -0x14(%rbp), %rcx
leaq 0xb1bd(%rip), %rax      # 0xd660
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movslq -0x14(%rbp), %rcx
leaq 0xb1a7(%rip), %rax      # 0xd660
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
orl $0x3, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2de0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2478
movl 0xe901(%rip), %eax      # 0x10de0
movl %eax, 0xe8ff(%rip)      # 0x10de4
movq 0xe8ec(%rip), %rax      # 0x10dd8
movl 0xe8ee(%rip), %ecx      # 0x10de0
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0xe8e2(%rip)      # 0x10de8
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
cmpq $0x8000, %rax           # imm = 0x8000
jae 0x2533
movslq -0x14(%rbp), %rcx
leaq 0xe8cc(%rip), %rax      # 0x10df0
movb $0x0, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x250d
movq $0x8001, 0x168b2(%rip) # imm = 0x8001
xorl %eax, %eax
subq 0x168a9(%rip), %rax     # 0x18df0
movq %rax, 0x168aa(%rip)     # 0x18df8
movq $0x0, 0x168a7(%rip) # 0x18e00
movq $0x1, 0xe86c(%rip) # 0x10dd0
callq 0x2f70
movl 0xe859(%rip), %eax      # 0x10dc8
movl %eax, 0x16893(%rip)     # 0x18e08
movq 0xe844(%rip), %rdi      # 0x10dc0
callq 0x20a0
leaq 0xe7b8(%rip), %rdi      # 0x10d40
leaq 0x7ea2(%rip), %rsi      # 0xa431
callq 0x2150
movq %rax, 0xe825(%rip)      # 0x10dc0
leaq 0x1686e(%rip), %rdi     # 0x18e10
leaq 0x810e(%rip), %rsi      # 0xa6b7
callq 0x2150
movq %rax, 0x168db(%rip)     # 0x18e90
movq 0x168d4(%rip), %rax     # 0x18e90
movq %rax, 0x168d5(%rip)     # 0x18e98
leaq 0x168d6(%rip), %rdi     # 0x18ea0
leaq 0x7e60(%rip), %rsi      # 0xa431
callq 0x2150
movq %rax, 0x16943(%rip)     # 0x18f20
movq 0x1693c(%rip), %rax     # 0x18f20
movq %rax, 0x1693d(%rip)     # 0x18f28
movl $0x10, %edi
callq 0x3740
movq $0x0, 0x16800(%rip) # 0x18e00
movl $0x0, 0xe7be(%rip)      # 0x10dc8
movl $0x0, 0xe7b8(%rip)      # 0x10dcc
cmpb $0x0, 0xc71b(%rip)      # 0xed36
je 0x26e0
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0xe7a8(%rip), %eax      # 0x10de0
jge 0x269d
movslq -0x18(%rbp), %rcx
movq 0xe793(%rip), %rax      # 0x10dd8
movslq -0x14(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq 0xe77d(%rip), %rax      # 0x10dd8
movslq -0x14(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movslq -0x18(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x18(%rbp)
movq 0xe759(%rip), %rax      # 0x10dd8
movslq -0x14(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x20(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x262f
movslq -0x18(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2130
movq %rax, 0x1687f(%rip)     # 0x18f30
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x26de
movq 0x16869(%rip), %rax     # 0x18f30
movslq -0x14(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x26b8
jmp 0x26e0
movq $0x2, 0xe6e5(%rip) # 0x10dd0
callq 0x2f70
movq 0x167a1(%rip), %rax     # 0x18e98
movq %rax, 0x16792(%rip)     # 0x18e90
callq 0x37c0
movl $0x10, %edi
callq 0x3740
movq 0x16814(%rip), %rax     # 0x18f28
movq %rax, 0x16805(%rip)     # 0x18f20
cmpl $0x0, 0xe6a6(%rip)      # 0x10dc8
jne 0x2753
movq 0x167f5(%rip), %rdi     # 0x18f20
leaq 0x7f88(%rip), %rsi      # 0xa6ba
leaq 0xc1fd(%rip), %rdx      # 0xe936
leaq 0xc1e0(%rip), %rcx      # 0xe920
leaq 0xc1e8(%rip), %r8       # 0xe92f
movb $0x0, %al
callq 0x2110
jmp 0x280d
movq 0xe666(%rip), %rdi      # 0x10dc0
movl 0xe668(%rip), %edx      # 0x10dc8
movl 0xe662(%rip), %ecx      # 0x10dc8
leaq 0xc1c2(%rip), %r8       # 0xe92f
leaq 0xc1b5(%rip), %rax      # 0xe929
cmpl $0x1, %ecx
cmoveq %rax, %r8
leaq 0x7f49(%rip), %rsi      # 0xa6cb
leaq 0xc197(%rip), %rcx      # 0xe920
movb $0x0, %al
callq 0x2110
movq 0x16789(%rip), %rdi     # 0x18f20
movl 0xe62b(%rip), %edx      # 0x10dc8
movl 0xe625(%rip), %ecx      # 0x10dc8
leaq 0xc185(%rip), %r8       # 0xe92f
leaq 0xc178(%rip), %rax      # 0xe929
cmpl $0x1, %ecx
cmoveq %rax, %r8
leaq 0x7f0c(%rip), %rsi      # 0xa6cb
leaq 0xc15a(%rip), %rcx      # 0xe920
movb $0x0, %al
callq 0x2110
movq 0xa824(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movl 0xe5eb(%rip), %edx      # 0x10dc8
movl 0xe5e5(%rip), %ecx      # 0x10dc8
leaq 0xc145(%rip), %r8       # 0xe92f
leaq 0xc138(%rip), %rax      # 0xe929
cmpl $0x1, %ecx
cmoveq %rax, %r8
leaq 0x7ecd(%rip), %rsi      # 0xa6cc
leaq 0xc11a(%rip), %rcx      # 0xe920
movb $0x0, %al
callq 0x2110
cmpb $0x0, 0xc521(%rip)      # 0xed35
je 0x281b
callq 0x3800
cmpb $0x0, 0xc511(%rip)      # 0xed33
je 0x2829
callq 0x3a30
cmpb $0x0, 0xc506(%rip)      # 0xed36
je 0x2837
callq 0x3c00
cmpb $0x0, 0xc4f9(%rip)      # 0xed37
je 0x2845
callq 0x3e60
movq 0x16644(%rip), %rdi     # 0x18e90
callq 0x20a0
movq 0x166c8(%rip), %rdi     # 0x18f20
callq 0x20a0
movq 0xe55c(%rip), %rdi      # 0x10dc0
callq 0x20a0
cmpl $0x0, 0xe558(%rip)      # 0x10dc8
jne 0x2887
cmpl $0x0, 0x1658f(%rip)     # 0x18e08
jne 0x2887
leaq 0xe4be(%rip), %rdi      # 0x10d40
callq 0x2050
cmpl $0x0, 0xe53a(%rip)      # 0x10dc8
setne %al
andb $0x1, %al
movzbl %al, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)