// File: /workspace/github_c_makefile_star2_O1/ugobas[P]tnm/dof_tnm.c
// Function: Axe_prot_side
void Axe_prot_side(struct axe *axe_side, int *N_side, struct side_chain *sc,
		   struct bond *bond, int ibond,
		   atom *atoms, int natoms, int *refatom)
{
  if(bond->atom->res!=sc->res){
    // Residue start
    sc->res=bond->atom->res;
    sc->aa= bond->atom->aa;
    if((sc->aa=='G')||(sc->aa=='A')||(sc->aa=='P'))return;
    
    // Find first and last atom in side chain
    sc->first_atom=-1;
    sc->last_atom=-1;
    sc->first_ref=-1;
    sc->last_ref=-1;
    int i;
    for(i=bond->i_atom; i<natoms; i++){
      atom *atom_i=atoms+i;
      if((atom_i->res>sc->res)||
	 (strncmp(atom_i->name,"OT", 2)==0)||
	 (strncmp(atom_i->name,"OX", 2)==0))
	break;
      if((strncmp(atom_i->name,"N ", 2)==0)||
	 (strncmp(atom_i->name,"CA", 2)==0)||
	 (strncmp(atom_i->name,"CB", 2)==0))continue;
      if((strncmp(atom_i->name,"C ", 2)!=0)&&
	 (strncmp(atom_i->name,"O ", 2)!=0)){
	sc->last_atom=i;
	if(sc->first_atom<0)sc->first_atom=i;
	int iref=refatom[i];
	if(iref>=0){
	  sc->last_ref=iref; if(sc->first_ref<0)sc->first_ref=iref;
	}
      }
    }
    sc->ndof=0; sc->numdof=0; sc->oldref=0;
  }
  
  if((bond->terminal)||
     (strncmp(bond->atom->name,"N ", 2)==0)||
     (strncmp(bond->atom->name,"CA", 2)==0)||
     (strncmp(bond->atom->name,"C ", 2)==0)||
     (strncmp(bond->atom->name,"O ", 2)==0))
    return;
    
  if((sc->first_atom<0)||(sc->first_ref<0)||
     (sc->aa=='G')||(sc->aa=='A')||(sc->aa=='P'))return;
  
  if(((strncmp(bond->atom->name,"CB", 2)!=0)&&
      (strncmp(bond->atom->name,"CG", 2)==0))&&
     ((sc->aa=='F')||(sc->aa=='W')||(sc->aa=='Y')||(sc->aa=='H'))){
    return;  // if aromatic ring, exit
  }

  //sprintf(type, "%1d", sc->numdof);
  struct axe *axe=axe_side+*N_side;
  int first_atom=(Next_bond(bond, ibond, natoms))->i_atom;
  if(Set_dof(&axe, N_side, 's', bond, first_atom, &sc->ndof,
	     &sc->oldref, refatom, natoms, sc->last_atom, sc->last_ref)){
    sc->numdof++;
  }
  return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, 0xc(%rsp)
movq %rdx, %r15
movq %rsi, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movq 0x78(%rsp), %r12
movl 0x70(%rsp), %r13d
movq (%rcx), %r14
movl 0x64(%r14), %ebp
cmpl 0x4(%rdx), %ebp
jne 0x142fd
cmpl $0x0, 0x30(%rcx)
jne 0x1431b
addq $0x18, %r14
leaq 0x41d6d(%rip), %rsi     # 0x55f23
movl $0x2, %edx
movq %r14, %rdi
movq %rcx, %rbp
callq 0x2070
testl %eax, %eax
je 0x1431b
leaq 0x40f95(%rip), %rsi     # 0x5516a
movl $0x2, %edx
movq %r14, %rdi
callq 0x2070
testl %eax, %eax
je 0x1431b
leaq 0x41d35(%rip), %rsi     # 0x55f26
movl $0x2, %edx
movq %r14, %rdi
callq 0x2070
testl %eax, %eax
je 0x1431b
leaq 0x41d1c(%rip), %rsi     # 0x55f29
movl $0x2, %edx
movq %r14, %rdi
callq 0x2070
testl %eax, %eax
je 0x1431b
cmpl $0x0, 0xc(%r15)
js 0x1431b
cmpl $0x0, 0x10(%r15)
js 0x1431b
movzbl (%r15), %ebx
leal -0x41(%rbx), %eax
cmpl $0xf, %eax
ja 0x14252
movl $0x8041, %ecx           # imm = 0x8041
btl %eax, %ecx
jb 0x1431b
leaq 0x3cf6b(%rip), %rsi     # 0x511c4
movl $0x2, %edx
movq %r14, %rdi
callq 0x2070
movq %rbp, %rdi
testl %eax, %eax
je 0x1428c
leaq 0x41db9(%rip), %rsi     # 0x5602d
movl $0x2, %edx
movq %r14, %rdi
callq 0x2070
movq %rbp, %rdi
testl %eax, %eax
je 0x144a3
movq 0x28(%rsp), %rbp
movslq (%rbp), %rax
imulq $0x158, %rax, %rax      # imm = 0x158
movq 0x20(%rsp), %rcx
addq %rax, %rcx
leaq 0x30(%rsp), %r14
movq %rcx, (%r14)
movl 0xc(%rsp), %esi
movl %r13d, %edx
movq %rdi, %rbx
callq 0x144fa
movl 0x20(%rax), %r8d
leaq 0x1c(%r15), %r9
leaq 0x20(%r15), %rax
movl 0x14(%r15), %r10d
movl 0x18(%r15), %r11d
subq $0x8, %rsp
movq %r14, %rdi
movq %rbp, %rsi
movl $0x73, %edx
movq %rbx, %rcx
pushq %r11
pushq %r10
pushq %r13
pushq %r12
pushq %rax
callq 0x13d1c
addq $0x30, %rsp
testl %eax, %eax
je 0x1431b
incl 0x24(%r15)
jmp 0x1431b
movl %ebp, 0x4(%r15)
movzbl 0x68(%r14), %eax
movb %al, (%r15)
addl $-0x41, %eax
cmpl $0xf, %eax
ja 0x1432a
movl $0x8041, %edx           # imm = 0x8041
btl %eax, %edx
jae 0x1432a
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pcmpeqd %xmm0, %xmm0
movq %r15, (%rsp)
movdqu %xmm0, 0xc(%r15)
movq %r13, %rax
movq %rcx, 0x18(%rsp)
movl 0x20(%rcx), %r13d
cmpl %eax, %r13d
jge 0x1447b
movq (%rsp), %rax
addq $0xc, %rax
movq %rax, 0x10(%rsp)
movslq %r13d, %rax
imulq $0x70, %rax, %rcx
leaq (%rcx,%r9), %r15
addq $0x64, %r15
movq 0x78(%rsp), %rcx
leaq (%rcx,%rax,4), %rbx
cmpl %ebp, (%r15)
jg 0x1447b
leaq -0x4c(%r15), %r12
movl $0x2, %edx
movq %r12, %rdi
leaq 0x41b9e(%rip), %rsi     # 0x55f2c
callq 0x2070
testl %eax, %eax
je 0x1447b
movl $0x2, %edx
movq %r12, %rdi
leaq 0x41b85(%rip), %rsi     # 0x55f2f
callq 0x2070
testl %eax, %eax
je 0x1447b
movl $0x2, %edx
movq %r12, %rdi
leaq 0x41b5d(%rip), %rsi     # 0x55f23
callq 0x2070
testl %eax, %eax
je 0x14463
movl $0x2, %edx
movq %r12, %rdi
leaq 0x40d88(%rip), %rsi     # 0x5516a
callq 0x2070
testl %eax, %eax
je 0x14463
movl $0x2, %edx
movq %r12, %rdi
leaq 0x3cdca(%rip), %rsi     # 0x511c4
callq 0x2070
testl %eax, %eax
je 0x14463
movl $0x2, %edx
movq %r12, %rdi
leaq 0x41b14(%rip), %rsi     # 0x55f26
callq 0x2070
testl %eax, %eax
je 0x14463
movl $0x2, %edx
movq %r12, %rdi
leaq 0x41aff(%rip), %rsi     # 0x55f29
callq 0x2070
testl %eax, %eax
je 0x14463
movq (%rsp), %rax
movl %r13d, 0x14(%rax)
cmpl $0x0, 0xc(%rax)
jns 0x14449
movq 0x10(%rsp), %rax
movl %r13d, (%rax)
movl (%rbx), %eax
testl %eax, %eax
js 0x14463
movq (%rsp), %rcx
movl %eax, 0x18(%rcx)
cmpl $0x0, 0x10(%rcx)
jns 0x14463
movq (%rsp), %rcx
movl %eax, 0x10(%rcx)
incl %r13d
addq $0x70, %r15
addq $0x4, %rbx
movl 0x70(%rsp), %eax
cmpl %r13d, %eax
jne 0x14372
movq (%rsp), %r15
movq $0x0, 0x1c(%r15)
movl $0x0, 0x24(%r15)
movq 0x78(%rsp), %r12
movl 0x70(%rsp), %r13d
movq 0x18(%rsp), %rcx
jmp 0x141a1
addl $-0x46, %ebx
cmpl $0x13, %ebx
ja 0x1428c
movl $0xa0005, %eax          # imm = 0xA0005
btl %ebx, %eax
jb 0x1431b
jmp 0x1428c