// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movl %ecx, %r14d
movl %edx, %r12d
movl %edi, %ebx
movb $0x1, %al
cmpl %edx, %esi
jge 0x6c96
movslq %esi, %rax
movslq %r12d, %rcx
movb $0x1, %dl
leaq 0x10bb8(%rip), %r9      # 0x17820
movabsq $0x4000000100001200, %rdi # imm = 0x4000000100001200
movzbl (%rax,%r9), %r8d
cmpq $0x3e, %r8
ja 0x6c8d
btq %r8, %rdi
jae 0x6c8d
incq %rax
cmpq %rax, %rcx
jne 0x6c72
jmp 0x6c91
xorl %edx, %edx
jmp 0x6c83
testb %dl, %dl
setne %al
testl %ebx, %ebx
sets %cl
orb %al, %cl
jne 0x6eba
movl %ebx, %ecx
subl %esi, %ecx
addl %r12d, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x1ffe, %ecx           # imm = 0x1FFE
jg 0x6ebc
cmpl %r12d, %esi
jge 0x6ea9
movslq %r14d, %rax
xorl %ecx, %ecx
movq %rax, 0x20(%rsp)
testl %eax, %eax
cmovgl %r14d, %ecx
movq %rcx, 0x28(%rsp)
leaq 0x11940(%rip), %r13     # 0x18620
movl %r14d, 0xc(%rsp)
movl %r12d, 0x8(%rsp)
movslq %esi, %rbp
testl %r14d, %r14d
je 0x6d18
movq %rsi, 0x10(%rsp)
callq 0x21a0
movq 0x10(%rsp), %rsi
movq (%rax), %rax
leaq 0x10b15(%rip), %rcx     # 0x17820
movsbq (%rbp,%rcx), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
jne 0x6d43
incl %esi
leaq 0x10aff(%rip), %rax     # 0x17820
movsbl (%rbp,%rax), %edi
movq %rsi, %r15
callq 0x2080
movq %r15, %rsi
movl %ebx, %ecx
incl %ebx
movb %al, (%rcx,%r13)
cmpl %r12d, %esi
jl 0x6cea
jmp 0x6ea9
incl %esi
movl %esi, %r14d
cmpl %r12d, %esi
leaq 0x31(%rsp), %r13
jge 0x6d7a
movslq %esi, %rcx
leaq 0x10ac4(%rip), %rdx     # 0x17820
addq %rdx, %rcx
movl %esi, %r14d
movsbq (%rcx), %rdx
testb $0x8, (%rax,%rdx,2)
je 0x6d7a
incl %r14d
incq %rcx
cmpl %r14d, %r12d
jne 0x6d62
movl %r12d, %r14d
movl %esi, 0x1c(%rsp)
movslq %r14d, %r15
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x422d
leaq 0x11801(%rip), %rbp     # 0x18597
xorl %r12d, %r12d
cmpq %r12, 0x28(%rsp)
je 0x6e1e
incq %r12
movl $0x7, %edx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2060
addq $0x7, %rbp
testl %eax, %eax
jne 0x6d99
leaq -0x1(%r12), %rax
cmpq 0x20(%rsp), %rax
setge %bpl
movl %ebx, %eax
addb $0x60, %r12b
leaq 0x1184a(%rip), %rcx     # 0x18620
movb %r12b, (%rax,%rcx)
leal 0x1(%rbx), %eax
movl 0x1c(%rsp), %edx
cmpl %r14d, %edx
jge 0x6e2e
movl %eax, %edi
addq %rcx, %rdi
movl %r14d, %edx
movq 0x10(%rsp), %r12
subl %r12d, %edx
addl $-0x2, %edx
incq %rdx
movl $0x7a, %esi
callq 0x20d0
movq %r12, %rcx
subl %r14d, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
decl %eax
cmpl %eax, %ecx
jne 0x6e11
subl %eax, %ebx
movl %r14d, %esi
jmp 0x6e32
cmpq 0x20(%rsp), %r12
setge %bpl
movq 0x10(%rsp), %rsi
jmp 0x6e32
movl %edx, %esi
movl %eax, %ebx
testb %bpl, %bpl
je 0x6e93
cmpl %r14d, %esi
leaq 0x109df(%rip), %rbp     # 0x17820
jge 0x6e93
movl %ebx, %ebx
movq %rsi, 0x10(%rsp)
movslq %esi, %r12
subq %r12, %r15
xorl %r14d, %r14d
leaq 0x117c6(%rip), %r13     # 0x18620
leaq (%r12,%r14), %rax
movsbl (%rbp,%rax), %edi
callq 0x2080
leaq (%rbx,%r14), %rcx
movb %al, (%r13,%rcx)
incq %r14
cmpq %r14, %r15
jne 0x6e5a
movq 0x10(%rsp), %rsi
addl %r14d, %esi
addl %r14d, %ebx
movl 0xc(%rsp), %r14d
movl 0x8(%rsp), %r12d
jmp 0x6d39
movl 0xc(%rsp), %r14d
movl 0x8(%rsp), %r12d
leaq 0x1177c(%rip), %r13     # 0x18620
jmp 0x6d39
movl %ebx, %eax
incl %ebx
leaq 0x1176c(%rip), %rcx     # 0x18620
movw $0xa, (%rax,%rcx)
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq