// File: /workspace/github_c_makefile_star2_O3/josch[P]stride/hydrbond.c
// Function: DefineAcceptor
int DefineAcceptor(CHAIN *Chain, ACCEPTOR **Acc, int *ac, int Res, enum HYBRID Hybrid, 
		   enum GROUP Group, float HB_Radius, int N)
{

  Acc[*ac] = (ACCEPTOR *)ckalloc(sizeof(ACCEPTOR));

  Acc[*ac]->Chain = Chain;
  Acc[*ac]->A_Res    = Res;
  Acc[*ac]->AA_Res   = Res;
  Acc[*ac]->AA2_Res   = Res;
  Acc[*ac]->Hybrid    = Hybrid;
  Acc[*ac]->Group     = Group;
  Acc[*ac]->HB_Radius = HB_Radius;
  
  if( Group == Peptide ) {
    if( Res != Chain->NRes-1 ) {
      FindAtom(Chain,Res,"O",&Acc[*ac]->A_At);
      FindAtom(Chain,Res,"C",&Acc[*ac]->AA_At);
    }
    else {
      Acc[*ac]->A_At = ERR;
      Acc[*ac]->AA_At = ERR;
    }
    FindAtom(Chain,Res,"CA",&Acc[*ac]->AA2_At);
  }
  else if( Group == His ) {
    if( N == 1 ) {
      FindAtom(Chain,Res,"ND1",&Acc[*ac]->A_At);
      FindAtom(Chain,Res,"CG",&Acc[*ac]->AA_At);
      FindAtom(Chain,Res,"CE1",&Acc[*ac]->AA2_At);
    }
    else if( N == 2 ) {
      FindAtom(Chain,Res,"NE2",&Acc[*ac]->A_At);
      FindAtom(Chain,Res,"CE1",&Acc[*ac]->AA_At);
      FindAtom(Chain,Res,"CD2",&Acc[*ac]->AA2_At);
    }
  }
  else if( Group == Asn ) {
    FindAtom(Chain,Res,"OD1",&Acc[*ac]->A_At);
    FindAtom(Chain,Res,"CG",&Acc[*ac]->AA_At);
    FindAtom(Chain,Res,"CB",&Acc[*ac]->AA2_At);
  }
  else if( Group == Gln ) {
    FindAtom(Chain,Res,"OE1",&Acc[*ac]->A_At);
    FindAtom(Chain,Res,"CD",&Acc[*ac]->AA_At);
    FindAtom(Chain,Res,"CG",&Acc[*ac]->AA2_At);
  }
  else if( Group == Asp ) {
    if( N == 1 ) {
      FindAtom(Chain,Res,"OD1",&Acc[*ac]->A_At);
      FindAtom(Chain,Res,"CG",&Acc[*ac]->AA_At);
      FindAtom(Chain,Res,"CB",&Acc[*ac]->AA2_At);
    }
    else if( N == 2 ) {
      FindAtom(Chain,Res,"ND2",&Acc[*ac]->A_At);
      FindAtom(Chain,Res,"CG",&Acc[*ac]->AA_At);
      FindAtom(Chain,Res,"CB",&Acc[*ac]->AA2_At);
    }
  }
  else if( Group == Glu ) {
    if( N == 1 ) {
      FindAtom(Chain,Res,"OE1",&Acc[*ac]->A_At);
      FindAtom(Chain,Res,"CD",&Acc[*ac]->AA_At);
      FindAtom(Chain,Res,"CG",&Acc[*ac]->AA2_At);
    }
    else if( N == 2 ) {
      FindAtom(Chain,Res,"NE2",&Acc[*ac]->A_At);
      FindAtom(Chain,Res,"CD",&Acc[*ac]->AA_At);
      FindAtom(Chain,Res,"CG",&Acc[*ac]->AA2_At);
    }
  }
  else if( Group == Tyr ) {
    FindAtom(Chain,Res,"OH",&Acc[*ac]->A_At);
    FindAtom(Chain,Res,"CZ",&Acc[*ac]->AA_At);
    FindAtom(Chain,Res,"CE1",&Acc[*ac]->AA2_At);
  }
  else if( Group == Ser ) {
    FindAtom(Chain,Res,"OG",&Acc[*ac]->A_At);
    FindAtom(Chain,Res,"CB",&Acc[*ac]->AA_At);
  }
  else if( Group == Thr ) {
    FindAtom(Chain,Res,"OG1",&Acc[*ac]->A_At);
    FindAtom(Chain,Res,"CB",&Acc[*ac]->AA_At);
  }
  else if( Group == Met ) {
    FindAtom(Chain,Res,"SD",&Acc[*ac]->A_At);
    FindAtom(Chain,Res,"CG",&Acc[*ac]->AA_At);
  }
  else if( Group == Cys ) {
    FindAtom(Chain,Res,"SG",&Acc[*ac]->A_At);
    FindAtom(Chain,Res,"CB",&Acc[*ac]->AA_At);
  }
  
