// File: /workspace/github_c_makefile_star2_O3/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, 0x8(%rsp)
movq %rdx, %r14
movl %esi, %ebx
movq %rdi, %r15
leaq 0x3e1d7(%rip), %rsi     # 0x571c1
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %r9, %rdx
movq %r8, %rcx
xorl %eax, %eax
callq 0x2270
leaq 0x3e1fa(%rip), %rsi     # 0x57200
movq %rbp, %rdi
callq 0x2220
movq %rax, %r12
leaq 0x3e1bc(%rip), %rdi     # 0x571d4
movq %rbp, %rsi
xorl %eax, %eax
callq 0x20f0
movzbl (%r13), %eax
cmpl $0x43, %eax
je 0x19046
cmpl $0x53, %eax
jne 0x1907c
movl %ebx, 0x4(%rsp)
cmpb $0x43, 0x1(%r13)
jne 0x190a1
cmpb $0x52, 0x2(%r13)
sete %bl
jmp 0x190a3
cmpb $0x41, 0x1(%r13)
je 0x19054
cmpb $0x42, 0x1(%r13)
jne 0x1907c
leaq 0x3e197(%rip), %rdi     # 0x571f2
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
movb $0x1, %r13b
movl $0x0, (%rsp)
jmp 0x191cc
leaq 0x3e16f(%rip), %rdi     # 0x571f2
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
movl $0x0, (%rsp)
jmp 0x191b0
xorl %ebx, %ebx
cmpb $0x43, 0x1(%r13)
jne 0x190b8
movb $0x1, %bpl
cmpb $0x41, 0x2(%r13)
je 0x19150
cmpb $0x43, 0x1(%r13)
jne 0x19111
cmpb $0x42, 0x2(%r13)
jne 0x1914e
leaq 0x3e121(%rip), %rdi     # 0x571f2
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
testb %bl, %bl
je 0x192de
leaq 0x3e10d(%rip), %rdi     # 0x571ff
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
movb $0x1, %al
movl %eax, (%rsp)
movb $0x1, %r13b
jmp 0x192e8
leaq 0x3e0da(%rip), %rdi     # 0x571f2
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
testb %bl, %bl
je 0x191a5
leaq 0x3e0ca(%rip), %rdi     # 0x571ff
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
movb $0x1, %al
movl %eax, (%rsp)
jmp 0x191ac
xorl %ebp, %ebp
leaq 0x3e09b(%rip), %rdi     # 0x571f2
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
testb %bl, %bl
je 0x19190
leaq 0x3e08b(%rip), %rdi     # 0x571ff
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
movb $0x1, %al
movl %eax, (%rsp)
movb $0x1, %r13b
jmp 0x1919a
movb $0x1, %r13b
movl $0x0, (%rsp)
testb %bpl, %bpl
movl 0x4(%rsp), %ebx
je 0x191b0
jmp 0x191cc
movl $0x0, (%rsp)
movl 0x4(%rsp), %ebx
leaq 0x3e04b(%rip), %rdi     # 0x57202
movl $0xc, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2290
xorl %r13d, %r13d
leaq 0x3e03c(%rip), %rsi     # 0x5720f
movq %r12, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x21a0
testl %ebx, %ebx
jle 0x192c7
movl %ebx, %eax
imulq $0xc8, %rax, %rbx
xorl %ebp, %ebp
movslq (%r15,%rbp), %rax
imulq $0x70, %rax, %rax
movslq 0x64(%r14,%rax), %rax
movslq 0x4(%r15,%rbp), %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 0x192b7
shlq $0x5, %rax
movq 0x8(%rsp), %rsi
leaq (%rsi,%rax), %rdx
addq $0xd, %rdx
shlq $0x5, %rcx
addq %rsi, %rcx
addq $0xd, %rcx
movsd 0x20(%r15,%rbp), %xmm0
movq %r12, %rdi
leaq 0x3dfcf(%rip), %rsi     # 0x5721d
movb $0x1, %al
callq 0x21a0
cmpb $0x0, (%rsp)
je 0x19273
movsd 0x28(%r15,%rbp), %xmm0
movq %r12, %rdi
leaq 0x3fcce(%rip), %rsi     # 0x58f3a
movb $0x1, %al
callq 0x21a0
testb %r13b, %r13b
jne 0x192aa
movslq (%r15,%rbp), %rax
imulq $0x70, %rax, %rax
leaq (%r14,%rax), %rdx
addq $0x18, %rdx
movslq 0x4(%r15,%rbp), %rax
imulq $0x70, %rax, %rax
leaq (%r14,%rax), %rcx
addq $0x18, %rcx
movq %r12, %rdi
leaq 0x3df85(%rip), %rsi     # 0x57228
xorl %eax, %eax
callq 0x21a0
movl $0xa, %edi
movq %r12, %rsi
callq 0x2140
addq $0xc8, %rbp
cmpq %rbp, %rbx
jne 0x191f2
movq %r12, %rdi
callq 0x20c0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %r13b
movl $0x0, (%rsp)
movl 0x4(%rsp), %ebx
jmp 0x191cc