// File: /workspace/github_c_makefile_star2_O2/josch[P]stride/pdbasn.c
// Function: GetPdbAsn
void GetPdbAsn(CHAIN **Chain, int NChain)
{

  register int i, j, k;
  int Cn, Beg, End;
  char SecondStr;
  CHAIN *c;

  for( Cn=0; Cn<NChain; Cn++ ) {

    c = Chain[Cn];

    for( i=0; i<c->NHelix; i++ ) {

      switch( c->Helix[i]->Class ) {
      case 1:  SecondStr = 'H';
	break;
      case 3:  SecondStr = 'I';
	break;
      case 5:  SecondStr = 'G';
	break;
      }

      if( PdbN2SeqN(c,c->Helix[i]->PDB_ResNumb1,&Beg) &&
	  PdbN2SeqN(c,c->Helix[i]->PDB_ResNumb2,&End) )
	for( j=Beg; j<=End; j++ )
	  if( c->Rsd[j]->Prop->PdbAsn != 'H' )
	    c->Rsd[j]->Prop->PdbAsn = SecondStr;
    }
    
    for( i=0; i<c->NSheet; i++ )
      for( j=0; j<c->Sheet[i]->NStrand; j++ ) {
	  if( PdbN2SeqN(c,c->Sheet[i]->PDB_ResNumb1[j],&Beg) &&
	      PdbN2SeqN(c,c->Sheet[i]->PDB_ResNumb2[j],&End) )
	    for( k=Beg; k<=End; k++ )
	      if( c->Rsd[k]->Prop->PdbAsn != 'H' )
		c->Rsd[k]->Prop->PdbAsn = 'E';
	}

    for( i=0; i<c->NTurn; i++ ) { 
      if( PdbN2SeqN(c,c->Turn[i]->PDB_ResNumb1,&Beg) &&
	  PdbN2SeqN(c,c->Turn[i]->PDB_ResNumb2,&End) )
	for( j=Beg; j<=End; j++ )
	  if( c->Rsd[j]->Prop->PdbAsn != 'H' &&  c->Rsd[j]->Prop->PdbAsn != 'E' )
	    c->Rsd[j]->Prop->PdbAsn = 'T';
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x10(%rsp)
xorl %ecx, %ecx
testl %esi, %esi
cmovlel %ecx, %esi
movq %rsi, 0x18(%rsp)
leaq 0xc(%rsp), %r15
leaq 0x8(%rsp), %r12
cmpq 0x18(%rsp), %rcx
je 0x15259
movq 0x10(%rsp), %rax
movq %rcx, 0x20(%rsp)
movq (%rax,%rcx,8), %r13
xorl %ebx, %ebx
movslq 0x1c(%r13), %rax
cmpq %rax, %rbx
jge 0x1511d
movq 0x80(%r13), %rax
movq (%rax,%rbx,8), %rsi
movl 0x1c(%rsi), %eax
cmpl $0x5, %eax
je 0x150b4
cmpl $0x3, %eax
je 0x150af
cmpl $0x1, %eax
jne 0x150b7
movb $0x48, %bpl
jmp 0x150b7
movb $0x49, %bpl
jmp 0x150b7
movb $0x47, %bpl
addq $0xc, %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x4720
testl %eax, %eax
je 0x15115
movq 0x80(%r13), %rax
movq (%rax,%rbx,8), %rsi
addq $0x12, %rsi
movq %r13, %rdi
movq %r12, %rdx
callq 0x4720
testl %eax, %eax
je 0x15115
movslq 0xc(%rsp), %rax
movslq 0x8(%rsp), %rcx
cmpq %rcx, %rax
jg 0x15115
movq 0x68(%r13), %rdx
movq (%rdx,%rax,8), %rdx
movq 0x768(%rdx), %rdx
cmpb $0x48, 0x1d(%rdx)
je 0x15110
movb %bpl, 0x1d(%rdx)
incq %rax
jmp 0x150f2
incq %rbx
jmp 0x15080
xorl %ebx, %ebx
movb %bpl, 0x7(%rsp)
movslq 0x20(%r13), %rax
cmpq %rax, %rbx
jge 0x151cb
xorl %ebp, %ebp
movq 0x88(%r13), %rax
movq (%rax,%rbx,8), %rax
movslq (%rax), %rcx
cmpq %rcx, %rbp
jge 0x151be
imulq $0x6, %rbp, %r14
leaq (%rax,%r14), %rsi
addq $0xfa, %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x4720
testl %eax, %eax
je 0x151b6
movq 0x88(%r13), %rax
movq (%rax,%rbx,8), %rax
leaq (%rax,%r14), %rsi
addq $0x172, %rsi            # imm = 0x172
movq %r13, %rdi
movq %r12, %rdx
callq 0x4720
testl %eax, %eax
je 0x151b6
movslq 0xc(%rsp), %rax
movslq 0x8(%rsp), %rcx
cmpq %rcx, %rax
jg 0x151b6
movq 0x68(%r13), %rdx
movq (%rdx,%rax,8), %rdx
movq 0x768(%rdx), %rdx
cmpb $0x48, 0x1d(%rdx)
je 0x151b1
movb $0x45, 0x1d(%rdx)
incq %rax
jmp 0x15193
incq %rbp
jmp 0x15133
incq %rbx
movb 0x7(%rsp), %bpl
jmp 0x15124
xorl %ebx, %ebx
movslq 0x24(%r13), %rax
cmpq %rax, %rbx
jge 0x1524c
movq 0x90(%r13), %rax
movq (%rax,%rbx,8), %rsi
addq $0xc, %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x4720
testl %eax, %eax
je 0x15247
movq 0x90(%r13), %rax
movq (%rax,%rbx,8), %rsi
addq $0x12, %rsi
movq %r13, %rdi
movq %r12, %rdx
callq 0x4720
testl %eax, %eax
je 0x15247
movslq 0xc(%rsp), %rax
movslq 0x8(%rsp), %rcx
cmpq %rcx, %rax
jg 0x15247
movq 0x68(%r13), %rdx
movq (%rdx,%rax,8), %rdx
movq 0x768(%rdx), %rdx
movzbl 0x1d(%rdx), %esi
cmpl $0x45, %esi
je 0x15242
cmpl $0x48, %esi
je 0x15242
movb $0x54, 0x1d(%rdx)
incq %rax
jmp 0x1521c
incq %rbx
jmp 0x151cd
movq 0x20(%rsp), %rcx
incq %rcx
jmp 0x15065
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq