// File: /workspace/github_c_makefile_star2_O0/josch[P]stride/turn.c
// Function: GammaTurn
void GammaTurn(CHAIN **Chain, int Cn, HBOND **HBond)
{

  register int i;
  RESIDUE **r;
  TURN *t;
  int Tn;
  float Phi2, Psi2;
  char TurnType, Asn;

  for( i=0; i<Chain[Cn]->NRes-2; i++ ) {

    r = &Chain[Cn]->Rsd[i-1];

    Asn = r[2]->Prop->Asn;

    if( Asn == 'H' || Asn == 'T' || Asn == 'G' || Asn == 'I' ||
        FindBnd(HBond,r[3],r[1]) == ERR ||
        (i > 0 && FindBnd(HBond,r[3],r[0]) != ERR) || 
        (i < Chain[Cn]->NRes-3 && FindBnd(HBond,r[4],r[1]) != ERR) )
      continue;
    
    Phi2 = r[2]->Prop->Phi;
    Psi2 = r[2]->Prop->Psi;
    
    if( Phi2 > 0.0 && Psi2 < 0.0 )
      TurnType = '@';
    else
    if( Phi2 < 0.0 && Psi2 > 0.0 )
      TurnType = '&';
    else 
      continue;

    if( r[1]->Prop->Asn == 'C' )
      r[1]->Prop->Asn = 'T';
    
    if( r[2]->Prop->Asn == 'C' )
      r[2]->Prop->Asn = 'T';
    
    if( r[3]->Prop->Asn == 'C' )
      r[3]->Prop->Asn = 'T';
    
    Tn = Chain[Cn]->NAssignedTurn;
    Chain[Cn]->AssignedTurn[Tn] = (TURN *)ckalloc(sizeof(TURN));
    t = Chain[Cn]->AssignedTurn[Tn];
    strcpy(t->Res1,r[1]->ResType);
    strcpy(t->Res2,r[3]->ResType);
    strcpy(t->PDB_ResNumb1,r[1]->PDB_ResNumb);
    strcpy(t->PDB_ResNumb2,r[3]->PDB_ResNumb);
    t->TurnType = TurnType;
    Chain[Cn]->NAssignedTurn++;
  }
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movl %esi, 0x3c(%rsp)
movq %rdx, 0x30(%rsp)
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movq 0x40(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x24cc4
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movl 0x2c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movb 0x1c(%rax), %al
movb %al, 0xa(%rsp)
movsbl 0xa(%rsp), %eax
cmpl $0x48, %eax
je 0x24aa4
movsbl 0xa(%rsp), %eax
cmpl $0x54, %eax
je 0x24aa4
movsbl 0xa(%rsp), %eax
cmpl $0x47, %eax
je 0x24aa4
movsbl 0xa(%rsp), %eax
cmpl $0x49, %eax
je 0x24aa4
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0x10950
cmpl $-0x1, %eax
je 0x24aa4
cmpl $0x0, 0x2c(%rsp)
jle 0x24a68
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x20(%rsp), %rax
movq (%rax), %rdx
callq 0x10950
cmpl $-0x1, %eax
jne 0x24aa4
movl 0x2c(%rsp), %eax
movq 0x40(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jge 0x24aa9
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0x10950
cmpl $-0x1, %eax
je 0x24aa9
jmp 0x24cb4
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movss (%rax), %xmm0
movss %xmm0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, 0xc(%rsp)
movss 0x10(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x24b0b
movss 0xc(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x24b0b
movb $0x40, 0xb(%rsp)
jmp 0x24b3f
movss 0x10(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x24b38
movss 0xc(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x24b38
movb $0x26, 0xb(%rsp)
jmp 0x24b3d
jmp 0x24cb4
jmp 0x24b3f
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x43, %eax
jne 0x24b6c
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movb $0x54, 0x1c(%rax)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x43, %eax
jne 0x24b99
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movb $0x54, 0x1c(%rax)
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x43, %eax
jne 0x24bc6
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x768(%rax), %rax
movb $0x54, 0x1c(%rax)
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x28(%rax), %eax
movl %eax, 0x14(%rsp)
movl $0x1b, %edi
callq 0x7360
movq %rax, %rdx
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x98(%rax), %rax
movslq 0x14(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x98(%rax), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
addq $0xa, %rsi
callq 0x2060
movq 0x18(%rsp), %rdi
addq $0x6, %rdi
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rsi
addq $0xa, %rsi
callq 0x2060
movq 0x18(%rsp), %rdi
addq $0xc, %rdi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
addq $0x4, %rsi
callq 0x2060
movq 0x18(%rsp), %rdi
addq $0x12, %rdi
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rsi
addq $0x4, %rsi
callq 0x2060
movb 0xb(%rsp), %cl
movq 0x18(%rsp), %rax
movb %cl, 0x1a(%rax)
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x2498a
addq $0x48, %rsp
retq
nopl (%rax)