// File: /workspace/github_c_makefile_star2_O1/josch[P]stride/report.c
// Function: ReportHydrBonds
void ReportHydrBonds(CHAIN **Chain, int NChain, HBOND **HBond, FILE *Out,
		     COMMAND *Cmd)
{
  register int i, k, Cn;
  int Cnt, Res;
  BUFFER Bf, Tmp, Tmp1;
  HBOND *p;
  RESIDUE *r;

  PrepareBuffer(Bf,Chain);

  Glue(Bf,"REM",Out);
  sprintf(Tmp,"REM  ------------------ ");
  strcat(Tmp,"Mainchain hydrogen bonds");
  strcat(Tmp," ------------------------");
  Glue(Bf,Tmp,Out);
  Glue(Bf,"REM",Out);

  Glue(Bf,"REM  Definition of Stickle et al., J.Mol.Biol. 226:1143-1159, 1992",Out);
  Glue(Bf,"REM  A1 is the angle between the planes of donor complex and O..N-C",Out);
  Glue(Bf,"REM  A2 is the angle between the planes of acceptor complex and N..O=C",Out);
  Glue(Bf,"REM",Out);

  sprintf(Tmp,"HBT  %-6d",Chain[0]->NHydrBondTotal);
  Glue(Bf,Tmp,Out);
  sprintf(Tmp,"HBI  %-6d",Chain[0]->NHydrBondInterchain);
  Glue(Bf,Tmp,Out);
  for( Cn=0; Cn<NChain; Cn++ )
    if( Chain[Cn]->Valid ) {

      sprintf(Tmp,"HBC  %-6d  %s %c %4d",
	      Chain[Cn]->NHydrBond,Chain[Cn]->File,SpaceToDash(Chain[Cn]->Id),Chain[Cn]->NRes);
      Glue(Bf,Tmp,Out);
    }
  Glue(Bf,"REM",Out);

  Glue(Bf,"REM  |--Residue 1--|     |--Residue 2--|  N-O N..O=C O..N-C     A1     A2",Out);

  for( Cn=0; Cn<NChain; Cn++ ) {

    if( !Chain[Cn]->Valid )
      continue;
    
    for( i=0; i<Chain[Cn]->NRes; i++ ) {

      r = Chain[Cn]->Rsd[i];

      Cnt = 0;
      for( k=0; k<r->Inv->NBondDnr; k++ ) {
	p = HBond[r->Inv->HBondDnr[k]];
	if( p->ExistHydrBondRose ) {
	  Res = p->Acc->A_Res;
	  sprintf(Tmp,"DNR %4s %c %4s %4d -> ",
		  r->ResType,SpaceToDash(Chain[Cn]->Id),r->PDB_ResNumb,i);

	  sprintf(Tmp1,"%4s %c %4s %4d %4.1f %6.1f %6.1f %6.1f %6.1f ",
		  p->Acc->Chain->Rsd[Res]->ResType,
		  /* patch replace SpaceToDash(Chain[Cn]->Id), */
		  SpaceToDash(p->Acc->Chain->Id),
		  p->Acc->Chain->Rsd[Res]->PDB_ResNumb,Res,p->AccDonDist,p->AccAng,
		  p->DonAng,p->AccDonAng,p->DonAccAng);
	  strcat(Tmp,Tmp1);
	  Glue(Bf,Tmp,Out);
	  Cnt++;
	}
      }

      Cnt = 0;
      for( k=0; k<r->Inv->NBondAcc; k++ ) {
	p = HBond[r->Inv->HBondAcc[k]];
	if( p->ExistHydrBondRose ) {
	  Res = p->Dnr->D_Res;
	  sprintf(Tmp,"ACC %4s %c %4s %4d -> ",
		  r->ResType,SpaceToDash(Chain[Cn]->Id),r->PDB_ResNumb,i);

	  sprintf(Tmp1,"%4s %c %4s %4d %4.1f %6.1f %6.1f %6.1f %6.1f ",
		  p->Dnr->Chain->Rsd[Res]->ResType,
		  /* patch replace SpaceToDash(Chain[Cn]->Id), */
		  SpaceToDash(p->Dnr->Chain->Id),
		  p->Dnr->Chain->Rsd[Res]->PDB_ResNumb,Res,p->AccDonDist,
		  p->AccAng,p->DonAng,p->AccDonAng,p->DonAccAng);
	  strcat(Tmp,Tmp1);
	  Glue(Bf,Tmp,Out);
	  Cnt++;
	}
      }

    }
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc68, %rsp            # imm = 0xC68
movq %rcx, %r14
movq %rdx, 0x38(%rsp)
movl %esi, %ebp
movq %rdi, %r13
movaps 0x9424(%rip), %xmm0     # 0x1a1e0
leaq 0x49b(%rsp), %rbx
movaps %xmm0, -0x4b(%rbx)
movaps %xmm0, -0x3b(%rbx)
movaps %xmm0, -0x2b(%rbx)
movaps %xmm0, -0x1b(%rbx)
movaps %xmm0, -0xb(%rbx)
movl $0xb0, %esi
addq (%rdi), %rsi
movq %rbx, %rdi
callq 0x2070
movw $0xa, 0x4(%rbx)
leaq 0x9462(%rip), %r12      # 0x1a257
leaq 0x450(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x112df
movups 0x971a(%rip), %xmm0     # 0x1a52c
leaq 0x40(%rsp), %r15
movups %xmm0, 0x9(%r15)
movups 0x9700(%rip), %xmm0     # 0x1a523
movaps %xmm0, (%r15)
movq %r15, %rdi
callq 0x20b0
movups 0x9706(%rip), %xmm0     # 0x1a53c
movups %xmm0, 0x40(%rsp,%rax)
movups 0x9703(%rip), %xmm0     # 0x1a545
movups %xmm0, 0x49(%rsp,%rax)
movq %r15, %rdi
callq 0x20b0
movups 0x96ff(%rip), %xmm0     # 0x1a555
movups %xmm0, 0x40(%rsp,%rax)
movups 0x96fd(%rip), %xmm0     # 0x1a55f
movups %xmm0, 0x4a(%rsp,%rax)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x112df
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x112df
leaq 0x96e5(%rip), %rsi      # 0x1a56f
movq %rbx, %rdi
movq %r14, %rdx
callq 0x112df
leaq 0x9716(%rip), %rsi      # 0x1a5b2
movq %rbx, %rdi
movq %r14, %rdx
callq 0x112df
leaq 0x9748(%rip), %rsi      # 0x1a5f6
movq %rbx, %rdi
movq %r14, %rdx
callq 0x112df
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %r12
movq %r14, %rdx
callq 0x112df
movq (%r13), %rax
movl 0x38(%rax), %edx
leaq 0x9765(%rip), %rsi      # 0x1a63d
movq %r15, %rdi
xorl %eax, %eax
callq 0x2220
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x112df
movq (%r13), %rax
movl 0x34(%rax), %edx
leaq 0x9749(%rip), %rsi      # 0x1a647
movq %r15, %rdi
xorl %eax, %eax
callq 0x2220
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, 0x8(%rsp)
movq %r14, %rdx
callq 0x112df
movl %ebp, %eax
movq %rax, 0x28(%rsp)
movl %ebp, (%rsp)
testl %ebp, %ebp
movq %r13, 0x10(%rsp)
jle 0x10fa1
leaq 0x971c(%rip), %rbx      # 0x1a651
leaq 0x40(%rsp), %r14
leaq 0x450(%rsp), %r15
xorl %ebp, %ebp
movq (%r12,%rbp,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x10f97
movl 0x30(%rax), %r12d
movq 0x48(%rax), %r13
movsbl 0x40(%rax), %edi
callq 0x517a
movsbl %al, %r8d
movq 0x10(%rsp), %rax
movq (%rax,%rbp,8), %rax
movl (%rax), %r9d
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movq 0x10(%rsp), %r12
movq %r13, %rcx
xorl %eax, %eax
callq 0x2220
movq %r15, %rdi
movq %r14, %rsi
movq 0x8(%rsp), %rdx
callq 0x112df
incq %rbp
cmpq %rbp, 0x28(%rsp)
jne 0x10f44
leaq 0x92af(%rip), %rsi      # 0x1a257
leaq 0x450(%rsp), %rbx
movq %rbx, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x112df
leaq 0x969f(%rip), %rsi      # 0x1a666
movq %rbx, %rdi
movq %r14, %rdx
callq 0x112df
cmpl $0x0, (%rsp)
jle 0x11293
leaq 0x40(%rsp), %r13
xorl %edx, %edx
movq (%r12,%rdx,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x11285
movq (%r12,%rdx,8), %rax
cmpl $0x0, (%rax)
jle 0x11285
xorl %esi, %esi
movq %rdx, 0x30(%rsp)
movq 0x68(%rax), %rax
movq %rsi, (%rsp)
movq (%rax,%rsi,8), %rbx
movq 0x770(%rbx), %rax
cmpl $0x0, 0x30(%rax)
jle 0x1113f
leaq 0xa(%rbx), %rcx
movq %rcx, 0x20(%rsp)
leaq 0x4(%rbx), %rcx
movq %rcx, 0x18(%rsp)
xorl %r15d, %r15d
movslq (%rax,%r15,4), %rax
movq 0x38(%rsp), %rcx
movq (%rcx,%rax,8), %rbp
cmpl $0x0, 0x14(%rbp)
je 0x11128
movq 0x8(%rbp), %rax
movslq 0x8(%rax), %r14
movq (%r12,%rdx,8), %rax
movsbl 0x40(%rax), %edi
callq 0x517a
movsbl %al, %ecx
movq %r13, %rdi
leaq 0x9640(%rip), %rsi      # 0x1a6b0
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %r8
movq (%rsp), %r9
xorl %eax, %eax
callq 0x2220
movq 0x8(%rbp), %rax
movq (%rax), %rax
movq 0x68(%rax), %rcx
movq (%rcx,%r14,8), %r12
addq $0xa, %r12
movsbl 0x40(%rax), %edi
callq 0x517a
movsbl %al, %ecx
movq 0x8(%rbp), %rax
movq (%rax), %rax
movq 0x68(%rax), %rax
movq (%rax,%r14,8), %r8
addq $0x4, %r8
xorps %xmm0, %xmm0
cvtss2sd 0x38(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x48(%rbp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x4c(%rbp), %xmm2
xorps %xmm3, %xmm3
cvtss2sd 0x50(%rbp), %xmm3
xorps %xmm4, %xmm4
cvtss2sd 0x54(%rbp), %xmm4
leaq 0x860(%rsp), %rbp
movq %rbp, %rdi
leaq 0x95d6(%rip), %rsi      # 0x1a6c7
movq %r12, %rdx
movq 0x10(%rsp), %r12
movl %r14d, %r9d
movb $0x5, %al
callq 0x2220
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2200
leaq 0x450(%rsp), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rdx
callq 0x112df
movq 0x30(%rsp), %rdx
incq %r15
movq 0x770(%rbx), %rax
movslq 0x30(%rax), %rcx
cmpq %rcx, %r15
jl 0x11037
movq 0x770(%rbx), %rax
cmpl $0x0, 0x34(%rax)
jle 0x1126e
leaq 0xa(%rbx), %rcx
movq %rcx, 0x20(%rsp)
leaq 0x4(%rbx), %rcx
movq %rcx, 0x18(%rsp)
xorl %r15d, %r15d
movslq 0x18(%rax,%r15,4), %rax
movq 0x38(%rsp), %rcx
movq (%rcx,%rax,8), %rbp
cmpl $0x0, 0x14(%rbp)
je 0x11257
movq (%rbp), %rax
movslq 0x8(%rax), %r14
movq (%r12,%rdx,8), %rax
movsbl 0x40(%rax), %edi
callq 0x517a
movsbl %al, %ecx
movq %r13, %rdi
leaq 0x9556(%rip), %rsi      # 0x1a6f5
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %r8
movq (%rsp), %r9
xorl %eax, %eax
callq 0x2220
movq (%rbp), %rax
movq (%rax), %rax
movq 0x68(%rax), %rcx
movq (%rcx,%r14,8), %r12
addq $0xa, %r12
movsbl 0x40(%rax), %edi
callq 0x517a
movsbl %al, %ecx
movq (%rbp), %rax
movq (%rax), %rax
movq 0x68(%rax), %rax
movq (%rax,%r14,8), %r8
addq $0x4, %r8
xorps %xmm0, %xmm0
cvtss2sd 0x38(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x48(%rbp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x4c(%rbp), %xmm2
xorps %xmm3, %xmm3
cvtss2sd 0x50(%rbp), %xmm3
xorps %xmm4, %xmm4
cvtss2sd 0x54(%rbp), %xmm4
leaq 0x860(%rsp), %rbp
movq %rbp, %rdi
leaq 0x94a7(%rip), %rsi      # 0x1a6c7
movq %r12, %rdx
movq 0x10(%rsp), %r12
movl %r14d, %r9d
movb $0x5, %al
callq 0x2220
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2200
leaq 0x450(%rsp), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %rdx
callq 0x112df
movq 0x30(%rsp), %rdx
incq %r15
movq 0x770(%rbx), %rax
movslq 0x34(%rax), %rcx
cmpq %rcx, %r15
jl 0x11165
movq (%rsp), %rsi
incq %rsi
movq (%r12,%rdx,8), %rax
movslq (%rax), %rcx
cmpq %rcx, %rsi
jl 0x11005
incq %rdx
cmpq 0x28(%rsp), %rdx
jne 0x10fe3
addq $0xc68, %rsp            # imm = 0xC68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq