// File: /workspace/github_c_makefile_star2_O1/josch[P]stride/elem.c
// Function: FullElement
int FullElement(char *Asn1, char *Asn2, char *Asn3, int Length, char SecStrType, int ElemLength,
		 char EditChar, int *YYN, int *NYY, int *YNN, int *NNY)
{

  register int i, j, Count1, Count2, Count3;
  int Beg, ElLength;

  *YYN = 0;
  *NYY = 0;
  *YNN = 0;
  *NNY = 0;

  if( ElemLength >= Length )
    return(0);

  ElLength = ElemLength-1;
  Count1 = 0;
  Count2 = 0;
  Count3 = 0;

  Beg = -1;
  
  for( i=1; i<Length; i++ ) {
    if( ( i == 0 && 
	  ( Asn1[i] == SecStrType && Asn2[i] == SecStrType && Asn3[i] == SecStrType) ||
          ( Asn1[i] != SecStrType && Asn2[i] != SecStrType && Asn3[i] != SecStrType) )
       ||
        ( i  > 0 && 
	  ( Asn1[i] != Asn1[i-1] || Asn2[i] != Asn2[i-1] || Asn3[i] != Asn3[i-1] ) )
       ||
        i == Length-1 ) {
      
      if( Count1 >= ElLength && Count2 >= ElLength && Count3 <  ElLength ) 
	(*YYN)++;
      else
      if( Count1 <  ElLength && Count2 >= ElLength && Count3 >= ElLength ) 
	(*NYY)++;
      else
      if( Count1 >= ElLength && Count2 <  ElLength && Count3 <  ElLength ) 
	(*YNN)++;
      else
      if( Count1 <  ElLength && Count2 <  ElLength && Count3 >= ElLength ) 
	(*NNY)++;
      
/*       if( Count1 >= ElLength || Count2 >= ElLength || Count3 >= ElLength ) {
 * 	for( j=Beg-1; j<i; j++ ) {
 * 	  Asn1[j] = 'X';
 * 	  Asn2[j] = 'X';
 * 	  Asn3[j] = 'X';
 * 	}
 *       }
 * 
 */
      if( Count1 >= ElLength && ( Count2 < ElLength || Count3 < ElLength ) )
	for( j=Beg-1; j<i; j++ )
	  Asn1[j] = EditChar;

      if( Count2 >= ElLength && ( Count1 < ElLength || Count3 < ElLength ) )
	for( j=Beg-1; j<i; j++ )
	  Asn2[j] = EditChar;

      if( Count3 >= ElLength && ( Count1 < ElLength || Count2 < ElLength ) )
	for( j=Beg-1; j<i; j++ )
	  Asn3[j] = EditChar;

      Count1 = 0;
      Count2 = 0;
      Count3 = 0;
      Beg = -1;
      
    }
    else {
      if( Asn1[i] == SecStrType ) Count1++;
      if( Asn2[i] == SecStrType ) Count2++;
      if( Asn3[i] == SecStrType ) Count3++;
      if( Beg == -1 && (Count1 == 1 || Count2 == 1 || Count3 == 1) ) Beg = i;
    }
  }	

  CorrectAsn(Asn1,Length,SecStrType,EditChar,ElLength);
  CorrectAsn(Asn2,Length,SecStrType,EditChar,ElLength);
  CorrectAsn(Asn3,Length,SecStrType,EditChar,ElLength);

  return( (*YYN) * (*NYY) * (*YNN) * (*NNY) );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, %ebx
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %r10
movq 0xa0(%rsp), %r9
movq 0x98(%rsp), %rdx
movq 0x90(%rsp), %rdi
movq 0x88(%rsp), %rsi
xorl %eax, %eax
movl %eax, (%rsi)
movl %eax, (%rdi)
movl %eax, (%rdx)
movl %eax, (%r9)
cmpl %ecx, %ebx
jge 0x16ccb
decl %ebx
movq %rcx, 0x20(%rsp)
cmpl $0x2, %ecx
jl 0x16c51
movq 0x20(%rsp), %rax
leal -0x1(%rax), %ecx
movq %rcx, 0x28(%rsp)
movl %eax, %eax
movq %rax, 0x38(%rsp)
xorl %r9d, %r9d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %r15d
xorl %r12d, %r12d
xorl %r11d, %r11d
movq %r10, 0x40(%rsp)
movl %r8d, (%rsp)
movl %ebx, 0x1c(%rsp)
movb (%r10,%r15), %al
cmpb %r8b, %al
je 0x16a45
movq 0x10(%rsp), %rcx
cmpb %r8b, (%rcx,%r15)
je 0x16a45
movq 0x8(%rsp), %rcx
cmpb %r8b, (%rcx,%r15)
jne 0x16a84
cmpb -0x1(%r10,%r15), %al
jne 0x16a84
movq 0x10(%rsp), %rcx
movb (%rcx,%r15), %dl
cmpb -0x1(%rcx,%r15), %dl
jne 0x16a84
movq 0x8(%rsp), %rsi
movb (%rsi,%r15), %cl
cmpb -0x1(%rsi,%r15), %cl
setne %sil
cmpq %r15, 0x28(%rsp)
sete %dil
orb %sil, %dil
cmpb $0x1, %dil
jne 0x16c04
cmpl %ebx, %r11d
setl %al
cmpl %ebx, %r12d
setl %r14b
orb %al, %r14b
jne 0x16aa3
movq 0x88(%rsp), %rcx
cmpl %ebx, %r9d
jl 0x16aed
cmpl %ebx, %r11d
setge %al
jge 0x16abd
cmpl %ebx, %r12d
jl 0x16abd
movq 0x90(%rsp), %rcx
cmpl %ebx, %r9d
jge 0x16aed
cmpl %ebx, %r12d
setl %cl
andb %cl, %al
cmpb $0x1, %al
jne 0x16ad6
movq 0x98(%rsp), %rcx
cmpl %ebx, %r9d
jl 0x16aed
cmpl %ebx, %r11d
jge 0x16aef
cmpl %ebx, %r12d
jge 0x16aef
movq 0xa0(%rsp), %rcx
cmpl %ebx, %r9d
jl 0x16aef
incl (%rcx)
cmpl %ebx, %r9d
setl %al
cmpl %ebx, %r12d
setl %cl
leal -0x1(%rbp), %edx
movslq %ebp, %rsi
cmpl %ebx, %r11d
movl %edx, 0x4(%rsp)
jl 0x16b5e
orb %al, %cl
je 0x16b5e
cmpq %rsi, %r15
jl 0x16b5e
movslq %edx, %rdi
addq %r10, %rdi
movl %r15d, %edx
subl %ebp, %edx
incq %rdx
movq %rsi, 0x30(%rsp)
movzbl 0x80(%rsp), %esi
movl %r9d, %r13d
movl %r14d, %ebx
movl %r12d, %r14d
movq %rbp, %r12
movl %r11d, %ebp
callq 0x20f0
movq 0x30(%rsp), %rsi
movl 0x4(%rsp), %edx
movl %ebp, %r11d
movq %r12, %rbp
movl %r14d, %r12d
movl %ebx, %r14d
movl 0x1c(%rsp), %ebx
movl %r13d, %r9d
cmpl %ebx, %r9d
setl %al
cmpl %ebx, %r11d
setl %cl
cmpl %ebx, %r12d
jl 0x16ba5
orb %al, %cl
je 0x16ba5
cmpq %rsi, %r15
jl 0x16ba5
movslq %edx, %rdi
addq 0x10(%rsp), %rdi
movl %r15d, %edx
subl %ebp, %edx
incq %rdx
movq %rsi, %r12
movzbl 0x80(%rsp), %esi
movl %r9d, %r13d
callq 0x20f0
movq %r12, %rsi
movl 0x4(%rsp), %edx
movl %r13d, %r9d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %r11d, %r11d
cmpl %ebx, %r9d
jl 0x16be2
cmpq %rsi, %r15
setge %al
andb %al, %r14b
cmpb $0x1, %r14b
jne 0x16be2
movslq %edx, %rdi
addq 0x8(%rsp), %rdi
movl %r15d, %edx
subl %ebp, %edx
incq %rdx
movzbl 0x80(%rsp), %esi
callq 0x20f0
xorl %r11d, %r11d
xorl %r12d, %r12d
xorl %r9d, %r9d
movl (%rsp), %r8d
incq %r15
movl %r13d, %ebp
cmpq %r15, 0x38(%rsp)
movq 0x40(%rsp), %r10
jne 0x16a26
jmp 0x16c51
xorl %esi, %esi
cmpb %r8b, %al
sete %sil
addl %esi, %r11d
xorl %eax, %eax
cmpb %r8b, %dl
sete %al
addl %eax, %r12d
xorl %eax, %eax
cmpb %r8b, %cl
sete %al
addl %eax, %r9d
cmpl $-0x1, %ebp
je 0x16c30
movl %ebp, %r13d
jmp 0x16bec
movl %r15d, %r13d
cmpl $0x1, %r9d
je 0x16c3f
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl $0x1, %r12d
cmovel %r15d, %r13d
cmpl $0x1, %r11d
cmovel %r15d, %r13d
jmp 0x16bec
movsbl %r8b, %ebp
movsbl 0x80(%rsp), %r14d
movq %r10, %rdi
movq 0x20(%rsp), %r15
movl %r15d, %esi
movl %ebp, %edx
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x17d2c
movq 0x10(%rsp), %rdi
movl %r15d, %esi
movl %ebp, %edx
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x17d2c
movq 0x8(%rsp), %rdi
movl %r15d, %esi
movl %ebp, %edx
movl %r14d, %ecx
movl %ebx, %r8d
callq 0x17d2c
movq 0x90(%rsp), %rax
movl (%rax), %eax
movq 0x88(%rsp), %rcx
imull (%rcx), %eax
movq 0x98(%rsp), %rcx
imull (%rcx), %eax
movq 0xa0(%rsp), %rcx
imull (%rcx), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq