// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/crossassemblers/macro8x/macro8x.c
// Function: copyMacLine
int copyMacLine( int length, int from, int term, int nargs )
{
  char    name[SYMLEN];
  int     ix;
  int     jx;
  int     kx;
  BOOL    bl;

  bl = TRUE;
  for( ix = from; ix < term; ix++ )
  {
    if( !is_blank( line[ix] )) bl = FALSE;
  }
  if( bl || ( length < 0 )) return length;
  if(( length + term - from + 1) >= MAC_MAX_LENGTH ) return -1;
  for( ix = from; ix < term; )
  {
    if( nargs && isalpha( line[ix] ))      /* Start of symbol?                */
    {
      for( jx = ix + 1; jx < term; jx++)   /* Find end of symbol.             */
      {
        if( !isalnum( line[jx] )) break;
      }
      lexemeToName( name, ix, jx );        /* Make into name.                 */
      for( kx = 0; kx < nargs; kx++ )      /* Compare to arguments.           */
      {
        if( strncmp( name, &mac_arg_name[kx + 1][0], SYMLEN ) == 0 )
        {
           mac_buffer[length++] = 'a' + (char) kx;
           for( ix++; ix < jx; ix++ )
           {
             mac_buffer[length++] = 'z';
           }
           break;
        } /* end if strncmp                                                   */
      } /* end for kx                                                         */
      if( kx >= nargs )
      {
        for ( ; ix < jx; )
        {
          mac_buffer[length++] = toupper( line[ix++] );
		}
      }
    } /*end if nargs                                                          */
    else
    {
      mac_buffer[length++] = toupper( line[ix++] );
    } /* end else                                                            */
  } /* end for ix                                                            */
  mac_buffer[length++] = '\n';
  mac_buffer[length] = 0;
  return length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movb $0x1, -0x29(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x81c7
movslq -0x20(%rbp), %rcx
leaq 0x802f(%rip), %rax      # 0x101a0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x81ba
movslq -0x20(%rbp), %rcx
leaq 0x801b(%rip), %rax      # 0x101a0
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
je 0x81ba
movslq -0x20(%rbp), %rcx
leaq 0x8007(%rip), %rax      # 0x101a0
movsbl (%rax,%rcx), %eax
cmpl $0xc, %eax
je 0x81ba
movslq -0x20(%rbp), %rcx
leaq 0x7ff3(%rip), %rax      # 0x101a0
movsbl (%rax,%rcx), %eax
cmpl $0x3e, %eax
je 0x81ba
movb $0x0, -0x29(%rbp)
jmp 0x81bc
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x815e
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
jne 0x81d6
cmpl $0x0, -0x8(%rbp)
jge 0x81e1
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x83fe
movl -0x8(%rbp), %eax
addl -0x10(%rbp), %eax
subl -0xc(%rbp), %eax
addl $0x1, %eax
cmpl $0x2000, %eax           # imm = 0x2000
jl 0x8200
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x83fe
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x83d0
cmpl $0x0, -0x14(%rbp)
je 0x8393
callq 0x2180
movq (%rax), %rax
movslq -0x20(%rbp), %rdx
leaq 0x7f71(%rip), %rcx      # 0x101a0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x8393
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x828e
callq 0x2180
movq (%rax), %rax
movslq -0x24(%rbp), %rdx
leaq 0x7f34(%rip), %rcx      # 0x101a0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x8281
jmp 0x828e
jmp 0x8283
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x8251
leaq -0x1b(%rbp), %rdi
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x4c90
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8343
leaq -0x1b(%rbp), %rdi
movl -0x28(%rbp), %eax
addl $0x1, %eax
cltq
leaq 0x84dd(%rip), %rsi      # 0x107a0
imulq $0x7, %rax, %rax
addq %rax, %rsi
movl $0x7, %edx
callq 0x2060
cmpl $0x0, %eax
jne 0x8333
movl -0x28(%rbp), %eax
movsbl %al, %eax
addl $0x61, %eax
movb %al, %dl
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x8537(%rip), %rax      # 0x10830
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x8331
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x850e(%rip), %rax      # 0x10830
movb $0x7a, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x8305
jmp 0x8343
jmp 0x8335
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x82a4
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x8391
jmp 0x834d
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x838f
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp)
movslq %eax, %rcx
leaq 0x7e36(%rip), %rax      # 0x101a0
movsbl (%rax,%rcx), %edi
callq 0x2080
movb %al, %dl
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x84a6(%rip), %rax      # 0x10830
movb %dl, (%rax,%rcx)
jmp 0x834d
jmp 0x8391
jmp 0x83cb
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp)
movslq %eax, %rcx
leaq 0x7df8(%rip), %rax      # 0x101a0
movsbl (%rax,%rcx), %edi
callq 0x2080
movb %al, %dl
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x8468(%rip), %rax      # 0x10830
movb %dl, (%rax,%rcx)
jmp 0x8206
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x844b(%rip), %rax      # 0x10830
movb $0xa, (%rax,%rcx)
movslq -0x8(%rbp), %rcx
leaq 0x843c(%rip), %rax      # 0x10830
movb $0x0, (%rax,%rcx)
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)