// File: /workspace/github_c_makefile_star2_O2/josch[P]stride/hydrbond.c
// Function: FindDnr
int FindDnr(CHAIN *Chain, DONOR **Dnr, int *NDnr, COMMAND *Cmd)
{

  int Res, dc;
  char Rsd[RES_FIELD];
  
  dc = *NDnr;

  for( Res=0; Res<Chain->NRes; Res++ ) {

    strcpy(Rsd,Chain->Rsd[Res]->ResType);

    DefineDnr(Chain,Dnr,&dc,Res,Nsp2,Peptide,1.90,0);

    if( !Cmd->SideChainHBond ) continue;

    if( !strcmp(Rsd,"TRP") ) 
      DefineDnr(Chain,Dnr,&dc,Res,Nsp2,Trp,1.90,0); 
    else if( !strcmp(Rsd,"ASN") ) DefineDnr(Chain,Dnr,&dc,Res,Nsp2,Asn,1.90,0); 
    else if( !strcmp(Rsd,"GLN") ) DefineDnr(Chain,Dnr,&dc,Res,Nsp2,Gln,1.90,0); 
    else if( !strcmp(Rsd,"ARG") ) {
      DefineDnr(Chain,Dnr,&dc,Res,Nsp2,Arg,1.90,1);
      DefineDnr(Chain,Dnr,&dc,Res,Nsp2,Arg,1.90,2);
      DefineDnr(Chain,Dnr,&dc,Res,Nsp2,Arg,1.90,3);
    }
    else if( !strcmp(Rsd,"HIS") ) {
      DefineDnr(Chain,Dnr,&dc,Res,Nsp2,His,1.90,1);
      DefineDnr(Chain,Dnr,&dc,Res,Nsp2,His,1.90,2);
    }
    else if( !strcmp(Rsd,"LYS") ) DefineDnr(Chain,Dnr,&dc,Res,Nsp3,Lys,2.10,0); 
    else if( !strcmp(Rsd,"SER") ) DefineDnr(Chain,Dnr,&dc,Res,Osp3,Ser,1.70,0);
    else if( !strcmp(Rsd,"THR") ) DefineDnr(Chain,Dnr,&dc,Res,Osp3,Thr,1.70,0);
    else if( !strcmp(Rsd,"TYR") ) DefineDnr(Chain,Dnr,&dc,Res,Osp2,Tyr,1.70,0); 
  }

  *NDnr = dc;
  return(dc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rdx, 0x20(%rsp)
movl (%rdx), %eax
leaq 0x1c(%rsp), %r13
movl %eax, (%r13)
xorl %ebp, %ebp
leaq 0x16(%rsp), %rbx
movslq (%r12), %rax
cmpq %rax, %rbp
jge 0x7f60
movq 0x68(%r12), %rax
movq (%rax,%rbp,8), %rsi
addq $0xa, %rsi
movq %rbx, %rdi
callq 0x2070
andl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
movss 0x11133(%rip), %xmm0    # 0x18e84
callq 0x7f7a
cmpl $0x0, 0x1d48(%r14)
je 0x7eff
cmpl $0x505254, 0x16(%rsp)   # imm = 0x505254
je 0x7dfc
cmpl $0x4e5341, 0x16(%rsp)   # imm = 0x4E5341
je 0x7e15
cmpl $0x4e4c47, 0x16(%rsp)   # imm = 0x4E4C47
je 0x7e2e
cmpl $0x475241, 0x16(%rsp)   # imm = 0x475241
je 0x7e47
cmpl $0x534948, 0x16(%rsp)   # imm = 0x534948
je 0x7eb3
cmpl $0x53594c, 0x16(%rsp)   # imm = 0x53594C
je 0x7f07
cmpl $0x524553, 0x16(%rsp)   # imm = 0x524553
je 0x7f28
cmpl $0x524854, 0x16(%rsp)   # imm = 0x524854
je 0x7f3f
cmpl $0x525954, 0x16(%rsp)   # imm = 0x525954
jne 0x7eff
andl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
pushq $0x2
popq %r8
pushq $0x9
jmp 0x7f54
andl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
pushq $0x1
jmp 0x7ef0
andl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
pushq $0x2
jmp 0x7ef0
andl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
pushq $0x3
jmp 0x7ef0
movl $0x1, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
pushq $0x4
popq %rbx
movl %ebx, %r9d
movss 0x1101a(%rip), %xmm0    # 0x18e84
callq 0x7f7a
movl $0x2, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
movl %ebx, %r9d
movss 0x10ff5(%rip), %xmm0    # 0x18e84
callq 0x7f7a
movl $0x3, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
movl %ebx, %r9d
leaq 0x16(%rsp), %rbx
jmp 0x7ef2
movl $0x1, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
pushq $0x5
popq %r9
movss 0x10fb0(%rip), %xmm0    # 0x18e84
callq 0x7f7a
movl $0x2, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
pushq $0x5
popq %r9
movss 0x10f8a(%rip), %xmm0    # 0x18e84
callq 0x7f7a
incq %rbp
jmp 0x7d12
andl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
pushq $0x1
popq %r8
pushq $0x6
popq %r9
movss 0x10f66(%rip), %xmm0    # 0x18e8c
jmp 0x7efa
andl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
pushq $0x3
popq %r8
pushq $0x7
jmp 0x7f54
andl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
pushq $0x3
popq %r8
pushq $0x8
popq %r9
movss 0x10f2a(%rip), %xmm0    # 0x18e88
jmp 0x7efa
movl 0x1c(%rsp), %eax
movq 0x20(%rsp), %rcx
movl %eax, (%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq