// File: /workspace/github_c_makefile_star2_O3/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, %r12d
movq %rdi, %r13
movl $0x320, %edi            # imm = 0x320
callq 0x5880
movq %rax, %rbx
movq %r13, %rdi
movq %rax, %rsi
movq %r14, 0x10(%rsp)
movq %r14, %rdx
callq 0x15810
movl %eax, %ebp
testl %eax, %eax
jne 0x15dc2
movq (%r13), %rax
movq 0x48(%rax), %rsi
leaq 0x4f11(%rip), %rdi      # 0x1accc
xorl %eax, %eax
callq 0x87c8
movl %ebp, (%rsp)
movl %ebp, %r15d
testl %r12d, %r12d
jle 0x15ef4
movl %r12d, %eax
movq %rax, 0x20(%rsp)
xorl %r12d, %r12d
movq %r13, 0x8(%rsp)
movq (%r13,%r12,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x15ed5
leaq (%r13,%r12,8), %r13
movl (%rsp), %ebp
xorl %r14d, %r14d
testl %ebp, %ebp
jle 0x15e25
movq (%r13), %rax
movsbl 0x40(%rax), %edi
callq 0x50a2
movq (%rbx,%r14,8), %rcx
cmpb 0x401(%rcx), %al
je 0x15e25
incq %r14
cmpq %r14, %r15
jne 0x15dff
jmp 0x15ee5
cmpl %ebp, %r14d
je 0x15ee5
movq (%r13), %rdi
movl %r14d, %ebp
movq (%rbx,%rbp,8), %rsi
callq 0x15b83
testl %eax, %eax
jne 0x15e86
movq (%rbx,%rbp,8), %r14
movsbl 0x401(%r14), %eax
movl %eax, 0x4(%rsp)
movq (%r13), %rax
movq 0x48(%rax), %rcx
movq %rcx, 0x18(%rsp)
movsbl 0x40(%rax), %edi
callq 0x50a2
movsbl %al, %r8d
leaq 0x4ea1(%rip), %rdi      # 0x1ad14
movq %r14, %rsi
movl 0x4(%rsp), %edx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x87c8
movq (%r13), %rsi
movslq (%rsi), %rax
testq %rax, %rax
movq 0x8(%rsp), %r13
jle 0x15ed5
movq (%rbx,%rbp,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 0x15eaf
incq %r12
cmpq 0x20(%rsp), %r12
jne 0x15de1
jmp 0x15ef4
movq %r13, %rdi
callq 0x2737
movq 0x8(%rsp), %r13
jmp 0x15ed5
movq 0x10(%rsp), %rax
cmpl $0x0, 0x1d78(%rax)
je 0x15f32
cmpl $0x0, (%rsp)
jle 0x15f1c
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x2040
incq %r14
cmpq %r14, %r15
jne 0x15f0b
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
nopl (%rax)