// File: /workspace/github_c_makefile_star2_O0/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
subq $0x90, %rsp
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movl $0x0, 0x81344(%rip)     # 0x8c0d4
movl $0x0, 0x8133e(%rip)     # 0x8c0d8
movl $0x0, 0x81338(%rip)     # 0x8c0dc
movl $0x0, 0x81332(%rip)     # 0x8c0e0
movl 0x30(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x38(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x80(%rbp)
movq %rcx, %rsp
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x30(%rbp), %eax
jge 0xadfe
movq -0x80(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xaddc
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x28(%rbp), %eax
jge 0xae2e
movq -0x80(%rbp), %rax
movl -0x44(%rbp), %edx
movq 0x20(%rbp), %rcx
movslq -0x44(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xae05
movl 0x38(%rbp), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x88(%rbp)
movq %rcx, %rsp
movq %rax, -0x50(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x38(%rbp), %eax
jge 0xae7d
movq -0x88(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xae58
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x18(%rbp), %eax
jge 0xaeeb
movl -0x44(%rbp), %edi
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0xb1e0
cmpl $0x0, %eax
je 0xaec0
movq 0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
addl 0x8121c(%rip), %eax     # 0x8c0d4
movl %eax, 0x81216(%rip)     # 0x8c0d4
jmp 0xaede
movq 0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
addl 0x81200(%rip), %eax     # 0x8c0d8
movl %eax, 0x811fa(%rip)     # 0x8c0d8
jmp 0xaee0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xae84
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xb099
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movslq (%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x6c(%rax), %eax
movq -0x20(%rbp), %rcx
movq -0x58(%rbp), %rdx
movslq 0x4(%rdx), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x6c(%rcx), %eax
je 0xb07d
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movslq (%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x6c(%rax), %edi
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0xb1e0
movl %eax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x6c(%rax), %edi
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0xb1e0
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x60(%rbp)
je 0xafd0
cmpl $0x0, -0x64(%rbp)
je 0xafd0
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
movq -0x20(%rbp), %rcx
movq -0x58(%rbp), %rdx
movslq (%rdx), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
subl 0x64(%rcx), %eax
cmpl $0x2, %eax
jle 0xafcb
movl 0x8111a(%rip), %eax     # 0x8c0dc
addl $0x1, %eax
movl %eax, 0x81111(%rip)     # 0x8c0dc
jmp 0xb07b
cmpl $0x0, -0x60(%rbp)
jne 0xb01d
cmpl $0x0, -0x64(%rbp)
jne 0xb01d
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movslq 0x4(%rcx), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
movq -0x20(%rbp), %rcx
movq -0x58(%rbp), %rdx
movslq (%rdx), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
subl 0x64(%rcx), %eax
cmpl $0x2, %eax
jle 0xb01b
movl 0x810ce(%rip), %eax     # 0x8c0e0
addl $0x1, %eax
movl %eax, 0x810c5(%rip)     # 0x8c0e0
jmp 0xb079
cmpl $0x0, -0x60(%rbp)
je 0xb029
cmpl $0x0, -0x64(%rbp)
je 0xb035
cmpl $0x0, -0x60(%rbp)
jne 0xb077
cmpl $0x0, -0x64(%rbp)
je 0xb077
movq -0x88(%rbp), %rax
movq -0x20(%rbp), %rcx
movq -0x58(%rbp), %rdx
movslq (%rdx), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
movslq 0x64(%rcx), %rcx
movl $0x1, (%rax,%rcx,4)
movq -0x20(%rbp), %rcx
movq -0x58(%rbp), %rdx
movslq 0x4(%rdx), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
movslq 0x64(%rcx), %rcx
movl $0x1, (%rax,%rcx,4)
jmp 0xb079
jmp 0xb07b
jmp 0xb07d
movq -0x58(%rbp), %rax
addq $0xc8, %rax
movq %rax, -0x58(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0xaefa
movl $0x0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x38(%rbp), %eax
jge 0xb0e4
movq -0x88(%rbp), %rax
movslq -0x44(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0xb0d7
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0xb0d9
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xb0b5
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x30(%rbp), %eax
jge 0xb187
movq -0x88(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x44(%rbp), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
movslq 0x64(%rcx), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0xb177
movq -0x80(%rbp), %rax
movslq -0x44(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0xb177
movq -0x80(%rbp), %rax
movl -0x6c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x6c(%rbp)
movslq -0x44(%rbp), %rcx
imull $0x3, (%rax,%rcx,4), %eax
movl %eax, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
cmpl $0x3, -0x78(%rbp)
jge 0xb175
movl -0x74(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x70(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0xb144
jmp 0xb177
jmp 0xb179
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xb0eb
movl -0x2c(%rbp), %esi
movl 0x18(%rbp), %edx
subl -0x2c(%rbp), %edx
leaq 0x6f91d(%rip), %rdi     # 0x7aab4
movb $0x0, %al
callq 0x10d0
movl -0x68(%rbp), %esi
movl 0x38(%rbp), %edx
movl -0x6c(%rbp), %ecx
movl 0x30(%rbp), %r8d
movl -0x70(%rbp), %r9d
imull $0x3, 0x28(%rbp), %eax
leaq 0x6f926(%rip), %rdi     # 0x7aae0
subq $0x10, %rsp
movl %eax, (%rsp)
movb $0x0, %al
callq 0x10d0
addq $0x10, %rsp
movl -0x70(%rbp), %eax
movq -0x38(%rbp), %rcx
movq %rcx, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax,%rax)