// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/allostery.c
// Function: Extract_atoms
int Extract_atoms(int *iref, int *iatom, int *atomres, // Output
		  struct residue *seq, float *mass,
		  atom *atoms, struct Reference Ref, char *ANAME)
{
  /* 
     iref[i]= representative atom (kin) of representative atom i (allostery)
     iatom=   atom number of representative atom i (allostery)
     atomres= representative atom (allostery) of residue
   */
  int ia, Na=0, Nres=atoms[Ref.atom_num[Ref.N_ref-1]].res+1;
  for(ia=0; ia<Nres; ia++)atomres[ia]=-1;
  for(ia=0; ia<Ref.N_ref; ia++){
    atom *atom_i=atoms+Ref.atom_num[ia];
    if((strncmp(atom_i->name, ANAME, 2)==0)||
       ((seq[atom_i->res].amm=='G')&&(strncmp(atom_i->name, "CA", 2)==0))){
      if(*mass==0)*mass=Ref.mass_atom[ia];
      iref[Na]=ia;
      iatom[Na]=Ref.atom_num[ia];
      //ires[Na]=atom_i->res;
      atomres[atom_i->res]=Na; Na++;
    }
  }
  /*for(ia=0; ia<Na; ia++){
    int r=(atoms+Ref.atom_num[iref[ia]])->res;
    printf("%d %c %s %s\n", ia, seq[r].amm, seq[r].pdbres,
    (atoms+Ref.atom_num[iref[ia]])->name);
   }
   exit(8);*/
  return(Na);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdx, %rax
movq 0x40(%rbp), %rdx
leaq 0x10(%rbp), %rdx
movq %rdx, -0x50(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rax, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x28(%rdx), %rcx
movl (%rdx), %edx
subl $0x1, %edx
movslq %edx, %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl 0x64(%rax), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x61e33
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x61e11
movl $0x0, -0x34(%rbp)
movq -0x50(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl (%rcx), %eax
jge 0x61f3f
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x28(%rcx), %rcx
movslq -0x34(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
addq $0x18, %rdi
movq 0x40(%rbp), %rsi
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x61ec1
movq -0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
movslq 0x64(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsbl 0x13(%rax), %eax
cmpl $0x47, %eax
jne 0x61f2f
movq -0x48(%rbp), %rdi
addq $0x18, %rdi
leaq 0x14456(%rip), %rsi     # 0x76308
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x61f2f
movq -0x28(%rbp), %rax
movss (%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x61eec
jp 0x61eec
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x28(%rbp), %rax
movss %xmm0, (%rax)
movq -0x50(%rbp), %rax
movl -0x34(%rbp), %esi
movq -0x8(%rbp), %rcx
movslq -0x38(%rbp), %rdx
movl %esi, (%rcx,%rdx,4)
movq 0x28(%rax), %rax
movslq -0x34(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x38(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movslq 0x64(%rcx), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x61f31
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x61e3a
movl -0x38(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)