// File: /workspace/github_c_makefile_star2_O1/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 %rdx, 0x20(%rsp)
movl (%rdx), %eax
movl %eax, 0x1c(%rsp)
cmpl $0x0, (%rdi)
jle 0x8c6c
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %r13d, %r13d
leaq 0x16(%rsp), %rbp
leaq 0x1c(%rsp), %rbx
movq 0x68(%r12), %rax
movq (%rax,%r13,8), %rsi
addq $0xa, %rsi
movq %rbp, %rdi
callq 0x2070
movl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
movss 0x114a2(%rip), %xmm0    # 0x19eac
callq 0x8c86
cmpl $0x0, 0x1d48(%r14)
je 0x8be4
cmpl $0x505254, 0x16(%rsp)   # imm = 0x505254
je 0x8abf
cmpl $0x4e5341, 0x16(%rsp)   # imm = 0x4E5341
je 0x8ae0
cmpl $0x4e4c47, 0x16(%rsp)   # imm = 0x4E4C47
je 0x8b01
cmpl $0x475241, 0x16(%rsp)   # imm = 0x475241
je 0x8b22
cmpl $0x534948, 0x16(%rsp)   # imm = 0x534948
je 0x8b92
cmpl $0x53594c, 0x16(%rsp)   # imm = 0x53594C
je 0x8bf6
cmpl $0x524553, 0x16(%rsp)   # imm = 0x524553
je 0x8c1f
cmpl $0x524854, 0x16(%rsp)   # imm = 0x524854
je 0x8c40
cmpl $0x525954, 0x16(%rsp)   # imm = 0x525954
jne 0x8be4
movl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
movl $0x2, %r8d
movl $0x9, %r9d
jmp 0x8c5f
movl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
jmp 0x8bd7
movl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
movl $0x2, %r9d
jmp 0x8bd7
movl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
movl $0x3, %r9d
jmp 0x8bd7
movl $0x1, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
movl $0x4, %r9d
movss 0x11366(%rip), %xmm0    # 0x19eac
callq 0x8c86
movl $0x2, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
movl $0x4, %r9d
movss 0x1133d(%rip), %xmm0    # 0x19eac
callq 0x8c86
movl $0x3, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
movl $0x4, %r9d
jmp 0x8bd7
movl $0x1, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
movl $0x5, %r9d
movss 0x112f6(%rip), %xmm0    # 0x19eac
callq 0x8c86
movl $0x2, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
xorl %r8d, %r8d
movl $0x5, %r9d
movss 0x112cd(%rip), %xmm0    # 0x19eac
callq 0x8c86
incq %r13
movslq (%r12), %rax
cmpq %rax, %r13
jl 0x89d4
jmp 0x8c6c
movl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
movl $0x1, %r8d
movl $0x6, %r9d
movss 0x11297(%rip), %xmm0    # 0x19eb4
jmp 0x8bdf
movl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
movl $0x3, %r8d
movl $0x7, %r9d
jmp 0x8c5f
movl $0x0, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movl %r13d, %ecx
movl $0x3, %r8d
movl $0x8, %r9d
movss 0x11249(%rip), %xmm0    # 0x19eb0
jmp 0x8bdf
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