// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/nma.c
// Function: Compute_Hessian_ANM
void Compute_Hessian_ANM  (double **Hessian, int N_ref, int *atom_ref,
			  struct interaction *Int_list, int N_int,
			   atom *atoms, int natoms)
{
  int N=3*N_ref;
  int n, i, j;
  int *i_ref=malloc(natoms*sizeof(int));
  for(i=0; i<natoms; i++)i_ref[i]=-1;
  for(i=0; i<N_ref; i++)i_ref[atom_ref[i]]=i;

  // Computing  elements in double precision
  for(i=0; i<N; i++)for(j=0; j<N; j++)Hessian[i][j]=0;
  for(n=0; n<N_int; n++){
    int i1_pdb=Int_list[n].i1, i2_pdb=Int_list[n].i2;
    int i1=3*i_ref[i1_pdb], i2=3*i_ref[i2_pdb], j1, j2;
    if((i1<0)||(i2<0))continue;
    atom *atom1= atoms+i1_pdb, *atom2=atoms+i2_pdb;
    int i1j1, i1j2, i2j1, i2j2;
    double r21[3], h, norm;
    r21[0]=atom2->r[0]-atom1->r[0];
    r21[1]=atom2->r[1]-atom1->r[1];
    r21[2]=atom2->r[2]-atom1->r[2];
    norm=Int_list[n].sec_der/Scalar_product_3_d(r21, r21);

    for(j1=0; j1<3; j1++){
      i1j1 = i1+j1; i2j1=i2+j1;
      for(j2=j1; j2<3; j2++){
	h = r21[j1]*r21[j2]*norm;
	i2j2 =i2+j2; i1j2=i1+j2;
        Hessian[i1j1][i2j2] =-h;
        Hessian[i2j2][i1j1] =-h;
        Hessian[i1j1][i1j2] +=h;
        Hessian[i2j2][i2j1] +=h;
        if(j1!=j2){
          Hessian[i1j2][i2j1] =-h;
          Hessian[i2j1][i1j2] =-h;
          Hessian[i1j2][i1j1]+= h;
          Hessian[i2j1][i2j2]+= h;
        }
      }
    }
  }
  free(i_ref);
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
imull $0x3, -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
movslq 0x10(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1180
movq %rax, -0x48(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl 0x10(%rbp), %eax
jge 0x32406
movq -0x48(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x323e4
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x32436
movl -0x3c(%rbp), %edx
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x3c(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3240d
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x32484
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x32477
movq -0x8(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x40(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x3244c
jmp 0x32479
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3243d
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x327b3
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
imull $0x3, (%rax,%rcx,4), %eax
movl %eax, -0x54(%rbp)
movq -0x48(%rbp), %rax
movslq -0x50(%rbp), %rcx
imull $0x3, (%rax,%rcx,4), %eax
movl %eax, -0x58(%rbp)
cmpl $0x0, -0x54(%rbp)
jl 0x324f0
cmpl $0x0, -0x58(%rbp)
jge 0x324f5
jmp 0x327a5
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rax
movslq -0x50(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movsd (%rax), %xmm0
movq -0x68(%rbp), %rax
subsd (%rax), %xmm0
movsd %xmm0, -0xa0(%rbp)
movq -0x70(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x68(%rbp), %rax
subsd 0x8(%rax), %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x70(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x68(%rbp), %rax
subsd 0x10(%rax), %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0xc8, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movsd %xmm0, -0xb8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x14c00
movaps %xmm0, %xmm1
movsd -0xb8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xb0(%rbp)
movl $0x0, -0x5c(%rbp)
cmpl $0x3, -0x5c(%rbp)
jge 0x327a3
movl -0x54(%rbp), %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x58(%rbp), %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x60(%rbp)
cmpl $0x3, -0x60(%rbp)
jge 0x32793
movslq -0x5c(%rbp), %rax
movsd -0xa0(%rbp,%rax,8), %xmm0
movslq -0x60(%rbp), %rax
mulsd -0xa0(%rbp,%rax,8), %xmm0
mulsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movl -0x58(%rbp), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x54(%rbp), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x78(%rbp)
movsd -0xa8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x80(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x8(%rbp), %rax
movslq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x74(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa8(%rbp), %xmm0
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x78(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa8(%rbp), %xmm0
movq -0x8(%rbp), %rax
movslq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x7c(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x5c(%rbp), %eax
cmpl -0x60(%rbp), %eax
je 0x32783
movsd -0xa8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x8(%rbp), %rax
movslq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x7c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x78(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa8(%rbp), %xmm0
movq -0x8(%rbp), %rax
movslq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x74(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa8(%rbp), %xmm0
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x80(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x32785
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x325d9
jmp 0x32795
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x325b7
jmp 0x327a5
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3248b
movq -0x48(%rbp), %rdi
callq 0x1040
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)