// File: /workspace/github_c_makefile_star2_O1/ugobas[P]tnm/simulation.c
// Function: Torsional_confchange
void Torsional_confchange(double *diff_phi, char *diff_type,
			  struct bond *bonds_ini,
			  struct Jacobian *J, struct Reference Ref1,
			  struct ali_atoms ali_a,
			  double Tors_fluct,
			  atom *atoms1, int natoms1, char *nameout,
			  struct axe *axes, int naxes,
			  struct residue *seq, int nres,
			  struct chain *chains, int Nchain, 
			  atom *atoms2, int natoms2,
			  struct Para_simul Para_simul,
			  struct Normal_Mode *NM,
			  char *mode_name, int NMODES, float rmsd_thr)
{
  int i, a;
  int IT_MAX=Para_simul.NSTEPS; // 100 
  float STEP_MAX=Para_simul.STEP_MAX, STEP_MIN=Para_simul.STEP_MIN; //0.3 0.001
  float A_MAX=Para_simul.ANGLE, PDB_STEP=0.33;
  printf("Interpolating conformation change with %d %s modes\n",
	 NMODES, mode_name);
  
  // Initial bonds
  Set_bonds_measure(bonds_ini, natoms1, atoms1);
  struct bond bonds[natoms1], bonds_tmp[natoms1];
  Copy_bonds(bonds, bonds_ini, natoms1);
  printf("Internal coordinates of initial structure\n");
  double phi_ini[naxes], phi_opt[naxes]; 
  Internal_coordinates(phi_ini, naxes, bonds_ini, natoms1);
  double diff_phi0[naxes]; for(i=0; i<naxes; i++)diff_phi0[i]=0;

  // Set references 
  /*char SEL[4]="EB"; // "EB" "ALL"
  struct Reference Ref1, Ref2;
  int N_ref=Set_reference(&Ref1, 0, SEL, atoms1, 0, natoms1);
  printf("Change reference atoms to %s n=%d\n",SEL, Ref1.N_ref);
  int N_Cart=3*N_ref; Ref1.N_Cart=N_Cart;
  int first_kin[naxes], last_kin[naxes];
  Change_kin(first_kin, last_kin, axes, naxes, natoms1, Ref1);
  struct Jacobian J; Allocate_Jacobian(&J, naxes, Ref1.N_Cart);
  */
  //int N_ref=Ref1.N_ref;
  int N_ali=ali_a.N_ref, N_Cart=3*N_ali;
  double Mass_tot=0; for(i=0; i<Ref1.N_ref; i++)Mass_tot+=Ref1.mass_atom[i];

  float coord_ref_1[N_Cart], coord_ref_2[N_Cart];
  Write_ref_coord_atom(coord_ref_1, N_ali, atoms1, ali_a.ali1);
  Write_ref_coord_atom(coord_ref_2, N_ali, atoms2, ali_a.ali2);
  float coord1[N_Cart], coord2[N_Cart], coord_pdb[N_Cart]; //coord_kin[N_Cart]; 
  for(i=0; i<N_Cart; i++){
    coord1[i]=coord_ref_1[i]; coord2[i]=coord1[i];
    coord_pdb[i]=coord1[i]; //coord_kin[i]=coord1[i];
  }


  float *coord_new=coord1, *coord_old=coord2, *mass_ref=Ref1.mass_atom;
  float coord_all[3*natoms1]; Put_coord(coord_all, bonds_ini, natoms1);
  float Ene=Energy_clashes(coord_all, natoms1);

  // Print rmsd
  char namermsd[200];
  sprintf(namermsd, "%s_%s_rmsd.dat", nameout, diff_type);
  FILE *file_rmsd=fopen(namermsd, "w");
  printf("Opening %s\n", namermsd);
  fprintf(file_rmsd,
	  "# Interpolating conformation change with %d %s modes\n",
	  NMODES, mode_name);
  fprintf(file_rmsd,"# RMSD_step: max= %.2g min= %.2g max. steps %d\n",
	  STEP_MAX, STEP_MIN, IT_MAX);
  fprintf(file_rmsd,"# E_clash(PDB)= %.2g\n", Ene);
  // Superimpose second structure to first one
  float RMSD_kf=rmsd_mclachlan_f(coord_ref_1, coord_ref_2, ali_a.mass, N_ali);
  float RMSD_ki=0, RMSD_step=0, RMSD_opt=RMSD_kf;
  printf("Initial RMSD: %.2f\n\n", RMSD_kf);
  fprintf(file_rmsd,"# RMSD= %.3f\n", RMSD_kf);
  fprintf(file_rmsd,"# RMSD_ki RMSD_kf RMSD_step E_clash factor accept\n");
  fprintf(file_rmsd, "%.3f\t%.3f\t%.3f\t%.2g\t%.2g\t%d\n",
	  RMSD_ki, RMSD_kf, RMSD_step, Ene, 1.0, 1);

  // Opening file for printing PDB
  FILE *file_pdb=NULL;
  float coord_all_1[3*natoms1], mass[natoms1], rmsd;
  for(i=0; i<natoms1; i++)mass[i]=Mass(atoms1+i);
  if(strcmp(diff_type, "standard")!=0){
    char pdbout[200];
    sprintf(pdbout, "%s_confchange_%s.pdb", nameout, diff_type);
    file_pdb=fopen(pdbout, "w");
    printf("Writing trajectory in PDB format in %s\n", pdbout);
    Print_seqres(file_pdb, chains, Nchain);
    Put_coord(coord_all_1, bonds_ini, natoms1);
    Print_PDB(file_pdb, atoms1, natoms1, coord_all_1, seq, 0, 0.0);
  }

  float c_amax[NMODES];
  for (i=0; i<NMODES; i++){
    float *mode=NM->Tors[i], max=fabs(mode[0]); 
    for(a=1; a<naxes; a++)if(fabs(mode[a])>max)max=fabs(mode[a]);
    c_amax[i]=A_MAX/max; // Maximum coefficient of mode i for phi<A_MAX
  }

  int accept=1, iter, exit=0, k_pdb=0;
  //float FRAC=0.0;
  float Mass_sqrt=sqrt(Mass_tot), c_thr=rmsd_thr*Mass_sqrt;
  double skip_tot=0; int nskip=0;
  for(iter=0; iter<IT_MAX; iter++){

    /*// Update Jacobian matrix WRONG!!!!
      rmsd=rmsd_mclachlan_f(coord_kin, coord_old, mass_ref, N_ali);
    if((rmsd>RMSD_TOL)){
      printf("Computing kinetic energy\n");
      // Kinetic energy must be computed with new atoms!!!!
      for(i=0;i<N_Cart;i++)coord_kin[i]=coord_old[i];
      atom atoms_t[natoms1]; Copy_atoms_bonds(atoms_t, bonds, natoms1);
      Compute_kinetic(J, axes, naxes, atoms_t, natoms1, Ref1, 0);
      }*/

    // Difference of coordinates
    float Diff_Cart[N_Cart];
    for(i=0;i<N_Cart;i++)Diff_Cart[i]=coord_ref_2[i]-coord_old[i];
    float tors_coeff[naxes];
    for(i=0; i<naxes; i++){
	tors_coeff[i]=
	  Scalar_product_weighted(Diff_Cart, J->Jacobian_ar[i],
				  Ref1.mass_coord, N_Cart);
      }

    // Compute angles
    double diff_step[naxes], diff_all[naxes];
    for(a=0; a<naxes; a++)diff_step[a]=0;
    double rstep=0, factor=1, excess=1;
    float c_lin[NMODES];
    for (i=0; i<NMODES; i++){
      float *mode=NM->Tors[i]; 
      double c=0; for(a=0; a<naxes; a++)c+=tors_coeff[a]*mode[a];
      if(fabs(c)>excess*c_amax[i])excess=fabs(c)/c_amax[i];
      c_lin[i]=c; rstep+=c*c;
    }
    rstep=1.1*sqrt(rstep/Mass_tot);
    if(rstep<STEP_MIN){exit=1; goto print;}
    factor=rstep/STEP_MAX;
    if(excess>factor)factor=excess;

    //float thr=FRAC*RMSD_kf*Mass_sqrt; if(thr<c_thr)thr=c_thr;
    int skip=0;
    for (i=0; i<NMODES; i++){
      float c=c_lin[i]; if(factor>1)c/=factor;
      if(fabs(c)<c_thr){skip++; continue;}
      float *mode=NM->Tors[i];
      for(a=0; a<naxes; a++)diff_step[a]+=c*mode[a];
    }
    skip_tot+=skip; nskip++;
    float max=0;
    for(i=0; i<naxes; i++)if(fabs(diff_step[i])>max)max=fabs(diff_step[i]);
    if(max>A_MAX){
      float f=A_MAX/max;
      printf("WARNING, too large angle= %.2f ", max);
      printf("Reducing d_phi by a factor %.2g\n", f);
      rstep/=f; for(i=0; i<naxes; i++)diff_step[i]*=f;
    }
    if(rstep<STEP_MIN){exit=1; goto print;}

    // Move atoms
    float reduce_step=1; factor=1;
    while(1){ // loop on amplitudes
      for(i=0; i<naxes; i++)diff_all[i]=diff_phi0[i]+diff_step[i];
      Copy_bonds(bonds_tmp, bonds_ini, natoms1);
      Build_up(bonds_tmp, natoms1, diff_all, naxes);
      accept=Write_RMSD(&reduce_step, &RMSD_opt, &RMSD_kf,
			STEP_MIN, STEP_MAX, factor, iter, file_rmsd,
			bonds_tmp, coord_all, natoms1, ali_a,
			coord_new,coord_old,coord_ref_1,coord_ref_2);
      if(accept)break;
      factor*=reduce_step; rstep*=reduce_step;
      if(rstep<STEP_MIN){
	printf("Too small amplitude (%.2g), exiting\n", factor);
	accept=0; break;
      }
      printf("Reducing amplitude by factor %.2g\n", reduce_step);
      for(i=0; i<naxes; i++)diff_step[i]*=reduce_step;
    } // End loop amplitude 


    if(accept==0){
      exit=1;
    }else{
      exit=(RMSD_opt < RMSD_TOL);
      // Store conformation
      Copy_bonds(bonds, bonds_tmp, natoms1);
      Internal_coordinates(phi_opt, naxes, bonds, natoms1);
      for(i=0; i<naxes; i++)diff_phi0[i]=phi_opt[i]-phi_ini[i];
    }

    // Print PDB
  print:
    if(file_pdb){
      rmsd=rmsd_mclachlan_f(coord_pdb, coord_new, mass_ref, N_ali);
      if((rmsd > PDB_STEP)|| exit){
	k_pdb++;
	for(i=0; i<N_Cart; i++)coord_pdb[i]=coord_new[i];
	RMSD_ki=rmsd_mclachlan_f(coord_all_1, coord_all, mass, natoms1);
	Print_PDB(file_pdb,atoms1,natoms1,coord_all,seq,k_pdb,RMSD_ki);
      }
    }
    printf("\n");
    if(exit){
      printf("Exiting iterations, rmsd= %.2f\n",RMSD_opt);
      break;
    }

    float *tmp=coord_old; coord_old=coord_new; coord_new=tmp;

  }

  // Take final coordinates from bonds
  fprintf(file_rmsd, "# Final RMSD:\n");
  float reduce_step;
  Write_RMSD(&reduce_step, &RMSD_opt, &RMSD_kf, STEP_MIN, 100, // = STEP_MAX
	     1.00, iter, file_rmsd, bonds, coord_all, natoms1, ali_a,
	     coord_new,coord_ref_1,coord_ref_1,coord_ref_2);
  printf("Final RMSD= %.2f\n", RMSD_kf);

  printf("Storing internal coordinates\n");
  Internal_coordinates(phi_opt, naxes, bonds, natoms1);
  for(i=0; i<naxes; i++)diff_phi[i]=phi_opt[i]-phi_ini[i];
  Periodic_angles(diff_phi, axes, naxes);

  Copy_bonds(bonds, bonds_ini, natoms1);
  Build_up(bonds, natoms1, diff_phi, naxes);
  fprintf(file_rmsd, "# Reconstructed RMSD:\n");
  Write_RMSD(&reduce_step, &RMSD_opt, &RMSD_kf, STEP_MIN, 100,
	     1.00, iter, file_rmsd, bonds, coord_all, natoms1,
	     ali_a, coord_new, coord_ref_1,coord_ref_1,coord_ref_2);
  printf("%d %s modes, reconstructed RMSD= %.2f\n", NMODES,mode_name,RMSD_kf);
  printf("Mean number of skipped modes out of %d: %.1f\n",
	 NMODES, skip_tot/nskip);
  fprintf(file_rmsd, "# Mean number of skipped modes out of %d: %.1f",
	  NMODES, skip_tot/nskip);
  fprintf(file_rmsd, " threshold= %.3f A\n", rmsd_thr);


  fclose(file_rmsd);
  if(file_pdb)fclose(file_pdb);
  //Empty_Ref(&Ref1);
  //Change_kin_back(axes, naxes, first_kin, last_kin);
  //Empty_Jacobian(J);
  if(0)Compute_kinetic(J, axes, naxes, atoms1, natoms1, Ref1,0);
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movss %xmm1, -0xd4(%rbp)
movl %r9d, %r14d
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, -0x50(%rbp)
movq %rdi, -0x168(%rbp)
movl 0xf8(%rbp), %esi
movq 0xf0(%rbp), %rdx
movl 0xb8(%rbp), %eax
movl %eax, -0x64(%rbp)
movss 0xac(%rbp), %xmm0
movss %xmm0, -0xe0(%rbp)
movss 0xb0(%rbp), %xmm0
movss %xmm0, -0x68(%rbp)
movss 0xb4(%rbp), %xmm0
movss %xmm0, -0x8c(%rbp)
leaq 0x26efd(%rip), %rdi     # 0x5b162
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x20f0
movq %r15, %rdi
movl %r14d, %esi
movq %r12, -0xc8(%rbp)
movq %r12, %rdx
callq 0x1512b
movq %r15, %rcx
movl %r14d, %r12d
movq %rsp, %r15
movq %r12, %rax
shlq $0x6, %rax
leaq (%rax,%rax,2), %rax
subq %rax, %r15
movq %r15, %rsp
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, -0x80(%rbp)
movq %rdx, %rsp
movq $0x0, 0x28(%r15)
movq %r14, -0x30(%rbp)
testl %r14d, %r14d
movq %rcx, -0x78(%rbp)
jle 0x3430e
xorl %r14d, %r14d
leaq (%rcx,%r14), %rsi
leaq (%r15,%r14), %rdi
movl $0xc0, %edx
callq 0x21a0
movq -0x78(%rbp), %rcx
testl %ebx, %ebx
je 0x34300
movq 0x28(%rcx,%r14), %rax
subq %rcx, %rax
shrq $0x6, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
cltq
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq %r15, %rax
movq %rax, 0x28(%r15,%r14)
incl %ebx
addq $0xc0, %r14
cmpl %ebx, -0x30(%rbp)
jne 0x342c2
movq %r13, -0x160(%rbp)
leaq 0x279b5(%rip), %rdi     # 0x5bcd1
callq 0x2090
movl 0x70(%rbp), %ebx
movl %ebx, %r13d
movq %rsp, %rdi
leaq 0xf(,%r13,8), %r14
andq $-0x10, %r14
subq %r14, %rdi
movq %rdi, %rsp
movq %rsp, %rax
subq %r14, %rax
movq %rax, -0x100(%rbp)
movq %rax, %rsp
movq %rdi, -0x138(%rbp)
movl %ebx, %esi
movq -0x78(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x16e07
movq %rsp, %rax
movq %r14, -0x1a8(%rbp)
subq %r14, %rax
movq %rax, -0x118(%rbp)
movq %rax, %rsp
testl %ebx, %ebx
jle 0x34393
leaq (,%r13,8), %rdx
movq -0x118(%rbp), %rdi
xorl %esi, %esi
callq 0x2110
leaq 0x40(%rbp), %rax
movl 0x18(%rax), %eax
movq %rax, -0xf8(%rbp)
leal (%rax,%rax,2), %esi
leaq 0x10(%rbp), %r10
movslq (%r10), %rax
testq %rax, %rax
jle 0x343d7
movq 0x10(%r10), %rcx
xorpd %xmm1, %xmm1
xorl %edx, %edx
movq -0xc8(%rbp), %r8
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%rdx,4), %xmm0
addsd %xmm0, %xmm1
incq %rdx
cmpq %rdx, %rax
jne 0x343c1
jmp 0x343e2
xorpd %xmm1, %xmm1
movq -0xc8(%rbp), %r8
movl %esi, -0x90(%rbp)
movl %esi, %eax
movq %rsp, %rcx
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
subq %rdx, %rcx
movq %rcx, -0x70(%rbp)
movq %rcx, %rsp
movq %rsp, %rax
movq %rdx, -0x148(%rbp)
subq %rdx, %rax
movq %rax, -0x58(%rbp)
movq %rax, %rsp
movq -0xf8(%rbp), %r9
testl %r9d, %r9d
jle 0x3445e
leaq 0x40(%rbp), %rax
movq (%rax), %rax
xorl %ecx, %ecx
movq -0x70(%rbp), %rdx
movslq (%rax,%rcx,4), %rsi
imulq $0x70, %rsi, %rdi
addq %r8, %rdi
xorl %esi, %esi
xorps %xmm0, %xmm0
cvtsd2ss (%rdi,%rsi,2), %xmm0
movss %xmm0, (%rdx,%rsi)
addq $0x4, %rsi
cmpl $0xc, %esi
jne 0x3443d
incq %rcx
addq %rsi, %rdx
cmpq %r9, %rcx
jne 0x34430
testl %r9d, %r9d
jle 0x344a7
movq 0x98(%rbp), %rax
leaq 0x40(%rbp), %rcx
movq 0x8(%rcx), %rcx
xorl %edx, %edx
movq -0x58(%rbp), %rsi
movslq (%rcx,%rdx,4), %rdi
imulq $0x70, %rdi, %r8
addq %rax, %r8
xorl %edi, %edi
xorps %xmm0, %xmm0
cvtsd2ss (%r8,%rdi,2), %xmm0
movss %xmm0, (%rsi,%rdi)
addq $0x4, %rdi
cmpl $0xc, %edi
jne 0x34485
incq %rdx
addq %rdi, %rsi
cmpq %r9, %rdx
jne 0x34478
movq %r12, -0xb8(%rbp)
movq %rsp, %r14
movq -0x148(%rbp), %rax
subq %rax, %r14
movq %r14, %rsp
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
testl %r9d, %r9d
movq %r15, -0x140(%rbp)
movsd %xmm1, -0x150(%rbp)
jle 0x3452c
movl -0x90(%rbp), %eax
cmpl $0x2, %eax
movl $0x1, %r15d
cmovgel %eax, %r15d
shlq $0x2, %r15
movq %r14, %rdi
movq -0x70(%rbp), %rsi
movq %r15, %rdx
callq 0x21a0
movq %rbx, %rdi
movq -0x70(%rbp), %rsi
movq %r15, %rdx
callq 0x21a0
movq %r12, %rdi
movq -0x70(%rbp), %rsi
movq %r15, %rdx
callq 0x21a0
leaq 0x10(%rbp), %r10
movq %rbx, -0xb0(%rbp)
movq %r12, -0xa0(%rbp)
movq %r14, -0x38(%rbp)
movq 0x60(%rbp), %r14
movq -0x30(%rbp), %rcx
leal (%rcx,%rcx,2), %eax
leaq 0xf(,%rax,4), %rbx
andq $-0x10, %rbx
movq %rsp, %rax
subq %rbx, %rax
movq %rax, -0x88(%rbp)
movq %rax, %rsp
testl %ecx, %ecx
movq -0x78(%rbp), %rdi
movq -0xb8(%rbp), %r12
jle 0x345ba
leaq 0x8(%rdi), %rax
xorl %ecx, %ecx
movq -0x88(%rbp), %rdx
leaq (%rcx,%rcx,2), %rsi
shlq $0x6, %rsi
cmpl $0x0, 0x20(%rdi,%rsi)
js 0x345ba
xorl %esi, %esi
xorps %xmm0, %xmm0
cvtsd2ss (%rax,%rsi,2), %xmm0
movss %xmm0, (%rdx,%rsi)
addq $0x4, %rsi
cmpq $0xc, %rsi
jne 0x34592
incq %rcx
addq $0xc0, %rax
addq %rsi, %rdx
cmpq %r12, %rcx
jne 0x34581
movq 0x10(%r10), %rax
movq %rax, -0x190(%rbp)
movq -0x88(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x32b71
movss %xmm0, -0xc0(%rbp)
leaq 0x26b61(%rip), %rsi     # 0x5b145
leaq -0x350(%rbp), %r15
movq %r15, %rdi
movq %r14, %rdx
movq -0x50(%rbp), %rcx
xorl %eax, %eax
callq 0x2260
leaq 0x22c3d(%rip), %rsi     # 0x57240
movq %r15, %rdi
callq 0x2210
movq %rax, %r14
leaq 0x26b3f(%rip), %rdi     # 0x5b154
movq %r15, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x26b3a(%rip), %rsi     # 0x5b160
movq %r14, %rdi
movl 0xf8(%rbp), %edx
movq 0xf0(%rbp), %rcx
xorl %eax, %eax
callq 0x2190
xorps %xmm0, %xmm0
cvtss2sd -0xe0(%rbp), %xmm0
cvtss2sd -0x68(%rbp), %xmm1
leaq 0x26b42(%rip), %rsi     # 0x5b196
movq %r14, %rdi
movsd %xmm0, -0x178(%rbp)
movsd %xmm1, -0x128(%rbp)
movl -0x64(%rbp), %edx
movb $0x2, %al
callq 0x2190
xorps %xmm0, %xmm0
cvtss2sd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
leaq 0x26b3e(%rip), %rsi     # 0x5b1c6
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
leaq 0x40(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x70(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0xf8(%rbp), %rcx
callq 0x4e010
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x94(%rbp)
movss %xmm0, -0x3c(%rbp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0xc0(%rbp)
leaq 0x26b0a(%rip), %rdi     # 0x5b1dc
movb $0x1, %al
callq 0x20f0
leaq 0x26b11(%rip), %rsi     # 0x5b1f1
movq %r14, %rdi
movsd -0xc0(%rbp), %xmm0
movb $0x1, %al
callq 0x2190
leaq 0x26b06(%rip), %rdi     # 0x5b1ff
movl $0x32, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2280
leaq 0x26b20(%rip), %rsi     # 0x5b232
movsd 0x1c926(%rip), %xmm4    # 0x51040
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
movq %r14, -0x120(%rbp)
movq %r14, %rdi
movsd -0xc0(%rbp), %xmm1
movsd -0x60(%rbp), %xmm3
movl $0x1, %edx
movb $0x5, %al
callq 0x2190
movq %rsp, %rax
subq %rbx, %rax
movq %rax, -0x108(%rbp)
movq %rax, %rsp
movq %rsp, %r14
leaq 0xf(,%r12,4), %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
cmpl $0x0, -0x30(%rbp)
jle 0x34791
xorl %ebx, %ebx
movq -0xc8(%rbp), %r15
movq %r15, %rdi
callq 0x25e79
movss %xmm0, (%r14,%rbx,4)
incq %rbx
addq $0x70, %r15
cmpq %rbx, %r12
jne 0x34777
movq %r14, -0x170(%rbp)
leaq 0x26ab0(%rip), %rsi     # 0x5b24f
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x2180
testl %eax, %eax
je 0x34893
movl 0x90(%rbp), %r14d
leaq 0x26a97(%rip), %rsi     # 0x5b258
leaq -0x280(%rbp), %r15
movq %r15, %rdi
movq 0x60(%rbp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2260
leaq 0x22a60(%rip), %rsi     # 0x57240
movq %r15, %rdi
callq 0x2210
movq %rax, %rbx
leaq 0x26a7b(%rip), %rdi     # 0x5b26d
movq %r15, %rsi
xorl %eax, %eax
callq 0x20f0
movq %rbx, %rdi
movq 0x88(%rbp), %rsi
movl %r14d, %edx
callq 0x3301f
cmpl $0x0, -0x30(%rbp)
movq -0x78(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq -0x38(%rbp), %r14
jle 0x3486d
leaq 0x8(%rdi), %rax
xorl %ecx, %ecx
movq -0x108(%rbp), %rdx
leaq (%rcx,%rcx,2), %r8
shlq $0x6, %r8
cmpl $0x0, 0x20(%rdi,%r8)
js 0x3486d
xorl %r8d, %r8d
xorps %xmm0, %xmm0
cvtsd2ss (%rax,%r8,2), %xmm0
movss %xmm0, (%rdx,%r8)
addq $0x4, %r8
cmpq $0xc, %r8
jne 0x34843
incq %rcx
addq $0xc0, %rax
addq %r8, %rdx
cmpq %r12, %rcx
jne 0x34830
xorps %xmm0, %xmm0
movq %rbx, -0xf0(%rbp)
movq %rbx, %rdi
movq -0x30(%rbp), %rdx
movq -0x108(%rbp), %rcx
movq 0x78(%rbp), %r8
xorl %r9d, %r9d
callq 0x32c92
jmp 0x348a2
movq $0x0, -0xf0(%rbp)
movq -0x38(%rbp), %r14
movl 0xf8(%rbp), %eax
movl %eax, %r8d
movq %rsp, %r9
leaq 0xf(,%r8,4), %rcx
andq $-0x10, %rcx
movq %rcx, -0x1a0(%rbp)
subq %rcx, %r9
movq %r9, %rsp
testl %eax, %eax
movl 0x70(%rbp), %r10d
movss -0x8c(%rbp), %xmm3
movq -0x58(%rbp), %r12
jle 0x34936
movq 0xe8(%rbp), %rax
movq 0x40(%rax), %rax
xorl %ecx, %ecx
movaps 0x22a31(%rip), %xmm0    # 0x57320
movq (%rax,%rcx,8), %rdx
movss (%rdx), %xmm1
andps %xmm0, %xmm1
cmpl $0x2, %r10d
jl 0x3491e
movl $0x1, %esi
movss (%rdx,%rsi,4), %xmm2
andps %xmm0, %xmm2
maxss %xmm1, %xmm2
incq %rsi
movaps %xmm2, %xmm1
cmpq %rsi, %r13
jne 0x34905
jmp 0x34921
movaps %xmm1, %xmm2
movaps %xmm3, %xmm1
divss %xmm2, %xmm1
movss %xmm1, (%r9,%rcx,4)
incq %rcx
cmpq %r8, %rcx
jne 0x348ef
xorps %xmm2, %xmm2
movsd -0x150(%rbp), %xmm0
xorps %xmm1, %xmm1
movsd %xmm1, -0xa8(%rbp)
ucomisd %xmm2, %xmm0
movq %r8, -0x110(%rbp)
movq %r9, -0x188(%rbp)
jb 0x34966
sqrtsd %xmm0, %xmm0
jmp 0x3496f
callq 0x2290
movl 0x70(%rbp), %r10d
movq -0xb0(%rbp), %rcx
cmpl $0x0, -0x64(%rbp)
jle 0x3520a
cvtsd2ss %xmm0, %xmm0
mulss -0xd4(%rbp), %xmm0
movss %xmm0, -0xc0(%rbp)
movl -0x90(%rbp), %eax
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
leaq (,%r13,8), %rax
movq %rax, -0x180(%rbp)
movq $0x0, -0x60(%rbp)
leaq 0xf(,%r13,4), %rax
andq $-0x10, %rax
movq %rax, -0x198(%rbp)
movl $0x0, -0xd8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xa8(%rbp)
movl $0x0, -0xdc(%rbp)
movq %rdx, -0x158(%rbp)
movq %r14, -0x38(%rbp)
movq %rsp, -0x1b0(%rbp)
movq %rsp, %r15
subq -0x148(%rbp), %r15
movq %r15, %rsp
cmpl $0x0, -0xf8(%rbp)
jle 0x34a31
xorl %eax, %eax
movss (%r12,%rax,4), %xmm0
subss (%rcx,%rax,4), %xmm0
movss %xmm0, (%r15,%rax,4)
incq %rax
cmpq %rax, %rdx
jne 0x34a18
movq %rcx, -0xb0(%rbp)
movq %rsp, %r14
subq -0x198(%rbp), %r14
movq %r14, %rsp
testl %r10d, %r10d
movq -0x160(%rbp), %rdx
movl -0x90(%rbp), %ecx
jle 0x34a9a
leaq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
xorl %ebx, %ebx
movq 0x10(%rdx), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
movq -0x50(%rbp), %rdx
movq %r13, %r12
movl %ecx, %r13d
callq 0x10c76
movl %r13d, %ecx
movq %r12, %r13
movq -0x160(%rbp), %rdx
movss %xmm0, (%r14,%rbx,4)
incq %rbx
cmpq %rbx, %r12
jne 0x34a65
movq %rsp, %r12
movq -0x1a8(%rbp), %rax
subq %rax, %r12
movq %r12, %rsp
movq %rsp, %r15
subq %rax, %r15
movq %r15, %rsp
movl 0x70(%rbp), %edi
testl %edi, %edi
jle 0x34ace
movq %r12, %rdi
xorl %esi, %esi
movq -0x180(%rbp), %rdx
callq 0x2110
movl 0x70(%rbp), %edi
movq %rsp, %rbx
subq -0x1a0(%rbp), %rbx
movq %rbx, %rsp
cmpl $0x0, 0xf8(%rbp)
jle 0x34b96
movq 0xe8(%rbp), %rax
movq 0x40(%rax), %rax
xorps %xmm0, %xmm0
xorl %ecx, %ecx
movsd 0x1c540(%rip), %xmm1    # 0x51040
movq -0x110(%rbp), %r8
movq -0x188(%rbp), %r9
movapd 0x2281a(%rip), %xmm5    # 0x57330
xorpd %xmm2, %xmm2
testl %edi, %edi
jle 0x34b3f
movq (%rax,%rcx,8), %rdx
xorl %esi, %esi
movss (%r14,%rsi,4), %xmm3
mulss (%rdx,%rsi,4), %xmm3
cvtss2sd %xmm3, %xmm3
addsd %xmm3, %xmm2
incq %rsi
cmpq %rsi, %r13
jne 0x34b24
movapd %xmm2, %xmm3
xorps %xmm4, %xmm4
cvtss2sd (%r9,%rcx,4), %xmm4
andpd %xmm5, %xmm3
movapd %xmm1, %xmm8
mulsd %xmm4, %xmm8
cmpltsd %xmm3, %xmm8
divsd %xmm4, %xmm3
andpd %xmm8, %xmm3
andnpd %xmm1, %xmm8
orpd %xmm3, %xmm8
xorps %xmm1, %xmm1
cvtsd2ss %xmm2, %xmm1
movss %xmm1, (%rbx,%rcx,4)
mulsd %xmm2, %xmm2
addsd %xmm2, %xmm0
incq %rcx
movapd %xmm8, %xmm1
cmpq %r8, %rcx
jne 0x34b16
jmp 0x34bb1
xorps %xmm0, %xmm0
movsd 0x1c49e(%rip), %xmm8    # 0x51040
movq -0x110(%rbp), %r8
movapd 0x2277f(%rip), %xmm5    # 0x57330
divsd -0x150(%rbp), %xmm0
ucomisd 0x1c49f(%rip), %xmm0    # 0x51060
jb 0x34bc9
sqrtsd %xmm0, %xmm7
jmp 0x34bf0
movapd %xmm8, -0x50(%rbp)
callq 0x2290
movapd -0x50(%rbp), %xmm8
movapd 0x2274e(%rip), %xmm5    # 0x57330
movq -0x110(%rbp), %r8
movl 0x70(%rbp), %edi
movapd %xmm0, %xmm7
movss -0x8c(%rbp), %xmm4
movaps 0x22721(%rip), %xmm6    # 0x57320
mulsd 0x261a1(%rip), %xmm7    # 0x5ada8
movsd -0x128(%rbp), %xmm0
ucomisd %xmm7, %xmm0
ja 0x34db9
cmpl $0x0, 0xf8(%rbp)
jle 0x34cb8
movapd %xmm7, %xmm0
divsd -0x178(%rbp), %xmm0
maxsd %xmm0, %xmm8
xorl %eax, %eax
xorl %ecx, %ecx
ucomisd 0x1c3fc(%rip), %xmm8    # 0x51040
movss (%rbx,%rax,4), %xmm0
jbe 0x34c58
cvtss2sd %xmm0, %xmm0
divsd %xmm8, %xmm0
cvtsd2ss %xmm0, %xmm0
movaps %xmm0, %xmm1
andps %xmm6, %xmm1
movss -0xc0(%rbp), %xmm2
ucomiss %xmm1, %xmm2
jbe 0x34c6f
incl %ecx
jmp 0x34ca5
testl %edi, %edi
jle 0x34ca5
movq 0xe8(%rbp), %rdx
movq 0x40(%rdx), %rdx
movq (%rdx,%rax,8), %rdx
xorl %esi, %esi
movss (%rdx,%rsi,4), %xmm1
mulss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm1
addsd (%r12,%rsi,8), %xmm1
movsd %xmm1, (%r12,%rsi,8)
incq %rsi
cmpq %rsi, %r13
jne 0x34c84
incq %rax
cmpq %r8, %rax
jne 0x34c3b
xorps %xmm8, %xmm8
cvtsi2sd %ecx, %xmm8
jmp 0x34cbd
xorpd %xmm8, %xmm8
xorps %xmm0, %xmm0
testl %edi, %edi
jle 0x34cf3
xorl %eax, %eax
movsd (%r12,%rax,8), %xmm1
movapd %xmm1, %xmm2
andpd %xmm5, %xmm2
xorps %xmm3, %xmm3
cvtss2sd %xmm0, %xmm3
ucomisd %xmm3, %xmm2
jbe 0x34ceb
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
andps %xmm6, %xmm0
incq %rax
cmpq %rax, %r13
jne 0x34cc6
ucomiss %xmm4, %xmm0
jbe 0x34d8c
movsd %xmm8, -0x50(%rbp)
divss %xmm0, %xmm4
movss %xmm4, -0xd0(%rbp)
cvtss2sd %xmm0, %xmm0
leaq 0x2657c(%rip), %rdi     # 0x5b295
movb $0x1, %al
movsd %xmm7, -0xb8(%rbp)
callq 0x20f0
xorps %xmm0, %xmm0
cvtss2sd -0xd0(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
leaq 0x26573(%rip), %rdi     # 0x5b2b5
movb $0x1, %al
callq 0x20f0
movsd -0xd0(%rbp), %xmm1
movsd -0xb8(%rbp), %xmm7
movl 0x70(%rbp), %edi
divsd %xmm1, %xmm7
testl %edi, %edi
jle 0x34d86
xorl %eax, %eax
movsd -0x50(%rbp), %xmm8
movsd (%r12,%rax,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%r12,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x34d6c
jmp 0x34d8c
movsd -0x50(%rbp), %xmm8
incl -0xd8(%rbp)
movsd -0xa8(%rbp), %xmm0
addsd %xmm8, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x128(%rbp), %xmm0
ucomisd %xmm7, %xmm0
jbe 0x34eff
movq -0x58(%rbp), %r12
movq -0x38(%rbp), %r14
movq -0xa0(%rbp), %rdi
movb $0x1, %r15b
cmpq $0x0, -0xf0(%rbp)
je 0x34e91
movq %r14, %rsi
movq -0x190(%rbp), %rdx
movq -0xf8(%rbp), %rbx
movl %ebx, %ecx
callq 0x4e010
cvtsd2ss %xmm0, %xmm0
ucomiss 0x25fe8(%rip), %xmm0    # 0x5ade4
seta %al
orb %r15b, %al
testb $0x1, %al
je 0x34e91
movb %r15b, -0x50(%rbp)
testl %ebx, %ebx
movq -0xa0(%rbp), %rcx
movq -0x158(%rbp), %rdx
jle 0x34e35
xorl %eax, %eax
movss (%r14,%rax,4), %xmm0
movss %xmm0, (%rcx,%rax,4)
incq %rax
cmpq %rax, %rdx
jne 0x34e22
movl -0xdc(%rbp), %r15d
incl %r15d
movq -0x108(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x170(%rbp), %rdx
movq -0x30(%rbp), %rbx
movl %ebx, %ecx
callq 0x4e010
cvtsd2ss %xmm0, %xmm0
movq -0xf0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movl %ebx, %edx
movq -0x88(%rbp), %rcx
movq 0x78(%rbp), %r8
movl %r15d, -0xdc(%rbp)
movl %r15d, %r9d
callq 0x32c92
movb -0x50(%rbp), %r15b
movl $0xa, %edi
callq 0x2060
testb %r15b, %r15b
je 0x34ebf
xorps %xmm0, %xmm0
cvtss2sd -0x3c(%rbp), %xmm0
leaq 0x2646f(%rip), %rdi     # 0x5b31e
movb $0x1, %al
callq 0x20f0
movq -0xb0(%rbp), %rax
jmp 0x34ec9
movq %r14, %rax
movq -0xb0(%rbp), %r14
movl 0x70(%rbp), %r10d
movq -0x1b0(%rbp), %rsp
testb %r15b, %r15b
jne 0x3521f
movq -0x60(%rbp), %rdx
incl %edx
movq %rax, %rcx
movq %rdx, -0x60(%rbp)
cmpl -0x64(%rbp), %edx
movq -0x158(%rbp), %rdx
jne 0x349f5
jmp 0x35218
movsd %xmm7, -0xb8(%rbp)
movl $0x3f800000, -0xe4(%rbp) # imm = 0x3F800000
movsd 0x1c127(%rip), %xmm1    # 0x51040
testl %edi, %edi
movq -0x118(%rbp), %rcx
jle 0x34f3f
xorl %eax, %eax
movsd (%rcx,%rax,8), %xmm0
addsd (%r12,%rax,8), %xmm0
movsd %xmm0, (%r15,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x34f26
movsd %xmm1, -0x50(%rbp)
movq -0x80(%rbp), %rdx
movq $0x0, 0x28(%rdx)
cmpl $0x0, -0x30(%rbp)
movq -0x78(%rbp), %rcx
jle 0x34fb6
xorl %ebx, %ebx
xorl %r14d, %r14d
leaq (%rcx,%rbx), %rsi
movq -0x80(%rbp), %rax
leaq (%rax,%rbx), %rdi
movl $0xc0, %edx
callq 0x21a0
movq -0x80(%rbp), %rdx
movq -0x78(%rbp), %rcx
testl %r14d, %r14d
je 0x34fa6
movq 0x28(%rcx,%rbx), %rax
subq %rcx, %rax
shrq $0x6, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
cltq
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq %rdx, %rax
movq %rax, 0x28(%rdx,%rbx)
incl %r14d
addq $0xc0, %rbx
cmpl %r14d, -0x30(%rbp)
jne 0x34f5f
movq %rdx, %r14
movq %rdx, %rdi
movq -0x30(%rbp), %rbx
movl %ebx, %esi
movq %r15, %rdx
movl 0x70(%rbp), %ecx
callq 0x154bb
xorps %xmm2, %xmm2
cvtsd2ss -0x50(%rbp), %xmm2
subq $0x50, %rsp
leaq 0x40(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x20(%rsp)
movups %xmm0, 0x10(%rsp)
movq -0x58(%rbp), %rax
movq %rax, 0x48(%rsp)
movq -0x70(%rbp), %rax
movq %rax, 0x40(%rsp)
movq -0xb0(%rbp), %rax
movq %rax, 0x38(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x30(%rsp)
movl %ebx, 0x8(%rsp)
movq -0x88(%rbp), %rax
movq %rax, (%rsp)
leaq -0xe4(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x94(%rbp), %rdx
movss -0x68(%rbp), %xmm0
movss -0xe0(%rbp), %xmm1
movq -0x60(%rbp), %rcx
movq -0x120(%rbp), %r8
movq %r14, %r9
callq 0x3551f
addq $0x50, %rsp
testl %eax, %eax
jne 0x350ee
cvtss2sd -0xe4(%rbp), %xmm3
movsd -0x50(%rbp), %xmm2
mulsd %xmm3, %xmm2
movsd -0xb8(%rbp), %xmm1
mulsd %xmm3, %xmm1
movsd -0x128(%rbp), %xmm0
ucomisd %xmm1, %xmm0
ja 0x351cd
movsd %xmm1, -0xb8(%rbp)
leaq 0x2625b(%rip), %rdi     # 0x5b2fb
movsd %xmm3, -0xd0(%rbp)
movaps %xmm3, %xmm0
movb $0x1, %al
movsd %xmm2, -0x50(%rbp)
callq 0x20f0
movsd -0x50(%rbp), %xmm1
movl 0x70(%rbp), %edi
testl %edi, %edi
jle 0x34f19
xorl %eax, %eax
movsd -0xd0(%rbp), %xmm2
movsd (%r12,%rax,8), %xmm0
mulsd %xmm2, %xmm0
movsd %xmm0, (%r12,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x350d1
jmp 0x34f19
movss 0x33dc6(%rip), %xmm0    # 0x68ebc
ucomiss -0x3c(%rbp), %xmm0
seta -0x50(%rbp)
movq -0x140(%rbp), %r15
movq $0x0, 0x28(%r15)
cmpl $0x0, -0x30(%rbp)
movq -0x58(%rbp), %r12
movq -0x80(%rbp), %rcx
jle 0x3516f
xorl %ebx, %ebx
xorl %r14d, %r14d
leaq (%rcx,%rbx), %rsi
leaq (%r15,%rbx), %rdi
movl $0xc0, %edx
callq 0x21a0
movq -0x80(%rbp), %rcx
testl %r14d, %r14d
je 0x3515f
movq 0x28(%rcx,%rbx), %rax
subq %rcx, %rax
shrq $0x6, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
cltq
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq %r15, %rax
movq %rax, 0x28(%r15,%rbx)
incl %r14d
addq $0xc0, %rbx
cmpl %r14d, -0x30(%rbp)
jne 0x35120
movq -0x100(%rbp), %rdi
movl 0x70(%rbp), %ebx
movl %ebx, %esi
movq %r15, %rdx
movq -0x30(%rbp), %rcx
callq 0x16e07
testl %ebx, %ebx
jle 0x351f6
xorl %eax, %eax
movq -0x138(%rbp), %rcx
movq -0x100(%rbp), %rdx
movq -0x38(%rbp), %r14
movq -0x118(%rbp), %rsi
movq -0xa0(%rbp), %rdi
movb -0x50(%rbp), %r15b
movsd (%rdx,%rax,8), %xmm0
subsd (%rcx,%rax,8), %xmm0
movsd %xmm0, (%rsi,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x351b1
jmp 0x34dcb
movb $0x1, %r15b
leaq 0x260ff(%rip), %rdi     # 0x5b2d6
movapd %xmm2, %xmm0
movb $0x1, %al
callq 0x20f0
movq -0x58(%rbp), %r12
movq -0x38(%rbp), %r14
movq -0xa0(%rbp), %rdi
jmp 0x34dcb
movq -0x38(%rbp), %r14
movq -0xa0(%rbp), %rdi
movb -0x50(%rbp), %r15b
jmp 0x34dcb
movq $0x0, -0x60(%rbp)
xorpd %xmm0, %xmm0
jmp 0x3522a
movl -0x64(%rbp), %eax
movq %rax, -0x60(%rbp)
xorps %xmm0, %xmm0
cvtsi2sdl -0xd8(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
leaq 0x26108(%rip), %rdi     # 0x5b33e
movl $0xe, %esi
movl $0x1, %edx
movq -0x120(%rbp), %r15
movq %r15, %rcx
callq 0x2280
subq $0x50, %rsp
leaq 0x40(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x20(%rsp)
movups %xmm0, 0x10(%rsp)
movq %r12, 0x48(%rsp)
movq -0x70(%rbp), %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movq %r14, -0x38(%rbp)
movq %r14, 0x30(%rsp)
movq -0x30(%rbp), %rbx
movl %ebx, 0x8(%rsp)
movq -0x88(%rbp), %rax
movq %rax, (%rsp)
leaq -0x12c(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x94(%rbp), %r14
movss 0x1bd63(%rip), %xmm1    # 0x51014
movss 0x1bd57(%rip), %xmm2    # 0x51010
movq %r14, %rdx
movss -0x68(%rbp), %xmm0
movq -0x60(%rbp), %rcx
movq %r15, %r8
movq -0x140(%rbp), %r15
movq %r15, %r9
callq 0x3551f
addq $0x50, %rsp
xorps %xmm0, %xmm0
cvtss2sd (%r14), %xmm0
leaq 0x26063(%rip), %rdi     # 0x5b34d
movb $0x1, %al
callq 0x20f0
leaq 0x26a5d(%rip), %rdi     # 0x5bd55
callq 0x2090
movq -0x100(%rbp), %r14
movq %r14, %rdi
movl 0x70(%rbp), %r12d
movl %r12d, %esi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x16e07
movl %r12d, %edx
testl %r12d, %r12d
movq -0x168(%rbp), %r12
movq -0x138(%rbp), %rcx
jle 0x35349
xorl %eax, %eax
movsd (%r14,%rax,8), %xmm0
subsd (%rcx,%rax,8), %xmm0
movsd %xmm0, (%r12,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x35330
movq %r12, %rdi
movq 0x68(%rbp), %rsi
callq 0x2f0aa
movq $0x0, 0x28(%r15)
cmpl $0x0, -0x30(%rbp)
movq -0x78(%rbp), %rcx
movq -0x60(%rbp), %r13
jle 0x353bf
xorl %ebx, %ebx
xorl %r14d, %r14d
leaq (%rcx,%rbx), %rsi
leaq (%r15,%rbx), %rdi
movl $0xc0, %edx
callq 0x21a0
movq -0x78(%rbp), %rcx
testl %r14d, %r14d
je 0x353af
movq 0x28(%rcx,%rbx), %rax
subq %rcx, %rax
shrq $0x6, %rax
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
cltq
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq %r15, %rax
movq %rax, 0x28(%r15,%rbx)
incl %r14d
addq $0xc0, %rbx
cmpl %r14d, -0x30(%rbp)
jne 0x35370
movq %r15, %rdi
movq -0x30(%rbp), %rbx
movl %ebx, %esi
movq %r12, %rdx
movl 0x70(%rbp), %ecx
callq 0x154bb
leaq 0x25f85(%rip), %rdi     # 0x5b35f
movl $0x16, %esi
movl $0x1, %edx
movq -0x120(%rbp), %r14
movq %r14, %rcx
callq 0x2280
subq $0x50, %rsp
leaq 0x40(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x20(%rsp)
movups %xmm0, 0x10(%rsp)
movq -0x58(%rbp), %rax
movq %rax, 0x48(%rsp)
movq -0x70(%rbp), %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movq -0x38(%rbp), %rax
movq %rax, 0x30(%rsp)
movl %ebx, 0x8(%rsp)
movq -0x88(%rbp), %rax
movq %rax, (%rsp)
leaq -0x12c(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
leaq -0x94(%rbp), %rbx
movss 0x1bbbf(%rip), %xmm1    # 0x51014
movss 0x1bbb3(%rip), %xmm2    # 0x51010
movq %rbx, %rdx
movss -0x68(%rbp), %xmm0
movl %r13d, %ecx
movq %r14, %r8
movq %r15, %r9
callq 0x3551f
addq $0x50, %rsp
xorps %xmm0, %xmm0
cvtss2sd (%rbx), %xmm0
leaq 0x25ef1(%rip), %rdi     # 0x5b376
movl 0xf8(%rbp), %ebx
movl %ebx, %esi
movq 0xf0(%rbp), %rdx
movb $0x1, %al
callq 0x20f0
movsd -0xa8(%rbp), %xmm0
divsd -0x80(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
leaq 0x25ee6(%rip), %rdi     # 0x5b39d
movl %ebx, %esi
movb $0x1, %al
callq 0x20f0
leaq 0x25f04(%rip), %rsi     # 0x5b3cb
movq %r14, %rdi
movl %ebx, %edx
movsd -0xa8(%rbp), %xmm0
movb $0x1, %al
callq 0x2190
xorps %xmm0, %xmm0
cvtss2sd -0xd4(%rbp), %xmm0
leaq 0x25f0d(%rip), %rsi     # 0x5b3fa
movq %r14, %rdi
movb $0x1, %al
callq 0x2190
movq %r14, %rdi
callq 0x20c0
movq -0xf0(%rbp), %rdi
testq %rdi, %rdi
je 0x35510
callq 0x20c0
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq