// File: /workspace/github_c_makefile_star2_O3/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, 0x18(%rsp)
testl %esi, %esi
jle 0x157ff
movl %esi, %eax
movq %rax, 0x10(%rsp)
xorl %ecx, %ecx
leaq 0xc(%rsp), %r14
leaq 0x8(%rsp), %r15
movq 0x18(%rsp), %rax
movq (%rax,%rcx,8), %r12
cmpl $0x0, 0x1c(%r12)
movq %rcx, 0x20(%rsp)
jle 0x15667
xorl %ebx, %ebx
movq 0x80(%r12), %rax
movq (%rax,%rbx,8), %rsi
movl 0x1c(%rsi), %eax
cmpl $0x5, %eax
je 0x155e6
cmpl $0x3, %eax
je 0x155e1
cmpl $0x1, %eax
jne 0x155e9
movb $0x48, %bpl
jmp 0x155e9
movb $0x49, %bpl
jmp 0x155e9
movb $0x47, %bpl
addq $0xc, %rsi
movq %r12, %rdi
movq %r14, %rdx
callq 0x4e44
testl %eax, %eax
je 0x15656
movq 0x80(%r12), %rax
movq (%rax,%rbx,8), %rsi
addq $0x12, %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x4e44
testl %eax, %eax
je 0x15656
movslq 0xc(%rsp), %rdx
movl 0x8(%rsp), %eax
cmpl %eax, %edx
jg 0x15656
movq %rdx, %rcx
shlq $0x3, %rcx
addq 0x68(%r12), %rcx
subl %edx, %eax
incl %eax
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movq 0x768(%rsi), %rsi
cmpb $0x48, 0x1d(%rsi)
je 0x1564f
movb %bpl, 0x1d(%rsi)
incq %rdx
cmpl %edx, %eax
jne 0x1563a
incq %rbx
movslq 0x1c(%r12), %rax
cmpq %rax, %rbx
jl 0x155be
movl 0x20(%r12), %ecx
testl %ecx, %ecx
jle 0x1574c
movq 0x88(%r12), %rax
xorl %ebx, %ebx
movb %bpl, 0x7(%rsp)
movq (%rax,%rbx,8), %rdx
cmpl $0x0, (%rdx)
jle 0x1573d
xorl %ebp, %ebp
leaq (,%rbp,2), %r13
addq %rbp, %r13
leaq (%rdx,%r13,2), %rsi
addq $0xfa, %rsi
movq %r12, %rdi
movq %r14, %rdx
callq 0x4e44
testl %eax, %eax
je 0x15718
movq 0x88(%r12), %rax
movq (%rax,%rbx,8), %rax
leaq (%rax,%r13,2), %rsi
addq $0x172, %rsi            # imm = 0x172
movq %r12, %rdi
movq %r15, %rdx
callq 0x4e44
testl %eax, %eax
je 0x15718
movslq 0xc(%rsp), %rdx
movl 0x8(%rsp), %eax
cmpl %eax, %edx
jg 0x15718
movq %rdx, %rcx
shlq $0x3, %rcx
addq 0x68(%r12), %rcx
subl %edx, %eax
incl %eax
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movq 0x768(%rsi), %rsi
cmpb $0x48, 0x1d(%rsi)
je 0x15711
movb $0x45, 0x1d(%rsi)
incq %rdx
cmpl %edx, %eax
jne 0x156fc
incq %rbp
movq 0x88(%r12), %rax
movq (%rax,%rbx,8), %rdx
movslq (%rdx), %rcx
cmpq %rcx, %rbp
jl 0x15692
movl 0x20(%r12), %ecx
movb 0x7(%rsp), %bpl
incq %rbx
movslq %ecx, %rdx
cmpq %rdx, %rbx
jl 0x15683
cmpl $0x0, 0x24(%r12)
jle 0x157ec
xorl %ebx, %ebx
movq 0x90(%r12), %rax
movq (%rax,%rbx,8), %rsi
addq $0xc, %rsi
movq %r12, %rdi
movq %r14, %rdx
callq 0x4e44
testl %eax, %eax
je 0x157db
movq 0x90(%r12), %rax
movq (%rax,%rbx,8), %rsi
addq $0x12, %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x4e44
testl %eax, %eax
je 0x157db
movslq 0xc(%rsp), %rdx
movl 0x8(%rsp), %eax
cmpl %eax, %edx
jg 0x157db
movq %rdx, %rcx
shlq $0x3, %rcx
addq 0x68(%r12), %rcx
subl %edx, %eax
incl %eax
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movq 0x768(%rsi), %rsi
movzbl 0x1d(%rsi), %edi
cmpl $0x45, %edi
je 0x157d4
cmpl $0x48, %edi
je 0x157d4
movb $0x54, 0x1d(%rsi)
incq %rdx
cmpl %edx, %eax
jne 0x157b7
incq %rbx
movslq 0x24(%r12), %rax
cmpq %rax, %rbx
jl 0x1575a
movq 0x20(%rsp), %rcx
incq %rcx
cmpq 0x10(%rsp), %rcx
jne 0x155a2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop