// File: /workspace/github_c_makefile_star2_O3/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:
cmpl %edx, %esi
jge 0x6d49
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r14d
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, 0x8(%rsp)
movslq %esi, %rax
movslq %edx, %rcx
movb $0x1, %dl
leaq 0x11b00(%rip), %r13     # 0x18820
movabsq $0x4000000100001200, %rsi # imm = 0x4000000100001200
movzbl (%rax,%r13), %edi
cmpq $0x3e, %rdi
ja 0x6d45
btq %rdi, %rsi
jae 0x6d45
incq %rax
cmpq %rax, %rcx
jne 0x6d2a
jmp 0x6d4c
xorl %edx, %edx
jmp 0x6d3b
movl %edi, %eax
retq
testb %dl, %dl
setne %al
movq 0x8(%rsp), %rdx
testl %edx, %edx
sets %cl
orb %al, %cl
jne 0x6fd4
movl %edx, %ecx
subl %ebp, %ecx
addl %r15d, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x1ffe, %ecx           # imm = 0x1FFE
jg 0x6fd6
cmpl %r15d, %ebp
jge 0x6fbe
movslq %r14d, %rax
xorl %ecx, %ecx
movq %rax, 0x28(%rsp)
testl %eax, %eax
cmovgl %r14d, %ecx
movq %rcx, 0x30(%rsp)
movl %r14d, 0x18(%rsp)
movl %r15d, 0x14(%rsp)
movslq %ebp, %rbx
testl %r14d, %r14d
je 0x6f0c
callq 0x21a0
movq (%rax), %rax
movsbq (%rbx,%r13), %rcx
testb $0x4, 0x1(%rax,%rcx,2)
je 0x6f10
leal 0x1(%rbp), %esi
movl %esi, %r12d
cmpl %r15d, %esi
jge 0x6df3
movslq %esi, %rcx
addq %r13, %rcx
movl %esi, %r12d
movsbq (%rcx), %rdx
testb $0x8, (%rax,%rdx,2)
je 0x6df3
incl %r12d
incq %rcx
cmpl %r12d, %r15d
jne 0x6ddb
movl %r15d, %r12d
movl %esi, 0x1c(%rsp)
movslq %r12d, %r13
leaq 0x21(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x423f
leaq 0x12786(%rip), %rbx     # 0x19597
xorl %r15d, %r15d
movq %r15, %r14
cmpq %r15, 0x30(%rsp)
je 0x6f37
leaq 0x1(%r14), %r15
movl $0x7, %edx
leaq 0x21(%rsp), %rdi
movq %rbx, %rsi
callq 0x2060
addq $0x7, %rbx
testl %eax, %eax
jne 0x6e14
movq 0x8(%rsp), %rcx
movl %ecx, %eax
addb $0x60, %r15b
leaq 0x127ce(%rip), %rdx     # 0x19620
movb %r15b, (%rax,%rdx)
movq %rcx, %r15
incl %r15d
movl 0x1c(%rsp), %ecx
cmpl %r12d, %ecx
jge 0x6f3e
movl %r15d, %edi
addq %rdx, %rdi
movl %r12d, %ebx
subl %ebp, %ebx
leal -0x2(%rbx), %edx
incq %rdx
movl $0x7a, %esi
callq 0x20d0
notl %ebp
andl $-0x2, %ebx
leal (%r12,%rbp), %eax
decl %eax
movd %r15d, %xmm0
movd %eax, %xmm1
pshufd $0x50, %xmm1, %xmm2     # xmm2 = xmm1[0,0,1,1]
movl $0x2, %eax
pcmpeqd %xmm3, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm3, %xmm0
movl %eax, %ecx
addl $-0x2, %eax
addl %ebx, %ecx
addl $-0x2, %ecx
cmpl $0x2, %ecx
jne 0x6ea6
negl %eax
movd %eax, %xmm3
pshufd $0x50, %xmm3, %xmm3     # xmm3 = xmm3[0,0,1,1]
por 0x1380(%rip), %xmm3     # 0x8250
movdqa 0x1388(%rip), %xmm4     # 0x8260
pxor %xmm4, %xmm2
pxor %xmm4, %xmm3
pcmpgtd %xmm2, %xmm3
pshufd $0x50, %xmm3, %xmm2     # xmm2 = xmm3[0,0,1,1]
pand %xmm2, %xmm1
pandn %xmm0, %xmm2
por %xmm1, %xmm2
pshufd $0xee, %xmm2, %xmm0     # xmm0 = xmm2[2,3,2,3]
paddq %xmm2, %xmm0
movd %xmm0, %eax
movq %rax, 0x8(%rsp)
jmp 0x6fa1
movb (%rbx,%r13), %cl
incl %ebp
movsbl %cl, %edi
callq 0x2080
movq 0x8(%rsp), %rdx
movl %edx, %ecx
incl %edx
movq %rdx, 0x8(%rsp)
leaq 0x126f1(%rip), %rdx     # 0x19620
movb %al, (%rcx,%rdx)
movl %ebp, %r12d
jmp 0x6fb2
movq 0x8(%rsp), %r15
jmp 0x6f40
movl %ecx, %ebp
cmpq 0x28(%rsp), %r14
jl 0x6f99
cmpl %r12d, %ebp
jge 0x6f99
movl %r15d, %r15d
movslq %ebp, %r14
subq %r14, %r13
xorl %ebx, %ebx
leaq 0x118c2(%rip), %rbp     # 0x18820
leaq (%r14,%rbx), %rax
movsbl (%rbp,%rax), %edi
callq 0x2080
leaq (%r15,%rbx), %rcx
leaq 0x126a9(%rip), %rdx     # 0x19620
movb %al, (%rdx,%rcx)
incq %rbx
cmpq %rbx, %r13
jne 0x6f5e
addl %ebx, %r15d
movq %r15, 0x8(%rsp)
movl 0x18(%rsp), %r14d
movl 0x14(%rsp), %r15d
movq %rbp, %r13
jmp 0x6fb2
movq %r15, 0x8(%rsp)
movl %ebp, %r12d
movl 0x18(%rsp), %r14d
movl 0x14(%rsp), %r15d
leaq 0x1186e(%rip), %r13     # 0x18820
movl %r12d, %ebp
cmpl %r15d, %r12d
jl 0x6da3
movq 0x8(%rsp), %rdx
movl %edx, %eax
incl %edx
leaq 0x12652(%rip), %rcx     # 0x19620
movw $0xa, (%rax,%rcx)
movl %edx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq