// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/allostery.c
// Function: Coupling_chains
void Coupling_chains(double **Chain_dir, double **Chain_coord,
		     double **Chain_def, double **Chain_cov,
		     double **norm_chain, char *ch, int Na,
		     char *chain_label, int Nchain, char *nameout1)
{
  printf("Printing average couplings of %d chains\n", Nchain);


  char nameout[200];
  //sprintf(nameout, "%s.chain%c_couplings.dat", nameout1,chain_label[i]);
  sprintf(nameout, "%s.chain_couplings.dat", nameout1);
  FILE *file_out=fopen(nameout, "w");
  printf("Writing %s\n", nameout);

  char header[200]; sprintf(header, "#chain1 chain2 ");
  if(Chain_dir)strcat(header,  " Directionality");
  if(Chain_coord)strcat(header," Coordination");
  if(Chain_cov)strcat(header,  " Covariance");
  if(Chain_def)strcat(header,  " Deformation");
  strcat(header,  " Proximity_weight");
  fprintf(file_out, "%s\n", header);

  for(int i=0; i<Nchain; i++){
    for(int j=i; j<Nchain; j++){
      fprintf(file_out, "%c %c ", chain_label[i], chain_label[j]);
      if(Chain_dir)fprintf(file_out, " %.4g", Chain_dir[i][j]);
      if(Chain_coord)fprintf(file_out, "\t%.4g", Chain_coord[i][j]);
      if(Chain_cov)fprintf(file_out, "\t%.4g", Chain_cov[i][j]);
      if(Chain_def)fprintf(file_out, "\t%.4g", Chain_def[i][j]);
      fprintf(file_out, "\t%.4g", norm_chain[i][j]);
      fprintf(file_out, "\n");
    }
  }
  fclose(file_out);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq 0x28(%rbp), %rax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl 0x20(%rbp), %esi
leaq 0x1e71b(%rip), %rdi     # 0x82c86
movb $0x0, %al
callq 0x10d0
leaq -0x100(%rbp), %rdi
movq 0x28(%rbp), %rdx
leaq 0x1e72b(%rip), %rsi     # 0x82caf
movb $0x0, %al
callq 0x1200
leaq -0x100(%rbp), %rdi
leaq 0x17dd9(%rip), %rsi     # 0x7c372
callq 0x11b0
movq %rax, -0x108(%rbp)
leaq -0x100(%rbp), %rsi
leaq 0x12f3b(%rip), %rdi     # 0x774ee
movb $0x0, %al
callq 0x10d0
leaq -0x1d0(%rbp), %rdi
leaq 0x1e6fe(%rip), %rsi     # 0x82cc6
movb $0x0, %al
callq 0x1200
cmpq $0x0, -0x8(%rbp)
je 0x645e9
leaq -0x1d0(%rbp), %rdi
leaq 0x1e6f2(%rip), %rsi     # 0x82cd6
callq 0x11e0
cmpq $0x0, -0x10(%rbp)
je 0x64603
leaq -0x1d0(%rbp), %rdi
leaq 0x1e6e8(%rip), %rsi     # 0x82ce6
callq 0x11e0
cmpq $0x0, -0x20(%rbp)
je 0x6461d
leaq -0x1d0(%rbp), %rdi
leaq 0x1e6dc(%rip), %rsi     # 0x82cf4
callq 0x11e0
cmpq $0x0, -0x18(%rbp)
je 0x64637
leaq -0x1d0(%rbp), %rdi
leaq 0x1e6ce(%rip), %rsi     # 0x82d00
callq 0x11e0
leaq -0x1d0(%rbp), %rdi
leaq 0x1e6c8(%rip), %rsi     # 0x82d0d
callq 0x11e0
movq -0x108(%rbp), %rdi
leaq -0x1d0(%rbp), %rdx
leaq 0x1e3f9(%rip), %rsi     # 0x82a58
movb $0x0, %al
callq 0x1150
movl $0x0, -0x1d4(%rbp)
movl -0x1d4(%rbp), %eax
cmpl 0x20(%rbp), %eax
jge 0x64818
movl -0x1d4(%rbp), %eax
movl %eax, -0x1d8(%rbp)
movl -0x1d8(%rbp), %eax
cmpl 0x20(%rbp), %eax
jge 0x64802
movq -0x108(%rbp), %rdi
movq 0x18(%rbp), %rax
movslq -0x1d4(%rbp), %rcx
movsbl (%rax,%rcx), %edx
movq 0x18(%rbp), %rax
movslq -0x1d8(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
leaq 0x1e659(%rip), %rsi     # 0x82d1f
movb $0x0, %al
callq 0x1150
cmpq $0x0, -0x8(%rbp)
je 0x64704
movq -0x108(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x1d4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1d8(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x13375(%rip), %rsi     # 0x77a72
movb $0x1, %al
callq 0x1150
cmpq $0x0, -0x10(%rbp)
je 0x6473b
movq -0x108(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x1d4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1d8(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x1807d(%rip), %rsi     # 0x7c7b1
movb $0x1, %al
callq 0x1150
cmpq $0x0, -0x20(%rbp)
je 0x64772
movq -0x108(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x1d4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1d8(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x18046(%rip), %rsi     # 0x7c7b1
movb $0x1, %al
callq 0x1150
cmpq $0x0, -0x18(%rbp)
je 0x647a9
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x1d4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1d8(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x1800f(%rip), %rsi     # 0x7c7b1
movb $0x1, %al
callq 0x1150
movq -0x108(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq -0x1d4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1d8(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x17fdf(%rip), %rsi     # 0x7c7b1
movb $0x1, %al
callq 0x1150
movq -0x108(%rbp), %rdi
leaq 0x19891(%rip), %rsi     # 0x7e078
movb $0x0, %al
callq 0x1150
movl -0x1d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d8(%rbp)
jmp 0x6468b
jmp 0x64804
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x64670
movq -0x108(%rbp), %rdi
callq 0x10a0
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopl (%rax)