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

  register int i;
  RESIDUE **r;
  TURN *t;
  int CA1, CA4, Tn;
  float Phi2, Phi3, Psi2, Psi3, Range1 = 30.0, Range2 = 45.0;
  char TurnType;

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

    r = &Chain[Cn]->Rsd[i];
    
    if( r[1]->Prop->Asn == 'H' || r[2]->Prop->Asn == 'H' || 
        r[1]->Prop->Asn == 'G' || r[2]->Prop->Asn == 'G' || 
        r[1]->Prop->Asn == 'I' || r[2]->Prop->Asn == 'G' || 
       !FindAtom(Chain[Cn],i,"CA",&CA1) || !FindAtom(Chain[Cn],i+3,"CA",&CA4) ||
       Dist(r[0]->Coord[CA1],r[3]->Coord[CA4]) > 7.0 )
      continue;
    
    Phi2 = r[1]->Prop->Phi;
    Psi2 = r[1]->Prop->Psi;
    Phi3 = r[2]->Prop->Phi;
    Psi3 = r[2]->Prop->Psi;
    
    if( TurnCondition(Phi2,-60.0,Psi2,-30,Phi3,-90.0,Psi3,0,Range1,Range2) )
      TurnType = '1';
    else
    if( TurnCondition(Phi2,60.0,Psi2,30,Phi3,90.0,Psi3,0,Range1,Range2) )
      TurnType = '2';
    else
    if( TurnCondition(Phi2,-60.0,Psi2,120,Phi3,80.0,Psi3,0,Range1,Range2) )
      TurnType = '3';
    else
    if( TurnCondition(Phi2,60.0,Psi2,-120,Phi3,-80.0,Psi3,0,Range1,Range2) )
      TurnType = '4';
    else
    if( TurnCondition(Phi2,-60.0,Psi2,120,Phi3,-90.0,Psi3,0,Range1,Range2) )
      TurnType = '5';
    else
    if( TurnCondition(Phi2,-120.0,Psi2,120,Phi3,-60.0,Psi3,0,Range1,Range2) )
      TurnType = '6';
    else
    if( TurnCondition(Phi2,-60.0,Psi2,-30,Phi3,-120.0,Psi3,120,Range1,Range2) )
      TurnType = '7';
    else
      TurnType = '8';
  
    if( r[0]->Prop->Asn == 'C' ) 
      r[0]->Prop->Asn = 'T';
    
    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[0]->ResType);
    strcpy(t->Res2,r[3]->ResType);
    strcpy(t->PDB_ResNumb1,r[0]->PDB_ResNumb);
    strcpy(t->PDB_ResNumb2,r[3]->PDB_ResNumb);
    t->TurnType = TurnType;
    Chain[Cn]->NAssignedTurn++;

  }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movss 0x8c97(%rip), %xmm0     # 0x2ca6c
