// File: /workspace/github_c_makefile_star2_O1/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 0x595c
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 0x9698
movl 0x40(%rsp), %eax
movl %r13d, %edx
leaq 0x10ac2(%rip), %rsi     # 0x19ef4
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movl (%r12), %eax
decl %eax
addq $0x14, %rcx
cmpl %r15d, %eax
jne 0x9605
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, (%rcx)
movslq (%rbx), %rcx
movq (%r14,%rcx,8), %rcx
movl %eax, 0x18(%rcx)
jmp 0x9634
addq $0x14, %rcx
leaq 0x10b25(%rip), %rdx     # 0x19f94
jmp 0x9489
addq $0x14, %rcx
leaq 0x10b02(%rip), %rdx     # 0x19f7e
jmp 0x9489
addq $0x14, %rcx
leaq 0x10af8(%rip), %rdx     # 0x19f81
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
jmp 0x957a
cmpl $0x2, %eax
je 0x9648
cmpl $0x1, %eax
jne 0x9698
addq $0x14, %rcx
leaq 0x10a93(%rip), %rdx     # 0x19f54
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10a7a(%rip), %rdx     # 0x19f58
jmp 0x9508
addq $0x14, %rcx
leaq 0x1165b(%rip), %rdx     # 0x1ab46
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10a60(%rip), %rdx     # 0x19f68
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x10a4e(%rip), %rdx     # 0x19f73
jmp 0x968d
cmpl $0x2, %eax
je 0x96da
cmpl $0x1, %eax
jne 0x9698
addq $0x14, %rcx
leaq 0x10a3e(%rip), %rdx     # 0x19f85
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x109f4(%rip), %rdx     # 0x19f58
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x109da(%rip), %rdx     # 0x19f5b
jmp 0x968d
addq $0x14, %rcx
leaq 0x10a00(%rip), %rdx     # 0x19f91
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
jmp 0x95f9
cmpl $0x2, %eax
je 0x96ea
cmpl $0x1, %eax
jne 0x9698
addq $0x14, %rcx
leaq 0x109c3(%rip), %rdx     # 0x19f89
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x1097f(%rip), %rdx     # 0x19f62
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x10958(%rip), %rdx     # 0x19f58
jmp 0x968d
leaq 0x10326(%rip), %rdx     # 0x19932
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10fcb(%rip), %rdx     # 0x1a5f4
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x11802(%rip), %rdx     # 0x1ae48
jmp 0x968d
addq $0x14, %rcx
leaq 0x1090b(%rip), %rdx     # 0x19f5e
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10903(%rip), %rdx     # 0x19f73
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x108ea(%rip), %rdx     # 0x19f77
movq %r12, %rdi
movl %r15d, %esi
callq 0x4f78
movslq (%rbx), %rax
movq (%r14,%rax,8), %rdi
cmpl $-0x1, 0x14(%rdi)
je 0x96b9
cmpl $-0x1, 0x18(%rdi)
je 0x96b9
testl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jne 0x96cf
cmpl $-0x1, 0x1c(%rdi)
jne 0x96cf
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 0x96c0
addq $0x14, %rcx
leaq 0x108a8(%rip), %rdx     # 0x19f8d
jmp 0x9547
addq $0x14, %rcx
leaq 0x10869(%rip), %rdx     # 0x19f5e
jmp 0x95c6