// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/interactions_tnm.c
// Function: Interactions_all
int Interactions_all(struct interaction *Int_list, float thr,
		     atom *atoms, int N_atoms, int N_res)
{
  // All pairs of atoms below the thresholds interact
  int N_int=0, i1, i2, i1_start=0, i2_start=0;
  atom *atom1=atoms, *atom2;
  float thr2=thr*thr;
  float t_max2=thr+22; t_max2*=t_max2;
  float d, d2;
  int res1, res2;

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

    while(atoms[i1_start].res< res1)i1_start++;
    i2_start=i1_start+1;

    for(res2=res1+1; res2<N_res; res2++){
      while(atoms[i2_start].res< res2)i2_start++;

      // Check if contact
      for(i1=i1_start; i1<N_atoms; i1++){
	atom1=atoms+i1; if(atom1->res != res1)break;
	for(i2=i2_start; i2<N_atoms; i2++){
	  atom2=atoms+i2; if(atom2->res != res2)break;

	  // Check if covalent
	  if((NOCOV) && Covalent(res1, res2, atom1, atom2))continue;

	  // Interatomic distance
	  d=atom2->r[0]-atom1->r[0];
	  d2 =d*d; if(d2>thr2){if(d2 > t_max2)goto next2; continue;}
	  d=atom2->r[1]-atom1->r[1];
	  d2+=d*d; if(d2>thr2){if(d2 > t_max2)goto next2; continue;}
	  d=atom2->r[2]-atom1->r[2];
	  d2+=d*d; if(d2>thr2){if(d2 > t_max2)goto next2; continue;}
	  if(d2 < thr2){
	    Int_list[N_int].i1=i1; Int_list[N_int].i2=i2;
	    Int_list[N_int].r0=sqrt(d2); Int_list[N_int].sec_der=1;
	    N_int++;
	    if(N_int >= INT_MAX){
	      printf("ERROR, too many interactions %d\n", N_int);
	      exit(8);
	    }
	  } // End store interaction
	}
      }
    next2: continue;
    }
  }
  return(N_int);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movss -0xc(%rbp), %xmm0
mulss -0xc(%rbp), %xmm0
movss %xmm0, -0x4c(%rbp)
movss 0x5a4b1(%rip), %xmm0    # 0x7bff0
addss -0xc(%rbp), %xmm0
movss %xmm0, -0x50(%rbp)
movss -0x50(%rbp), %xmm0
mulss -0x50(%rbp), %xmm0
movss %xmm0, -0x50(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x21e58
jmp 0x21b6d
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
cmpl -0x5c(%rbp), %eax
jge 0x21b8f
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x21b6d
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x21e48
jmp 0x21baf
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
cmpl -0x60(%rbp), %eax
jge 0x21bd1
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x21baf
movl -0x30(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x21e36
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl 0x64(%rax), %eax
cmpl -0x5c(%rbp), %eax
je 0x21c07
jmp 0x21e36
movl -0x34(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x21e26
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl 0x64(%rax), %eax
cmpl -0x60(%rbp), %eax
je 0x21c3d
jmp 0x21e26
leaq 0x6997c(%rip), %rax     # 0x8b5c0
cmpl $0x0, (%rax)
je 0x21c66
movl -0x5c(%rbp), %edi
movl -0x60(%rbp), %esi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0x215f0
cmpl $0x0, %eax
je 0x21c66
jmp 0x21e18
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
movq -0x40(%rbp), %rax
subsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x54(%rbp), %xmm0
mulss -0x54(%rbp), %xmm0
movss %xmm0, -0x58(%rbp)
movss -0x58(%rbp), %xmm0
ucomiss -0x4c(%rbp), %xmm0
jbe 0x21cae
movss -0x58(%rbp), %xmm0
ucomiss -0x50(%rbp), %xmm0
jbe 0x21ca9
jmp 0x21e38
jmp 0x21e18
movq -0x48(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x40(%rbp), %rax
subsd 0x8(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x54(%rbp), %xmm0
movss -0x54(%rbp), %xmm2
movss -0x58(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x58(%rbp)
movss -0x58(%rbp), %xmm0
ucomiss -0x4c(%rbp), %xmm0
jbe 0x21d05
movss -0x58(%rbp), %xmm0
ucomiss -0x50(%rbp), %xmm0
jbe 0x21d00
jmp 0x21e38
jmp 0x21e18
movq -0x48(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x40(%rbp), %rax
subsd 0x10(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x54(%rbp), %xmm0
movss -0x54(%rbp), %xmm2
movss -0x58(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x58(%rbp)
movss -0x58(%rbp), %xmm0
ucomiss -0x4c(%rbp), %xmm0
jbe 0x21d5c
movss -0x58(%rbp), %xmm0
ucomiss -0x50(%rbp), %xmm0
jbe 0x21d57
jmp 0x21e38
jmp 0x21e18
movss -0x58(%rbp), %xmm1
movss -0x4c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x21e16
movl -0x28(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x2c(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movss -0x58(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1220
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x20(%rax)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movsd 0x5426b(%rip), %xmm0    # 0x76048
movsd %xmm0, 0x28(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
leaq 0x7a4a3(%rip), %rcx     # 0x9c298
cmpl (%rcx), %eax
jl 0x21e14
movl -0x24(%rbp), %esi
leaq 0x5a2d8(%rip), %rdi     # 0x7c0db
movb $0x0, %al
callq 0x10d0
movl $0x8, %edi
callq 0x1210
jmp 0x21e16
jmp 0x21e18
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x21c0d
jmp 0x21e28
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x21bd7
jmp 0x21e38
jmp 0x21e3a
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x21ba1
jmp 0x21e4a
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x21b5f
movl -0x24(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)