movss %xmm0, 0x18(%rsp)
movss 0x8c85(%rip), %xmm0     # 0x2ca68
movss %xmm0, 0x14(%rsp)
movl $0x0, 0x48(%rsp)
movl 0x48(%rsp), %eax
movq 0x50(%rsp), %rcx
movslq 0x4c(%rsp), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
jge 0x2445d
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x68(%rax), %rax
movslq 0x48(%rsp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x48, %eax
je 0x23f82
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x48, %eax
je 0x23f82
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x47, %eax
je 0x23f82
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x47, %eax
je 0x23f82
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x49, %eax
je 0x23f82
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x47, %eax
je 0x23f82
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x48(%rsp), %esi
leaq 0x8d46(%rip), %rdx      # 0x2cc40
leaq 0x34(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
je 0x23f82
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x48(%rsp), %esi
addl $0x3, %esi
leaq 0x8d1b(%rip), %rdx      # 0x2cc40
leaq 0x30(%rsp), %rcx
callq 0x6140
cmpl $0x0, %eax
je 0x23f82
movq 0x40(%rsp), %rax
movq (%rax), %rdi
addq $0x188, %rdi            # imm = 0x188
movslq 0x34(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rsi
addq $0x188, %rsi            # imm = 0x188
movslq 0x30(%rsp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rsi
callq 0x4a30
cvtss2sd %xmm0, %xmm0
movsd 0x8b1c(%rip), %xmm1     # 0x2ca98
ucomisd %xmm1, %xmm0
jbe 0x23f87
jmp 0x2444d
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movss (%rax), %xmm0
movss %xmm0, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movss (%rax), %xmm0
movss %xmm0, 0x24(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, 0x1c(%rsp)
movss 0x28(%rsp), %xmm0
movss 0x20(%rsp), %xmm2
movss 0x24(%rsp), %xmm4
movss 0x1c(%rsp), %xmm6
movss 0x18(%rsp), %xmm9
movss 0x14(%rsp), %xmm8
movss 0x8a51(%rip), %xmm1     # 0x2ca70
movss 0x8a4d(%rip), %xmm3     # 0x2ca74
movss 0x8a49(%rip), %xmm5     # 0x2ca78
xorps %xmm7, %xmm7
movss %xmm9, (%rsp)
movss %xmm8, 0x8(%rsp)
callq 0x24470
cmpl $0x0, %eax
je 0x24053
movb $0x31, 0x13(%rsp)
jmp 0x242af
movss 0x28(%rsp), %xmm0
movss 0x20(%rsp), %xmm2
movss 0x24(%rsp), %xmm4
movss 0x1c(%rsp), %xmm6
movss 0x18(%rsp), %xmm9
movss 0x14(%rsp), %xmm8
movss 0x89fb(%rip), %xmm1     # 0x2ca7c
movss 0x89e3(%rip), %xmm3     # 0x2ca6c
movss 0x89ef(%rip), %xmm5     # 0x2ca80
xorps %xmm7, %xmm7
movss %xmm9, (%rsp)
movss %xmm8, 0x8(%rsp)
callq 0x24470
cmpl $0x0, %eax
je 0x240b5
movb $0x32, 0x13(%rsp)
jmp 0x242ad
movss 0x28(%rsp), %xmm0
movss 0x20(%rsp), %xmm2
movss 0x24(%rsp), %xmm4
movss 0x1c(%rsp), %xmm6
movss 0x18(%rsp), %xmm9
movss 0x14(%rsp), %xmm8
movss 0x898d(%rip), %xmm1     # 0x2ca70
movss 0x8999(%rip), %xmm3     # 0x2ca84
movss 0x8995(%rip), %xmm5     # 0x2ca88
xorps %xmm7, %xmm7
movss %xmm9, (%rsp)
movss %xmm8, 0x8(%rsp)
callq 0x24470
cmpl $0x0, %eax
je 0x24117
movb $0x33, 0x13(%rsp)
jmp 0x242ab
movss 0x28(%rsp), %xmm0
movss 0x20(%rsp), %xmm2
movss 0x24(%rsp), %xmm4
movss 0x1c(%rsp), %xmm6
movss 0x18(%rsp), %xmm9
movss 0x14(%rsp), %xmm8
movss 0x8937(%rip), %xmm1     # 0x2ca7c
movss 0x893f(%rip), %xmm3     # 0x2ca8c
movss 0x893b(%rip), %xmm5     # 0x2ca90
xorps %xmm7, %xmm7
movss %xmm9, (%rsp)
movss %xmm8, 0x8(%rsp)
callq 0x24470
cmpl $0x0, %eax
je 0x24179
movb $0x34, 0x13(%rsp)
jmp 0x242a9
movss 0x28(%rsp), %xmm0
movss 0x20(%rsp), %xmm2
movss 0x24(%rsp), %xmm4
movss 0x1c(%rsp), %xmm6
movss 0x18(%rsp), %xmm9
movss 0x14(%rsp), %xmm8
movss 0x88c9(%rip), %xmm1     # 0x2ca70
movss 0x88d5(%rip), %xmm3     # 0x2ca84
movss 0x88c1(%rip), %xmm5     # 0x2ca78
xorps %xmm7, %xmm7
movss %xmm9, (%rsp)
movss %xmm8, 0x8(%rsp)
callq 0x24470
cmpl $0x0, %eax
je 0x241db
movb $0x35, 0x13(%rsp)
jmp 0x242a7
movss 0x28(%rsp), %xmm0
movss 0x20(%rsp), %xmm2
movss 0x24(%rsp), %xmm4
movss 0x1c(%rsp), %xmm6
movss 0x18(%rsp), %xmm9
movss 0x14(%rsp), %xmm8
movss 0x8883(%rip), %xmm1     # 0x2ca8c
movss 0x8873(%rip), %xmm3     # 0x2ca84
movss 0x8857(%rip), %xmm5     # 0x2ca70
xorps %xmm7, %xmm7
movss %xmm9, (%rsp)
movss %xmm8, 0x8(%rsp)
callq 0x24470
cmpl $0x0, %eax
je 0x2423a
movb $0x36, 0x13(%rsp)
jmp 0x242a5
movss 0x28(%rsp), %xmm0
movss 0x20(%rsp), %xmm2
movss 0x24(%rsp), %xmm4
movss 0x1c(%rsp), %xmm6
movss 0x18(%rsp), %xmm9
movss 0x14(%rsp), %xmm8
movss 0x8808(%rip), %xmm1     # 0x2ca70
movss 0x8804(%rip), %xmm3     # 0x2ca74
movss 0x8814(%rip), %xmm5     # 0x2ca8c
movss 0x8804(%rip), %xmm7     # 0x2ca84
movss %xmm9, (%rsp)
movss %xmm8, 0x8(%rsp)
callq 0x24470
cmpl $0x0, %eax
je 0x2429e
movb $0x37, 0x13(%rsp)
jmp 0x242a3
movb $0x38, 0x13(%rsp)
jmp 0x242a5
jmp 0x242a7
jmp 0x242a9
jmp 0x242ab
jmp 0x242ad
jmp 0x242af
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x43, %eax
jne 0x242da
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x768(%rax), %rax
movb $0x54, 0x1c(%rax)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x43, %eax
jne 0x24307
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x768(%rax), %rax
movb $0x54, 0x1c(%rax)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x43, %eax
jne 0x24334
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x768(%rax), %rax
movb $0x54, 0x1c(%rax)
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x768(%rax), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x43, %eax
jne 0x24361
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x768(%rax), %rax
movb $0x54, 0x1c(%rax)
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x28(%rax), %eax
movl %eax, 0x2c(%rsp)
movl $0x1b, %edi
callq 0x7360
movq %rax, %rdx
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x98(%rax), %rax
movslq 0x2c(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x98(%rax), %rax
movslq 0x2c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rax
movq (%rax), %rsi
addq $0xa, %rsi
callq 0x2060
movq 0x38(%rsp), %rdi
addq $0x6, %rdi
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rsi
addq $0xa, %rsi
callq 0x2060
movq 0x38(%rsp), %rdi
addq $0xc, %rdi
movq 0x40(%rsp), %rax
movq (%rax), %rsi
addq $0x4, %rsi
callq 0x2060
movq 0x38(%rsp), %rdi
addq $0x12, %rdi
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rsi
addq $0x4, %rsi
callq 0x2060
movb 0x13(%rsp), %cl
movq 0x38(%rsp), %rax
movb %cl, 0x1a(%rax)
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x23df1
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)