// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/main_tnm.c
// Function: Get_interface
int Get_interface(int *Cart_interface,
		  struct interaction *Int_list, int N_int,
		  atom *atoms, int *apo_chain_num,
		  int n_apo, struct chain *chains, int Nchain,
		  int *atom_num, int N_ref, int natoms, int nres)
{
  N_res_1=0; N_res_2=0; N_cont_long_1=0; N_cont_long_2=0;

  int atom_ref[natoms], i;
  for(i=0; i<natoms; i++)atom_ref[i]=-1;
  for(i=0; i<N_ref; i++)atom_ref[atom_num[i]]=i;
  int res_inter[nres]; for(i=0; i<nres; i++)res_inter[i]=0;
  for(i=0; i<Nchain; i++){
    if(Belong_to_apo(i, apo_chain_num, n_apo)){N_res_1+=chains[i].nres;}
    else{N_res_2+=chains[i].nres;}
  }

  struct interaction *tmp=Int_list;
  for(int k=0; k<N_int; k++){
    if(atoms[tmp->i1].chain!=atoms[tmp->i2].chain){
      int apo1=Belong_to_apo(atoms[tmp->i1].chain, apo_chain_num, n_apo);
      int apo2=Belong_to_apo(atoms[tmp->i2].chain, apo_chain_num, n_apo);
      if(apo1 && apo2){
	if(atoms[tmp->i2].res-atoms[tmp->i1].res>2)N_cont_long_1++;
      }else if(apo1==0 && apo2==0){
	if(atoms[tmp->i2].res-atoms[tmp->i1].res>2)N_cont_long_2++;
      }else if((apo1 && apo2==0)||(apo1==0 && apo2)){
	res_inter[atoms[tmp->i1].res]=1;
	res_inter[atoms[tmp->i2].res]=1;
      }
    }
    tmp++;
  }
  int nres_inter=0, natom_inter=0, N_Cart_inter=0;
  for(i=0; i<nres; i++)if(res_inter[i])nres_inter++;
  for(i=0; i<natoms; i++){
    if(res_inter[atoms[i].res] && atom_ref[i]>=0){
      natom_inter++; int k=3*atom_ref[i];
      for(int j=0; j<3; j++){
	Cart_interface[N_Cart_inter]=k; N_Cart_inter++; k++;
      }
    }
  }

  printf("Interface between %d chains and %d chains:\n", n_apo, Nchain-n_apo);
  printf("%d residues out of %d "
	 "%d atoms out of %d "
	 "%d Cartesian coordinates out of %d\n",
	 nres_inter, nres, natom_inter, natoms, N_Cart_inter, 3*N_ref);
  return(N_Cart_inter);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %r13d
movq %r8, %rbx
movq %rcx, %r15
movl %edx, -0x2c(%rbp)
movq %rsi, %r14
movq %rdi, -0x50(%rbp)
movl 0x30(%rbp), %ecx
movl 0x28(%rbp), %r12d
xorl %eax, %eax
movl %eax, 0x600da(%rip)     # 0x69114
movl %eax, 0x600d8(%rip)     # 0x69118
movl %eax, 0x600d6(%rip)     # 0x6911c
movl %eax, 0x600d4(%rip)     # 0x69120
movq %rsp, %rdi
leaq 0xf(,%rcx,4), %rax
andq $-0x10, %rax
subq %rax, %rdi
movq %rdi, %rsp
testl %ecx, %ecx
movq %rdi, -0x40(%rbp)
jle 0x9083
leaq (,%rcx,4), %rdx
movq -0x40(%rbp), %rdi
movl $0xff, %esi
callq 0x2110
movq -0x40(%rbp), %rdi
testl %r12d, %r12d
jle 0x90a0
movq 0x20(%rbp), %rax
movl %r12d, %ecx
xorl %edx, %edx
movslq (%rax,%rdx,4), %rsi
movl %edx, (%rdi,%rsi,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x9091
movl 0x38(%rbp), %ecx
movl %ecx, %edx
movq %rsp, %r12
leaq 0xf(,%rdx,4), %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
testl %ecx, %ecx
movq %rdx, -0x48(%rbp)
jle 0x90d8
movq -0x48(%rbp), %rax
leaq (,%rax,4), %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x2110
movl %r13d, %eax
cmpl $0x0, 0x18(%rbp)
jle 0x9144
movq 0x10(%rbp), %rcx
movl 0x18(%rbp), %edx
xorl %esi, %esi
xorl %edi, %edi
xorl %r8d, %r8d
testl %r13d, %r13d
jle 0x912d
movl (%rbx), %r9d
cmpq %r9, %r8
je 0x911c
movl $0x1, %r10d
movq %r10, %r9
cmpq %r10, %rax
je 0x9117
movl (%rbx,%r9,4), %r11d
leaq 0x1(%r9), %r10
cmpq %r11, %r8
jne 0x9102
cmpq %rax, %r9
jae 0x912d
imulq $0x70, %r8, %r9
addl 0x1c(%rcx,%r9), %esi
movl %esi, 0x5ffe9(%rip)     # 0x69114
jmp 0x913c
imulq $0x70, %r8, %r9
addl 0x1c(%rcx,%r9), %edi
movl %edi, 0x5ffdc(%rip)     # 0x69118
incq %r8
cmpq %rdx, %r8
jne 0x90ef
movl -0x2c(%rbp), %esi
testl %esi, %esi
movl %r13d, -0x38(%rbp)
jle 0x9281
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
xorl %edi, %edi
movslq (%r14), %rcx
imulq $0x70, %rcx, %r8
movl 0x6c(%r15,%r8), %ecx
movslq 0x4(%r14), %rdx
imulq $0x70, %rdx, %r9
movl 0x6c(%r15,%r9), %edx
cmpl %edx, %ecx
je 0x9270
testl %r13d, %r13d
jle 0x9206
movl (%rbx), %esi
movb $0x1, %r10b
movb $0x1, %r11b
cmpl %ecx, %esi
je 0x91b8
movl $0x1, %r13d
movq %r13, %r11
cmpq %r13, %rax
je 0x91ad
leaq 0x1(%r11), %r13
cmpl %ecx, (%rbx,%r11,4)
jne 0x919b
cmpq %rax, %r11
setb %r11b
movl -0x38(%rbp), %r13d
cmpl %edx, %esi
je 0x91d9
movl $0x1, %esi
movq %rsi, %rcx
cmpq %rsi, %rax
je 0x91d2
leaq 0x1(%rcx), %rsi
cmpl %edx, (%rbx,%rcx,4)
jne 0x91c1
cmpq %rax, %rcx
setb %r10b
movl %r11d, %ecx
andb %r10b, %cl
cmpb $0x1, %cl
jne 0x9212
movl 0x64(%r15,%r9), %ecx
subl 0x64(%r15,%r8), %ecx
cmpl $0x3, %ecx
jl 0x9201
movl -0x30(%rbp), %ecx
incl %ecx
movl %ecx, -0x30(%rbp)
movl %ecx, 0x5ff1b(%rip)     # 0x6911c
movl -0x2c(%rbp), %esi
jmp 0x9270
xorl %r10d, %r10d
xorl %r11d, %r11d
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x921a
movzbl %r11b, %ecx
movzbl %r10b, %edx
movl %ecx, %esi
orl %edx, %esi
jne 0x9242
movl 0x64(%r15,%r9), %ecx
subl 0x64(%r15,%r8), %ecx
cmpl $0x3, %ecx
movl -0x2c(%rbp), %esi
jl 0x9270
movl -0x34(%rbp), %ecx
incl %ecx
movl %ecx, -0x34(%rbp)
movl %ecx, 0x5fee0(%rip)     # 0x69120
jmp 0x9270
testl %edx, %edx
sete %dl
testl %ecx, %ecx
sete %cl
testb %dl, %r11b
movl -0x2c(%rbp), %esi
jne 0x9259
andb %r10b, %cl
je 0x9270
movslq 0x64(%r15,%r8), %rcx
movl $0x1, %edx
movl %edx, (%r12,%rcx,4)
movslq 0x64(%r15,%r9), %rcx
movl %edx, (%r12,%rcx,4)
addq $0xc8, %r14
incl %edi
cmpl %esi, %edi
jne 0x9163
xorl %ebx, %ebx
movl $0x0, %r14d
cmpl $0x0, 0x38(%rbp)
movl 0x30(%rbp), %r8d
movq -0x50(%rbp), %r9
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
jle 0x92b5
xorl %eax, %eax
xorl %r14d, %r14d
cmpl $0x1, (%r12,%rax,4)
sbbl $-0x1, %r14d
incq %rax
cmpq %rax, %rcx
jne 0x92a4
movl $0x0, %r13d
testl %r8d, %r8d
jle 0x9309
xorl %eax, %eax
xorl %r13d, %r13d
xorl %ebx, %ebx
imulq $0x70, %rax, %rcx
movslq 0x64(%r15,%rcx), %rcx
cmpl $0x0, (%r12,%rcx,4)
je 0x9301
movl (%rdx,%rax,4), %ecx
testl %ecx, %ecx
js 0x9301
leal (%rcx,%rcx,2), %ecx
movslq %r13d, %rdx
leaq (%r9,%rdx,4), %rsi
xorl %edx, %edx
leal (%rcx,%rdx), %edi
movl %edi, (%rsi,%rdx,4)
incq %rdx
cmpl $0x3, %edx
jne 0x92ea
incl %ebx
addl %edx, %r13d
movq -0x40(%rbp), %rdx
incq %rax
cmpq %r8, %rax
jne 0x92c7
movl -0x38(%rbp), %esi
movl 0x18(%rbp), %edx
subl %esi, %edx
leaq 0x4bb86(%rip), %rdi     # 0x54e9e
xorl %eax, %eax
movq %r8, %r15
callq 0x20f0
movl 0x28(%rbp), %eax
leal (%rax,%rax,2), %r10d
subq $0x8, %rsp
leaq 0x4bb96(%rip), %rdi     # 0x54eca
movl %r14d, %esi
movl 0x38(%rbp), %edx
movl %ebx, %ecx
movl %r15d, %r8d
movl %r13d, %r9d
xorl %eax, %eax
pushq %r10
callq 0x20f0
addq $0x10, %rsp
movl %r13d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq