// File: /workspace/github_c_makefile_star2_O0/AK6DN[P]dec-utilities-for-pdp/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 && is_alpha( line[ix] ))      /* Start of symbol?                */
    {
      for( jx = ix + 1; jx < term; jx++)   /* Find end of symbol.             */
      {
        if( !is_alnum( 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++] = to_upper( line[ix++] );
		}
      }
    } /*end if nargs                                                          */
    else
    {
      mac_buffer[length++] = to_upper( 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 0x8c17
movslq -0x20(%rbp), %rcx
leaq 0x11cff(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x8c0a
movslq -0x20(%rbp), %rcx
leaq 0x11ceb(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
je 0x8c0a
movslq -0x20(%rbp), %rcx
leaq 0x11cd7(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0xc, %eax
je 0x8c0a
movslq -0x20(%rbp), %rcx
leaq 0x11cc3(%rip), %rax     # 0x1a8c0
movsbl (%rax,%rcx), %eax
cmpl $0x3e, %eax
je 0x8c0a
movb $0x0, -0x29(%rbp)
jmp 0x8c0c
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x8bae
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
jne 0x8c26
cmpl $0x0, -0x8(%rbp)
jge 0x8c31
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8e50
movl -0x8(%rbp), %eax
addl -0x10(%rbp), %eax
subl -0xc(%rbp), %eax
addl $0x1, %eax
cmpl $0x2000, %eax           # imm = 0x2000
jl 0x8c50
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8e50
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x8e22
cmpl $0x0, -0x14(%rbp)
je 0x8de5
callq 0x2190
movq (%rax), %rax
movslq -0x20(%rbp), %rdx
leaq 0x11c41(%rip), %rcx     # 0x1a8c0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x8de5
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x8cde
callq 0x2190
movq (%rax), %rax
movslq -0x24(%rbp), %rdx
leaq 0x11c04(%rip), %rcx     # 0x1a8c0
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x8cd1
jmp 0x8cde
jmp 0x8cd3
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x8ca1
leaq -0x1b(%rbp), %rdi
movslq -0x20(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x5090
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8d95
leaq -0x1b(%rbp), %rdi
movl -0x28(%rbp), %eax
addl $0x1, %eax
cltq
leaq 0x1291b(%rip), %rsi     # 0x1b630
imulq $0x7, %rax, %rax
addq %rax, %rsi
movl $0x7, %edx
callq 0x2060
cmpl $0x0, %eax
jne 0x8d85
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 0x12975(%rip), %rax     # 0x1b6c0
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x8d83
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x1294c(%rip), %rax     # 0x1b6c0
movb $0x7a, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x8d57
jmp 0x8d95
jmp 0x8d87
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x8cf6
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x8de3
jmp 0x8d9f
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x8de1
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp)
movslq %eax, %rcx
leaq 0x11b04(%rip), %rax     # 0x1a8c0
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 0x128e4(%rip), %rax     # 0x1b6c0
movb %dl, (%rax,%rcx)
jmp 0x8d9f
jmp 0x8de3
jmp 0x8e1d
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp)
movslq %eax, %rcx
leaq 0x11ac6(%rip), %rax     # 0x1a8c0
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 0x128a6(%rip), %rax     # 0x1b6c0
movb %dl, (%rax,%rcx)
jmp 0x8c56
movl -0x8(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
movslq %eax, %rcx
leaq 0x12889(%rip), %rax     # 0x1b6c0
movb $0xa, (%rax,%rcx)
movslq -0x8(%rbp), %rcx
leaq 0x1287a(%rip), %rax     # 0x1b6c0
movb $0x0, (%rax,%rcx)
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)