  if( Acc[*ac]->A_At   == ERR || Acc[*ac]->AA_At  == ERR ||
      (Acc[*ac]->AA2_At == ERR && (Hybrid == Nsp2 || Hybrid == Osp2 )) ) {
    free(Acc[*ac]); return(FAILURE); 
  }
  else (*ac)++;
  return(SUCCESS);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movss %xmm0, 0x4(%rsp)
movl %r9d, %r13d
movl %r8d, %ebp
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movl $0x30, %edi
callq 0x5880
movslq (%rbx), %rcx
movq %rax, (%r14,%rcx,8)
movq %r12, (%rax)
movq (%r14,%rcx,8), %rax
movl %r15d, 0x8(%rax)
movslq (%rbx), %rax
movq (%r14,%rax,8), %rax
movl %r15d, 0xc(%rax)
movslq (%rbx), %rax
movq (%r14,%rax,8), %rax
movl %r15d, 0x10(%rax)
movslq (%rbx), %rax
movq (%r14,%rax,8), %rax
movl %ebp, 0x20(%rax)
movslq (%rbx), %rax
movq (%r14,%rax,8), %rax
movl %r13d, 0x24(%rax)
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
movss 0x4(%rsp), %xmm0
movss %xmm0, 0x28(%rcx)
cmpl $0xd, %r13d
ja 0x959c
movl 0x40(%rsp), %eax
movl %r13d, %edx
leaq 0x10bca(%rip), %rsi     # 0x19f00
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movl (%r12), %eax
decl %eax
addq $0x14, %rcx
cmpl %r15d, %eax
jne 0x9509
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, (%rcx)
movslq (%rbx), %rcx
movq (%r14,%rcx,8), %rcx
movl %eax, 0x18(%rcx)
jmp 0x9538
addq $0x14, %rcx
leaq 0x10c29(%rip), %rdx     # 0x19f9c
jmp 0x938d
addq $0x14, %rcx
leaq 0x10c06(%rip), %rdx     # 0x19f86
jmp 0x938d
addq $0x14, %rcx
leaq 0x10bfc(%rip), %rdx     # 0x19f89
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
jmp 0x947e
cmpl $0x2, %eax
je 0x954c
cmpl $0x1, %eax
jne 0x959c
addq $0x14, %rcx
leaq 0x10b97(%rip), %rdx     # 0x19f5c
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10b7e(%rip), %rdx     # 0x19f60
jmp 0x940c
addq $0x14, %rcx
leaq 0x11747(%rip), %rdx     # 0x1ab36
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10b64(%rip), %rdx     # 0x19f70
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x10b52(%rip), %rdx     # 0x19f7b
jmp 0x9591
cmpl $0x2, %eax
je 0x95de
cmpl $0x1, %eax
jne 0x959c
addq $0x14, %rcx
leaq 0x10b42(%rip), %rdx     # 0x19f8d
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10af8(%rip), %rdx     # 0x19f60
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x10ade(%rip), %rdx     # 0x19f63
jmp 0x9591
addq $0x14, %rcx
leaq 0x10b04(%rip), %rdx     # 0x19f99
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
jmp 0x94fd
cmpl $0x2, %eax
je 0x95ee
cmpl $0x1, %eax
jne 0x959c
addq $0x14, %rcx
leaq 0x10ac7(%rip), %rdx     # 0x19f91
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10a83(%rip), %rdx     # 0x19f6a
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x10a5c(%rip), %rdx     # 0x19f60
jmp 0x9591
leaq 0x10432(%rip), %rdx     # 0x19942
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x110b7(%rip), %rdx     # 0x1a5e4
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x118ee(%rip), %rdx     # 0x1ae38
jmp 0x9591
addq $0x14, %rcx
leaq 0x10a0f(%rip), %rdx     # 0x19f66
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10a07(%rip), %rdx     # 0x19f7b
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x109ee(%rip), %rdx     # 0x19f7f
movq %r12, %rdi
movl %r15d, %esi
callq 0x4ea0
movslq (%rbx), %rax
movq (%r14,%rax,8), %rdi
cmpl $-0x1, 0x14(%rdi)
je 0x95bd
cmpl $-0x1, 0x18(%rdi)
je 0x95bd
testl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jne 0x95d3
cmpl $-0x1, 0x1c(%rdi)
jne 0x95d3
callq 0x2040
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl %eax
movl %eax, (%rbx)
movl $0x1, %eax
jmp 0x95c4
addq $0x14, %rcx
leaq 0x109ac(%rip), %rdx     # 0x19f95
jmp 0x944b
addq $0x14, %rcx
leaq 0x1096d(%rip), %rdx     # 0x19f66
jmp 0x94ca