// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/kinetic_tnm.c
// Function: Correlate_Jacobian
int Correlate_Jacobian(struct Jacobian J,
		       struct Reference Ref,
		       struct axe *axe, int N_axes)
{
  // Jacobian: derivatives with respect to torsions for all atoms
  // (only internal degrees of freedom)
  char nameout[100]="Jacobian_correlations.dat";
  FILE *file_out=fopen(nameout, "w");
  printf("Writing %s\n", nameout);
  fprintf(file_out, "#r(J[k], index) loc_shift glob_shift loc_rot glob_rot\n");
  int N=Ref.N_ref, i, k;
  float D2[N], index[N];
  for(i=0; i<N; i++)index[i]=i;
  for(k=0; k<N_axes; k++){
    float *J_k=J.Jacobian_ar[k];
    for(i=0; i<N; i++){
      double D=0;
      D+=(*J_k)*(*J_k); J_k++;
      D+=(*J_k)*(*J_k); J_k++; 
      D+=(*J_k)*(*J_k); J_k++;
      D2[i]=D;
    }
    float slope, offset, r=Corr_coeff(index, D2, N, &slope, &offset);
    struct axe *axe_k=axe+k;
    fprintf(file_out, "%.3f %c", r, axe_k->type);
    float v2=Module(axe_k->local_shift); fprintf(file_out, " %.3f", v2);
    v2=Module(axe_k->global_shift);fprintf(file_out, " %.3f", v2);
    v2=Module(axe_k->local_rot);   fprintf(file_out, " %.3f", v2);
    v2=Module(axe_k->global_rot);  fprintf(file_out, " %.3f\n", v2);
  }
  fclose(file_out); //exit(8);
  return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
leaq 0x58(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movaps 0x4d141(%rip), %xmm0    # 0x7dd20
movaps %xmm0, -0x20(%rbp)
movaps 0x4d126(%rip), %xmm0    # 0x7dd10
movaps %xmm0, -0x30(%rbp)
movaps 0x4d10b(%rip), %xmm0    # 0x7dd00
movaps %xmm0, -0x40(%rbp)
movaps 0x4d0f0(%rip), %xmm0    # 0x7dcf0
movaps %xmm0, -0x50(%rbp)
movaps 0x4d0d5(%rip), %xmm0    # 0x7dce0
movaps %xmm0, -0x60(%rbp)
movaps 0x4d0ba(%rip), %xmm0    # 0x7dcd0
movaps %xmm0, -0x70(%rbp)
movl $0x0, -0x10(%rbp)
leaq 0x4b74a(%rip), %rsi     # 0x7c372
leaq -0x70(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x11b0
movq -0xf8(%rbp), %rsi
movq %rax, -0x78(%rbp)
leaq 0x468a4(%rip), %rdi     # 0x774ee
xorl %eax, %eax
movb %al, -0xe9(%rbp)
callq 0x10d0
movb -0xe9(%rbp), %al
movq -0x78(%rbp), %rdi
leaq 0x4ce8a(%rip), %rsi     # 0x7daf2
callq 0x1150
movq -0xe8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x90(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xe0(%rbp)
movq %rcx, %rsp
movq %rax, -0x98(%rbp)
movl -0x7c(%rbp), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xd8(%rbp)
movq %rcx, %rsp
movq %rax, -0xa0(%rbp)
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x30cfe
movq -0xd8(%rbp), %rax
cvtsi2ssl -0x80(%rbp), %xmm0
movslq -0x80(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x30cd6
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x30f98
movq -0x100(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x84(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa8(%rbp)
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x30e30
movq -0xe0(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0xb0(%rbp)
movq -0xa8(%rbp), %rcx
movss (%rcx), %xmm0
movq -0xa8(%rbp), %rcx
mulss (%rcx), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movq -0xa8(%rbp), %rcx
addq $0x4, %rcx
movq %rcx, -0xa8(%rbp)
movq -0xa8(%rbp), %rcx
movss (%rcx), %xmm0
movq -0xa8(%rbp), %rcx
mulss (%rcx), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movq -0xa8(%rbp), %rcx
addq $0x4, %rcx
movq %rcx, -0xa8(%rbp)
movq -0xa8(%rbp), %rcx
movss (%rcx), %xmm0
movq -0xa8(%rbp), %rcx
mulss (%rcx), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movq -0xa8(%rbp), %rcx
addq $0x4, %rcx
movq %rcx, -0xa8(%rbp)
movsd -0xb0(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq -0x80(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x30d3b
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdi
movl -0x7c(%rbp), %edx
leaq -0xb4(%rbp), %rcx
leaq -0xb8(%rbp), %r8
callq 0x15750
movss %xmm0, -0xbc(%rbp)
movq -0x8(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x158, %rcx, %rcx      # imm = 0x158
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0x78(%rbp), %rdi
movss -0xbc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0xc8(%rbp), %rax
movsbl (%rax), %edx
leaq 0x4cc90(%rip), %rsi     # 0x7db29
movb $0x1, %al
callq 0x1150
movq -0xc8(%rbp), %rdi
addq $0xc0, %rdi
callq 0x30fc0
movss %xmm0, -0xcc(%rbp)
movq -0x78(%rbp), %rdi
movss -0xcc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x4ad56(%rip), %rsi     # 0x7bc28
movb $0x1, %al
callq 0x1150
movq -0xc8(%rbp), %rdi
addq $0x90, %rdi
callq 0x30fc0
movss %xmm0, -0xcc(%rbp)
movq -0x78(%rbp), %rdi
movss -0xcc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x4ad1d(%rip), %rsi     # 0x7bc28
movb $0x1, %al
callq 0x1150
movq -0xc8(%rbp), %rdi
addq $0xd8, %rdi
callq 0x30fc0
movss %xmm0, -0xcc(%rbp)
movq -0x78(%rbp), %rdi
movss -0xcc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x4ace4(%rip), %rsi     # 0x7bc28
movb $0x1, %al
callq 0x1150
movq -0xc8(%rbp), %rdi
addq $0xa8, %rdi
callq 0x30fc0
movss %xmm0, -0xcc(%rbp)
movq -0x78(%rbp), %rdi
movss -0xcc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x4df13(%rip), %rsi     # 0x7ee90
movb $0x1, %al
callq 0x1150
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x30d08
movq -0x78(%rbp), %rdi
callq 0x10a0
movq -0x90(%rbp), %rax
movq %rax, %rsp
xorl %eax, %eax
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)