// File: /workspace/github_c_makefile_star2_O1/ugobas[P]tnm/anharmonic_tnm.c
// Function: Interactions_CA
int Interactions_CA(struct interaction *Int_list, float thr,
		    atom *atoms, int natoms, int N_res, float *coord)
{
  int N_int=0, i1=0;
  float thr2=thr*thr, d, d2;

  for(int res1=0; res1<N_res; res1++){

    if(Find_CA(atoms, &i1, res1, natoms)< 0)continue;
    float *r1=coord+3*i1; atom *atom1=atoms+i1;
    int i2=i1+1;

    for(int res2=res1+1; res2<N_res; res2++){
      if(Find_CA(atoms, &i2, res2, natoms)< 0)continue;
      float *r2=coord+3*i2; atom *atom2=atoms+i2;

      int n=nat_res1_res2[atom1->res][atom2->res];

      // Interatomic distance
      d=r2[0]-r1[0]; d2 =d*d; if((d2>thr2)&&(n<0))continue;
      d=r2[1]-r1[1]; d2+=d*d; if((d2>thr2)&&(n<0))continue;
      d=r2[2]-r1[2]; d2+=d*d; if((d2>thr2)&&(n<0))continue;

      // store interaction
      Int_list[N_int].i1=i1; Int_list[N_int].i2=i2; N_int++;
      if(N_int >= INT_MAX){
	printf("ERROR, too many interactions %d\n", N_int);
	printf("%d residues, Threshold= %.2f\n", N_res, thr);
	exit(8);
      }
    }
  }
  return(N_int);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, 0x18(%rsp)
movq %rdi, 0x28(%rsp)
movl $0x0, 0x20(%rsp)
testl %ecx, %ecx
jle 0x1bd65
movq %r8, %r14
movq %rsi, %r12
movl %ecx, %r15d
movaps %xmm0, %xmm1
mulss %xmm0, %xmm1
movss %xmm1, 0xc(%rsp)
movq $0x0, 0x10(%rsp)
xorl %ebx, %ebx
movss %xmm0, 0x24(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movl %ebx, %edx
movl 0x18(%rsp), %ecx
callq 0x1c8f3
testl %eax, %eax
js 0x1bd58
movl 0x20(%rsp), %ebp
leal 0x1(%rbp), %eax
movl %eax, 0x1c(%rsp)
movq %rbx, 0x30(%rsp)
leal 0x1(%rbx), %r13d
cmpl %r15d, %r13d
jge 0x1bd53
movslq %ebp, %rax
leaq (%rax,%rax,2), %rbx
movq 0x5d667(%rip), %rcx     # 0x792d0
movq %rcx, 0x40(%rsp)
imulq $0x70, %rax, %rax
addq %r12, %rax
addq $0x64, %rax
movq %rax, 0x38(%rsp)
movq %r12, %rdi
leaq 0x1c(%rsp), %rsi
movl %r13d, %edx
movl 0x18(%rsp), %ecx
callq 0x1c8f3
testl %eax, %eax
js 0x1bd47
movslq 0x1c(%rsp), %rax
leaq (%rax,%rax,2), %rdx
movq 0x38(%rsp), %rcx
movslq (%rcx), %rcx
movq 0x40(%rsp), %rsi
movq (%rsi,%rcx,8), %rcx
imulq $0x70, %rax, %rsi
movslq 0x64(%r12,%rsi), %rsi
movss (%r14,%rdx,4), %xmm1
subss (%r14,%rbx,4), %xmm1
movl (%rcx,%rsi,4), %ecx
mulss %xmm1, %xmm1
ucomiss 0xc(%rsp), %xmm1
jbe 0x1bcdb
testl %ecx, %ecx
js 0x1bd47
movss 0x4(%r14,%rdx,4), %xmm0
subss 0x4(%r14,%rbx,4), %xmm0
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
ucomiss 0xc(%rsp), %xmm0
jbe 0x1bcfc
testl %ecx, %ecx
js 0x1bd47
movss 0x8(%r14,%rdx,4), %xmm1
subss 0x8(%r14,%rbx,4), %xmm1
mulss %xmm1, %xmm1
addss %xmm0, %xmm1
ucomiss 0xc(%rsp), %xmm1
jbe 0x1bd1d
testl %ecx, %ecx
js 0x1bd47
movq 0x10(%rsp), %rdx
movslq %edx, %rdx
imulq $0xc8, %rdx, %rcx
movq 0x28(%rsp), %rsi
movl %ebp, (%rsi,%rcx)
movl %eax, 0x4(%rsi,%rcx)
incl %edx
movq %rdx, 0x10(%rsp)
cmpl 0x5d593(%rip), %edx     # 0x792d8
jge 0x1bd82
incl %r13d
cmpl %r13d, %r15d
jne 0x1bc7e
movq 0x30(%rsp), %rbx
incl %ebx
cmpl %r15d, %ebx
jne 0x1bc23
jmp 0x1bd6e
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3b23a(%rip), %rdi     # 0x56fc3
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x20f0
xorps %xmm0, %xmm0
cvtss2sd 0x24(%rsp), %xmm0
leaq 0x3bb8c(%rip), %rdi     # 0x57931
movl %r15d, %esi
movb $0x1, %al
callq 0x20f0
movl $0x8, %edi
callq 0x2270