// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movss -0xc(%rbp), %xmm0
mulss -0xc(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2632b
movq -0x18(%rbp), %rdi
movl -0x40(%rbp), %edx
movl -0x1c(%rbp), %ecx
leaq -0x30(%rbp), %rsi
callq 0x27260
cmpl $0x0, %eax
jge 0x2611c
jmp 0x2631d
movq -0x28(%rbp), %rax
imull $0x3, -0x30(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2631b
movq -0x18(%rbp), %rdi
movl -0x58(%rbp), %edx
movl -0x1c(%rbp), %ecx
leaq -0x54(%rbp), %rsi
callq 0x27260
cmpl $0x0, %eax
jge 0x26180
jmp 0x2630d
movq -0x28(%rbp), %rax
imull $0x3, -0x54(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movslq -0x54(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq 0x760e0(%rip), %rax     # 0x9c290
movq -0x50(%rbp), %rcx
movslq 0x64(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq -0x68(%rbp), %rcx
movslq 0x64(%rcx), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x6c(%rbp)
movq -0x60(%rbp), %rax
movss (%rax), %xmm0
movq -0x48(%rbp), %rax
subss (%rax), %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x38(%rbp), %xmm0
mulss -0x38(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x3c(%rbp), %xmm0
ucomiss -0x34(%rbp), %xmm0
jbe 0x26204
cmpl $0x0, -0x6c(%rbp)
jge 0x26204
jmp 0x2630d
movq -0x60(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x48(%rbp), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x38(%rbp), %xmm0
movss -0x38(%rbp), %xmm2
movss -0x3c(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x3c(%rbp), %xmm0
ucomiss -0x34(%rbp), %xmm0
jbe 0x2624d
cmpl $0x0, -0x6c(%rbp)
jge 0x2624d
jmp 0x2630d
movq -0x60(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x48(%rbp), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x38(%rbp), %xmm0
movss -0x38(%rbp), %xmm2
movss -0x3c(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x3c(%rbp), %xmm0
ucomiss -0x34(%rbp), %xmm0
jbe 0x26293
cmpl $0x0, -0x6c(%rbp)
jge 0x26293
jmp 0x2630d
movl -0x30(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x54(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl 0x75fc4(%rip), %eax     # 0x9c298
jl 0x2630b
movl -0x2c(%rbp), %esi
leaq 0x55dfb(%rip), %rdi     # 0x7c0db
movb $0x0, %al
callq 0x10d0
movl -0x20(%rbp), %esi
movss -0xc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x56710(%rip), %rdi     # 0x7ca0a
movb $0x1, %al
callq 0x10d0
movl $0x8, %edi
callq 0x1210
jmp 0x2630d
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x26157
jmp 0x2631d
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x260f3
movl -0x2c(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)