// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/anharmonic_tnm.c
// Function: Energy_debug
double Energy_debug(float *r, atom *atoms, int natoms,
		    struct residue *seq, int nres,
		    struct interaction *Int_list, int N_int,
		    struct interaction **Int_KB, int NA)
{
  double E_nat=0, E_nonat=0; int n_nat=0, n_not=0;
  double d_min=100, d_nat_ave=0; int i1_min=-1, i2_min=-1;
  for(int i=0; i<N_int_all; i++){
    int i1=Int_list_all[i].i1, i2=Int_list_all[i].i2;
    int n=nat_res1_res2[atoms[i1].res][atoms[i2].res];
    float d=Min_res_dist(r, atoms, &i1, &i2, n, natoms);
    if(d>=C_THR)continue;
    if(d<=0){
      printf("ERROR, d(%d,%d)= %.2g n=%d\n", i1, i2, d, n);
      exit(8);
    }
    if(n>=0){
      float e=Compute_V(Int_list+n, d)-Int_list[n].E_min;
      if(e<0)printf("Neg SB de= %.2g n=%d d= %.3f d0=%.3f\n",
		     e, n, d, Int_list[n].r0);
      E_nat+=e;
      float x=fabs(d-Int_list[n].r0);
      if(x>0.01){
	atom *a1=atoms+i1, *a2=atoms+i2;
	printf("ERROR in interaction %d, %s r%d - %s r%d, d= %.2f\n",
	       n, a1->name, a1->res, a2->name, a2->res, d);
	a1=atoms+Int_list[n].i1; a2=atoms+Int_list[n].i2; 
	printf("Contact matrix: %s r%d - %s r%d, d= %.2f\n",
	       a1->name, a1->res, a2->name, a2->res, d); exit(8);
      }
      d_nat_ave+=x;
      n_nat++;
    }else{
      int a=seq[atoms[i1].res].i_aa, b=seq[atoms[i2].res].i_aa;
      float e=Compute_V(Int_KB[a]+b, d)-Int_KB[a][b].E_min;
      if(e<0){
	printf("Non-native int. d=%.5g\n", d);
	printf("Neg KB energy= %.3g ab=%d-%d d= %.3f\n", e, a, b, d);
	printf("A0= %.2g A1= %.2g A2= %.2g A4= %.2g\n",
	       Int_KB[a][b].A0, Int_KB[a][b].A1,
	       Int_KB[a][b].A2, Int_KB[a][b].A4);
	int j=3*i1;
	printf("a1: %s %d r%d\tr= %.3g %.3g %.3g\t",
	       atoms[i1].name, i1, atoms[i1].res,
	       r[j], r[j+1], r[j+2]);
	//atoms[i1].r[0], atoms[i1].r[1], atoms[i1].r[2]);
	j=3*i2;
	printf("a2: %s %d r%d\tr= %.3g %.3g %.3g\n",
	       atoms[i2].name, i2, atoms[i2].res,
	       r[j], r[j+1], r[j+2]); 
	//atoms[i2].r[0], atoms[i2].r[1], atoms[i2].r[2]);
      }
      E_nonat+=e; n_not++;
      if(d<d_min){d_min=d; i1_min=i1; i2_min=i2;}
    }
  }
  printf("%d tested interactions over %d pairs, ", N_int_all, nres*(nres-1)/2);
  printf("%d native over %d, %d non-native d_thr= %.2f\n",
	 n_nat, N_int, n_not, C_THR);
  printf("Energy: native %.4g |r0-d|=%.3g non-native %.4g\n",
	 E_nat, d_nat_ave/n_nat, E_nonat);
  if(i1_min>=0){
    printf("d_min_nonat=%.5g ", d_min);
    printf("a1: %s %d r %d  ",atoms[i1_min].name, i1_min, atoms[i1_min].res);
    printf("a2: %s %d r %d\n",atoms[i2_min].name, i2_min, atoms[i2_min].res);
  }
  return(E_nat+E_nonat);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movsd 0x55c8e(%rip), %xmm0    # 0x7c020
movsd %xmm0, -0x50(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0xffffffff, -0x5c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x60(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl 0x75ebf(%rip), %eax     # 0x9c27c
jge 0x269ce
movq 0x75eb6(%rip), %rax     # 0x9c280
movslq -0x64(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x68(%rbp)
movq 0x75e9c(%rip), %rax     # 0x9c280
movslq -0x64(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x6c(%rbp)
movq 0x75e91(%rip), %rax     # 0x9c290
movq -0x10(%rbp), %rcx
movslq -0x68(%rbp), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
movslq 0x64(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq -0x10(%rbp), %rcx
movslq -0x6c(%rbp), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
movslq 0x64(%rcx), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x70(%rbp), %r8d
movl -0x14(%rbp), %r9d
leaq -0x68(%rbp), %rdx
leaq -0x6c(%rbp), %rcx
callq 0x27350
movss %xmm0, -0x74(%rbp)
movss -0x74(%rbp), %xmm0
leaq 0x65bcb(%rip), %rax     # 0x8c028
ucomiss (%rax), %xmm0
jb 0x26467
jmp 0x269c0
xorps %xmm0, %xmm0
ucomiss -0x74(%rbp), %xmm0
jb 0x2649a
movl -0x68(%rbp), %esi
movl -0x6c(%rbp), %edx
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movl -0x70(%rbp), %ecx
leaq 0x5659f(%rip), %rdi     # 0x7ca28
movb $0x1, %al
callq 0x10d0
movl $0x8, %edi
callq 0x1210
cmpl $0x0, -0x70(%rbp)
jl 0x266b9
movq -0x30(%rbp), %rdi
movslq -0x70(%rbp), %rax
imulq $0xc8, %rax, %rax
addq %rax, %rdi
movss -0x74(%rbp), %xmm0
callq 0x27810
cvtss2sd %xmm0, %xmm0
movq -0x30(%rbp), %rax
movslq -0x70(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
subsd 0xb8(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x78(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x78(%rbp), %xmm0
jbe 0x2652a
movss -0x78(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movl -0x70(%rbp), %esi
movss -0x74(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x30(%rbp), %rax
movslq -0x70(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm2
leaq 0x565d5(%rip), %rdi     # 0x7caf8
movb $0x3, %al
callq 0x10d0
movss -0x78(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x30(%rbp), %rax
movslq -0x70(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
subsd 0x20(%rax), %xmm0
movaps 0x55f2c(%rip), %xmm1    # 0x7c490
pand %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x7c(%rbp)
movss -0x7c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x55e9e(%rip), %xmm1    # 0x7c420
ucomisd %xmm1, %xmm0
jbe 0x26698
movq -0x10(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl -0x70(%rbp), %esi
movq -0x88(%rbp), %rdx
addq $0x18, %rdx
movq -0x88(%rbp), %rax
movl 0x64(%rax), %ecx
movq -0x90(%rbp), %r8
addq $0x18, %r8
movq -0x90(%rbp), %rax
movl 0x64(%rax), %r9d
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x56528(%rip), %rdi     # 0x7cb1e
movb $0x1, %al
callq 0x10d0
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x70(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq -0x70(%rbp), %rdx
imulq $0xc8, %rdx, %rdx
addq %rdx, %rcx
movslq 0x4(%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rsi
addq $0x18, %rsi
movq -0x88(%rbp), %rax
movl 0x64(%rax), %edx
movq -0x90(%rbp), %rcx
addq $0x18, %rcx
movq -0x90(%rbp), %rax
movl 0x64(%rax), %r8d
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x564ca(%rip), %rdi     # 0x7cb51
movb $0x1, %al
callq 0x10d0
movl $0x8, %edi
callq 0x1210
movss -0x7c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x269be
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x68(%rbp), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
movslq 0x64(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x94(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x6c(%rbp), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
movslq 0x64(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x98(%rbp)
movq 0x18(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x98(%rbp), %rax
imulq $0xc8, %rax, %rax
addq %rax, %rdi
movss -0x74(%rbp), %xmm0
callq 0x27810
cvtss2sd %xmm0, %xmm0
movq 0x18(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x98(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
subsd 0xb8(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x9c(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x9c(%rbp), %xmm0
jbe 0x2696f
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x563f0(%rip), %rdi     # 0x7cb7b
movb $0x1, %al
callq 0x10d0
movss -0x9c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movl -0x94(%rbp), %esi
movl -0x98(%rbp), %edx
movss -0x74(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x563d9(%rip), %rdi     # 0x7cb93
movb $0x2, %al
callq 0x10d0
movq 0x18(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x98(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movsd 0x30(%rax), %xmm0
movq 0x18(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x98(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movsd 0x38(%rax), %xmm1
movq 0x18(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x98(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movsd 0x40(%rax), %xmm2
movq 0x18(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x98(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movsd 0x48(%rax), %xmm3
leaq 0x5635d(%rip), %rdi     # 0x7cbb9
movb $0x4, %al
callq 0x10d0
imull $0x3, -0x68(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rsi
movslq -0x68(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rsi
addq $0x18, %rsi
movl -0x68(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x68(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %ecx
movq -0x8(%rbp), %rax
movslq -0xa0(%rbp), %rdi
movss (%rax,%rdi,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x8(%rbp), %rax
movl -0xa0(%rbp), %edi
addl $0x1, %edi
movslq %edi, %rdi
movss (%rax,%rdi,4), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x8(%rbp), %rax
movl -0xa0(%rbp), %edi
addl $0x2, %edi
movslq %edi, %rdi
movss (%rax,%rdi,4), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x562fc(%rip), %rdi     # 0x7cbde
movb $0x3, %al
callq 0x10d0
imull $0x3, -0x6c(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq -0x10(%rbp), %rsi
movslq -0x6c(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rsi
addq $0x18, %rsi
movl -0x6c(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %ecx
movq -0x8(%rbp), %rax
movslq -0xa0(%rbp), %rdi
movss (%rax,%rdi,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x8(%rbp), %rax
movl -0xa0(%rbp), %edi
addl $0x1, %edi
movslq %edi, %rdi
movss (%rax,%rdi,4), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x8(%rbp), %rax
movl -0xa0(%rbp), %edi
addl $0x2, %edi
movslq %edi, %rdi
movss (%rax,%rdi,4), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x56297(%rip), %rdi     # 0x7cbff
movb $0x3, %al
callq 0x10d0
movss -0x9c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x269bc
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x269be
jmp 0x269c0
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x263b4
movl 0x758a8(%rip), %esi     # 0x9c27c
movl -0x24(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
imull %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
leaq 0x5622f(%rip), %rdi     # 0x7cc20
movb $0x0, %al
callq 0x10d0
movl -0x44(%rbp), %esi
movl 0x10(%rbp), %edx
movl -0x48(%rbp), %ecx
leaq 0x65620(%rip), %rax     # 0x8c028
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x56230(%rip), %rdi     # 0x7cc47
movb $0x1, %al
callq 0x10d0
movsd -0x38(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
cvtsi2sdl -0x44(%rbp), %xmm2
divsd %xmm2, %xmm1
movsd -0x40(%rbp), %xmm2
leaq 0x56238(%rip), %rdi     # 0x7cc75
movb $0x3, %al
callq 0x10d0
cmpl $0x0, -0x5c(%rbp)
jl 0x26ac9
movsd -0x50(%rbp), %xmm0
leaq 0x56250(%rip), %rdi     # 0x7cca6
movb $0x1, %al
callq 0x10d0
movq -0x10(%rbp), %rsi
movslq -0x5c(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rsi
addq $0x18, %rsi
movl -0x5c(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %ecx
leaq 0x5622c(%rip), %rdi     # 0x7ccb8
movb $0x0, %al
callq 0x10d0
movq -0x10(%rbp), %rsi
movslq -0x60(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rsi
addq $0x18, %rsi
movl -0x60(%rbp), %edx
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %ecx
leaq 0x56207(%rip), %rdi     # 0x7ccc9
movb $0x0, %al
callq 0x10d0
movsd -0x38(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)