// File: /workspace/github_c_makefile_star2_O1/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, %r13
movl $0x320, %edi            # imm = 0x320
callq 0x595c
movq %rax, %rbx
movq %r13, %rdi
movq %rax, %rsi
movq %r14, 0x10(%rsp)
movq %r14, %rdx
callq 0x159cc
movl %eax, %r15d
testl %eax, %eax
jne 0x15f5b
movq (%r13), %rax
movq 0x48(%rax), %rsi
leaq 0x4d88(%rip), %rdi      # 0x1acdc
xorl %eax, %eax
callq 0x8900
testl %ebp, %ebp
jle 0x16083
movl %ebp, %ebp
xorl %r14d, %r14d
movq %r13, 0x8(%rsp)
movq %rbp, 0x18(%rsp)
movq (%r13,%r14,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x16066
leaq (%r13,%r14,8), %r13
xorl %r12d, %r12d
testl %r15d, %r15d
jle 0x15fb2
movq (%r13), %rax
movsbl 0x40(%rax), %edi
callq 0x517a
movq (%rbx,%r12,8), %rcx
cmpb 0x401(%rcx), %al
je 0x15fb2
incq %r12
cmpq %r12, %r15
jne 0x15f8e
movl %r15d, %r12d
cmpl %r15d, %r12d
je 0x16074
movq (%r13), %rdi
movl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
callq 0x15d2f
testl %eax, %eax
jne 0x16017
movq (%rbx,%r12,8), %rbp
movsbl 0x401(%rbp), %eax
movl %eax, 0x4(%rsp)
movq (%r13), %rax
movq 0x48(%rax), %rcx
movq %rcx, 0x20(%rsp)
movsbl 0x40(%rax), %edi
callq 0x517a
movsbl %al, %r8d
leaq 0x4d25(%rip), %rdi      # 0x1ad24
movq %rbp, %rsi
movq 0x18(%rsp), %rbp
movl 0x4(%rsp), %edx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0x8900
movq (%r13), %rsi
movslq (%rsi), %rax
testq %rax, %rax
movq 0x8(%rsp), %r13
jle 0x16066
movq (%rbx,%r12,8), %rdx
movq 0x410(%rdx), %rcx
movq 0x420(%rdx), %rdx
movq 0x68(%rsi), %rsi
xorl %edi, %edi
movb (%rcx,%rdi), %r8b
movq (%rsi,%rdi,8), %r9
movq 0x768(%r9), %r9
movb %r8b, 0x1e(%r9)
movss (%rdx,%rdi,4), %xmm0
movss %xmm0, 0x18(%r9)
incq %rdi
cmpq %rdi, %rax
jne 0x16040
incq %r14
cmpq %rbp, %r14
jne 0x15f72
jmp 0x16083
movq %r13, %rdi
callq 0x2737
movq 0x8(%rsp), %r13
jmp 0x16066
movq 0x10(%rsp), %rax
cmpl $0x0, 0x1d78(%rax)
je 0x160c0
testl %r15d, %r15d
jle 0x160aa
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x2040
incq %r14
cmpq %r14, %r15
jne 0x16099
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