// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/allostery.c
// Function: Deformation_propagation
void Deformation_propagation(float **Deformation_coupling, int Na,
			    char **pdbres, char *amm, char *chain,
			    char *nameout)
{
  char namefile[200];
  sprintf(namefile, "%s.perturbation_propagation.dat", nameout);
  FILE *file_out=fopen(namefile, "w");
  printf("Writing %s\n", namefile);
  fprintf(file_out, "# Predicted deformation produced on sites j by a ");
  fprintf(file_out, "perturbation applied at site i:\n");
  fprintf(file_out, "# Def(i->j)~Allo_i exp(-|i-j|/prop_length_i)\n");
  fprintf(file_out, "#AA res chain Allo prop_length C.c.\n");
  float *d=malloc(Na*sizeof(float));
  float *y=malloc(Na*sizeof(float));
  float slope, offset, r; int i, j;
  for(i=0; i<Na; i++){
    float *Ci=Deformation_coupling[i];
    for(j=0; j<Na; j++){
      if(i>j){d[j]=i-j;}else{d[j]=j-i;}
      y[j]=log(Ci[j]);
    }
    r=Corr_coeff(d, y, Na, &slope, &offset);
    fprintf(file_out, "%c\t%s\t%c\t%.3f\t%.3f\t%.3f\n",
	    amm[i], pdbres[i], chain[i], exp(offset), -1/slope, r);
  }
  fclose(file_out);
  free(d); free(y);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %r8, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movl %esi, %ebp
movq %rdi, 0x30(%rsp)
leaq 0x154a5(%rip), %rsi     # 0x5d53d
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r9, %rdx
xorl %eax, %eax
callq 0x2270
leaq 0xf14f(%rip), %rsi      # 0x57200
movq %rbx, %rdi
callq 0x2220
movq %rax, %r14
leaq 0x9c8c(%rip), %rdi      # 0x51d4f
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x15489(%rip), %rdi     # 0x5d55d
movl $0x31, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2290
leaq 0x154a2(%rip), %rdi     # 0x5d58f
movl $0x20, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2290
leaq 0x154aa(%rip), %rdi     # 0x5d5b0
movl $0x2d, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2290
leaq 0x154bf(%rip), %rdi     # 0x5d5de
movl $0x24, %esi
movl $0x1, %edx
movq %r14, 0x18(%rsp)
movq %r14, %rcx
callq 0x2290
movl %ebp, 0x8(%rsp)
movslq %ebp, %rbx
leaq (,%rbx,4), %r14
movq %r14, %rdi
callq 0x21e0
movq %rax, %r15
movq %r14, %rdi
callq 0x21e0
movq %rax, %r14
testl %ebx, %ebx
jle 0x4826e
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
xorl %r13d, %r13d
movq %rax, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq (%rax,%r13,8), %rbp
movq %r13, %r12
movq %r14, %rbx
xorl %r14d, %r14d
movq 0x28(%rsp), %rax
addl %r14d, %eax
cmpq %r14, %r13
movl %r12d, %ecx
cmovbel %eax, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, (%r15,%r14,4)
xorps %xmm0, %xmm0
cvtss2sd (%rbp,%r14,4), %xmm0
callq 0x2120
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rbx,%r14,4)
incq %r14
decq %r12
cmpq %r14, 0x20(%rsp)
jne 0x48188
movq %r15, %r12
movq %r15, %rdi
movq %rbx, %r14
movq %rbx, %rsi
movl 0x8(%rsp), %edx
leaq 0x14(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0x108db
movss %xmm0, 0xc(%rsp)
movq 0x40(%rsp), %rax
movsbl (%rax,%r13), %ebx
movq 0x38(%rsp), %rax
movq (%rax,%r13,8), %r15
movq 0x48(%rsp), %rax
movsbl (%rax,%r13), %ebp
xorps %xmm0, %xmm0
cvtss2sd 0x10(%rsp), %xmm0
callq 0x22b0
movss 0x8eec(%rip), %xmm1     # 0x51110
divss 0x14(%rsp), %xmm1
cvtss2sd %xmm1, %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0xc(%rsp), %xmm2
movq 0x18(%rsp), %rdi
leaq 0x153c0(%rip), %rsi     # 0x5d603
movl %ebx, %edx
movq %r15, %rcx
movl %ebp, %r8d
movb $0x3, %al
callq 0x21a0
incq %r13
movq 0x28(%rsp), %rcx
decq %rcx
movq 0x20(%rsp), %rax
cmpq %rax, %r13
movq %r12, %r15
jne 0x48171
movq 0x18(%rsp), %rdi
callq 0x20c0
movq %r15, %rdi
callq 0x2050
movq %r14, %rdi
callq 0x2050
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq