// File: /workspace/github_c_makefile_star2_O2/josch[P]stride/dssp.c
// Function: GetDsspAsn
void GetDsspAsn(CHAIN **Chain, int NChain, COMMAND *Cmd)
{
  DSSP **Dssp;

  int NDsspChain=0, DsspCn, Cn, i;

  Dssp  = (DSSP **)ckalloc(MAX_CHAIN*sizeof(DSSP *));
  
  if( (NDsspChain = ReadDSSP(Chain,Dssp,Cmd)) == 0 )
    die("NODSSP Dssp file for %s not found\n",Chain[0]->File);
  
  for( Cn=0; Cn<NChain; Cn++ ) {
    
    if( !Chain[Cn]->Valid )
      continue;
    
    for( DsspCn=0; DsspCn<NDsspChain; DsspCn++ )
      if( SpaceToDash(Chain[Cn]->Id) == Dssp[DsspCn]->Id )
	break;

    if( DsspCn == NDsspChain ) {
      fprintf(stderr,"No DSSP chain corresponding to %s%c\n",
	      Chain[Cn]->File,SpaceToDash(Chain[Cn]->Id));
      continue;
    }

    if( !CompPdbDssp(Chain[Cn],Dssp[DsspCn]) )
      die("PDBDSSPDIF Chain %s%c differs from %s%c\n",
	  Dssp[DsspCn]->File,Dssp[DsspCn]->Id,Chain[Cn]->File,SpaceToDash(Chain[Cn]->Id));
    
    for( i=0; i<Chain[Cn]->NRes; i++ ) {
      Chain[Cn]->Rsd[i]->Prop->DsspAsn  = Dssp[DsspCn]->SecondStr[i];
      Chain[Cn]->Rsd[i]->Prop->DsspSolv = Dssp[DsspCn]->Accessibility[i];
    }
  }

  if( Cmd->DsspAsn ) {
    for( i=0; i<NDsspChain; i++ ) free(Dssp[i]);
    free(Dssp);
  }
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r12
movl $0x320, %edi            # imm = 0x320
callq 0x50f4
movq %rax, %rbx
movq %r12, %rdi
movq %rax, %rsi
movq %r14, 0x18(%rsp)
movq %r14, %rdx
callq 0x15268
movl %eax, %r14d
testl %eax, %eax
jne 0x157fc
movq (%r12), %rax
movq 0x48(%rax), %rsi
leaq 0x4487(%rip), %rdi      # 0x19c7c
xorl %eax, %eax
callq 0x7c4c
xorl %eax, %eax
testl %r14d, %r14d
movl $0x0, %r15d
movl %r14d, 0xc(%rsp)
cmovgl %r14d, %r15d
testl %ebp, %ebp
cmovlel %eax, %ebp
xorl %r13d, %r13d
movq %rbp, %r9
movq %rbp, 0x10(%rsp)
cmpq %r9, %r13
je 0x15957
movq (%r12,%r13,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x1594f
xorl %r14d, %r14d
cmpq %r14, %r15
je 0x1585d
movq (%r12,%r13,8), %rax
movsbl 0x40(%rax), %edi
callq 0x4969
movq (%rbx,%r14,8), %rcx
cmpb 0x401(%rcx), %al
je 0x15860
incq %r14
jmp 0x1583a
movl %r15d, %r14d
cmpl 0xc(%rsp), %r14d
je 0x15918
movq (%r12,%r13,8), %rdi
movl %r14d, %ebp
movq (%rbx,%rbp,8), %rsi
callq 0x155d5
testl %eax, %eax
jne 0x158c3
movq (%rbx,%rbp,8), %r14
movsbl 0x401(%r14), %eax
movl %eax, 0x8(%rsp)
movq (%r12,%r13,8), %rax
movq 0x48(%rax), %rcx
movq %rcx, 0x20(%rsp)
movsbl 0x40(%rax), %edi
callq 0x4969
movsbl %al, %r8d
leaq 0x4414(%rip), %rdi      # 0x19cc4
movq %r14, %rsi
movl 0x8(%rsp), %edx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0x7c4c
movq (%r12,%r13,8), %rax
movl (%rax), %ecx
testl %ecx, %ecx
movl $0x0, %edx
cmovlel %edx, %ecx
xorl %edx, %edx
movq 0x10(%rsp), %r9
cmpq %rdx, %rcx
je 0x1594f
movq (%rbx,%rbp,8), %rsi
movq 0x410(%rsi), %rdi
movb (%rdi,%rdx), %dil
movq 0x68(%rax), %r8
movq (%r8,%rdx,8), %r8
movq 0x768(%r8), %r8
movb %dil, 0x1e(%r8)
movq 0x420(%rsi), %rsi
movss (%rsi,%rdx,4), %xmm0
movss %xmm0, 0x18(%r8)
incq %rdx
jmp 0x158da
movq 0xa6d1(%rip), %rax      # 0x1fff0
movq (%rax), %r14
movq (%r12,%r13,8), %rax
movq 0x48(%rax), %rbp
movsbl 0x40(%rax), %edi
callq 0x4969
movsbl %al, %ecx
movq %r14, %rdi
leaq 0x435f(%rip), %rsi      # 0x19c9f
movq %rbp, %rdx
xorl %eax, %eax
callq 0x2160
movq 0x10(%rsp), %r9
incq %r13
jmp 0x15820
movq 0x18(%rsp), %rax
cmpl $0x0, 0x1d78(%rax)
je 0x15994
movl %r15d, %r14d
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x1597e
movq (%rbx,%r15,8), %rdi
callq 0x2040
incq %r15
jmp 0x1596b
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop