// File: /workspace/github_c_makefile_star2_O3/josch[P]stride/fillasn.c
// Function: MakeEnds
int MakeEnds(int *Beg1, int ResBeg1, int NeiBeg1, char *Beg1Cn, char ResBeg1Cn, int *End1, 
	     int ResEnd1, int NeiEnd1, char ResEnd1Cn, int *Beg2, int ResBeg2, int NeiBeg2, 
	     char *Beg2Cn, char ResBeg2Cn, int *End2, int ResEnd2, int NeiEnd2, 
	     char ResEnd2Cn, PATTERN **Pat, int NPat)
{

  register int i;
  int Flag1 = 0, Flag2 = 0;


  if( ResBeg1 <= NeiBeg1 && NeiBeg1 <= NeiEnd1 && NeiEnd1 <= ResEnd1 &&
      ResBeg2 <= NeiBeg2 && NeiBeg2 <= NeiEnd2 && NeiEnd2 <= ResEnd2 &&
      ResBeg1Cn == ResEnd1Cn && ResBeg2Cn == ResEnd2Cn ) {

    *Beg1 = ResBeg1;
    *End1 = ResEnd1;
    *Beg2 = ResBeg2;
    *End2 = ResEnd2;
    *Beg1Cn = ResBeg1Cn;
    *Beg2Cn = ResBeg2Cn;
    
    for( i=0; i<NPat && (Flag1 == 0 || Flag2 == 0); i++ ) {
      if( ( (Pat[i]->Hb1->Dnr->D_Res == (*Beg1) 
	     && Pat[i]->Hb1->Acc->A_Res == (*End2)
	     && Pat[i]->Hb1->Dnr->Chain->Id == (*Beg1Cn)
	     && Pat[i]->Hb1->Acc->Chain->Id == (*Beg2Cn) ) 
	   ||
	   (Pat[i]->Hb1->Acc->A_Res == (*Beg1) 
	    && Pat[i]->Hb1->Dnr->D_Res == (*End2) 
	    && Pat[i]->Hb1->Acc->Chain->Id == (*Beg1Cn)
	    && Pat[i]->Hb1->Dnr->Chain->Id == (*Beg2Cn) ) ) 
	 && Pat[i]->Hb1->Dnr->D_Res == Pat[i]->Hb2->Acc->A_Res 
	 && Pat[i]->Hb2->Dnr->D_Res == Pat[i]->Hb1->Acc->A_Res )
	Flag1 = 1; 
      if( ( (Pat[i]->Hb1->Dnr->D_Res == (*Beg2) 
	     && Pat[i]->Hb1->Acc->A_Res == (*End1) 
	     && Pat[i]->Hb1->Dnr->Chain->Id == (*Beg2Cn)
	     && Pat[i]->Hb1->Acc->Chain->Id == (*Beg1Cn) ) 
	   ||
	   (Pat[i]->Hb1->Acc->A_Res == (*Beg2) 
	    && Pat[i]->Hb1->Dnr->D_Res == (*End1) 
	    && Pat[i]->Hb1->Acc->Chain->Id == (*Beg2Cn)
	    && Pat[i]->Hb1->Dnr->Chain->Id == (*Beg1Cn) ) ) 
	 && Pat[i]->Hb1->Dnr->D_Res == Pat[i]->Hb2->Acc->A_Res 
	 && Pat[i]->Hb2->Dnr->D_Res == Pat[i]->Hb1->Acc->A_Res )
	Flag2 = 1; 
    }
    
    if( !Flag1 ) {
      if( *Beg1 != NeiBeg1 ) (*Beg1)++;
      if( *End2 != NeiEnd2 ) (*End2)--;
    }
    
    if( !Flag2 ) {
      if( *End1 != NeiEnd1 ) (*End1)--;
      if( *Beg2 != NeiBeg2 ) (*Beg2)++;
    }
    return(SUCCESS);
  }
  
  return(FAILURE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movb 0x70(%rsp), %r10b
xorl %eax, %eax
cmpb 0x90(%rsp), %r10b
jne 0xd972
cmpb 0x48(%rsp), %r8b
jne 0xd972
movl 0x88(%rsp), %ebx
movl 0x80(%rsp), %r13d
cmpl %r13d, %ebx
jg 0xd972
movl 0x40(%rsp), %ebp
movl 0x38(%rsp), %r10d
cmpl %r10d, %ebp
jg 0xd972
cmpl %edx, %esi
jg 0xd972
cmpl %ebp, %edx
jg 0xd972
movl 0x60(%rsp), %r15d
movl 0x58(%rsp), %r11d
cmpl %r15d, %r11d
jg 0xd972
cmpl %ebx, %r15d
jg 0xd972
movl 0xa0(%rsp), %ebx
movq 0x78(%rsp), %rax
movq 0x68(%rsp), %r14
movq 0x50(%rsp), %r12
movl %esi, (%rdi)
movq %rax, %rsi
movl %r10d, (%r9)
movl %r11d, (%r12)
movl %r13d, (%rax)
movb %r8b, (%rcx)
movb 0x70(%rsp), %al
movb %al, (%r14)
testl %ebx, %ebx
jle 0xd927
movl %edx, -0x4(%rsp)
movl %ebx, %r8d
xorl %r12d, %r12d
xorl %r11d, %r11d
xorl %r13d, %r13d
testl %r13d, %r13d
je 0xd7f8
testl %r11d, %r11d
jne 0xd96d
movq 0x98(%rsp), %rax
movq (%rax,%r12,8), %r10
movq (%r10), %rdx
movq (%rdx), %rbx
movq 0x8(%rdx), %rdx
movl 0x8(%rbx), %ebp
movl (%rdi), %r15d
movl 0x8(%rdx), %r14d
cmpl %r15d, %ebp
jne 0xd844
cmpl (%rsi), %r14d
jne 0xd844
movq (%rbx), %rax
movb 0x40(%rax), %al
cmpb (%rcx), %al
jne 0xd844
movq (%rdx), %rax
movb 0x70(%rsp), %sil
cmpb %sil, 0x40(%rax)
movq 0x78(%rsp), %rsi
jne 0xd844
movl %r14d, %r15d
jmp 0xd86a
cmpl %r15d, %r14d
jne 0xd887
cmpl (%rsi), %ebp
jne 0xd887
movq (%rdx), %rax
movb 0x40(%rax), %al
cmpb (%rcx), %al
jne 0xd887
movq (%rbx), %rax
movb 0x70(%rsp), %sil
cmpb %sil, 0x40(%rax)
movq 0x78(%rsp), %rsi
jne 0xd887
movq 0x8(%r10), %r14
movq 0x8(%r14), %rax
cmpl 0x8(%rax), %ebp
jne 0xd887
movq (%r14), %rax
cmpl %r15d, 0x8(%rax)
movl $0x1, %eax
cmovel %eax, %r13d
movq 0x50(%rsp), %rax
movl (%rax), %r14d
movl 0x8(%rdx), %r15d
cmpl %r14d, %ebp
jne 0xd8bf
cmpl (%r9), %r15d
jne 0xd8bf
movq (%rbx), %rax
movb 0x70(%rsp), %sil
cmpb %sil, 0x40(%rax)
movq 0x78(%rsp), %rsi
jne 0xd8bf
movq (%rdx), %rax
movb 0x40(%rax), %al
cmpb (%rcx), %al
jne 0xd8bf
movl %r15d, %r14d
jmp 0xd8df
cmpl %r14d, %r15d
jne 0xd8fc
cmpl (%r9), %ebp
jne 0xd8fc
movq (%rdx), %rax
movb 0x70(%rsp), %dl
cmpb %dl, 0x40(%rax)
jne 0xd8fc
movq (%rbx), %rax
movb 0x40(%rax), %al
cmpb (%rcx), %al
jne 0xd8fc
movq 0x8(%r10), %rdx
movq 0x8(%rdx), %rax
cmpl 0x8(%rax), %ebp
jne 0xd8fc
movq (%rdx), %rax
cmpl %r14d, 0x8(%rax)
movl $0x1, %eax
cmovel %eax, %r11d
incq %r12
cmpq %r12, %r8
jne 0xd7ea
testl %r11d, %r11d
sete %cl
testl %r13d, %r13d
movl 0x40(%rsp), %ebp
movl 0x60(%rsp), %r15d
movq 0x50(%rsp), %r12
movl -0x4(%rsp), %edx
jne 0xd942
jmp 0xd929
movb $0x1, %cl
movl (%rdi), %eax
cmpl %edx, %eax
je 0xd933
incl %eax
movl %eax, (%rdi)
movl (%rsi), %edx
cmpl 0x88(%rsp), %edx
je 0xd942
decl %edx
movl %edx, (%rsi)
movl $0x1, %eax
testb %cl, %cl
je 0xd972
movl (%r9), %eax
cmpl %ebp, %eax
je 0xd957
decl %eax
movl %eax, (%r9)
movl (%r12), %ecx
movl $0x1, %eax
cmpl %r15d, %ecx
je 0xd972
incl %ecx
movl %ecx, (%r12)
jmp 0xd972
movl $0x1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq