// File: /workspace/github_c_makefile_star2_O2/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, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movl %esi, %ebp
movq %rdi, 0x28(%rsp)
leaq 0x15281(%rip), %rsi     # 0x574ad
movq $0x0, 0x20(%rsp)
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r9, %rdx
xorl %eax, %eax
callq 0x2260
leaq 0xef02(%rip), %rsi      # 0x51150
movq %rbx, %rdi
callq 0x2210
movq %rax, %r14
leaq 0x9a47(%rip), %rdi      # 0x4bca7
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x1525c(%rip), %rdi     # 0x574cd
pushq $0x31
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2280
leaq 0x15276(%rip), %rdi     # 0x574ff
pushq $0x20
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2280
leaq 0x15282(%rip), %rdi     # 0x57520
pushq $0x2d
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2280
leaq 0x1529b(%rip), %rdi     # 0x5754e
pushq $0x24
popq %rsi
movq %rbx, %rdx
movq %r14, 0x18(%rsp)
movq %r14, %rcx
callq 0x2280
movslq %ebp, %rbx
leaq (,%rbx,4), %r14
movq %r14, %rdi
callq 0x21d0
movq %rax, (%rsp)
movq %r14, %rdi
callq 0x21d0
movq %rax, %r14
testl %ebx, %ebx
movl $0x0, %eax
movl %ebp, 0x8(%rsp)
cmovgl %ebp, %eax
movq %rax, 0x48(%rsp)
movl %ebx, %r15d
xorl %r13d, %r13d
cmpq 0x48(%rsp), %r13
je 0x423e1
movq 0x28(%rsp), %rax
movq (%rax,%r13,8), %rbp
movq %r13, %r12
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x42359
movq 0x20(%rsp), %rax
addl %ebx, %eax
cmpq %rbx, %r13
movl %r12d, %ecx
cmovbel %eax, %ecx
cvtsi2ss %ecx, %xmm0
movq (%rsp), %rax
movss %xmm0, (%rax,%rbx,4)
cvtss2sd (%rbp,%rbx,4), %xmm0
callq 0x2120
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%r14,%rbx,4)
incq %rbx
decq %r12
jmp 0x4231a
movq (%rsp), %rdi
movq %r14, %rsi
movl 0x8(%rsp), %edx
leaq 0x14(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0xfe18
movss %xmm0, 0xc(%rsp)
movq 0x38(%rsp), %rax
movsbl (%rax,%r13), %ebx
movq 0x30(%rsp), %rax
movq (%rax,%r13,8), %r12
movq 0x40(%rsp), %rax
movsbl (%rax,%r13), %ebp
cvtss2sd 0x10(%rsp), %xmm0
callq 0x22a0
movss 0x8c5b(%rip), %xmm1     # 0x4b004
divss 0x14(%rsp), %xmm1
cvtss2sd %xmm1, %xmm1
cvtss2sd 0xc(%rsp), %xmm2
movq 0x18(%rsp), %rdi
leaq 0x151ae(%rip), %rsi     # 0x57573
movl %ebx, %edx
movq %r12, %rcx
movl %ebp, %r8d
movb $0x3, %al
callq 0x2190
incq %r13
decq 0x20(%rsp)
jmp 0x42301
movq 0x18(%rsp), %rdi
callq 0x20c0
movq (%rsp), %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