// File: /workspace/github_c_makefile_star2_O1/ugobas[P]tnm/interactions_tnm.c
// Function: Print_contact_matrix
void Print_contact_matrix(struct interaction *Int_list, int N_int,
			  atom *atoms, struct residue *res,
			  char *name, char *pdb)
{
  char nameout[100]; sprintf(nameout, "%s_%s_Cont_Mat.txt", pdb,name);
  FILE *file_out=fopen(nameout, "w");
  printf("Writing contact matrix in %s\n", nameout);
  int i, SCR=0, ALL=1;
  if((strncmp(name,"SCR",3)==0))SCR=1;
  if((strncmp(name,"CA",2)==0)||(strncmp(name,"CB",2)==0)||
     (strncmp(name,"SCA",3)==0)||(strncmp(name,"SCB",3)==0))ALL=0;
  fprintf(file_out, "#res1\tres2\td");
  if(SCR)fprintf(file_out, "\tw");
  if(ALL)fprintf(file_out, "\tatom1\tatom2");
  fprintf(file_out, "\tcontacts=%d\n",N_int);
  for(i=0; i<N_int; i++){
    int ij=abs(atoms[Int_list[i].i1].res-atoms[Int_list[i].i2].res);
    if(ij<=2)continue;
    fprintf(file_out, "%s\t%s\t%.2f",
	    res[atoms[Int_list[i].i1].res].pdbres,
	    res[atoms[Int_list[i].i2].res].pdbres,
	    Int_list[i].r0);
    if(SCR)fprintf(file_out, "\t%.4f", Int_list[i].sec_der);
    if(ALL)fprintf(file_out, "\t%s\t%s",
		   atoms[Int_list[i].i1].name,
		   atoms[Int_list[i].i2].name);
    fprintf(file_out, "\n");
  }
  fclose(file_out);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, %r13
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, 0xc(%rsp)
movq %rdi, %r15
leaq 0x3da2d(%rip), %rsi     # 0x57201
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %r9, %rdx
movq %r8, %rcx
xorl %eax, %eax
callq 0x2260
leaq 0x3da50(%rip), %rsi     # 0x57240
movq %rbp, %rdi
callq 0x2210
movq %rax, %r12
leaq 0x3da12(%rip), %rdi     # 0x57214
movq %rbp, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x44690(%rip), %rsi     # 0x5dea3
movl $0x3, %edx
movq %r13, %rdi
callq 0x2070
movl %eax, 0x8(%rsp)
leaq 0x3b93f(%rip), %rsi     # 0x5516a
movl $0x2, %edx
movq %r13, %rdi
callq 0x2070
testl %eax, %eax
je 0x1988e
leaq 0x37981(%rip), %rsi     # 0x511c4
movl $0x2, %edx
movq %r13, %rdi
callq 0x2070
testl %eax, %eax
je 0x1988e
leaq 0x37927(%rip), %rsi     # 0x51182
movl $0x3, %edx
movq %r13, %rdi
callq 0x2070
testl %eax, %eax
je 0x1988e
leaq 0x37950(%rip), %rsi     # 0x511c3
movl $0x3, %edx
movq %r13, %rdi
callq 0x2070
testl %eax, %eax
je 0x1988e
movl $0x0, 0x4(%rsp)
jmp 0x19894
movb $0x1, %al
movl %eax, 0x4(%rsp)
leaq 0x3d997(%rip), %rdi     # 0x57232
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2280
cmpl $0x0, 0x8(%rsp)
movl 0xc(%rsp), %ebp
jne 0x198d1
leaq 0x3d980(%rip), %rdi     # 0x5723f
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2280
cmpb $0x0, 0x4(%rsp)
jne 0x198f1
leaq 0x3d963(%rip), %rdi     # 0x57242
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2280
leaq 0x3d957(%rip), %rsi     # 0x5724f
movq %r12, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2190
testl %ebp, %ebp
jle 0x199eb
movl %ebp, %eax
imulq $0xc8, %rax, %rbp
xorl %r13d, %r13d
movslq (%r15,%r13), %rax
imulq $0x70, %rax, %rax
movslq 0x64(%r14,%rax), %rax
movslq 0x4(%r15,%r13), %rcx
imulq $0x70, %rcx, %rcx
movslq 0x64(%r14,%rcx), %rcx
movl %eax, %edx
subl %ecx, %edx
movl %edx, %esi
negl %esi
cmovsl %edx, %esi
cmpl $0x3, %esi
jb 0x199db
shlq $0x5, %rax
leaq (%rbx,%rax), %rdx
addq $0xd, %rdx
shlq $0x5, %rcx
addq %rbx, %rcx
addq $0xd, %rcx
movsd 0x20(%r15,%r13), %xmm0
movq %r12, %rdi
leaq 0x3d8ee(%rip), %rsi     # 0x5725d
movb $0x1, %al
callq 0x2190
cmpl $0x0, 0x8(%rsp)
jne 0x19995
movsd 0x28(%r15,%r13), %xmm0
movq %r12, %rdi
leaq 0x3f5ff(%rip), %rsi     # 0x58f8d
movb $0x1, %al
callq 0x2190
cmpb $0x0, 0x4(%rsp)
jne 0x199ce
movslq (%r15,%r13), %rax
imulq $0x70, %rax, %rax
leaq (%r14,%rax), %rdx
addq $0x18, %rdx
movslq 0x4(%r15,%r13), %rax
imulq $0x70, %rax, %rax
leaq (%r14,%rax), %rcx
addq $0x18, %rcx
movq %r12, %rdi
leaq 0x3d8a1(%rip), %rsi     # 0x57268
xorl %eax, %eax
callq 0x2190
movl $0xa, %edi
movq %r12, %rsi
callq 0x2140
addq $0xc8, %r13
cmpq %r13, %rbp
jne 0x19918
movq %r12, %rdi
callq 0x20c0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq