// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/interactions_tnm.c
// Function: Compute_interactions
void Compute_interactions(int *N_int, struct interaction **Int_list,
			  char *INT_TYPE, atom *atoms, int natoms,
			  int nres, char *nameout)
{
  INT_MAX=100*nres;
  struct interaction *Int_tmp=malloc(INT_MAX*sizeof(struct interaction));
  if(Int_tmp==NULL){
    printf("ERROR, no memory available for storing %d interactions\n",
	   INT_MAX); exit(8);
  }
  if(C_THR<1){
    printf("ERROR, Rc= %.2g\n", C_THR); exit(8);
  }

  if(HNM){
    *N_int=Interactions_hnm(Int_tmp, "CA", 20, atoms, natoms, nres);
  }else if((strncmp(INT_TYPE, "CA", 2)==0)||(strncmp(INT_TYPE, "CB", 2)==0)){
    *N_int=Interactions(Int_tmp, INT_TYPE, C_THR, atoms, natoms, nres);
  }else if((strncmp(INT_TYPE, "SCA", 3)==0)||
	   (strncmp(INT_TYPE, "SCB", 3)==0)){
    *N_int=Interactions_all_ref(Int_tmp, C_THR, atoms, natoms, nres, REF);
  }else if(strncmp(INT_TYPE, "MIN", 3)==0){
    if(N_RESRES==1){
      *N_int=Interactions_min(Int_tmp, C_THR, atoms, natoms, nres);
    }else{
      //*N_int=Interactions_all(Int_tmp, C_THR, atoms, natoms, nres);
      *N_int=Interactions_min_M(Int_tmp, C_THR, atoms, natoms, nres);
    }
  }else if(strncmp(INT_TYPE, "HYD", 3)==0){
    *N_int=Interactions_min(Int_tmp, C_THR, atoms, natoms, nres);
    //Heavy_atoms_interactors(Int_tmp, *N_int,atoms);
  }else if(strncmp(INT_TYPE, "SCR", 3)==0){
    *N_int=Screened_Interactions(Int_tmp,C_THR,atoms,natoms,nres,
				 3,S_THR);
  }else if(strncmp(INT_TYPE, "SHA", 3)==0){
    *N_int=Screened_Interactions(Int_tmp,C_THR,atoms,natoms,nres,
				 S_TYPE,S_THR);
  }else if(strncmp(INT_TYPE, "HB", 2)==0){
    *N_int=Interactions_HB(Int_tmp, C_THR, atoms, natoms, nres,
			   DA_THR, COS_DAA, ENE_HB);
  }else{
    printf("WARNING, incorrect interaction type %s\n", INT_TYPE);
    printf("Setting to default MIN\n"); strcpy(INT_TYPE, "MIN");
    *N_int=Interactions_min(Int_tmp, C_THR, atoms, natoms, nres);
  }
  printf("%d interactions of type %s found\n", *N_int, INT_TYPE);

  int k;
  for(k=0; k<*N_int; k++){
    Int_tmp[k].res1=atoms[Int_tmp[k].i1].res;
    Int_tmp[k].res2=atoms[Int_tmp[k].i2].res;
  }

  // Each atoms only interacts once per residue
  if((ONEINT)&&
     ((strncmp(INT_TYPE, "SCR", 3)==0)||(strncmp(INT_TYPE, "SHA", 3)==0))){
    //Purge_interactions_atom_res(N_int, Int_list, nres);
    Purge_interactions_res_pair(N_int, Int_tmp, nres);
  }
 
  C0=C0_MIN;
  if((strncmp(INT_TYPE,"CA",2)==0)||(strncmp(INT_TYPE,"CB",2)==0)||HNM)
    C0=C0_CA;
  Compute_sec_der(Int_tmp, *N_int, nameout);
  //Compute_sec_der(Int_tmp, *N_int, POW, EXP_HESSIAN, C0, C1_THR, C_THR);
  //Compute_sec_der_old(Int_tmp, *N_int, EXP_HESSIAN);

  *Int_list=malloc((*N_int)*sizeof(struct interaction));
  for(k=0; k<*N_int; k++)(*Int_list)[k]=Int_tmp[k];
  free(Int_tmp);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
imull $0x64, -0x28(%rbp), %ecx
leaq 0x7d339(%rip), %rax     # 0x9c298
movl %ecx, (%rax)
leaq 0x7d330(%rip), %rax     # 0x9c298
movslq (%rax), %rax
imulq $0xc8, %rax, %rdi
callq 0x1180
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1efa3
leaq 0x7d30f(%rip), %rax     # 0x9c298
movl (%rax), %esi
leaq 0x5d09e(%rip), %rdi     # 0x7c030
movb $0x0, %al
callq 0x10d0
movl $0x8, %edi
callq 0x1210
movss 0x570e5(%rip), %xmm0    # 0x76090
leaq 0x6d076(%rip), %rax     # 0x8c028
ucomiss (%rax), %xmm0
jbe 0x1efde
leaq 0x6d06a(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x5d09b(%rip), %rdi     # 0x7c068
movb $0x1, %al
callq 0x10d0
movl $0x8, %edi
callq 0x1210
leaq 0x6d0c3(%rip), %rax     # 0x8c0a8
cmpl $0x0, (%rax)
je 0x1f01a
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
leaq 0x57308(%rip), %rsi     # 0x76308
movss 0x57080(%rip), %xmm0    # 0x76088
callq 0x1f510
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f319
movq -0x18(%rbp), %rdi
leaq 0x572e3(%rip), %rsi     # 0x76308
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x1f04e
movq -0x18(%rbp), %rdi
leaq 0x5730a(%rip), %rsi     # 0x76349
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1f07e
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x6cfcb(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
callq 0x1f7f0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f317
movq -0x18(%rbp), %rdi
leaq 0x5727e(%rip), %rsi     # 0x76307
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x1f0b2
movq -0x18(%rbp), %rdi
leaq 0x572a5(%rip), %rsi     # 0x76348
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1f0e4
movq -0x30(%rbp), %rdi
leaq 0x6cf6b(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
leaq 0x6d01e(%rip), %r8      # 0x8c0f0
callq 0x1fa70
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f315
movq -0x18(%rbp), %rdi
leaq 0x5b59a(%rip), %rsi     # 0x7a689
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1f15d
leaq 0x6cfa7(%rip), %rax     # 0x8c0ac
cmpl $0x1, (%rax)
jne 0x1f132
movq -0x30(%rbp), %rdi
leaq 0x6cf13(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
callq 0x1ff00
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f158
movq -0x30(%rbp), %rdi
leaq 0x6ceeb(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
callq 0x20250
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f313
movq -0x18(%rbp), %rdi
leaq 0x57280(%rip), %rsi     # 0x763e8
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1f1a2
movq -0x30(%rbp), %rdi
leaq 0x6cea6(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
callq 0x1ff00
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f311
movq -0x18(%rbp), %rdi
leaq 0x640c2(%rip), %rsi     # 0x8326f
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1f1f8
movq -0x30(%rbp), %rdi
leaq 0x6ce61(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
leaq 0x6cec8(%rip), %rax     # 0x8c0a4
movss (%rax), %xmm1
movl $0x3, %r8d
callq 0x2c310
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f30f
movq -0x18(%rbp), %rdi
leaq 0x5753d(%rip), %rsi     # 0x76740
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1f252
movq -0x30(%rbp), %rdi
leaq 0x6ce0b(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
leaq 0x6ce6a(%rip), %rax     # 0x8c09c
movl (%rax), %r8d
leaq 0x6ce68(%rip), %rax     # 0x8c0a4
movss (%rax), %xmm1
callq 0x2c310
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f30d
movq -0x18(%rbp), %rdi
leaq 0x58eaf(%rip), %rsi     # 0x7810c
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1f2b5
movq -0x30(%rbp), %rdi
leaq 0x6cdb1(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
leaq 0x6c328(%rip), %rax     # 0x8b5b4
movss (%rax), %xmm1
leaq 0x6c321(%rip), %rax     # 0x8b5b8
movss (%rax), %xmm2
leaq 0x6c30e(%rip), %rax     # 0x8b5b0
movss (%rax), %xmm3
callq 0x207d0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f30b
movq -0x18(%rbp), %rsi
leaq 0x5cdb9(%rip), %rdi     # 0x7c079
movb $0x0, %al
callq 0x10d0
leaq 0x5cdd3(%rip), %rdi     # 0x7c0a1
movb $0x0, %al
callq 0x10d0
movq -0x18(%rbp), %rdi
leaq 0x5b3a9(%rip), %rsi     # 0x7a689
callq 0x1060
movq -0x30(%rbp), %rdi
leaq 0x6cd38(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
callq 0x1ff00
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1f30d
jmp 0x1f30f
jmp 0x1f311
jmp 0x1f313
jmp 0x1f315
jmp 0x1f317
jmp 0x1f319
movq -0x8(%rbp), %rax
movl (%rax), %esi
movq -0x18(%rbp), %rdx
leaq 0x5cd8f(%rip), %rdi     # 0x7c0b9
movb $0x0, %al
callq 0x10d0
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x1f3c2
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %ecx
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x34(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rcx
movslq 0x4(%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %ecx
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1f338
leaq 0x6ccd7(%rip), %rax     # 0x8c0a0
cmpl $0x0, (%rax)
je 0x1f412
movq -0x18(%rbp), %rdi
leaq 0x63e96(%rip), %rsi     # 0x8326f
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x1f402
movq -0x18(%rbp), %rdi
leaq 0x5734d(%rip), %rsi     # 0x76740
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x1f412
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x28(%rbp), %edx
callq 0x20cf0
movss 0x6c3e2(%rip), %xmm0    # 0x8b7fc
leaq 0x6cc13(%rip), %rax     # 0x8c034
movss %xmm0, (%rax)
movq -0x18(%rbp), %rdi
leaq 0x56ed8(%rip), %rsi     # 0x76308
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x1f465
movq -0x18(%rbp), %rdi
leaq 0x56eff(%rip), %rsi     # 0x76349
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x1f465
leaq 0x6cc48(%rip), %rax     # 0x8c0a8
cmpl $0x0, (%rax)
je 0x1f478
movss 0x6c38b(%rip), %xmm0    # 0x8b7f8
leaq 0x6cbc0(%rip), %rax     # 0x8c034
movss %xmm0, (%rax)
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %esi
movq 0x10(%rbp), %rdx
callq 0x20f20
movq -0x8(%rbp), %rax
movslq (%rax), %rax
imulq $0xc8, %rax, %rdi
callq 0x1180
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x1f4f6
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movslq -0x34(%rbp), %rax
imulq $0xc8, %rax, %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
movslq -0x34(%rbp), %rax
imulq $0xc8, %rax, %rax
addq %rax, %rsi
movl $0xc8, %edx
callq 0x1160
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1f4af
movq -0x30(%rbp), %rdi
callq 0x1040
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)