// File: /workspace/github_c_makefile_star2_O3/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, %r13
movq %rdx, 0x38(%rsp)
movl %esi, %ebp
movq %rdi, %r14
movaps 0x9262(%rip), %xmm0     # 0x1a1d0
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 0x92a0(%rip), %r12      # 0x1a247
leaq 0x450(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x114b3
movups 0x9558(%rip), %xmm0     # 0x1a51c
leaq 0x40(%rsp), %r15
movups %xmm0, 0x9(%r15)
movups 0x953e(%rip), %xmm0     # 0x1a513
movaps %xmm0, (%r15)
movq %r15, %rdi
callq 0x20b0
movups 0x9544(%rip), %xmm0     # 0x1a52c
movups %xmm0, 0x40(%rsp,%rax)
movups 0x9541(%rip), %xmm0     # 0x1a535
movups %xmm0, 0x49(%rsp,%rax)
movq %r15, %rdi
callq 0x20b0
movups 0x953d(%rip), %xmm0     # 0x1a545
movups %xmm0, 0x40(%rsp,%rax)
movups 0x953b(%rip), %xmm0     # 0x1a54f
movups %xmm0, 0x4a(%rsp,%rax)
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x114b3
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x114b3
leaq 0x9523(%rip), %rsi      # 0x1a55f
movq %rbx, %rdi
movq %r13, %rdx
callq 0x114b3
leaq 0x9554(%rip), %rsi      # 0x1a5a2
movq %rbx, %rdi
movq %r13, %rdx
callq 0x114b3
leaq 0x9586(%rip), %rsi      # 0x1a5e6
movq %rbx, %rdi
movq %r13, %rdx
callq 0x114b3
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %r12
movq %r13, %rdx
callq 0x114b3
movq (%r14), %rax
movl 0x38(%rax), %edx
leaq 0x95a4(%rip), %rsi      # 0x1a62d
movq %r15, %rdi
xorl %eax, %eax
callq 0x2220
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x114b3
movq (%r14), %rax
movl 0x34(%rax), %edx
leaq 0x9589(%rip), %rsi      # 0x1a637
movq %r15, %rdi
xorl %eax, %eax
callq 0x2220
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x114b3
testl %ebp, %ebp
jle 0x1143b
movl %ebp, 0x8(%rsp)
movl %ebp, %eax
movq %rax, 0x28(%rsp)
leaq 0x9561(%rip), %rbx      # 0x1a641
leaq 0x40(%rsp), %r14
leaq 0x450(%rsp), %r15
xorl %ebp, %ebp
movq %r13, 0x20(%rsp)
movq %r12, (%rsp)
movq (%r12,%rbp,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x1114c
movl 0x30(%rax), %r12d
movq 0x48(%rax), %r13
movsbl 0x40(%rax), %edi
callq 0x50a2
movsbl %al, %r8d
movq (%rsp), %rax
movq (%rax,%rbp,8), %rax
movl (%rax), %r9d
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %edx
movq (%rsp), %r12
movq %r13, %rcx
movq 0x20(%rsp), %r13
xorl %eax, %eax
callq 0x2220
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x114b3
incq %rbp
cmpq %rbp, 0x28(%rsp)
jne 0x110f8
leaq 0x90ea(%rip), %rsi      # 0x1a247
leaq 0x450(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rdx
callq 0x114b3
leaq 0x94df(%rip), %rsi      # 0x1a656
movq %rbx, %rdi
movq %r13, %rdx
callq 0x114b3
cmpl $0x0, 0x8(%rsp)
jle 0x11467
leaq 0x40(%rsp), %r13
xorl %esi, %esi
movq (%r12,%rsi,8), %rax
cmpl $0x0, 0x58(%rax)
je 0x1142b
cmpl $0x0, (%rax)
jle 0x1142b
xorl %ebp, %ebp
movq %rsi, 0x30(%rsp)
movq 0x68(%rax), %rax
movq (%rax,%rbp,8), %rdi
movq 0x770(%rdi), %rax
cmpl $0x0, 0x30(%rax)
movq %rdi, 0x8(%rsp)
jle 0x112f0
leaq 0xa(%rdi), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x4(%rdi), %rcx
movq %rcx, 0x10(%rsp)
xorl %r15d, %r15d
movslq (%rax,%r15,4), %rcx
movq 0x38(%rsp), %rdx
movq (%rdx,%rcx,8), %rbx
cmpl $0x0, 0x14(%rbx)
je 0x112e0
movq 0x8(%rbx), %rax
movslq 0x8(%rax), %r14
movq (%r12,%rsi,8), %rax
movsbl 0x40(%rax), %edi
callq 0x50a2
movsbl %al, %ecx
movq %r13, %rdi
leaq 0x9482(%rip), %rsi      # 0x1a6a0
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0x2220
movq 0x8(%rbx), %rax
movq (%rax), %rax
movq 0x68(%rax), %rcx
movq (%rcx,%r14,8), %r12
addq $0xa, %r12
movsbl 0x40(%rax), %edi
callq 0x50a2
movsbl %al, %ecx
movq 0x8(%rbx), %rax
movq (%rax), %rax
movq 0x68(%rax), %rax
movq (%rax,%r14,8), %r8
addq $0x4, %r8
xorps %xmm0, %xmm0
cvtss2sd 0x38(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x48(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x4c(%rbx), %xmm2
xorps %xmm3, %xmm3
cvtss2sd 0x50(%rbx), %xmm3
xorps %xmm4, %xmm4
cvtss2sd 0x54(%rbx), %xmm4
leaq 0x860(%rsp), %rbx
movq %rbx, %rdi
leaq 0x9419(%rip), %rsi      # 0x1a6b7
movq %r12, %rdx
movq (%rsp), %r12
movl %r14d, %r9d
movb $0x5, %al
callq 0x2220
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2200
leaq 0x450(%rsp), %rdi
movq %r13, %rsi
movq 0x20(%rsp), %rdx
callq 0x114b3
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x770(%rdi), %rax
incq %r15
movslq 0x30(%rax), %rcx
cmpq %rcx, %r15
jl 0x111e5
cmpl $0x0, 0x34(%rax)
jle 0x11418
leaq 0xa(%rdi), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x4(%rdi), %rcx
movq %rcx, 0x10(%rsp)
xorl %r15d, %r15d
movslq 0x18(%rax,%r15,4), %rcx
movq 0x38(%rsp), %rdx
movq (%rdx,%rcx,8), %rbx
cmpl $0x0, 0x14(%rbx)
je 0x11408
movq (%rbx), %rax
movslq 0x8(%rax), %r14
movq (%r12,%rsi,8), %rax
movsbl 0x40(%rax), %edi
callq 0x50a2
movsbl %al, %ecx
movq %r13, %rdi
leaq 0x939d(%rip), %rsi      # 0x1a6e5
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0x2220
movq (%rbx), %rax
movq (%rax), %rax
movq 0x68(%rax), %rcx
movq (%rcx,%r14,8), %r12
addq $0xa, %r12
movsbl 0x40(%rax), %edi
callq 0x50a2
movsbl %al, %ecx
movq (%rbx), %rax
movq (%rax), %rax
movq 0x68(%rax), %rax
movq (%rax,%r14,8), %r8
addq $0x4, %r8
xorps %xmm0, %xmm0
cvtss2sd 0x38(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x48(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x4c(%rbx), %xmm2
xorps %xmm3, %xmm3
cvtss2sd 0x50(%rbx), %xmm3
xorps %xmm4, %xmm4
cvtss2sd 0x54(%rbx), %xmm4
leaq 0x860(%rsp), %rbx
movq %rbx, %rdi
leaq 0x92f1(%rip), %rsi      # 0x1a6b7
movq %r12, %rdx
movq (%rsp), %r12
movl %r14d, %r9d
movb $0x5, %al
callq 0x2220
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2200
leaq 0x450(%rsp), %rdi
movq %r13, %rsi
movq 0x20(%rsp), %rdx
callq 0x114b3
movq 0x30(%rsp), %rsi
movq 0x8(%rsp), %rax
movq 0x770(%rax), %rax
incq %r15
movslq 0x34(%rax), %rcx
cmpq %rcx, %r15
jl 0x1130f
incq %rbp
movq (%r12,%rsi,8), %rax
movslq (%rax), %rcx
cmpq %rcx, %rbp
jl 0x111b2
incq %rsi
cmpq 0x28(%rsp), %rsi
jne 0x11194
jmp 0x11467
leaq 0x8e05(%rip), %rsi      # 0x1a247
leaq 0x450(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rdx
callq 0x114b3
leaq 0x91fa(%rip), %rsi      # 0x1a656
movq %rbx, %rdi
movq %r13, %rdx
callq 0x114b3
addq $0xc68, %rsp            # imm = 0xC68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq