// File: /workspace/github_c_makefile_star2_O3/josch[P]stride/hydrbond.c
// Function: FindHydrogenBonds
int FindHydrogenBonds(CHAIN **Chain, int NChain, HBOND **HBond, COMMAND *Cmd)
{
  DONOR **Dnr;
  ACCEPTOR **Acc;
  BOOLEAN *BondedDonor, *BondedAcceptor;
  int NDnr=0, NAcc=0;
  int dc, ac, ccd, cca, cc, hc=0, i;
  void (*HBOND_Energy)();
  BUFFER Text;

  Dnr = (DONOR **)ckalloc(MAXDONOR*sizeof(DONOR *));
  Acc = (ACCEPTOR **)ckalloc(MAXACCEPTOR*sizeof(ACCEPTOR *));
  
  for( cc=0; cc<NChain; cc++ ) { 
    FindDnr(Chain[cc],Dnr,&NDnr,Cmd); 
    FindAcc(Chain[cc],Acc,&NAcc,Cmd);
  }

  BondedDonor    = (BOOLEAN *)ckalloc(NDnr*sizeof(BOOLEAN));
  BondedAcceptor = (BOOLEAN *)ckalloc(NAcc*sizeof(BOOLEAN));
  for( i=0; i<NDnr; i++ )
    BondedDonor[i] = NO;
  for( i=0; i<NAcc; i++ )
    BondedAcceptor[i] = NO;

  if( Cmd->EnergyType == 'D' ) 
    HBOND_Energy = DSSP_Energy; 
  else 
    HBOND_Energy = GRID_Energy;

  for( dc=0; dc<NDnr; dc++ ) {

    if( Dnr[dc]->Group != Peptide && !Cmd->SideChainHBond ) continue;
    
    for( ac=0; ac<NAcc; ac++ ) {
      
      if( abs(Acc[ac]->A_Res - Dnr[dc]->D_Res) < 2 && Acc[ac]->Chain->Id == Dnr[dc]->Chain->Id ) 
	continue;
      
       if( Acc[ac]->Group != Peptide && !Cmd->SideChainHBond ) continue;

      if( hc == MAXHYDRBOND ) 
	die("Number of hydrogen bonds exceeds current limit of %d in %s\n",
	    MAXHYDRBOND,Chain[0]->File);
      HBond[hc] = (HBOND *)ckalloc(sizeof(HBOND));

      HBond[hc]->ExistHydrBondRose = NO;
      HBond[hc]->ExistHydrBondBaker = NO;
      HBond[hc]->ExistPolarInter = NO;
      
      if( (HBond[hc]->AccDonDist = 
	   Dist(Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->D_At],
		Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At]) ) <=
	 Cmd->DistCutOff ) {
	
	
	if( Cmd->MainChainPolarInt && Dnr[dc]->Group == Peptide && 
	   Acc[ac]->Group == Peptide && Dnr[dc]->H != ERR) {
	  HBOND_Energy(Acc[ac]->Chain->Rsd[Acc[ac]->AA2_Res]->Coord[Acc[ac]->AA2_At],
		       Acc[ac]->Chain->Rsd[Acc[ac]->AA_Res]->Coord[Acc[ac]->AA_At],
		       Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At],
		       Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->H],
		       Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->D_At],
		       Cmd,HBond[hc]);
	  
	  if( HBond[hc]->Energy < -10.0 &&
	     ( (Cmd->EnergyType == 'G' && fabs(HBond[hc]->Et) > Eps && 
		fabs(HBond[hc]->Ep) > Eps ) || Cmd->EnergyType != 'G' ) )
	    HBond[hc]->ExistPolarInter = YES;
	}

	if( Cmd->MainChainHBond && 
	    (HBond[hc]->OHDist = 
	     Dist(Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->H],
		  Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At])) <= 2.5 &&
	    (HBond[hc]->AngNHO = 
	     Ang(Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->D_At],
		 Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->H],
		 Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At])) >= 90.0 &&
	     HBond[hc]->AngNHO <= 180.0 &&
	    (HBond[hc]->AngCOH = 
	     Ang(Acc[ac]->Chain->Rsd[Acc[ac]->AA_Res]->Coord[Acc[ac]->AA_At],
		 Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At],
		 Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->H])) >= 90.0 &&
	     
	     HBond[hc]->AngCOH <= 180.0 )
	  HBond[hc]->ExistHydrBondBaker = YES;

	if( Cmd->MainChainHBond && 
	   HBond[hc]->AccDonDist <= Dnr[dc]->HB_Radius+Acc[ac]->HB_Radius ) {
	  
	  HBond[hc]->AccAng = 
	    Ang(Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->D_At],
		Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At],
		Acc[ac]->Chain->Rsd[Acc[ac]->AA_Res]->Coord[Acc[ac]->AA_At]);
	  
	  if( ( ( Acc[ac]->Hybrid == Nsp2 || Acc[ac]->Hybrid == Osp2 ) && 
	       ( HBond[hc]->AccAng >= MINACCANG_SP2 && 
		HBond[hc]->AccAng <= MAXACCANG_SP2 ) ) || 
	     ( ( Acc[ac]->Hybrid == Ssp3 ||  Acc[ac]->Hybrid == Osp3 ) && 
	      ( HBond[hc]->AccAng >= MINACCANG_SP3 && 
	       HBond[hc]->AccAng <= MAXACCANG_SP3 ) ) ) {
	    
	    HBond[hc]->DonAng = 
	      Ang(Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At],
		  Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->D_At],
		  Dnr[dc]->Chain->Rsd[Dnr[dc]->DD_Res]->Coord[Dnr[dc]->DD_At]);
	    
	    if( ( ( Dnr[dc]->Hybrid == Nsp2 || Dnr[dc]->Hybrid == Osp2 ) && 
		 ( HBond[hc]->DonAng >= MINDONANG_SP2 && 
		  HBond[hc]->DonAng <= MAXDONANG_SP2 ) ) || 
	       ( ( Dnr[dc]->Hybrid == Nsp3 || Dnr[dc]->Hybrid == Osp3 ) && 
		( HBond[hc]->DonAng >= MINDONANG_SP3 &&
		 HBond[hc]->DonAng <= MAXDONANG_SP3 ) ) ) {
	      
	      if( Dnr[dc]->Hybrid == Nsp2 || Dnr[dc]->Hybrid == Osp2 ) {
		HBond[hc]->AccDonAng = 
		  fabs(Torsion(Dnr[dc]->Chain->Rsd[Dnr[dc]->DDI_Res]->Coord[Dnr[dc]->DDI_At],
			       Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->D_At],
			       Dnr[dc]->Chain->Rsd[Dnr[dc]->DD_Res]->Coord[Dnr[dc]->DD_At],
			       Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At]));
		
		if( HBond[hc]->AccDonAng > 90.0 && HBond[hc]->AccDonAng < 270.0 )
		  HBond[hc]->AccDonAng = fabs(180.0 - HBond[hc]->AccDonAng);
		
	      }
	      
	      if( Acc[ac]->Hybrid == Nsp2 || Acc[ac]->Hybrid == Osp2 ) {
		HBond[hc]->DonAccAng = 
		  fabs(Torsion(Dnr[dc]->Chain->Rsd[Dnr[dc]->D_Res]->Coord[Dnr[dc]->D_At],
			       Acc[ac]->Chain->Rsd[Acc[ac]->A_Res]->Coord[Acc[ac]->A_At],
			       Acc[ac]->Chain->Rsd[Acc[ac]->AA_Res]->Coord[Acc[ac]->AA_At],
			       Acc[ac]->Chain->Rsd[Acc[ac]->AA2_Res]->Coord[Acc[ac]->AA2_At]));
		
		if(HBond[hc]->DonAccAng > 90.0 && HBond[hc]->DonAccAng < 270.0)
		  HBond[hc]->DonAccAng = fabs(180.0 - HBond[hc]->DonAccAng);
		
	      }
	      
	      if( ( Dnr[dc]->Hybrid != Nsp2 && Dnr[dc]->Hybrid != Osp2 && 
		   Acc[ac]->Hybrid != Nsp2 && Acc[ac]->Hybrid != Osp2 ) ||
		 ( Acc[ac]->Hybrid != Nsp2 && Acc[ac]->Hybrid != Osp2 &&
		  ( Dnr[dc]->Hybrid == Nsp2 || Dnr[dc]->Hybrid == Osp2 ) &&
		  HBond[hc]->AccDonAng <= ACCDONANG ) ||
		 ( Dnr[dc]->Hybrid != Nsp2 && Dnr[dc]->Hybrid != Osp2 &&
		  ( Acc[ac]->Hybrid == Nsp2 || Acc[ac]->Hybrid == Osp2 ) &&
		  HBond[hc]->DonAccAng <= DONACCANG ) ||
		 ( ( Dnr[dc]->Hybrid == Nsp2 || Dnr[dc]->Hybrid == Osp2 ) && 
		  ( Acc[ac]->Hybrid == Nsp2 || Acc[ac]->Hybrid == Osp2 ) &&
		  HBond[hc]->AccDonAng <= ACCDONANG &&
		  HBond[hc]->DonAccAng <= DONACCANG ) )
		HBond[hc]->ExistHydrBondRose = YES;
	    }
	  }
	}
	
      }

      if( (HBond[hc]->ExistPolarInter && HBond[hc]->Energy < 0.0) 
	  || HBond[hc]->ExistHydrBondRose || HBond[hc]->ExistHydrBondBaker ) {
	HBond[hc]->Dnr = Dnr[dc];
	HBond[hc]->Acc = Acc[ac];
	BondedDonor[dc] = YES;
	BondedAcceptor[ac] = YES;
	if( (ccd = FindChain(Chain,NChain,Dnr[dc]->Chain->Id)) != ERR ) {
	  if( Chain[ccd]->Rsd[Dnr[dc]->D_Res]->Inv->NBondDnr < MAXRESDNR )
	    Chain[ccd]->Rsd[Dnr[dc]->D_Res]->Inv->
	      HBondDnr[Chain[ccd]->Rsd[Dnr[dc]->D_Res]->Inv->NBondDnr++] = hc;
	  else
	    fprintf(stderr,"Residue %s %s of chain %s%c is involved in %d hydrogen bonds (%d are allowed)\n",
		Chain[ccd]->Rsd[Dnr[dc]->D_Res]->ResType,
		Chain[ccd]->Rsd[Dnr[dc]->D_Res]->PDB_ResNumb,
		Chain[ccd]->File,SpaceToDash(Chain[ccd]->Id),
		Chain[ccd]->Rsd[Dnr[dc]->D_Res]->Inv->NBondDnr,MAXRESDNR-1);
	}
	if( (cca  = FindChain(Chain,NChain,Acc[ac]->Chain->Id)) != ERR ) {
	  if( Chain[cca]->Rsd[Acc[ac]->A_Res]->Inv->NBondAcc < MAXRESACC )
	    Chain[cca]->Rsd[Acc[ac]->A_Res]->Inv->
	      HBondAcc[Chain[cca]->Rsd[Acc[ac]->A_Res]->Inv->NBondAcc++] = hc;
	  else
	    fprintf(stderr,"Residue %s %s of chain %s%c is involved in %d hydrogen bonds (%d are allowed)\n",
		Chain[cca]->Rsd[Acc[ac]->A_Res]->ResType,
		Chain[cca]->Rsd[Acc[ac]->A_Res]->PDB_ResNumb,
		Chain[cca]->File,SpaceToDash(Chain[cca]->Id),
		Chain[cca]->Rsd[Acc[ac]->A_Res]->Inv->NBondAcc,MAXRESACC-1);
	}
	if( ccd != cca && ccd != ERR ) {
	  Chain[ccd]->Rsd[Dnr[dc]->D_Res]->Inv->InterchainHBonds = YES;
	  Chain[cca]->Rsd[Acc[ac]->A_Res]->Inv->InterchainHBonds = YES;
	  if( HBond[hc]->ExistHydrBondRose ) {
	    Chain[0]->NHydrBondInterchain++;
	    Chain[0]->NHydrBondTotal++;
	  }
	}
	else
	if( ccd == cca && ccd != ERR && HBond[hc]->ExistHydrBondRose ) {
	  Chain[ccd]->NHydrBond++;
	  Chain[0]->NHydrBondTotal++;
	}
	hc++;
      }
      else
	free(HBond[hc]);
    }
  }
  if( Cmd->Info )
    for( i=0; i<hc; i++ ) { 
      if( HBond[i]->Energy < 0.0 ) {
	sprintf(Text,"%3d ",i); 
	PrintHydrBond(Text,HBond[i]); 
      }
    } 
    
  for( i=0; i<NDnr; i++ )
    if( !BondedDonor[i] )
      free(Dnr[i]);
  for( i=0; i<NAcc; i++ )
    if( !BondedAcceptor[i] )
      free(Acc[i]);

  if( NDnr )
    free(BondedDonor);
  if( NAcc )
    free(BondedAcceptor);

  return(hc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rcx, 0x58(%rsp)
movq %rdx, 0x38(%rsp)
movl %esi, %ebx
movq %rdi, 0x20(%rsp)
xorl %r14d, %r14d
movl %r14d, 0x4c(%rsp)
movl %r14d, 0x48(%rsp)
movl $0x27100, %edi          # imm = 0x27100
callq 0x5880
movq %rax, %rbp
movl $0x27100, %edi          # imm = 0x27100
callq 0x5880
movq %rax, %r13
movl $0x0, %eax
movl %ebx, 0x34(%rsp)
testl %ebx, %ebx
jle 0x969f
movl 0x34(%rsp), %r14d
xorl %r12d, %r12d
movq 0x58(%rsp), %rbx
movq 0x20(%rsp), %r15
movq (%r15,%r12,8), %rdi
movq %rbp, %rsi
leaq 0x4c(%rsp), %rdx
movq %rbx, %rcx
callq 0x8864
movq (%r15,%r12,8), %rdi
movq %r13, %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rcx
callq 0x8f7e
incq %r12
cmpq %r12, %r14
jne 0x9666
movl 0x4c(%rsp), %eax
movl 0x48(%rsp), %r14d
movq %rbp, 0x70(%rsp)
movl %eax, 0x2c(%rsp)
movslq %eax, %r12
leaq (,%r12,4), %r15
movq %r15, %rdi
callq 0x5880
movq %rax, %rbp
movslq %r14d, %rax
movq %rax, 0x40(%rsp)
leaq (,%rax,4), %rbx
movq %rbx, %rdi
callq 0x5880
movq %rax, 0x60(%rsp)
movq %r12, 0x78(%rsp)
testl %r12d, %r12d
jle 0x96f2
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x20f0
movq %rbp, 0x50(%rsp)
testl %r14d, %r14d
jle 0x970b
movq 0x60(%rsp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x20f0
movq 0x58(%rsp), %rax
cmpb $0x44, 0x1c07(%rax)
movl 0x2c(%rsp), %ebp
movq 0x40(%rsp), %rdi
jne 0x972b
leaq -0x3f5c(%rip), %rax     # 0x57cd
jmp 0x9732
leaq -0x420e(%rip), %rax     # 0x5524
movq %rax, 0x68(%rsp)
testl %ebp, %ebp
jle 0xa222
movl %r14d, 0x30(%rsp)
xorl %edx, %edx
movl $0x0, 0x14(%rsp)
movq %r13, 0x88(%rsp)
movq 0x38(%rsp), %r14
movq 0x58(%rsp), %rbp
movq 0x70(%rsp), %rcx
movq (%rcx,%rdx,8), %rax
cmpl $0x0, 0x28(%rax)
movl 0x30(%rsp), %eax
movq %rdx, 0x80(%rsp)
je 0x9788
cmpl $0x0, 0x1d48(%rbp)
je 0xa15d
testl %eax, %eax
jle 0xa15d
leaq (%rcx,%rdx,8), %r12
movq %r13, %rbx
xorl %r13d, %r13d
movq (%rbx), %rax
movl 0x8(%rax), %edx
movq (%r12), %rcx
subl 0x8(%rcx), %edx
movl %edx, %esi
negl %esi
cmovsl %edx, %esi
cmpl $0x1, %esi
ja 0x97c5
movq (%rax), %rdx
movb 0x40(%rdx), %dl
movq (%rcx), %rcx
cmpb 0x40(%rcx), %dl
je 0x9b15
cmpl $0x0, 0x24(%rax)
je 0x97d8
cmpl $0x0, 0x1d48(%rbp)
je 0x9b15
cmpl $0xc350, 0x14(%rsp)     # imm = 0xC350
jne 0x9801
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq 0x48(%rax), %rdx
leaq 0x107aa(%rip), %rdi     # 0x19f9f
movl $0xc350, %esi           # imm = 0xC350
xorl %eax, %eax
callq 0x87c8
movl $0x58, %edi
callq 0x5880
movslq 0x14(%rsp), %r15
movq %rax, (%r14,%r15,8)
movl $0x0, 0x18(%rax)
movq $0x0, 0x10(%rax)
movq (%r12), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %rdx
movslq 0x14(%rax), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x2, %rdi
addq (%rcx,%rdx,8), %rdi
movl $0x188, %r8d            # imm = 0x188
addq %r8, %rdi
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %rdx
movslq 0x14(%rax), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x2, %rsi
addq (%rcx,%rdx,8), %rsi
addq %r8, %rsi
callq 0x40c3
movq %r15, 0x18(%rsp)
movq (%r14,%r15,8), %rdi
movss %xmm0, 0x38(%rdi)
movss 0x1d0c(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jb 0x9955
cmpl $0x0, 0x1d50(%rbp)
je 0x98b1
movq (%r12), %r8
cmpl $0x0, 0x28(%r8)
jne 0x98b1
movq (%rbx), %rdx
cmpl $0x0, 0x24(%rdx)
je 0x9fc8
cmpl $0x0, 0x1d4c(%rbp)
je 0x9955
movq (%r12), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %rdx
movslq 0x20(%rax), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x2, %rdi
addq (%rcx,%rdx,8), %rdi
movl $0x188, %r8d            # imm = 0x188
addq %r8, %rdi
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %rdx
movslq 0x14(%rax), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x2, %rsi
addq (%rcx,%rdx,8), %rsi
movl $0x188, %r15d           # imm = 0x188
addq %r8, %rsi
callq 0x40c3
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rdi
movss %xmm0, 0x3c(%rdi)
movss 0xffd8(%rip), %xmm1     # 0x19900
ucomiss %xmm0, %xmm1
jae 0x9b2a
cmpl $0x0, 0x1d4c(%rbp)
je 0x9955
movq (%r12), %rcx
movss 0x2c(%rcx), %xmm0
movq (%rbx), %rax
addss 0x28(%rax), %xmm0
ucomiss 0x38(%rdi), %xmm0
jae 0x9c4c
cmpl $0x0, 0x10(%rdi)
je 0x9964
xorps %xmm0, %xmm0
ucomiss 0x1c(%rdi), %xmm0
ja 0x9974
cmpl $0x0, 0x14(%rdi)
jne 0x9974
cmpl $0x0, 0x18(%rdi)
je 0x9fb9
movq (%r12), %rax
movq %rax, (%rdi)
movq (%rbx), %rax
movq 0x18(%rsp), %rcx
movq (%r14,%rcx,8), %rcx
movq %rax, 0x8(%rcx)
movq 0x50(%rsp), %rax
movl $0x1, %ecx
movq 0x80(%rsp), %rdx
movl %ecx, (%rax,%rdx,4)
movq 0x60(%rsp), %rax
movl %ecx, (%rax,%r13,4)
movq (%r12), %rax
movq (%rax), %rax
movsbl 0x40(%rax), %edx
movq 0x20(%rsp), %r14
movq %r14, %rdi
movl 0x34(%rsp), %esi
callq 0x4f77
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x9a05
movslq %ebp, %rax
movq (%r14,%rax,8), %rsi
movq 0x68(%rsi), %rcx
movq (%r12), %rdx
movslq 0x8(%rdx), %rdx
movq (%rcx,%rdx,8), %rdi
movq 0x770(%rdi), %rcx
movslq 0x30(%rcx), %rdx
cmpq $0x5, %rdx
jg 0xa0ce
leal 0x1(%rdx), %eax
movl %eax, 0x30(%rcx)
movl 0x14(%rsp), %eax
movl %eax, (%rcx,%rdx,4)
movq (%rbx), %rax
movq (%rax), %rax
movsbl 0x40(%rax), %edx
movq %r14, %rdi
movl 0x34(%rsp), %esi
callq 0x4f77
movl %eax, %r15d
movslq %eax, %r14
cmpl $-0x1, %eax
je 0x9a61
movq 0x20(%rsp), %rax
movq (%rax,%r14,8), %rsi
movq 0x68(%rsi), %rax
movq (%rbx), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x770(%rdi), %rax
movslq 0x34(%rax), %rcx
cmpq $0x5, %rcx
jg 0xa0df
leal 0x1(%rcx), %edx
movl %edx, 0x34(%rax)
movl 0x14(%rsp), %edx
movl %edx, 0x18(%rax,%rcx,4)
cmpl $-0x1, %ebp
je 0x9ad4
cmpl %r15d, %ebp
je 0x9ad4
movslq %ebp, %rax
movq 0x20(%rsp), %rdx
movq (%rdx,%rax,8), %rax
movq 0x68(%rax), %rax
movq (%r12), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x770(%rax), %rax
movl $0x1, %esi
movl %esi, 0x38(%rax)
movq (%rdx,%r14,8), %rax
movq 0x68(%rax), %rax
movq (%rbx), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x770(%rax), %rax
movl %esi, 0x38(%rax)
movq 0x38(%rsp), %r14
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rax
cmpl $0x0, 0x14(%rax)
je 0x9b07
movq 0x20(%rsp), %rax
movq (%rax), %rax
incl 0x34(%rax)
jmp 0x9b04
cmpl $-0x1, %ebp
movq 0x38(%rsp), %r14
je 0x9b07
cmpl %r15d, %ebp
jne 0x9b07
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rax
cmpl $0x0, 0x14(%rax)
je 0x9b07
movslq %ebp, %rax
movq 0x20(%rsp), %rcx
movq (%rcx,%rax,8), %rax
incl 0x30(%rax)
movq (%rcx), %rax
incl 0x38(%rax)
incl 0x14(%rsp)
movq 0x40(%rsp), %rdi
movq 0x58(%rsp), %rbp
incq %r13
addq $0x8, %rbx
cmpq %rdi, %r13
jl 0x979a
jmp 0xa15d
movq (%r12), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %rdx
movq (%rcx,%rdx,8), %rcx
movslq 0x14(%rax), %rdx
leaq (%rdx,%rdx,2), %rdx
leaq 0x188(%rcx,%rdx,4), %rdi
movslq 0x20(%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0x188(%rcx,%rax,4), %rsi
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %r8
movslq 0x14(%rax), %rax
leaq (%rax,%rax,2), %rdx
shlq $0x2, %rdx
addq (%rcx,%r8,8), %rdx
addq %r15, %rdx
callq 0x40f4
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rdi
movss %xmm0, 0x40(%rdi)
ucomiss 0xff70(%rip), %xmm0     # 0x19b08
jb 0x9931
movss 0xff5e(%rip), %xmm1     # 0x19b04
ucomiss %xmm0, %xmm1
jb 0x9931
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0xc(%rax), %rdx
movslq 0x18(%rax), %rsi
leaq (%rsi,%rsi,2), %rdi
shlq $0x2, %rdi
addq (%rcx,%rdx,8), %rdi
movslq 0x8(%rax), %rdx
movslq 0x14(%rax), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x2, %rsi
addq (%rcx,%rdx,8), %rsi
movl $0x188, %r9d            # imm = 0x188
addq %r9, %rdi
addq %r9, %rsi
movq (%r12), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %r8
movslq 0x20(%rax), %rax
leaq (%rax,%rax,2), %rdx
shlq $0x2, %rdx
addq (%rcx,%r8,8), %rdx
addq %r9, %rdx
callq 0x40f4
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rdi
movss %xmm0, 0x44(%rdi)
ucomiss 0xfedf(%rip), %xmm0     # 0x19b08
jb 0x9931
movss 0xfecd(%rip), %xmm1     # 0x19b04
ucomiss %xmm0, %xmm1
jb 0x9931
movl $0x1, 0x18(%rdi)
jmp 0x9931
movq (%rcx), %rdx
movq 0x68(%rdx), %rdx
movslq 0x8(%rcx), %rsi
movslq 0x14(%rcx), %rcx
leaq (%rcx,%rcx,2), %rdi
shlq $0x2, %rdi
addq (%rdx,%rsi,8), %rdi
movl $0x188, %r9d            # imm = 0x188
addq %r9, %rdi
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %rdx
movslq 0x14(%rax), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x2, %rsi
addq (%rcx,%rdx,8), %rsi
addq %r9, %rsi
movslq 0xc(%rax), %r8
movslq 0x18(%rax), %rax
leaq (%rax,%rax,2), %rdx
shlq $0x2, %rdx
addq (%rcx,%r8,8), %rdx
addq %r9, %rdx
callq 0x40f4
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rdi
movss %xmm0, 0x48(%rdi)
movq (%rbx), %rax
movl 0x20(%rax), %ecx
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jne 0xa0f5
ucomiss 0xfe37(%rip), %xmm0     # 0x19b08
jb 0x9955
movss 0xfe25(%rip), %xmm1     # 0x19b04
ucomiss %xmm0, %xmm1
jb 0x9955
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %rdx
movslq 0x14(%rax), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x2, %rdi
addq (%rcx,%rdx,8), %rdi
movl $0x188, %r9d            # imm = 0x188
addq %r9, %rdi
movq (%r12), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x8(%rax), %rdx
movslq 0x14(%rax), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x2, %rsi
addq (%rcx,%rdx,8), %rsi
addq %r9, %rsi
movslq 0xc(%rax), %r8
movslq 0x18(%rax), %rax
leaq (%rax,%rax,2), %rdx
shlq $0x2, %rdx
addq (%rcx,%r8,8), %rdx
addq %r9, %rdx
callq 0x40f4
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rdi
movss %xmm0, 0x4c(%rdi)
movq (%r12), %rax
movl 0x24(%rax), %ecx
cmpq $0x3, %rcx
ja 0x9955
leaq 0x101c8(%rip), %rsi     # 0x19f38
movslq (%rsi,%rcx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
ucomiss 0xfd88(%rip), %xmm0     # 0x19b08
jb 0x9d8f
movss 0xfd7a(%rip), %xmm1     # 0x19b04
ucomiss %xmm0, %xmm1
jae 0x9db6
cmpl $0x1, %ecx
jne 0x9955
ucomiss 0xfd69(%rip), %xmm0     # 0x19b08
jb 0x9955
movss 0xfd57(%rip), %xmm1     # 0x19b04
ucomiss %xmm0, %xmm1
jb 0x9955
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jne 0x9e7d
movq (%rax), %rcx
movq 0x68(%rcx), %rcx
movslq 0x10(%rax), %rdx
movslq 0x1c(%rax), %rsi
leaq (%rsi,%rsi,2), %rdi
shlq $0x2, %rdi
addq (%rcx,%rdx,8), %rdi
movl $0x188, %r10d           # imm = 0x188
addq %r10, %rdi
movslq 0x8(%rax), %rdx
movslq 0x14(%rax), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x2, %rsi
addq (%rcx,%rdx,8), %rsi
movslq 0xc(%rax), %r8
movslq 0x18(%rax), %rax
leaq (%rax,%rax,2), %rdx
shlq $0x2, %rdx
addq (%rcx,%r8,8), %rdx
addq %r10, %rsi
addq %r10, %rdx
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x68(%rcx), %r8
movslq 0x8(%rax), %r9
movslq 0x14(%rax), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x2, %rcx
addq (%r8,%r9,8), %rcx
addq %r10, %rcx
callq 0x3e9c
andps 0xfa9f(%rip), %xmm0     # 0x198e0
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rdi
movss %xmm0, 0x50(%rdi)
ucomiss 0xfcb2(%rip), %xmm0     # 0x19b08
jbe 0x9e7d
movss 0xfcb0(%rip), %xmm1     # 0x19b10
ucomiss %xmm0, %xmm1
jbe 0x9e7d
movss 0xfc97(%rip), %xmm1     # 0x19b04
subss %xmm0, %xmm1
andps 0xfa68(%rip), %xmm1     # 0x198e0
movss %xmm1, 0x50(%rdi)
movq (%rbx), %rax
testl $0xfffffffd, 0x20(%rax) # imm = 0xFFFFFFFD
jne 0x9f49
movq (%r12), %rcx
movq (%rcx), %rdx
movq 0x68(%rdx), %rdx
movslq 0x8(%rcx), %rsi
movslq 0x14(%rcx), %rcx
leaq (%rcx,%rcx,2), %rdi
shlq $0x2, %rdi
addq (%rdx,%rsi,8), %rdi
movq (%rax), %rcx
movq 0x68(%rcx), %r8
movslq 0x8(%rax), %rcx
movslq 0x14(%rax), %rdx
leaq (%rdx,%rdx,2), %rsi
shlq $0x2, %rsi
addq (%r8,%rcx,8), %rsi
movl $0x188, %r10d           # imm = 0x188
addq %r10, %rdi
addq %r10, %rsi
movslq 0xc(%rax), %rcx
movslq 0x18(%rax), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x2, %rdx
addq (%r8,%rcx,8), %rdx
addq %r10, %rdx
movslq 0x10(%rax), %r9
movslq 0x1c(%rax), %rax
leaq (%rax,%rax,2), %rcx
shlq $0x2, %rcx
addq (%r8,%r9,8), %rcx
addq %r10, %rcx
callq 0x3e9c
andps 0xf9d3(%rip), %xmm0     # 0x198e0
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rdi
movss %xmm0, 0x54(%rdi)
ucomiss 0xfbe6(%rip), %xmm0     # 0x19b08
jbe 0x9f49
movss 0xfbe4(%rip), %xmm1     # 0x19b10
ucomiss %xmm0, %xmm1
jbe 0x9f49
movss 0xfbcb(%rip), %xmm1     # 0x19b04
subss %xmm0, %xmm1
andps 0xf99c(%rip), %xmm1     # 0x198e0
movss %xmm1, 0x54(%rdi)
movq (%r12), %rax
movl 0x24(%rax), %eax
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
je 0x9f67
movq (%rbx), %rcx
testl $0xfffffffd, 0x20(%rcx) # imm = 0xFFFFFFFD
jne 0xa151
movq (%rbx), %rcx
movl 0x20(%rcx), %ecx
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jne 0xa113
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0xa12e
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jne 0x9955
movss 0xff3c(%rip), %xmm0     # 0x19ed4
ucomiss 0x50(%rdi), %xmm0
jb 0x9955
movss 0xfb5e(%rip), %xmm0     # 0x19b08
ucomiss 0x54(%rdi), %xmm0
jb 0x9955
jmp 0xa151
callq 0x2040
movq 0x40(%rsp), %rdi
jmp 0x9b15
movslq 0x20(%r8), %rcx
cmpq $-0x1, %rcx
je 0x98b1
movq (%rdx), %rax
movq 0x68(%rax), %r9
movslq 0x10(%rdx), %rsi
movslq 0x1c(%rdx), %rax
leaq (%rax,%rax,2), %rax
shlq $0x2, %rax
addq (%r9,%rsi,8), %rax
movl $0x188, %r11d           # imm = 0x188
addq %r11, %rax
movslq 0xc(%rdx), %r10
movslq 0x18(%rdx), %rsi
leaq (%rsi,%rsi,2), %rsi
shlq $0x2, %rsi
addq (%r9,%r10,8), %rsi
addq %r11, %rsi
movslq 0x8(%rdx), %r10
movslq 0x14(%rdx), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x2, %rdx
addq (%r9,%r10,8), %rdx
addq %r11, %rdx
movq (%r8), %r9
movq 0x68(%r9), %r9
movslq 0x8(%r8), %r10
movq (%r9,%r10,8), %r9
leaq (%rcx,%rcx,2), %rcx
leaq 0x188(%r9,%rcx,4), %rcx
movslq 0x14(%r8), %r8
leaq (%r8,%r8,2), %r8
leaq 0x188(%r9,%r8,4), %r8
movq %rdi, (%rsp)
movq %rax, %rdi
movq %rbp, %r9
xorl %eax, %eax
callq *0x68(%rsp)
movq 0x18(%rsp), %rax
movq (%r14,%rax,8), %rdi
movss 0xfe5c(%rip), %xmm0     # 0x19ed0
ucomiss 0x1c(%rdi), %xmm0
jbe 0x98b1
cmpb $0x47, 0x1c07(%rbp)
jne 0xa0c2
movss 0x24(%rdi), %xmm0
movaps 0xf84d(%rip), %xmm1     # 0x198e0
andps %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0xf7be(%rip), %xmm2     # 0x19860
ucomisd %xmm2, %xmm0
jbe 0x98b1
movss 0x28(%rdi), %xmm0
andps %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm2, %xmm0
jbe 0x98b1
movl $0x1, 0x10(%rdi)
jmp 0x98b1
leaq (%r14,%rax,8), %rdx
movq %r12, %rcx
callq 0x2328
jmp 0x9a05
movq 0x20(%rsp), %rax
leaq (%rax,%r14,8), %rdx
movq %rbx, %rcx
callq 0x23a6
jmp 0x9a61
addl $-0x3, %ecx
cmpl $0x1, %ecx
ja 0x9955
ucomiss 0xfdcc(%rip), %xmm0     # 0x19ed4
jae 0x9cd7
jmp 0x9955
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0xa12e
movss 0xfdb2(%rip), %xmm0     # 0x19ed4
ucomiss 0x50(%rdi), %xmm0
jb 0x9f79
jmp 0xa151
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jne 0xa144
movss 0xf9ca(%rip), %xmm0     # 0x19b08
ucomiss 0x54(%rdi), %xmm0
jae 0xa151
testl %eax, %eax
jne 0x9955
jmp 0x9f84
movl $0x1, 0x14(%rdi)
jmp 0x9955
movq 0x80(%rsp), %rdx
incq %rdx
cmpq 0x78(%rsp), %rdx
movq 0x88(%rsp), %r13
jl 0x9760
cmpl $0x0, 0x1d60(%rbp)
setne %al
cmpl $0x0, 0x14(%rsp)
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa1e9
movl 0x14(%rsp), %r12d
xorps %xmm0, %xmm0
leaq 0xfe87(%rip), %rbx      # 0x1a02a
leaq 0x90(%rsp), %r14
xorl %r15d, %r15d
movq 0x38(%rsp), %rax
movq (%rax,%r15,8), %rax
ucomiss 0x1c(%rax), %xmm0
jbe 0xa1e1
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2220
movq 0x38(%rsp), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0xa29b
xorps %xmm0, %xmm0
incq %r15
cmpq %r15, %r12
jne 0xa1ae
movl 0x2c(%rsp), %ebp
testl %ebp, %ebp
jle 0xa231
xorl %ebx, %ebx
movl 0x30(%rsp), %r14d
movq 0x70(%rsp), %r15
movq 0x50(%rsp), %r12
cmpl $0x0, (%r12,%rbx,4)
jne 0xa212
movq (%r15,%rbx,8), %rdi
callq 0x2040
incq %rbx
cmpq %rbx, 0x78(%rsp)
jne 0xa202
movl 0x2c(%rsp), %ebp
jmp 0xa23b
movl $0x0, 0x14(%rsp)
movq 0x50(%rsp), %r12
jmp 0xa240
movl 0x30(%rsp), %r14d
movq 0x50(%rsp), %r12
movq 0x40(%rsp), %rdi
testl %r14d, %r14d
jle 0xa26a
xorl %ebx, %ebx
movq 0x60(%rsp), %rax
cmpl $0x0, (%rax,%rbx,4)
jne 0xa262
movq %rdi, %r15
movq (%r13,%rbx,8), %rdi
callq 0x2040
movq %r15, %rdi
incq %rbx
cmpq %rbx, %rdi
jne 0xa247
testl %ebp, %ebp
je 0xa276
movq %r12, %rdi
callq 0x2040
testl %r14d, %r14d
je 0xa285
movq 0x60(%rsp), %rdi
callq 0x2040
movl 0x14(%rsp), %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq