// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edi, %r14d
cmpl %edx, %esi
jge 0x6992
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r12d
movslq %esi, %rax
movslq %edx, %rcx
movb $0x1, %dl
leaq 0x7a08(%rip), %r9       # 0xe0f0
movabsq $0x4000000100001200, %rsi # imm = 0x4000000100001200
movzbl (%rax,%r9), %edi
cmpq $0x3e, %rdi
ja 0x670d
btq %rdi, %rsi
jae 0x670d
incq %rax
cmpq %rax, %rcx
jne 0x66f2
jmp 0x6711
xorl %edx, %edx
jmp 0x6703
testb %dl, %dl
setne %al
testl %r14d, %r14d
sets %cl
orb %al, %cl
jne 0x6992
movl %r14d, %ecx
subl %r12d, %ecx
addl %r15d, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x1ffe, %ecx           # imm = 0x1FFE
jg 0x6995
cmpl %r15d, %r12d
jge 0x697f
movslq %ebp, %rax
xorl %ecx, %ecx
movq %rax, 0x18(%rsp)
testl %eax, %eax
cmovgl %ebp, %ecx
movq %rcx, 0x20(%rsp)
movl %ebp, 0x8(%rsp)
movl %r15d, 0x4(%rsp)
movslq %r12d, %rbx
testl %ebp, %ebp
je 0x68d5
callq 0x2190
leaq 0x7975(%rip), %rdx      # 0xe0f0
movq (%rax), %rax
movsbq (%rbx,%rdx), %rbx
testb $0x4, 0x1(%rax,%rbx,2)
je 0x68da
leal 0x1(%r12), %esi
movl %esi, %r13d
cmpl %r15d, %esi
jge 0x67bc
movslq %esi, %rcx
addq %rdx, %rcx
movl %esi, %r13d
movsbq (%rcx), %rdx
testb $0x8, (%rax,%rdx,2)
je 0x67bc
incl %r13d
incq %rcx
cmpl %r13d, %r15d
jne 0x67a4
movl %r15d, %r13d
movl %esi, 0xc(%rsp)
leaq 0x11(%rsp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x3fe6
leaq 0x7f20(%rip), %rbx      # 0xe6f7
xorl %ebp, %ebp
movq %rbp, %r15
cmpq %rbp, 0x20(%rsp)
je 0x6913
leaq 0x1(%r15), %rbp
movl $0x7, %edx
leaq 0x11(%rsp), %rdi
movq %rbx, %rsi
callq 0x2070
addq $0x7, %rbx
testl %eax, %eax
jne 0x67d9
movl %r14d, %eax
addb $0x60, %bpl
leaq 0x7f6d(%rip), %rcx      # 0xe780
movb %bpl, (%rax,%rcx)
incl %r14d
movl 0xc(%rsp), %eax
cmpl %r13d, %eax
jge 0x6910
movl %r14d, %edi
addq %rcx, %rdi
movl %r13d, %ebx
subl %r12d, %ebx
leal -0x2(%rbx), %edx
incq %rdx
movl $0x7a, %esi
callq 0x20d0
notl %r12d
andl $-0x2, %ebx
leal (%r12,%r13), %eax
decl %eax
movd %r14d, %xmm0
movd %eax, %xmm1
pshufd $0x50, %xmm1, %xmm2     # xmm2 = xmm1[0,0,1,1]
movl $0x2, %eax
movl 0x8(%rsp), %ebp
movl 0x4(%rsp), %r15d
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 0x686f
negl %eax
movd %eax, %xmm3
pshufd $0x50, %xmm3, %xmm3     # xmm3 = xmm3[0,0,1,1]
por 0x7a7(%rip), %xmm3      # 0x7040
movdqa 0x7af(%rip), %xmm4      # 0x7050
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, %r14d
leaq 0x781d(%rip), %r9       # 0xe0f0
jmp 0x6902
movsbq (%rbx,%r9), %rbx
callq 0x2030
leaq 0x780a(%rip), %r9       # 0xe0f0
movq (%rax), %rax
incl %r12d
movb (%rax,%rbx,4), %al
movl %r14d, %ecx
incl %r14d
leaq 0x7e84(%rip), %rdx      # 0xe780
movb %al, (%rcx,%rdx)
movl %r12d, %r13d
movl %r13d, %r12d
cmpl %r15d, %r13d
jl 0x6764
jmp 0x697f
movl %eax, %r12d
movl 0x8(%rsp), %ebp
leaq 0x77d2(%rip), %r9       # 0xe0f0
cmpq 0x18(%rsp), %r15
jl 0x6975
cmpl %r13d, %r12d
movl 0x4(%rsp), %r15d
jge 0x68ff
callq 0x2030
leaq 0x77b5(%rip), %r9       # 0xe0f0
movl %r14d, %r14d
movslq %r12d, %rcx
movslq %r13d, %rsi
subq %rcx, %rsi
xorl %edx, %edx
leaq 0x7e30(%rip), %r10      # 0xe780
movq (%rax), %rdi
leaq (%rcx,%rdx), %r8
movsbq (%r9,%r8), %r8
movb (%rdi,%r8,4), %dil
leaq (%r14,%rdx), %r8
movb %dil, (%r10,%r8)
incq %rdx
cmpq %rdx, %rsi
jne 0x6950
addl %edx, %r14d
jmp 0x6902
movl %r12d, %r13d
movl 0x4(%rsp), %r15d
jmp 0x6902
movl %r14d, %eax
incl %r14d
leaq 0x7df4(%rip), %rcx      # 0xe780
movw $0xa, (%rax,%rcx)
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq