// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x30
popq %rdi
callq 0x50f4
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 0x8918
movl 0x40(%rsp), %eax
movl %r13d, %edx
leaq 0x10817(%rip), %rsi     # 0x18ecc
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movl (%r12), %eax
decl %eax
addq $0x14, %rcx
cmpl %r15d, %eax
jne 0x8885
orl $-0x1, (%rcx)
movslq (%rbx), %rax
movq (%r14,%rax,8), %rax
orl $-0x1, 0x18(%rax)
jmp 0x88b4
addq $0x14, %rcx
leaq 0x1087d(%rip), %rdx     # 0x18f6c
jmp 0x8709
addq $0x14, %rcx
leaq 0x1085a(%rip), %rdx     # 0x18f56
jmp 0x8709
addq $0x14, %rcx
leaq 0x10850(%rip), %rdx     # 0x18f59
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
jmp 0x87fa
cmpl $0x2, %eax
je 0x88c8
cmpl $0x1, %eax
jne 0x8918
addq $0x14, %rcx
leaq 0x107eb(%rip), %rdx     # 0x18f2c
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x107d2(%rip), %rdx     # 0x18f30
jmp 0x8788
addq $0x14, %rcx
leaq 0x1137b(%rip), %rdx     # 0x19ae6
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x107b8(%rip), %rdx     # 0x18f40
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x107a6(%rip), %rdx     # 0x18f4b
jmp 0x890d
cmpl $0x2, %eax
je 0x8958
cmpl $0x1, %eax
jne 0x8918
addq $0x14, %rcx
leaq 0x10796(%rip), %rdx     # 0x18f5d
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x1074c(%rip), %rdx     # 0x18f30
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x10732(%rip), %rdx     # 0x18f33
jmp 0x890d
addq $0x14, %rcx
leaq 0x10758(%rip), %rdx     # 0x18f69
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
jmp 0x8879
cmpl $0x2, %eax
je 0x8968
cmpl $0x1, %eax
jne 0x8918
addq $0x14, %rcx
leaq 0x1071b(%rip), %rdx     # 0x18f61
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x106d7(%rip), %rdx     # 0x18f3a
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x106b0(%rip), %rdx     # 0x18f30
jmp 0x890d
leaq 0x100b6(%rip), %rdx     # 0x18942
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x10d0b(%rip), %rdx     # 0x195b4
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x11522(%rip), %rdx     # 0x19de8
jmp 0x890d
addq $0x14, %rcx
leaq 0x10663(%rip), %rdx     # 0x18f36
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x18, %rcx
leaq 0x1065b(%rip), %rdx     # 0x18f4b
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rcx
addq $0x1c, %rcx
leaq 0x10642(%rip), %rdx     # 0x18f4f
movq %r12, %rdi
movl %r15d, %esi
callq 0x4777
movslq (%rbx), %rax
movq (%r14,%rax,8), %rdi
cmpl $-0x1, 0x14(%rdi)
je 0x8939
cmpl $-0x1, 0x18(%rdi)
je 0x8939
testl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jne 0x894f
cmpl $-0x1, 0x1c(%rdi)
jne 0x894f
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)
pushq $0x1
popq %rax
jmp 0x8940
addq $0x14, %rcx
leaq 0x10602(%rip), %rdx     # 0x18f65
jmp 0x87c7
addq $0x14, %rcx
leaq 0x105c3(%rip), %rdx     # 0x18f36
jmp 0x8846