// File: /workspace/github_c_makefile_star2_O2/ugobas[P]tnm/confchange.c
// Function: Mode_confchange_old
int Mode_confchange_old(struct Tors *Diff, struct Normal_Mode *NM,
			struct bond *bonds, atom *atoms, int natoms,
			struct Reference Ref, struct residue *seq,
			float *coord_1, float *coord_2, float M_sqrt,
			char *nameout, char *name_pdb)
{
  int NMODES_CC=10, nround=1, itmax=10, nreduce=4, i, j, k, num_mod=0;
  float STEP_MAX=0.4, c_thr=0.02*M_sqrt, TOL=0.04, TOL2=0.01;
  float c_max=STEP_MAX*M_sqrt;
  char out[100]; sprintf(out, "%s.mode_confchange.dat", nameout);
  printf("Writing %s\n", out);
  FILE *file_out=fopen(out, "w");
  sprintf(out, "%s.mode_confchange.pdb", nameout);
  printf("Writing %s\n", out);
  FILE *file_pdb=fopen(out, "w");

  float rmsd_ini=rmsd_mclachlan_f(coord_1,coord_2,Ref.mass_atom,Ref.N_ref);
  int naxes=NM->N_axes, ncoord=NM->N_Cart;
  double d_phi_opt[naxes], d_phi[naxes];
  float coord_new[ncoord], coord_step[ncoord], coord_all[3*natoms];
  float D_coord[ncoord];   int done[NM->N];
  float gasdev(long *idum);
  float sigma[NM->N]; for(int i=0; i<NM->N; i++)sigma[i]=sqrt(NM->sigma2[i]);
  idum=randomgenerator();
  InitRandom((RANDOMTYPE)idum);

  for(int type=0; type<1; type++){
    for(int lin=0; lin<2; lin++){
      if(lin==1 && type==1)continue;

      char what[100];
      if(lin){sprintf(what, "Linear ");}
      else{sprintf(what, "Torsional ");}
      strcat(what, " conformations, norm. modes ranked by"); 
      if(type){strcat(what, " overlap");}
      else{strcat(what, " frequency");}
      fprintf(file_out, "# %s\n", what);
      fprintf(file_out,"#1=n.modes 2=rmsd_min 3=rmsd 4=mode 5=c_alpha\n");
      fprintf(file_out, "0\t%.3g\t%.3g\t0\t0\n",rmsd_ini,rmsd_ini);

      if(type)for(k=0; k<NM->N; k++)done[k]=0;
      for(i=0; i<naxes; i++)d_phi_opt[i]=0;
      for(i=0; i<ncoord; i++){
	coord_step[i]=coord_1[i];
	D_coord[i]=coord_2[i]-coord_step[i];
      }
      float c_lin[NM->N];
      for (i=0; i<NM->N; i++){
	c_lin[i]=Scalar_product_weighted(D_coord, NM->Cart[i],
					 Ref.mass_coord, ncoord);
      }

      int jmode[NM->N], imode, accept=1, kj=0;
      float score_opt=-1000, score_old=-1000, yy, cc=0;

      for(imode=0; imode<NM->N; imode++){

	if(type==0){
	  kj=imode; // Rank the modes by the frequency
	}else{ 
	  // Rank the modes by the correlation with conf.change
	  kj=-1; float cmax=0;
	  for(k=0; k<NM->N; k++){
	    if(done[k])continue;
	    if(kj<0 || fabs(c_lin[k])>fabs(cmax)){kj=k; cmax=c_lin[k];}
	  }
	  if(cmax==0 || kj<0)break;
	  done[kj]=1;
	}
	jmode[imode]=kj;

	int random=0; float tol, rfact=0.5;
	for(int round=0; round<nround; round++){

	  int done2[NM->N];
	  if(random){tol=TOL;}
	  else{tol=0; for(i=0; i<NM->N; i++)done2[i]=0;}

	  for(int iter=0; iter<=itmax; iter++){

	    if(lin){
	      cc=c_lin[kj]; float *cart=NM->Cart[kj];
	      for(i=0; i<ncoord; i++)coord_new[i]=coord_step[i]+cc*cart[i];
	      yy=-rmsd_mclachlan_f(coord_2,coord_new,Ref.mass_atom,Ref.N_ref);
	      if(yy>=score_opt){
		accept=1; score_opt=yy;
		float *mode=NM->Tors[kj];
		for(i=0; i<naxes; i++)d_phi_opt[i]+=cc*mode[i];
	      }else{accept=0;}
	      goto print_rmsd;
	    }

	    // Full reconstruction, optimize the coefficient
	    // Determine mode (kj) and coefficient (cc)
	    if(random){
	      if(iter>imode)break;
	      int iran=imode*RandomFloating();
	      if(iran>imode)iran=imode;
	      kj=jmode[iran];
	      cc=gasdev(&idum)*sigma[kj]*rfact;
	    }else{ // Minimization
	      kj=-1; cc=0;
	      for(j=imode; j>=0; j--){
		k=jmode[j]; if(done2[k])continue;
		if(kj<0 || fabs(c_lin[k])>fabs(cc)){kj=k; cc=c_lin[k];}
	      }
	      if(kj<0 || fabs(cc)<c_thr)break;
	    }

	    // Compute RMSD
	    if(fabs(cc)>c_max){if(cc>0){cc=c_max;}else{cc=-c_max;}}
	    for(int j=0; j<nreduce; j++){
	      yy=-RMSD_confchange(cc, NM->Tors[kj], d_phi, coord_all,
				  coord_new, d_phi_opt, naxes, bonds,atoms,
				  natoms,Ref,coord_2);
	      // Test if improvement
	      if(yy>score_opt-tol){
		accept=1; score_old=score_opt; score_opt=yy; 
		for(i=0; i<naxes; i++)d_phi_opt[i]=d_phi[i];
		break;
	      }else{accept=0; cc/=2; done2[kj]=1;}
	    }
	  print_rmsd:
	    fprintf(file_out, "%d\t%.3g\t%.3g\t%d\t%.3g\n",
		    imode,-score_opt,-yy,kj,cc);
	    if(accept==0)continue;
	    
	    for(i=0; i<ncoord; i++){
	      coord_step[i]=coord_new[i];
	      D_coord[i]=coord_2[i]-coord_new[i];
	    }
	    for (i=0; i<NM->N; i++){
	      c_lin[i]=Scalar_product_weighted(D_coord, NM->Cart[i],
					       Ref.mass_coord, ncoord);
	    } 

	    if(lin)goto print_pdb;
	    if(fabs(score_old-score_opt)<TOL2)break;
	  } // end iter
	  if(random){random=0; rfact/=2;}else{random=1;}
	} // end round
	
      print_pdb:
	if(imode==NMODES_CC){ //&& sel
	  num_mod++;
	  fprintf(file_pdb, "MODEL %d\n", num_mod);
	  fprintf(file_pdb, "REMARK %s\n", what);
	  fprintf(file_pdb, "REMARK RMSD from target: %.2f\n", -score_opt);
	  fprintf(file_pdb, "REMARK  The fitted conformation change is ");
	  fprintf(file_pdb, "obtained with %d normal modes\n", NMODES_CC);
	  float coord_all_1[3*natoms], *c=coord_all_1, mass[natoms];
	  for(i=0; i<natoms; i++){
	    mass[i]=1;
	    double *r=atoms[i].r; for(k=0; k<3; k++){*c=*r; c++; r++;}
	  }
	  float rmsd=rmsd_mclachlan_f(coord_all_1, coord_all, mass, natoms);
	  rmsd=rmsd_mclachlan_f(coord_1,coord_new,Ref.mass_atom,Ref.N_ref);
	  Print_PDB(file_pdb, atoms, natoms, coord_all, seq, num_mod, rmsd);
	}
    
      } // end imode
  
      if(type==1 &&  lin==0) // Store angles
	for(i=0; i<naxes; i++)Diff->Tors[i]=d_phi_opt[i];
      
      yy=-RMSD_confchange(0, NM->Tors[0], d_phi, coord_all, coord_new,
			  d_phi_opt,naxes,bonds,atoms,natoms,Ref,coord_2);
      fprintf(file_out, "#%d modes RMSD= %.3f RMSD tors. reconstr.= %.3f\n",
	      imode, -score_opt, -yy);
      fprintf(file_out, "&\n");
      printf("%d best modes RMSD=%.3f\n", imode, -score_opt);
      
      /*fprintf(file_out,"# %d non-zero coefficients of normal modes:\n",imode);
	for(i=0; i<NM->N; i++)if(cnew[i])
	fprintf(file_out,"%d %.3g\n",i,cnew[i]);*/
    } // end lin
  }// end type
  fclose(file_out);
  fclose(file_pdb);
  return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %r9, -0x188(%rbp)
movq %r8, -0x68(%rbp)
movq %rcx, -0xa8(%rbp)
movq %rdx, -0x140(%rbp)
movq %rsi, %r13
movq 0x50(%rbp), %rdx
movaps %xmm0, -0x150(%rbp)
cvtss2sd %xmm0, %xmm0
mulsd 0x2621f(%rip), %xmm0    # 0x53c20
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x104(%rbp)
leaq 0x26ff6(%rip), %rsi     # 0x54a0a
xorl %r14d, %r14d
leaq -0x280(%rbp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2260
leaq 0x1e278(%rip), %r15     # 0x4bca7
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x2370d(%rip), %r12     # 0x51150
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2210
movq %rax, -0x98(%rbp)
leaq 0x26fc5(%rip), %rsi     # 0x54a21
movq %rbx, %rdi
movq 0x50(%rbp), %rdx
xorl %eax, %eax
callq 0x2260
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2210
movq %rax, -0xb8(%rbp)
leaq 0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movl (%rax), %ecx
movq 0x40(%rbp), %rdi
movq 0x48(%rbp), %rsi
movq %rdx, -0x138(%rbp)
movl %ecx, -0x78(%rbp)
callq 0x47a64
movsd %xmm0, -0x38(%rbp)
movq %rsp, -0x158(%rbp)
movl 0x8(%r13), %eax
movl 0xc(%r13), %ecx
movq %rsp, %rdx
movq %rax, -0xd0(%rbp)
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rdx
movq %rdx, -0x70(%rbp)
movq %rdx, %rsp
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, -0xe8(%rbp)
movq %rdx, %rsp
movq %rsp, %r12
movq %rcx, -0xf8(%rbp)
leaq 0xf(,%rcx,4), %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x100(%rbp)
movq %rcx, %rsp
movq -0x68(%rbp), %rcx
leal (%rcx,%rcx,2), %ecx
leaq 0xf(,%rcx,4), %rcx
andq $-0x10, %rcx
movq %rsp, %rdx
movq %rcx, -0x180(%rbp)
subq %rcx, %rdx
movq %rdx, -0xd8(%rbp)
movq %rdx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0xb0(%rbp)
movq %rcx, %rsp
movl (%r13), %eax
movq %rsp, %rdx
leaq 0xf(,%rax,4), %rcx
andq $-0x10, %rcx
subq %rcx, %rdx
movq %rdx, -0x130(%rbp)
movq %rdx, %rsp
xorps %xmm1, %xmm1
cltq
cmpq %rax, %r14
jge 0x2dbb1
movq 0x28(%r13), %rax
movss (%rax,%r14,4), %xmm0
ucomiss %xmm1, %xmm0
jb 0x2db93
sqrtss %xmm0, %xmm0
jmp 0x2db9b
callq 0x21c0
xorps %xmm1, %xmm1
movq -0x130(%rbp), %rax
movss %xmm0, (%rax,%r14,4)
incq %r14
movl (%r13), %eax
jmp 0x2db77
movaps -0x150(%rbp), %xmm0
mulss 0x26080(%rip), %xmm0    # 0x53c40
movaps %xmm0, -0x150(%rbp)
cvtsd2ss -0x38(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
callq 0x2f672
movq %rax, 0x4691b(%rip)     # 0x744f8
movq %rax, %rdi
callq 0x49ebc
cvtss2sd -0x38(%rbp), %xmm1
movsd %xmm1, -0x160(%rbp)
movaps 0x22c67(%rip), %xmm1    # 0x50860
xorps -0x150(%rbp), %xmm1
movaps %xmm1, -0x1a0(%rbp)
movq -0x68(%rbp), %rax
movl %eax, %ecx
movq -0xd0(%rbp), %rdx
testl %edx, %edx
movl $0x0, %esi
cmovgl %edx, %esi
movq %rsi, -0xc0(%rbp)
movq -0xf8(%rbp), %rdx
testl %edx, %edx
movl $0x0, %r15d
cmovgl %edx, %r15d
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
movq %rdx, -0x178(%rbp)
movb $0x1, %al
leaq 0xf(,%rcx,4), %rcx
andq $-0x10, %rcx
movq %rcx, -0x170(%rbp)
movl $0x0, -0x4c(%rbp)
movq 0x48(%rbp), %r14
testb $0x1, %al
je 0x2e65e
xorl %ebx, %ebx
cmpl $0x2, %ebx
je 0x2e657
testl %ebx, %ebx
movl %ebx, -0x30(%rbp)
movaps %xmm0, -0x120(%rbp)
je 0x2dc9d
movabsq $0x207261656e694c, %rax # imm = 0x207261656E694C
movq %rax, -0x210(%rbp)
jmp 0x2dcb8
movabsq $0x616e6f6973726f54, %rax # imm = 0x616E6F6973726F54
movq %rax, -0x210(%rbp)
movl $0x206c61, -0x209(%rbp) # imm = 0x206C61
leaq -0x210(%rbp), %rbx
movq %rbx, %rdi
callq 0x20d0
movabsq $0x79622064656b6e, %rcx # imm = 0x79622064656B6E
movq %rcx, -0x1f2(%rbp,%rax)
movups 0x26d61(%rip), %xmm0    # 0x54a41
movups %xmm0, -0x210(%rbp,%rax)
movups 0x26d62(%rip), %xmm0    # 0x54a51
movups %xmm0, -0x200(%rbp,%rax)
movq %rbx, %rdi
callq 0x20d0
movabsq $0x6e65757165726620, %rcx # imm = 0x6E65757165726620
movq %rcx, -0x210(%rbp,%rax)
movl $0x79636e, -0x209(%rbp,%rax) # imm = 0x79636E
movq -0x98(%rbp), %rbx
movq %rbx, %rdi
leaq 0x26391(%rip), %rsi     # 0x540be
leaq -0x210(%rbp), %rdx
xorl %eax, %eax
callq 0x2190
leaq 0x26e18(%rip), %rdi     # 0x54b5a
pushq $0x2e
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2280
movq %rbx, %rdi
leaq 0x26e2f(%rip), %rsi     # 0x54b89
movsd -0x160(%rbp), %xmm0
movaps %xmm0, %xmm1
movb $0x2, %al
callq 0x2190
xorl %eax, %eax
movq 0x40(%rbp), %rcx
movq -0x70(%rbp), %rdx
movq -0xc0(%rbp), %rsi
cmpq %rax, %rsi
je 0x2dd8c
andq $0x0, (%rdx,%rax,8)
incq %rax
jmp 0x2dd7d
xorl %eax, %eax
cmpq %rax, %r15
je 0x2ddbf
movss (%rcx,%rax,4), %xmm0
movq -0x100(%rbp), %rdx
movss %xmm0, (%rdx,%rax,4)
movss (%r14,%rax,4), %xmm1
subss %xmm0, %xmm1
movq -0xb0(%rbp), %rdx
movss %xmm1, (%rdx,%rax,4)
incq %rax
jmp 0x2dd8e
movq %rsp, -0x168(%rbp)
movl (%r13), %eax
movq %rsp, %rcx
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x38(%rbp)
movq %rcx, %rsp
leaq 0x10(%rbp), %rax
movq 0x18(%rax), %r14
xorl %ebx, %ebx
movslq (%r13), %rax
cmpq %rax, %rbx
jge 0x2de22
movq 0x38(%r13), %rax
movq (%rax,%rbx,8), %rsi
movq -0xb0(%rbp), %rdi
movq %r14, %rdx
movq -0xf8(%rbp), %rcx
callq 0xfd1e
movq -0x38(%rbp), %rax
movss %xmm0, (%rax,%rbx,4)
incq %rbx
jmp 0x2dded
movl %eax, %ecx
movq %rsp, %rdx
leaq 0xf(,%rcx,4), %rcx
andq $-0x10, %rcx
subq %rcx, %rdx
movq %rdx, -0xc8(%rbp)
movq %rdx, %rsp
xorl %esi, %esi
pushq $0x1
popq %rcx
movl %ecx, -0x2c(%rbp)
movss 0x25b68(%rip), %xmm0    # 0x539b8
movaps %xmm0, %xmm1
movss %xmm0, -0x7c(%rbp)
movq 0x48(%rbp), %r14
movl -0x30(%rbp), %r8d
movaps %xmm1, -0x60(%rbp)
cltq
cmpq %rax, %rsi
movq %rsi, -0x48(%rbp)
jge 0x2e556
movq -0xc8(%rbp), %rax
movl %esi, (%rax,%rsi,4)
cvtsi2sd %esi, %xmm0
movsd %xmm0, -0x190(%rbp)
leaq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xf0(%rbp)
movb $0x1, %al
movl $0x0, -0x3c(%rbp)
movl %esi, %ebx
movss 0x21c69(%rip), %xmm0    # 0x4fb14
movss %xmm0, -0x50(%rbp)
testb $0x1, %al
je 0x2e54a
movq %rsp, -0x128(%rbp)
movl (%r13), %eax
movq %rsp, %rcx
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0xe0(%rbp)
movq %rcx, %rsp
movss 0x25d5d(%rip), %xmm0    # 0x53c44
movss %xmm0, -0x74(%rbp)
cmpl $0x0, -0x3c(%rbp)
movaps -0x60(%rbp), %xmm0
jne 0x2df23
movl (%r13), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x2df1b
movq -0xe0(%rbp), %rdx
andl $0x0, (%rdx,%rcx,4)
incq %rcx
jmp 0x2df06
xorps %xmm1, %xmm1
movss %xmm1, -0x74(%rbp)
xorl %ecx, %ecx
movl -0x2c(%rbp), %eax
movaps %xmm0, -0x60(%rbp)
movl %ecx, -0x80(%rbp)
cmpl $0xb, %ecx
je 0x2e394
testl %r8d, %r8d
je 0x2dfc8
movq %rbx, -0xa0(%rbp)
movslq %ebx, %rbx
movq -0x38(%rbp), %rax
movss (%rax,%rbx,4), %xmm1
movq 0x38(%r13), %rax
movq (%rax,%rbx,8), %rax
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x2df83
movss (%rax,%rcx,4), %xmm0
mulss %xmm1, %xmm0
movq -0x100(%rbp), %rdx
addss (%rdx,%rcx,4), %xmm0
movss %xmm0, (%r12,%rcx,4)
incq %rcx
jmp 0x2df5e
movaps %xmm1, -0x90(%rbp)
movq %r14, %rdi
movq %r12, %rsi
movq -0x138(%rbp), %rdx
movl -0x78(%rbp), %ecx
callq 0x47a64
cvtsd2ss %xmm0, %xmm3
xorps 0x228b6(%rip), %xmm3    # 0x50860
movaps -0x60(%rbp), %xmm0
ucomiss %xmm0, %xmm3
jae 0x2e03c
movaps %xmm0, %xmm2
xorl %ebx, %ebx
movaps -0x90(%rbp), %xmm4
jmp 0x2e25d
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x2e084
movl -0x80(%rbp), %eax
cmpq %rax, %rsi
jb 0x2e391
xorl %eax, %eax
movq %rsi, %rbx
callq 0x49ffd
mulsd -0x190(%rbp), %xmm0
cvttsd2si %xmm0, %eax
cmpl %eax, %ebx
cmovll %ebx, %eax
cltq
movq -0xc8(%rbp), %rcx
movslq (%rcx,%rax,4), %rbx
leaq 0x464e8(%rip), %rdi     # 0x744f8
callq 0x49cbc
movapd %xmm0, %xmm4
movq -0x130(%rbp), %rax
mulss (%rax,%rbx,4), %xmm4
mulss -0x50(%rbp), %xmm4
movaps %xmm4, %xmm0
andps 0x231fc(%rip), %xmm0    # 0x51230
movl -0x2c(%rbp), %eax
jmp 0x2e102
movq 0x40(%r13), %rax
movq (%rax,%rbx,8), %rax
xorl %ecx, %ecx
movq -0x70(%rbp), %rdx
movq -0xc0(%rbp), %rsi
movaps -0x90(%rbp), %xmm4
cmpq %rcx, %rsi
je 0x2e079
movss (%rax,%rcx,4), %xmm0
mulss %xmm4, %xmm0
cvtss2sd %xmm0, %xmm0
addsd (%rdx,%rcx,8), %xmm0
movsd %xmm0, (%rdx,%rcx,8)
incq %rcx
jmp 0x2e058
pushq $0x1
popq %rbx
movaps %xmm3, %xmm2
jmp 0x2e25d
xorps %xmm4, %xmm4
pushq $-0x1
popq %rax
movl %eax, %ebx
movl %esi, %eax
testl %eax, %eax
js 0x2e0dc
movl %eax, %ecx
movq -0xc8(%rbp), %rdx
movl (%rdx,%rcx,4), %ecx
movslq %ecx, %rdx
movq -0xe0(%rbp), %rdi
cmpl $0x0, (%rdi,%rdx,4)
jne 0x2e0d8
movq -0x38(%rbp), %rdi
movss (%rdi,%rdx,4), %xmm0
testl %ebx, %ebx
js 0x2e0d3
movaps %xmm0, %xmm1
movaps 0x2316b(%rip), %xmm3    # 0x51230
andps %xmm3, %xmm1
movaps %xmm4, %xmm2
andps %xmm3, %xmm2
ucomiss %xmm2, %xmm1
jbe 0x2e0d8
movl %ecx, %ebx
movaps %xmm0, %xmm4
decl %eax
jmp 0x2e08e
testl %ebx, %ebx
js 0x2e391
movaps %xmm4, %xmm0
andps 0x23142(%rip), %xmm0    # 0x51230
movss -0x104(%rbp), %xmm1
ucomiss %xmm0, %xmm1
movl -0x2c(%rbp), %eax
ja 0x2e3c1
movaps -0x150(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x2e12a
ucomiss 0x1cef7(%rip), %xmm4    # 0x4b00c
movaps %xmm1, %xmm4
movaps -0x120(%rbp), %xmm0
ja 0x2e131
movaps -0x1a0(%rbp), %xmm4
jmp 0x2e131
movaps -0x120(%rbp), %xmm0
movq %rbx, -0xa0(%rbp)
movslq %ebx, %rbx
movaps -0x60(%rbp), %xmm1
subss -0x74(%rbp), %xmm1
movss %xmm1, -0x2c(%rbp)
pushq $0x4
popq %r14
subl $0x1, %r14d
jb 0x2e209
movq 0x40(%r13), %rax
movq (%rax,%rbx,8), %rdi
subq $0x50, %rsp
leaq 0x10(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x38(%rsp)
movups %xmm1, 0x28(%rsp)
movups %xmm0, 0x18(%rsp)
movq 0x48(%rbp), %rax
movq %rax, 0x48(%rsp)
movq -0x68(%rbp), %rax
movl %eax, 0x10(%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x140(%rbp), %rax
movq %rax, (%rsp)
movaps %xmm4, %xmm0
movq -0xe8(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq %r12, %rcx
movq -0x70(%rbp), %r8
movq -0xd0(%rbp), %r9
movaps %xmm4, -0x90(%rbp)
callq 0x2d8f7
addq $0x50, %rsp
xorps 0x22681(%rip), %xmm0    # 0x50860
ucomiss -0x2c(%rbp), %xmm0
ja 0x2e218
movaps -0x90(%rbp), %xmm4
mulss 0x21920(%rip), %xmm4    # 0x4fb14
movq -0xe0(%rbp), %rax
movl $0x1, (%rax,%rbx,4)
xorl %eax, %eax
jmp 0x2e14d
movaps -0x60(%rbp), %xmm2
movq 0x48(%rbp), %r14
movaps %xmm0, %xmm3
movl %eax, %ebx
jmp 0x2e25d
xorl %eax, %eax
movq 0x48(%rbp), %r14
movq -0x70(%rbp), %rcx
movq -0xc0(%rbp), %rsi
movaps -0x90(%rbp), %xmm4
cmpq %rax, %rsi
je 0x2e24b
movq -0xe8(%rbp), %rdx
movsd (%rdx,%rax,8), %xmm1
movsd %xmm1, (%rcx,%rax,8)
incq %rax
jmp 0x2e230
pushq $0x1
popq %rbx
movaps %xmm0, %xmm2
movaps -0x60(%rbp), %xmm1
movss %xmm1, -0x7c(%rbp)
movaps %xmm0, %xmm3
movaps %xmm2, -0x90(%rbp)
movaps %xmm2, %xmm0
movaps 0x225f2(%rip), %xmm2    # 0x50860
xorps %xmm2, %xmm0
cvtss2sd %xmm0, %xmm0
movaps %xmm3, -0x120(%rbp)
movaps %xmm3, %xmm1
xorps %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm4, %xmm2
movq -0x98(%rbp), %rdi
leaq 0x26902(%rip), %rsi     # 0x54b9a
movq -0x48(%rbp), %rdx
movq -0xa0(%rbp), %rcx
movb $0x3, %al
callq 0x2190
movaps -0x90(%rbp), %xmm2
testl %ebx, %ebx
movl %ebx, %eax
movl -0x30(%rbp), %r8d
je 0x2e365
movl %eax, -0x2c(%rbp)
xorl %eax, %eax
cmpq %rax, %r15
je 0x2e2f6
movss (%r12,%rax,4), %xmm0
movq -0x100(%rbp), %rcx
movss %xmm0, (%rcx,%rax,4)
movss (%r14,%rax,4), %xmm1
subss %xmm0, %xmm1
movq -0xb0(%rbp), %rcx
movss %xmm1, (%rcx,%rax,4)
incq %rax
jmp 0x2e2c4
xorl %ebx, %ebx
movslq (%r13), %rax
cmpq %rax, %rbx
jge 0x2e331
movq 0x38(%r13), %rax
movq (%rax,%rbx,8), %rsi
movq -0xb0(%rbp), %rdi
movq -0xf0(%rbp), %rdx
movq -0xf8(%rbp), %rcx
callq 0xfd1e
movq -0x38(%rbp), %rax
movss %xmm0, (%rax,%rbx,4)
incq %rbx
jmp 0x2e2f8
movl -0x30(%rbp), %r8d
testl %r8d, %r8d
jne 0x2e3c7
movss -0x7c(%rbp), %xmm0
movaps -0x90(%rbp), %xmm2
subss %xmm2, %xmm0
andps 0x22edb(%rip), %xmm0    # 0x51230
movss 0x22ea3(%rip), %xmm1    # 0x51200
ucomiss %xmm0, %xmm1
movl -0x2c(%rbp), %eax
ja 0x2e37d
movl -0x80(%rbp), %ecx
incl %ecx
movaps %xmm2, %xmm0
movq -0x48(%rbp), %rsi
movq -0xa0(%rbp), %rbx
jmp 0x2df28
pushq $0x1
popq %rax
movaps %xmm2, -0x60(%rbp)
movq -0x48(%rbp), %rsi
movq -0xa0(%rbp), %rbx
jmp 0x2e394
movl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movss -0x50(%rbp), %xmm0
mulss 0x21770(%rip), %xmm0    # 0x4fb14
cmpl $0x0, -0x3c(%rbp)
je 0x2e3af
movss %xmm0, -0x50(%rbp)
xorl $0x1, -0x3c(%rbp)
movq -0x128(%rbp), %rsp
xorl %eax, %eax
jmp 0x2deb0
movq -0x48(%rbp), %rsi
jmp 0x2e394
movq -0x128(%rbp), %rsp
pushq $0x1
popq %rax
movaps -0x90(%rbp), %xmm1
movq -0x48(%rbp), %rsi
movl %eax, -0x2c(%rbp)
cmpq $0xa, %rsi
jne 0x2e53e
movl -0x4c(%rbp), %edx
incl %edx
movq -0xb8(%rbp), %rbx
movq %rbx, %rdi
leaq 0x24d74(%rip), %rsi     # 0x53173
movl %edx, -0x4c(%rbp)
xorl %eax, %eax
movaps %xmm1, -0x60(%rbp)
callq 0x2190
movq %rbx, %rdi
leaq 0x266c4(%rip), %rsi     # 0x54adb
leaq -0x210(%rbp), %rdx
xorl %eax, %eax
callq 0x2190
movaps -0x60(%rbp), %xmm0
xorps 0x22430(%rip), %xmm0    # 0x50860
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
leaq 0x266a8(%rip), %rsi     # 0x54ae6
movb $0x1, %al
callq 0x2190
leaq 0x266b9(%rip), %rdi     # 0x54b05
pushq $0x2a
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2280
movq %rbx, %rdi
leaq 0x266cc(%rip), %rsi     # 0x54b30
pushq $0xa
popq %rdx
xorl %eax, %eax
callq 0x2190
movq %rsp, -0xf0(%rbp)
movq %rsp, %rdi
subq -0x180(%rbp), %rdi
movq %rdi, %rsp
movq %rsp, %rdx
subq -0x170(%rbp), %rdx
movq %rdx, %rsp
movq -0xa8(%rbp), %rax
xorl %ecx, %ecx
movq %rdi, %rsi
movq -0x178(%rbp), %r9
cmpq %r9, %rcx
je 0x2e4d5
movl $0x3f800000, (%rdx,%rcx,4) # imm = 0x3F800000
xorl %r8d, %r8d
cmpl $0xc, %r8d
je 0x2e4c9
cvtsd2ss (%rax,%r8,2), %xmm0
movss %xmm0, (%rsi,%r8)
addq $0x4, %r8
jmp 0x2e4b1
incq %rcx
addq %r8, %rsi
addq $0x70, %rax
jmp 0x2e4a2
movq -0xd8(%rbp), %r14
movq %r14, %rsi
movq -0x68(%rbp), %rbx
movl %ebx, %ecx
callq 0x47a64
movq 0x40(%rbp), %rdi
movq %r12, %rsi
movq -0x138(%rbp), %rdx
movl -0x78(%rbp), %ecx
callq 0x47a64
cvtsd2ss %xmm0, %xmm0
movq -0xb8(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movl %ebx, %edx
movq %r14, %rcx
movq -0x188(%rbp), %r8
movl -0x4c(%rbp), %r9d
callq 0x2f4bd
movq -0xf0(%rbp), %rsp
movq 0x48(%rbp), %r14
movl -0x30(%rbp), %r8d
movq -0x48(%rbp), %rsi
movaps -0x60(%rbp), %xmm1
incq %rsi
movl (%r13), %eax
jmp 0x2de60
movaps -0x60(%rbp), %xmm1
movl -0x2c(%rbp), %eax
jmp 0x2e3dc
movq 0x40(%r13), %rax
movq (%rax), %rdi
subq $0x50, %rsp
leaq 0x10(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x38(%rsp)
movups %xmm1, 0x28(%rsp)
movups %xmm0, 0x18(%rsp)
movq %r14, 0x48(%rsp)
movq -0x68(%rbp), %rax
movl %eax, 0x10(%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x140(%rbp), %rax
movq %rax, (%rsp)
xorps %xmm0, %xmm0
movq -0xe8(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq %r12, %rcx
movq -0x70(%rbp), %r8
movq -0xd0(%rbp), %r9
callq 0x2d8f7
addq $0x50, %rsp
movaps %xmm0, %xmm2
movaps %xmm0, -0x120(%rbp)
movaps 0x22284(%rip), %xmm1    # 0x50860
movaps -0x60(%rbp), %xmm0
xorps %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
cvtss2sd %xmm2, %xmm1
movq -0x98(%rbp), %rbx
movq %rbx, %rdi
leaq 0x265af(%rip), %rsi     # 0x54bb0
movq -0x48(%rbp), %rdx
movb $0x2, %al
callq 0x2190
leaq 0x23a38(%rip), %rdi     # 0x5204b
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
movl -0x30(%rbp), %ebx
callq 0x2280
leaq 0x265b6(%rip), %rdi     # 0x54be1
movq -0x48(%rbp), %rsi
movsd -0x38(%rbp), %xmm0
movb $0x1, %al
callq 0x20f0
movaps -0x120(%rbp), %xmm0
movq -0x168(%rbp), %rsp
xorps 0x22210(%rip), %xmm0    # 0x50860
incl %ebx
jmp 0x2dc73
xorl %eax, %eax
jmp 0x2dc69
movq -0x98(%rbp), %rdi
callq 0x20c0
movq -0xb8(%rbp), %rdi
callq 0x20c0
movq -0x158(%rbp), %rsp
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq