// File: /workspace/github_c_makefile_star2_O2/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 0xd22f
cmpb 0x48(%rsp), %r8b
jne 0xd22f
movl 0x88(%rsp), %r14d
movl 0x80(%rsp), %ebx
cmpl %ebx, %r14d
jg 0xd22f
movl 0x40(%rsp), %r10d
movl 0x38(%rsp), %ebp
cmpl %ebp, %r10d
jg 0xd22f
cmpl %edx, %esi
jg 0xd22f
cmpl %r10d, %edx
jg 0xd22f
movl 0x60(%rsp), %r11d
movl 0x58(%rsp), %r10d
cmpl %r11d, %r10d
jg 0xd22f
cmpl %r14d, %r11d
jg 0xd22f
movl %edx, -0x4(%rsp)
movl 0xa0(%rsp), %r12d
movq 0x78(%rsp), %r13
movq 0x68(%rsp), %r11
movq 0x50(%rsp), %r15
movl %esi, (%rdi)
movl %ebp, (%r9)
movl %r10d, (%r15)
movl %ebx, (%r13)
movb %r8b, (%rcx)
xorl %r8d, %r8d
testl %r12d, %r12d
cmovlel %r8d, %r12d
movb 0x70(%rsp), %al
movb %al, (%r11)
xorl %r11d, %r11d
xorl %esi, %esi
cmpq %r8, %r12
je 0xd1d9
testl %r11d, %r11d
je 0xd0ae
testl %esi, %esi
jne 0xd22a
movq 0x98(%rsp), %rax
movq (%rax,%r8,8), %r10
movq (%r10), %rax
movq (%rax), %rbp
movq 0x8(%rax), %rdx
movl 0x8(%rbp), %ebx
movl (%rdi), %r14d
movl 0x8(%rdx), %eax
cmpl %r14d, %ebx
jne 0xd107
cmpl (%r13), %eax
jne 0xd107
movq (%rbp), %r15
movb 0x40(%r15), %r15b
cmpb (%rcx), %r15b
movq 0x50(%rsp), %r15
jne 0xd107
movq (%rdx), %r15
movb 0x70(%rsp), %r13b
cmpb %r13b, 0x40(%r15)
movq 0x78(%rsp), %r13
movq 0x50(%rsp), %r15
jne 0xd107
movl %eax, %r14d
jmp 0xd130
cmpl %r14d, %eax
jne 0xd153
cmpl (%r13), %ebx
jne 0xd153
movq (%rdx), %rax
movb 0x40(%rax), %al
cmpb (%rcx), %al
jne 0xd153
movq (%rbp), %rax
movb 0x70(%rsp), %r13b
cmpb %r13b, 0x40(%rax)
movq 0x78(%rsp), %r13
jne 0xd153
movq 0x8(%r10), %rax
movq 0x8(%rax), %r15
cmpl 0x8(%r15), %ebx
jne 0xd14e
movq (%rax), %rax
cmpl %r14d, 0x8(%rax)
movl $0x1, %eax
cmovel %eax, %r11d
movq 0x50(%rsp), %r15
movl (%r15), %eax
movl 0x8(%rdx), %r14d
cmpl %eax, %ebx
jne 0xd192
cmpl (%r9), %r14d
jne 0xd192
movq (%rbp), %r15
movb 0x70(%rsp), %r13b
cmpb %r13b, 0x40(%r15)
movq 0x78(%rsp), %r13
movq 0x50(%rsp), %r15
jne 0xd192
movq (%rdx), %r15
movb 0x40(%r15), %r15b
cmpb (%rcx), %r15b
movq 0x50(%rsp), %r15
jne 0xd192
movl %r14d, %eax
jmp 0xd1b5
cmpl %eax, %r14d
jne 0xd1d1
cmpl (%r9), %ebx
jne 0xd1d1
movq (%rdx), %rdx
movb 0x70(%rsp), %r14b
cmpb %r14b, 0x40(%rdx)
jne 0xd1d1
movq (%rbp), %rdx
movb 0x40(%rdx), %dl
cmpb (%rcx), %dl
jne 0xd1d1
movq 0x8(%r10), %rdx
movq 0x8(%rdx), %r10
cmpl 0x8(%r10), %ebx
jne 0xd1d1
movq (%rdx), %rdx
cmpl %eax, 0x8(%rdx)
movl $0x1, %eax
cmovel %eax, %esi
incq %r8
jmp 0xd098
testl %r11d, %r11d
movl $0x1, %eax
movl 0x40(%rsp), %edx
movl 0x60(%rsp), %r8d
jne 0xd20b
movl (%rdi), %ecx
cmpl -0x4(%rsp), %ecx
je 0xd1f8
incl %ecx
movl %ecx, (%rdi)
movl (%r13), %ecx
cmpl 0x88(%rsp), %ecx
je 0xd20b
decl %ecx
movl %ecx, (%r13)
testl %esi, %esi
jne 0xd22f
movl (%r9), %ecx
cmpl %edx, %ecx
je 0xd21b
decl %ecx
movl %ecx, (%r9)
movl (%r15), %ecx
cmpl %r8d, %ecx
je 0xd22f
incl %ecx
movl %ecx, (%r15)
jmp 0xd22f
movl $0x1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq