// File: /workspace/github_c_makefile_star2_O0/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 %r14
pushq %rbx
subq $0x300, %rsp            # imm = 0x300
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
leaq 0x10(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movl %r8d, -0x34(%rbp)
movq %r9, -0x40(%rbp)
movss %xmm0, -0x44(%rbp)
movl $0xa, -0x48(%rbp)
movl $0x1, -0x4c(%rbp)
movl $0xa, -0x50(%rbp)
movl $0x4, -0x54(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x3ecccccd, -0x68(%rbp) # imm = 0x3ECCCCCD
movss -0x44(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x37cdf(%rip), %xmm1    # 0x7ed50
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movl $0x3d23d70a, -0x70(%rbp) # imm = 0x3D23D70A
movl $0x3c23d70a, -0x74(%rbp) # imm = 0x3C23D70A
movss -0x68(%rbp), %xmm0
movss -0x44(%rbp), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x78(%rbp)
movq 0x50(%rbp), %rdx
leaq 0x38d3e(%rip), %rsi     # 0x7fde8
xorl %eax, %eax
movb %al, -0x2c9(%rbp)
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x1200
movq -0x2c8(%rbp), %rsi
movb -0x2c9(%rbp), %al
leaq 0x30415(%rip), %rdi     # 0x774ee
movq %rdi, -0x2d8(%rbp)
callq 0x10d0
movq -0x2c8(%rbp), %rdi
leaq 0x3527f(%rip), %rsi     # 0x7c372
movq %rsi, -0x2c0(%rbp)
callq 0x11b0
movq -0x2c8(%rbp), %rdi
movq %rax, %rcx
movb -0x2c9(%rbp), %al
movq %rcx, -0xe8(%rbp)
movq 0x50(%rbp), %rdx
leaq 0x38cde(%rip), %rsi     # 0x7fdff
callq 0x1200
movq -0x2d8(%rbp), %rdi
movq -0x2c8(%rbp), %rsi
movb -0x2c9(%rbp), %al
callq 0x10d0
movq -0x2c8(%rbp), %rdi
movq -0x2c0(%rbp), %rsi
callq 0x11b0
movq %rax, %rcx
movq -0x2b8(%rbp), %rax
movq %rcx, -0xf0(%rbp)
movq 0x40(%rbp), %rdi
movq 0x48(%rbp), %rsi
movq 0x10(%rax), %rdx
movl (%rax), %ecx
callq 0x70af0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xf4(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xf8(%rbp)
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0xfc(%rbp)
movl -0xf8(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x108(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x2b0(%rbp)
movq %rcx, %rsp
movq %rax, -0x110(%rbp)
movl -0xf8(%rbp), %eax
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x2a8(%rbp)
movq %rcx, %rsp
movq %rax, -0x118(%rbp)
movl -0xfc(%rbp), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x2a0(%rbp)
movq %rcx, %rsp
movq %rax, -0x120(%rbp)
movl -0xfc(%rbp), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x298(%rbp)
movq %rcx, %rsp
movq %rax, -0x128(%rbp)
movl -0x34(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x290(%rbp)
movq %rcx, %rsp
movq %rax, -0x130(%rbp)
movl -0xfc(%rbp), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x288(%rbp)
movq %rcx, %rsp
movq %rax, -0x138(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x280(%rbp)
movq %rcx, %rsp
movq %rax, -0x140(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x278(%rbp)
movq %rcx, %rsp
movq %rax, -0x148(%rbp)
movl $0x0, -0x14c(%rbp)
movl -0x14c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x4734d
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1220
movq -0x278(%rbp), %rax
cvtsd2ss %xmm0, %xmm0
movslq -0x14c(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14c(%rbp)
jmp 0x472fa
callq 0x49ce0
movq %rax, 0x5515f(%rip)     # 0x9c4b8
movq 0x55158(%rip), %rdi     # 0x9c4b8
callq 0x756e0
movl $0x0, -0x150(%rbp)
cmpl $0x1, -0x150(%rbp)
jge 0x48374
movl $0x0, -0x154(%rbp)
cmpl $0x2, -0x154(%rbp)
jge 0x4835e
cmpl $0x1, -0x154(%rbp)
jne 0x473aa
cmpl $0x1, -0x150(%rbp)
jne 0x473aa
jmp 0x4834a
cmpl $0x0, -0x154(%rbp)
je 0x473ca
leaq -0x1c0(%rbp), %rdi
leaq 0x38b9c(%rip), %rsi     # 0x7ff5d
movb $0x0, %al
callq 0x1200
jmp 0x473df
leaq -0x1c0(%rbp), %rdi
leaq 0x38b8d(%rip), %rsi     # 0x7ff65
movb $0x0, %al
callq 0x1200
leaq -0x1c0(%rbp), %rdi
leaq 0x38a32(%rip), %rsi     # 0x7fe1f
callq 0x11e0
cmpl $0x0, -0x150(%rbp)
je 0x47410
leaq -0x1c0(%rbp), %rdi
leaq 0x38a3c(%rip), %rsi     # 0x7fe45
callq 0x11e0
jmp 0x47423
leaq -0x1c0(%rbp), %rdi
leaq 0x38a30(%rip), %rsi     # 0x7fe4e
callq 0x11e0
movq -0xe8(%rbp), %rdi
leaq -0x1c0(%rbp), %rdx
leaq 0x37e93(%rip), %rsi     # 0x7f2cb
movb $0x0, %al
callq 0x1150
movq -0xe8(%rbp), %rdi
leaq 0x38b23(%rip), %rsi     # 0x7ff70
movb $0x0, %al
callq 0x1150
movq -0xe8(%rbp), %rdi
movss -0xf4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0xf4(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x38b25(%rip), %rsi     # 0x7ff9f
movb $0x2, %al
callq 0x1150
cmpl $0x0, -0x150(%rbp)
je 0x474bb
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x474b9
movq -0x280(%rbp), %rax
movslq -0x60(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x47491
jmp 0x474bb
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0xf8(%rbp), %eax
jge 0x474eb
movq -0x2b0(%rbp), %rax
movslq -0x58(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x474c2
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0xfc(%rbp), %eax
jge 0x4754b
movq -0x288(%rbp), %rax
movq -0x298(%rbp), %rcx
movq 0x40(%rbp), %rdx
movslq -0x58(%rbp), %rsi
movss (%rdx,%rsi,4), %xmm0
movslq -0x58(%rbp), %rdx
movss %xmm0, (%rcx,%rdx,4)
movq 0x48(%rbp), %rdx
movslq -0x58(%rbp), %rsi
movss (%rdx,%rsi,4), %xmm0
movslq -0x58(%rbp), %rdx
subss (%rcx,%rdx,4), %xmm0
movslq -0x58(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x474f2
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq %rsp, %rcx
movq %rcx, -0x1c8(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x2e0(%rbp)
movq %rcx, %rsp
movq %rax, -0x1d0(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x475d8
movq -0x288(%rbp), %rdi
movq -0x2b8(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x38(%rcx), %rcx
movslq -0x58(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x18(%rax), %rdx
movl -0xfc(%rbp), %ecx
callq 0x15510
movq -0x2e0(%rbp), %rax
movslq -0x58(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x47585
movq -0x20(%rbp), %rax
movl (%rax), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x2e8(%rbp)
movq %rcx, %rsp
movq %rax, -0x1d8(%rbp)
movl $0x1, -0x1e0(%rbp)
movl $0x0, -0x1e4(%rbp)
movss 0x374fb(%rip), %xmm0    # 0x7eb18
movss %xmm0, -0x1e8(%rbp)
movss 0x374eb(%rip), %xmm0    # 0x7eb18
movss %xmm0, -0x1ec(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x1f4(%rbp)
movl $0x0, -0x1dc(%rbp)
movl -0x1dc(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x481ca
cmpl $0x0, -0x150(%rbp)
jne 0x47676
movl -0x1dc(%rbp), %eax
movl %eax, -0x1e4(%rbp)
jmp 0x47761
movl $0xffffffff, -0x1e4(%rbp) # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movss %xmm0, -0x1f8(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x4772a
movq -0x280(%rbp), %rax
movslq -0x60(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x476b4
jmp 0x4771c
cmpl $0x0, -0x1e4(%rbp)
jl 0x476f9
movq -0x2e0(%rbp), %rax
movslq -0x60(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x34db8(%rip), %xmm1    # 0x7c490
pand %xmm1, %xmm0
movss -0x1f8(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movaps 0x34da1(%rip), %xmm2    # 0x7c490
pand %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4771a
movq -0x2e0(%rbp), %rax
movl -0x60(%rbp), %ecx
movl %ecx, -0x1e4(%rbp)
movslq -0x60(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x1f8(%rbp)
jmp 0x4771c
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x47692
movss -0x1f8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x4773e
jp 0x4773e
jmp 0x47747
cmpl $0x0, -0x1e4(%rbp)
jge 0x4774c
jmp 0x481ca
movq -0x280(%rbp), %rax
movslq -0x1e4(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movq -0x2e8(%rbp), %rax
movl -0x1e4(%rbp), %edx
movslq -0x1dc(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x0, -0x1fc(%rbp)
movss 0x2e8de(%rip), %xmm0    # 0x76068
movss %xmm0, -0x204(%rbp)
movl $0x0, -0x208(%rbp)
movl -0x208(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jge 0x47f6b
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq %rsp, %rcx
movq %rcx, -0x210(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x2f0(%rbp)
movq %rcx, %rsp
movq %rax, -0x218(%rbp)
cmpl $0x0, -0x1fc(%rbp)
je 0x477f6
movss -0x70(%rbp), %xmm0
movss %xmm0, -0x200(%rbp)
jmp 0x47832
xorps %xmm0, %xmm0
movss %xmm0, -0x200(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x47830
movq -0x2f0(%rbp), %rax
movslq -0x58(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x47808
jmp 0x47832
movl $0x0, -0x21c(%rbp)
movl -0x21c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jg 0x47ef8
cmpl $0x0, -0x154(%rbp)
je 0x479d2
movq -0x2e0(%rbp), %rax
movslq -0x1e4(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x1f4(%rbp)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x1e4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x228(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0xfc(%rbp), %eax
jge 0x478ea
movq -0x2a0(%rbp), %rax
movq -0x298(%rbp), %rcx
movslq -0x58(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm1
movss -0x1f4(%rbp), %xmm0
movq -0x228(%rbp), %rcx
movslq -0x58(%rbp), %rdx
movss (%rcx,%rdx,4), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movslq -0x58(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x47894
movq -0x2a0(%rbp), %rsi
movq -0x2b8(%rbp), %rax
movq 0x48(%rbp), %rdi
movq 0x10(%rax), %rdx
movl (%rax), %ecx
callq 0x70af0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x1f0(%rbp)
movss -0x1f0(%rbp), %xmm0
ucomiss -0x1e8(%rbp), %xmm0
jb 0x479c3
movl $0x1, -0x1e0(%rbp)
movss -0x1f0(%rbp), %xmm0
movss %xmm0, -0x1e8(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x1e4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x230(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0xf8(%rbp), %eax
jge 0x479c1
movq -0x2b0(%rbp), %rax
movss -0x1f4(%rbp), %xmm0
movq -0x230(%rbp), %rcx
movslq -0x58(%rbp), %rdx
mulss (%rcx,%rdx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movslq -0x58(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x4797a
jmp 0x479cd
movl $0x0, -0x1e0(%rbp)
jmp 0x47d70
cmpl $0x0, -0x1fc(%rbp)
je 0x47a87
movl -0x21c(%rbp), %eax
cmpl -0x1dc(%rbp), %eax
jle 0x479f2
jmp 0x47ef8
cvtsi2sdl -0x1dc(%rbp), %xmm0
movsd %xmm0, -0x2f8(%rbp)
movb $0x0, %al
callq 0x75930
movaps %xmm0, %xmm1
movsd -0x2f8(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x234(%rbp)
movl -0x234(%rbp), %eax
cmpl -0x1dc(%rbp), %eax
jle 0x47a3c
movl -0x1dc(%rbp), %eax
movl %eax, -0x234(%rbp)
movq -0x2e8(%rbp), %rax
movslq -0x234(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1e4(%rbp)
leaq 0x54a5e(%rip), %rdi     # 0x9c4b8
callq 0x75410
movq -0x278(%rbp), %rax
movslq -0x1e4(%rbp), %rcx
mulss (%rax,%rcx,4), %xmm0
mulss -0x204(%rbp), %xmm0
movss %xmm0, -0x1f4(%rbp)
jmp 0x47b7f
movl $0xffffffff, -0x1e4(%rbp) # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movss %xmm0, -0x1f4(%rbp)
movl -0x1dc(%rbp), %eax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jl 0x47b49
movq -0x2f0(%rbp), %rax
movq -0x2e8(%rbp), %rcx
movslq -0x5c(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
movl %ecx, -0x60(%rbp)
movslq -0x60(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x47ad3
jmp 0x47b3b
cmpl $0x0, -0x1e4(%rbp)
jl 0x47b18
movq -0x2e0(%rbp), %rax
movslq -0x60(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x34999(%rip), %xmm1    # 0x7c490
pand %xmm1, %xmm0
movss -0x1f4(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movaps 0x34982(%rip), %xmm2    # 0x7c490
pand %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x47b39
movq -0x2e0(%rbp), %rax
movl -0x60(%rbp), %ecx
movl %ecx, -0x1e4(%rbp)
movslq -0x60(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x1f4(%rbp)
jmp 0x47b3b
movl -0x5c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x47aa5
cmpl $0x0, -0x1e4(%rbp)
jl 0x47b78
movss -0x1f4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movaps 0x3492b(%rip), %xmm0    # 0x7c490
pand %xmm0, %xmm1
movss -0x6c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x47b7d
jmp 0x47ef8
jmp 0x47b7f
movss -0x1f4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x348fe(%rip), %xmm1    # 0x7c490
pand %xmm1, %xmm0
movss -0x78(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x47be0
movss -0x1f4(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x47bc4
movss -0x78(%rbp), %xmm0
movss %xmm0, -0x1f4(%rbp)
jmp 0x47bde
movss -0x78(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x1f4(%rbp)
jmp 0x47be0
movl $0x0, -0x238(%rbp)
movl -0x238(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x47d6e
movq -0x2b0(%rbp), %r8
movq -0x2a0(%rbp), %rcx
movq -0x290(%rbp), %rdx
movq -0x2a8(%rbp), %rsi
movq -0x2b8(%rbp), %rax
movss -0x1f4(%rbp), %xmm0
movq -0x20(%rbp), %rdi
movq 0x40(%rdi), %rdi
movslq -0x1e4(%rbp), %r9
movq (%rdi,%r9,8), %rdi
movl -0xf8(%rbp), %r9d
movq -0x28(%rbp), %r10
movq -0x30(%rbp), %r11
movl -0x34(%rbp), %ebx
movq 0x48(%rbp), %r14
subq $0x50, %rsp
movups (%rax), %xmm1
movups 0x10(%rax), %xmm2
movups 0x20(%rax), %xmm3
movq %rsp, %rax
movups %xmm3, 0x38(%rax)
movups %xmm2, 0x28(%rax)
movups %xmm1, 0x18(%rax)
movq %r14, 0x48(%rax)
movl %ebx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x46ef0
addq $0x50, %rsp
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x1f0(%rbp)
movss -0x1f0(%rbp), %xmm0
movss -0x1e8(%rbp), %xmm1
subss -0x200(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x47d1d
movl $0x1, -0x1e0(%rbp)
movss -0x1e8(%rbp), %xmm0
movss %xmm0, -0x1ec(%rbp)
movss -0x1f0(%rbp), %xmm0
movss %xmm0, -0x1e8(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0xf8(%rbp), %eax
jge 0x47d1b
movq -0x2b0(%rbp), %rax
movq -0x2a8(%rbp), %rcx
movslq -0x58(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movslq -0x58(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x47ce5
jmp 0x47d6e
movq -0x2f0(%rbp), %rax
movl $0x0, -0x1e0(%rbp)
movss -0x1f4(%rbp), %xmm0
movss 0x2e356(%rip), %xmm1    # 0x76094
divss %xmm1, %xmm0
movss %xmm0, -0x1f4(%rbp)
movslq -0x1e4(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
jmp 0x47d5a
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
jmp 0x47bea
jmp 0x47d70
movq -0xe8(%rbp), %rdi
movl -0x1dc(%rbp), %edx
movss -0x1e8(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x1f0(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
cvtss2sd %xmm1, %xmm1
movl -0x1e4(%rbp), %ecx
movss -0x1f4(%rbp), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x381e8(%rip), %rsi     # 0x7ffb0
movb $0x3, %al
callq 0x1150
cmpl $0x0, -0x1e0(%rbp)
jne 0x47ddd
jmp 0x47ee4
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0xfc(%rbp), %eax
jge 0x47e40
movq -0x288(%rbp), %rax
movq -0x2a0(%rbp), %rcx
movq -0x298(%rbp), %rdx
movslq -0x58(%rbp), %rsi
movss (%rcx,%rsi,4), %xmm0
movslq -0x58(%rbp), %rsi
movss %xmm0, (%rdx,%rsi,4)
movq 0x48(%rbp), %rdx
movslq -0x58(%rbp), %rsi
movss (%rdx,%rsi,4), %xmm0
movslq -0x58(%rbp), %rdx
subss (%rcx,%rdx,4), %xmm0
movslq -0x58(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x47de4
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x47e9a
movq -0x288(%rbp), %rdi
movq -0x2b8(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x38(%rcx), %rcx
movslq -0x58(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movq 0x18(%rax), %rdx
movl -0xfc(%rbp), %ecx
callq 0x15510
movq -0x2e0(%rbp), %rax
movslq -0x58(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x47e47
cmpl $0x0, -0x154(%rbp)
je 0x47eb2
movl $0x3c, -0x23c(%rbp)
jmp 0x47f3d
movss -0x1ec(%rbp), %xmm0
subss -0x1e8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movaps 0x345c3(%rip), %xmm0    # 0x7c490
pand %xmm0, %xmm1
movss -0x74(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x47ee2
jmp 0x47ef8
jmp 0x47ee4
movl -0x21c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x21c(%rbp)
jmp 0x4783c
cmpl $0x0, -0x1fc(%rbp)
je 0x47f29
movl $0x0, -0x1fc(%rbp)
movss -0x204(%rbp), %xmm0
movss 0x2e179(%rip), %xmm1    # 0x76094
divss %xmm1, %xmm0
movss %xmm0, -0x204(%rbp)
jmp 0x47f33
movl $0x1, -0x1fc(%rbp)
movl $0x0, -0x23c(%rbp)
movq -0x210(%rbp), %rax
movq %rax, %rsp
movl -0x23c(%rbp), %eax
testl %eax, %eax
je 0x47f55
jmp 0x47f53
jmp 0x47f6d
jmp 0x47f57
movl -0x208(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x208(%rbp)
jmp 0x4779c
jmp 0x47f6d
movl -0x1dc(%rbp), %eax
cmpl -0x48(%rbp), %eax
jne 0x481b4
movl -0x64(%rbp), %eax
incl %eax
movl %eax, -0x64(%rbp)
movq -0xf0(%rbp), %rdi
movl -0x64(%rbp), %edx
leaq 0x36490(%rip), %rsi     # 0x7e425
xorl %eax, %eax
movb %al, -0x309(%rbp)
callq 0x1150
movb -0x309(%rbp), %al
movq -0xf0(%rbp), %rdi
leaq 0x37f33(%rip), %rsi     # 0x7fee9
leaq -0x1c0(%rbp), %rdx
callq 0x1150
movq -0xf0(%rbp), %rdi
movaps 0x36d90(%rip), %xmm1    # 0x7ed60
movss -0x1e8(%rbp), %xmm0
pxor %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x37f0d(%rip), %rsi     # 0x7fef4
movb $0x1, %al
callq 0x1150
movb -0x309(%rbp), %al
movq -0xf0(%rbp), %rdi
leaq 0x37f11(%rip), %rsi     # 0x7ff13
callq 0x1150
movb -0x309(%rbp), %al
movq -0xf0(%rbp), %rdi
movl -0x48(%rbp), %edx
leaq 0x37f20(%rip), %rsi     # 0x7ff3e
callq 0x1150
movl -0x34(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %eax
movl %eax, %ecx
movq %rsp, %rax
movq %rax, -0x248(%rbp)
leaq 0xf(,%rcx,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rax
subq %rdx, %rax
movq %rax, -0x308(%rbp)
movq %rax, %rsp
movq %rcx, -0x250(%rbp)
movq %rax, -0x258(%rbp)
movl -0x34(%rbp), %eax
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x300(%rbp)
movq %rcx, %rsp
movq %rax, -0x260(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x4812e
movq -0x300(%rbp), %rax
movslq -0x58(%rbp), %rcx
movss 0x2dfe3(%rip), %xmm0    # 0x76090
movss %xmm0, (%rax,%rcx,4)
movq -0x30(%rbp), %rax
movslq -0x58(%rbp), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x268(%rbp)
movl $0x0, -0x60(%rbp)
cmpl $0x3, -0x60(%rbp)
jge 0x4811e
movq -0x268(%rbp), %rax
movsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x258(%rbp), %rax
movss %xmm0, (%rax)
movq -0x258(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x258(%rbp)
movq -0x268(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x268(%rbp)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x480cf
jmp 0x48120
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x4808e
movq -0x290(%rbp), %rsi
movq -0x300(%rbp), %rdx
movq -0x308(%rbp), %rdi
movl -0x34(%rbp), %ecx
callq 0x70af0
movq -0x2b8(%rbp), %rax
movq -0x2a0(%rbp), %rsi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x26c(%rbp)
movq 0x40(%rbp), %rdi
movq 0x10(%rax), %rdx
movl (%rax), %ecx
callq 0x70af0
movq -0x290(%rbp), %rcx
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x26c(%rbp)
movq -0xf0(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x34(%rbp), %edx
movq -0x40(%rbp), %r8
movl -0x64(%rbp), %r9d
movss -0x26c(%rbp), %xmm0
callq 0x49a60
movq -0x248(%rbp), %rax
movq %rax, %rsp
jmp 0x481b6
movl -0x1dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1dc(%rbp)
jmp 0x4764a
cmpl $0x1, -0x150(%rbp)
jne 0x48220
cmpl $0x0, -0x154(%rbp)
jne 0x48220
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0xf8(%rbp), %eax
jge 0x4821e
movq -0x2b0(%rbp), %rax
movslq -0x58(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x58(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x481e3
jmp 0x48220
movq -0x2b0(%rbp), %r8
movq -0x2a0(%rbp), %rcx
movq -0x290(%rbp), %rdx
movq -0x2a8(%rbp), %rsi
movq -0x2b8(%rbp), %rax
movq -0x20(%rbp), %rdi
movq 0x40(%rdi), %rdi
movq (%rdi), %rdi
movl -0xf8(%rbp), %r9d
movq -0x28(%rbp), %r10
movq -0x30(%rbp), %r11
movl -0x34(%rbp), %ebx
movq 0x48(%rbp), %r14
subq $0x50, %rsp
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movq %rsp, %rax
movups %xmm2, 0x38(%rax)
movups %xmm1, 0x28(%rax)
movups %xmm0, 0x18(%rax)
movq %r14, 0x48(%rax)
movl %ebx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
xorps %xmm0, %xmm0
callq 0x46ef0
addq $0x50, %rsp
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x1f0(%rbp)
movq -0xe8(%rbp), %rdi
movl -0x1dc(%rbp), %edx
movss -0x1e8(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x1f0(%rbp), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x37ccf(%rip), %rsi     # 0x7ffc6
movb $0x2, %al
callq 0x1150
movq -0xe8(%rbp), %rdi
leaq 0x35088(%rip), %rsi     # 0x7d394
movb $0x0, %al
callq 0x1150
movl -0x1dc(%rbp), %esi
movss -0x1e8(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x37cbe(%rip), %rdi     # 0x7fff7
movb $0x1, %al
callq 0x10d0
movq -0x1c8(%rbp), %rax
movq %rax, %rsp
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0x47386
jmp 0x48360
movl -0x150(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x150(%rbp)
jmp 0x4736f
movq -0xe8(%rbp), %rdi
callq 0x10a0
movq -0xf0(%rbp), %rdi
callq 0x10a0
movl $0x1, -0x23c(%rbp)
movq -0x108(%rbp), %rax
movq %rax, %rsp
xorl %eax, %eax
leaq -0x10(%rbp), %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax,%rax)