// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %r15d
movl %esi, %r12d
movl %edi, %ebp
movslq %esi, %rax
movslq %edx, %rdi
movb $0x1, %cl
leaq 0x114e4(%rip), %r13     # 0x17810
movabsq $0x4000000100001200, %r9 # imm = 0x4000000100001200
cmpq %rdi, %rax
jge 0x6355
movzbl (%rax,%r13), %r8d
cmpq $0x3e, %r8
ja 0x6351
btq %r8, %r9
jae 0x6351
incq %rax
jmp 0x6336
xorl %ecx, %ecx
jmp 0x634c
testb %cl, %cl
setne %al
testl %ebp, %ebp
sets %cl
orb %al, %cl
jne 0x6538
movl %ebp, %eax
subl %r12d, %eax
addl %edx, %eax
cmpl $0x1ffe, %eax           # imm = 0x1FFE
jle 0x637d
pushq $-0x1
popq %rbp
jmp 0x6538
movq %rdi, 0x38(%rsp)
movslq %r15d, %rax
xorl %ecx, %ecx
movq %rax, 0x30(%rsp)
testl %eax, %eax
cmovgl %r15d, %ecx
movq %rcx, 0x40(%rsp)
movl %r15d, 0x18(%rsp)
movl %edx, 0xc(%rsp)
movl %ebp, %r14d
cmpl 0xc(%rsp), %r12d
jge 0x6528
movq %rbp, 0x20(%rsp)
movq %r12, 0x10(%rsp)
movslq %r12d, %rbp
testl %r15d, %r15d
je 0x6424
callq 0x2190
movq (%rax), %rax
movsbq (%rbp,%r13), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
je 0x6429
movq 0x10(%rsp), %rdx
leal 0x1(%rdx), %ecx
movl %ecx, 0x1c(%rsp)
movq %rbp, %rbx
shlq $0x20, %rbx
leaq 0x1(%rbp), %rcx
movl %edx, %r13d
movq 0x38(%rsp), %rsi
movabsq $0x100000000, %rdi      # imm = 0x100000000
cmpq %rsi, %rcx
jge 0x6450
leaq 0x11406(%rip), %rdx     # 0x17810
movsbq (%rcx,%rdx), %rdx
incl %r13d
addq %rdi, %rbx
incq %rcx
testb $0x8, (%rax,%rdx,2)
jne 0x63fe
sarq $0x20, %rbx
jmp 0x6458
movb (%rbp,%r13), %cl
movq 0x10(%rsp), %r12
incl %r12d
movsbl %cl, %edi
callq 0x2080
movq 0x20(%rsp), %rbp
incl %ebp
leaq 0x121c9(%rip), %rcx     # 0x18610
movb %al, (%r14,%rcx)
jmp 0x63a0
movq %rsi, %rbx
movl 0xc(%rsp), %r13d
leaq 0x29(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x3fe9
leaq 0x12118(%rip), %rbp     # 0x18587
xorl %r12d, %r12d
movq %r12, %r15
cmpq %r12, 0x40(%rsp)
je 0x64c6
leaq 0x1(%r15), %r12
leaq 0x29(%rsp), %rdi
movq %rbp, %rsi
pushq $0x7
popq %rdx
callq 0x2060
addq $0x7, %rbp
testl %eax, %eax
jne 0x6472
addb $0x60, %r12b
leaq 0x1216d(%rip), %rax     # 0x18610
movb %r12b, (%r14,%rax)
movl 0x1c(%rsp), %edx
movl %edx, %eax
cmpl %r13d, %eax
jge 0x64cd
leaq 0x12157(%rip), %rcx     # 0x18610
movb $0x7a, 0x1(%r14,%rcx)
incl %eax
incq %r14
jmp 0x64ad
movq 0x20(%rsp), %rbp
jmp 0x64e1
cmpl %edx, %r13d
cmovgl %r13d, %edx
incl %r14d
movl %edx, %eax
movq %rax, 0x10(%rsp)
movl %r14d, %ebp
cmpq 0x30(%rsp), %r15
movl 0x18(%rsp), %r15d
leaq 0x1131e(%rip), %r13     # 0x17810
movq 0x10(%rsp), %r12
jl 0x63a0
movslq %r12d, %r12
movl %ebp, %ebp
cmpq %rbx, %r12
jge 0x63a0
movsbl (%r12,%r13), %edi
incq %r12
callq 0x2080
leaq 0x120f1(%rip), %rcx     # 0x18610
movb %al, (%rbp,%rcx)
incq %rbp
jmp 0x6502
incl %ebp
leaq 0x120df(%rip), %rax     # 0x18610
movw $0xa, (%r14,%rax)
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq