// File: /workspace/github_c_makefile_star2_O0/josch[P]stride/ssbond.c
// Function: SSBond
int SSBond(CHAIN **Chain, int NChain)
{

  register int Res1, Res2, Cn1, Cn2;
  int S1, S2, Bn, Cnt=0;
  
  for( Cn1=0; Cn1<NChain; Cn1++ )
    for( Res1=0; Res1<Chain[Cn1]->NRes; Res1++ ) {
      if( strcmp(Chain[Cn1]->Rsd[Res1]->ResType,"CYS") )
	continue;
      for( Cn2=Cn1; Cn2<NChain; Cn2++ )
	for( Res2 = ( (Cn2 == Cn1)? Res1+1 : 0) ; Res2<Chain[Cn2]->NRes; Res2++ ) {
	  if( strcmp(Chain[Cn2]->Rsd[Res2]->ResType,"CYS") )
	    continue;
	  
	  if( !ExistSSBond(Chain,NChain,Cn1,Cn2,
			   Chain[Cn1]->Rsd[Res1]->PDB_ResNumb,
			   Chain[Cn2]->Rsd[Res2]->PDB_ResNumb) && 
	     FindAtom(Chain[Cn1],Res1,"SG",&S1) && FindAtom(Chain[Cn2],Res2,"SG",&S2) &&
	     Dist(Chain[Cn1]->Rsd[Res1]->Coord[S1],
		  Chain[Cn2]->Rsd[Res2]->Coord[S2]) <= SSDIST ) {
	    Bn = Chain[0]->NBond;
	    Chain[0]->SSbond[Bn] =  (SSBOND *)ckalloc(sizeof(SSBOND));
	    strcpy(Chain[0]->SSbond[Bn]->PDB_ResNumb1,Chain[Cn1]->Rsd[Res1]->PDB_ResNumb);
	    strcpy(Chain[0]->SSbond[Bn]->PDB_ResNumb2,Chain[Cn2]->Rsd[Res2]->PDB_ResNumb);
	    Chain[0]->SSbond[Bn]->ChainId1 = Chain[Cn1]->Id;
	    Chain[0]->SSbond[Bn]->ChainId2 = Chain[Cn2]->Id;
	    Chain[0]->SSbond[Bn]->AsnSource = Stride;
	    Chain[0]->NBond++;
	    Cnt++;
	  }
	}
    }
  
  return(Cnt);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movl $0x0, 0xc(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jge 0x23b75
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
movq 0x30(%rsp), %rcx
movslq 0x20(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl (%rcx), %eax
jge 0x23b63
movq 0x30(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0xa, %rdi
leaq 0x8051(%rip), %rsi      # 0x2b874
callq 0x2130
cmpl $0x0, %eax
je 0x23832
jmp 0x23b53
movl 0x20(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jge 0x23b51
movl 0x1c(%rsp), %eax
cmpl 0x20(%rsp), %eax
jne 0x2385f
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x23867
xorl %eax, %eax
movl %eax, 0x8(%rsp)
jmp 0x23867
movl 0x8(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
movq 0x30(%rsp), %rcx
movslq 0x1c(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpl (%rcx), %eax
jge 0x23b3f
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0xa, %rdi
leaq 0x7fc5(%rip), %rsi      # 0x2b874
callq 0x2130
cmpl $0x0, %eax
je 0x238be
jmp 0x23b2f
movq 0x30(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl 0x20(%rsp), %edx
movl 0x1c(%rsp), %ecx
movq 0x30(%rsp), %rax
movslq 0x20(%rsp), %r8
movq (%rax,%r8,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %r8
movq (%rax,%r8,8), %r8
addq $0x4, %r8
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %r9
movq (%rax,%r9,8), %rax
movq 0x68(%rax), %rax
movslq 0x24(%rsp), %r9
movq (%rax,%r9,8), %r9
addq $0x4, %r9
callq 0x23b80
cmpl $0x0, %eax
jne 0x23b2d
movq 0x30(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x28(%rsp), %esi
leaq 0x8530(%rip), %rdx      # 0x2be64
leaq 0x18(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
je 0x23b2d
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x24(%rsp), %esi
leaq 0x8504(%rip), %rdx      # 0x2be64
leaq 0x14(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
je 0x23b2d
movq 0x30(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x188, %rdi            # imm = 0x188
movslq 0x18(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x188, %rsi            # imm = 0x188
movslq 0x14(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rsi
callq 0x4a30
cvtss2sd %xmm0, %xmm1
movsd 0x80a8(%rip), %xmm0     # 0x2ba88
ucomisd %xmm1, %xmm0
jb 0x23b2d
movq 0x30(%rsp), %rax
movq (%rax), %rax
movl 0x2c(%rax), %eax
movl %eax, 0x10(%rsp)
movl $0x14, %edi
callq 0x7360
movq %rax, %rdx
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0xa0(%rax), %rax
movslq 0x10(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0xa0(%rax), %rax
movslq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x30(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x4, %rsi
callq 0x2060
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0xa0(%rax), %rax
movslq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x6, %rdi
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x4, %rsi
callq 0x2060
movq 0x30(%rsp), %rax
movslq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movb 0x40(%rax), %cl
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0xa0(%rax), %rax
movslq 0x10(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movb %cl, 0xe(%rax)
movq 0x30(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movb 0x40(%rax), %cl
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0xa0(%rax), %rax
movslq 0x10(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movb %cl, 0xf(%rax)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0xa0(%rax), %rax
movslq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x0, 0x10(%rax)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x23b2f
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x2386f
jmp 0x23b41
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x2383a
jmp 0x23b53
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x237e3
jmp 0x23b65
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x237cd
movl 0xc(%rsp), %eax
addq $0x38, %rsp
retq
nop