// File: /workspace/github_c_makefile_star2_O3/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 $0x318, %rsp            # imm = 0x318
movss %xmm1, -0xd4(%rbp)
movl %r9d, %r14d
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, -0xf0(%rbp)
movq %rdi, -0x170(%rbp)
movl 0xf8(%rbp), %esi
movq 0xf0(%rbp), %rdx
movl 0xb8(%rbp), %eax
movl %eax, -0x7c(%rbp)
movss 0xac(%rbp), %xmm0
movss %xmm0, -0xdc(%rbp)
movss 0xb0(%rbp), %xmm0
movss %xmm0, -0x80(%rbp)
movss 0xb4(%rbp), %xmm0
movss %xmm0, -0xa0(%rbp)
leaq 0x271ad(%rip), %rdi     # 0x5b11a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x20f0
movq %r15, %rdi
movl %r14d, %esi
movq %r12, -0xb8(%rbp)
movq %r12, %rdx
callq 0x14cf3
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, -0xd0(%rbp)
movq %rdx, %rsp
movq $0x0, 0x28(%r15)
movq %r14, -0x30(%rbp)
testl %r14d, %r14d
movq %rcx, -0x38(%rbp)
jle 0x34019
xorl %r14d, %r14d
leaq (%rcx,%r14), %rsi
leaq (%r15,%r14), %rdi
movl $0xc0, %edx
callq 0x21b0
movq -0x38(%rbp), %rcx
testl %ebx, %ebx
je 0x3400b
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 0x33fcd
movq %r13, -0x1a8(%rbp)
leaq 0x27c62(%rip), %rdi     # 0x5bc89
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, -0xf8(%rbp)
movq %rax, %rsp
movq %rdi, -0x138(%rbp)
movl %ebx, %esi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x16806
movq %rsp, %rax
movq %r14, -0x148(%rbp)
subq %r14, %rax
movq %rax, -0x118(%rbp)
movq %rax, %rsp
testl %ebx, %ebx
jle 0x3409e
leaq (,%r13,8), %rdx
movq -0x118(%rbp), %rdi
xorl %esi, %esi
callq 0x2110
leaq 0x40(%rbp), %rax
movl 0x18(%rax), %eax
movq %rax, -0x68(%rbp)
leal (%rax,%rax,2), %eax
movl %eax, -0x3c(%rbp)
leaq 0x10(%rbp), %r14
movslq (%r14), %rax
testq %rax, %rax
jle 0x340e6
movq 0x10(%r14), %rcx
xorpd %xmm1, %xmm1
xorl %edx, %edx
movq -0x38(%rbp), %rdi
movq -0xb8(%rbp), %r9
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%rdx,4), %xmm0
addsd %xmm0, %xmm1
incq %rdx
cmpq %rdx, %rax
jne 0x340d0
jmp 0x340f5
xorpd %xmm1, %xmm1
movq -0x38(%rbp), %rdi
movq -0xb8(%rbp), %r9
movsd %xmm1, -0x150(%rbp)
movl -0x3c(%rbp), %eax
movq %rsp, %rsi
leaq 0xf(,%rax,4), %r11
andq $-0x10, %r11
subq %r11, %rsi
movq %rsi, %rsp
movq %rsp, %rax
subq %r11, %rax
movq %rax, -0x70(%rbp)
movq %rax, %rsp
cmpl $0x0, -0x68(%rbp)
movq %r15, -0x140(%rbp)
movq %rsi, -0xb0(%rbp)
movq %r11, -0x110(%rbp)
jle 0x34240
movq 0x98(%rbp), %rax
leaq 0x40(%rbp), %rcx
movq (%rcx), %rcx
xorl %edx, %edx
movq -0x68(%rbp), %r10
movslq (%rcx,%rdx,4), %rdi
imulq $0x70, %rdi, %r8
addq %r9, %r8
xorl %edi, %edi
xorps %xmm0, %xmm0
cvtsd2ss (%r8,%rdi,2), %xmm0
movss %xmm0, (%rsi,%rdi)
addq $0x4, %rdi
cmpl $0xc, %edi
jne 0x34162
incq %rdx
addq %rdi, %rsi
cmpq %r10, %rdx
jne 0x34155
leaq 0x40(%rbp), %rcx
movq 0x8(%rcx), %rcx
xorl %edx, %edx
movq -0x70(%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 0x3419f
incq %rdx
addq %rdi, %rsi
cmpq %r10, %rdx
jne 0x34192
movq %rsp, %rdi
subq %r11, %rdi
movq %rdi, %rsp
movq %rsp, %r14
subq %r11, %r14
movq %r14, %rsp
movq %rsp, %rbx
subq %r11, %rbx
movq %rbx, %rsp
testl %r10d, %r10d
movq %r14, -0x58(%rbp)
movq %rbx, -0x108(%rbp)
movq %rdi, -0x50(%rbp)
jle 0x34236
movl -0x3c(%rbp), %eax
cmpl $0x2, %eax
movl $0x1, %r15d
cmovgel %eax, %r15d
shlq $0x2, %r15
movq -0xb0(%rbp), %rsi
movq %r15, %rdx
callq 0x21b0
movq %r14, %rdi
movq -0xb0(%rbp), %r14
movq %r14, %rsi
movq %r15, %rdx
callq 0x21b0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x21b0
movq -0x38(%rbp), %rdi
leaq 0x10(%rbp), %r14
jmp 0x3426a
movq %rsp, %rax
subq %r11, %rax
movq %rax, -0x50(%rbp)
movq %rax, %rsp
movq %rsp, %rax
subq %r11, %rax
movq %rax, -0x58(%rbp)
movq %rax, %rsp
movq %rsp, %rax
subq %r11, %rax
movq %rax, -0x108(%rbp)
movq %rax, %rsp
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, -0x90(%rbp)
movq %rax, %rsp
testl %ecx, %ecx
jle 0x342d7
leaq 0x8(%rdi), %rax
xorl %ecx, %ecx
movq -0x90(%rbp), %rdx
leaq (%rcx,%rcx,2), %rsi
shlq $0x6, %rsi
cmpl $0x0, 0x20(%rdi,%rsi)
js 0x342d7
xorl %esi, %esi
xorps %xmm0, %xmm0
cvtsd2ss (%rax,%rsi,2), %xmm0
movss %xmm0, (%rdx,%rsi)
addq $0x4, %rsi
cmpq $0xc, %rsi
jne 0x342af
incq %rcx
addq $0xc0, %rax
addq %rsi, %rdx
cmpq %r12, %rcx
jne 0x3429e
movq 0x10(%r14), %rax
movq %rax, -0x190(%rbp)
movq -0x90(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x3273e
movss %xmm0, -0x78(%rbp)
leaq 0x26dff(%rip), %rsi     # 0x5b0fd
leaq -0x340(%rbp), %r15
movq %r15, %rdi
movq 0x60(%rbp), %rdx
movq -0xf0(%rbp), %rcx
xorl %eax, %eax
callq 0x2270
leaq 0x22edf(%rip), %rsi     # 0x57200
movq %r15, %rdi
callq 0x2220
movq %rax, %r14
leaq 0x26dd9(%rip), %rdi     # 0x5b10c
movq %r15, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x26dd4(%rip), %rsi     # 0x5b118
movq %r14, %rdi
movl 0xf8(%rbp), %edx
movq 0xf0(%rbp), %rcx
xorl %eax, %eax
callq 0x21a0
xorps %xmm0, %xmm0
cvtss2sd -0xdc(%rbp), %xmm0
cvtss2sd -0x80(%rbp), %xmm1
leaq 0x26ddc(%rip), %rsi     # 0x5b14e
movq %r14, %rdi
movsd %xmm0, -0x180(%rbp)
movsd %xmm1, -0x128(%rbp)
movl -0x7c(%rbp), %edx
movb $0x2, %al
callq 0x21a0
xorps %xmm0, %xmm0
cvtss2sd -0x78(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
leaq 0x26dd8(%rip), %rsi     # 0x5b17e
movq %r14, %rdi
movb $0x1, %al
callq 0x21a0
leaq 0x40(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0xb0(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rcx
callq 0x4dfa0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x84(%rbp)
movss %xmm0, -0x40(%rbp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x78(%rbp)
leaq 0x26da7(%rip), %rdi     # 0x5b194
movb $0x1, %al
callq 0x20f0
leaq 0x26dae(%rip), %rsi     # 0x5b1a9
movq %r14, %rdi
movsd -0x78(%rbp), %xmm0
movb $0x1, %al
callq 0x21a0
leaq 0x26da6(%rip), %rdi     # 0x5b1b7
movl $0x32, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x2290
leaq 0x26dc0(%rip), %rsi     # 0x5b1ea
movsd 0x1cd16(%rip), %xmm4    # 0x51148
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
movq %r14, -0x120(%rbp)
movq %r14, %rdi
movsd -0x78(%rbp), %xmm1
movsd -0x98(%rbp), %xmm3
movl $0x1, %edx
movb $0x5, %al
callq 0x21a0
movq %rsp, %rax
subq %rbx, %rax
movq %rax, -0x100(%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 0x344a9
xorl %ebx, %ebx
movq -0xb8(%rbp), %r15
movq %r15, %rdi
callq 0x25a4d
movss %xmm0, (%r14,%rbx,4)
incq %rbx
addq $0x70, %r15
cmpq %rbx, %r12
jne 0x3448f
leaq 0x26d57(%rip), %rsi     # 0x5b207
movq -0xf0(%rbp), %rbx
movq %rbx, %rdi
callq 0x2190
testl %eax, %eax
je 0x345a8
leaq 0x26d42(%rip), %rsi     # 0x5b210
leaq -0x270(%rbp), %r15
movq %r15, %rdi
movq 0x60(%rbp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2270
leaq 0x22d13(%rip), %rsi     # 0x57200
movq %r15, %rdi
callq 0x2220
movq %rax, %rbx
leaq 0x26d26(%rip), %rdi     # 0x5b225
movq %r15, %rsi
xorl %eax, %eax
callq 0x20f0
movq %rbx, -0x60(%rbp)
movq %rbx, %rdi
movq 0x88(%rbp), %rsi
movl 0x90(%rbp), %edx
callq 0x32bec
cmpl $0x0, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq -0x110(%rbp), %rbx
movq -0x58(%rbp), %r15
jle 0x34588
leaq 0x8(%rdi), %rax
xorl %ecx, %ecx
movq -0x100(%rbp), %rdx
leaq (%rcx,%rcx,2), %r8
shlq $0x6, %r8
cmpl $0x0, 0x20(%rdi,%r8)
js 0x34588
xorl %r8d, %r8d
xorps %xmm0, %xmm0
cvtsd2ss (%rax,%r8,2), %xmm0
movss %xmm0, (%rdx,%r8)
addq $0x4, %r8
cmpq $0xc, %r8
jne 0x3455e
incq %rcx
addq $0xc0, %rax
addq %r8, %rdx
cmpq %r12, %rcx
jne 0x3454b
xorps %xmm0, %xmm0
movq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq -0x100(%rbp), %rcx
movq 0x78(%rbp), %r8
xorl %r9d, %r9d
callq 0x3285f
jmp 0x345bb
movq $0x0, -0x60(%rbp)
movq -0x110(%rbp), %rbx
movq -0x58(%rbp), %r15
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), %edi
movq -0x70(%rbp), %r12
movss -0xa0(%rbp), %xmm3
jle 0x3464d
movq 0xe8(%rbp), %rax
movq 0x40(%rax), %rax
xorl %ecx, %ecx
movaps 0x22cd9(%rip), %xmm0    # 0x572e0
movq (%rax,%rcx,8), %rdx
movss (%rdx), %xmm1
andps %xmm0, %xmm1
cmpl $0x2, %edi
jl 0x34635
movl $0x1, %esi
movss (%rdx,%rsi,4), %xmm2
andps %xmm0, %xmm2
maxss %xmm1, %xmm2
incq %rsi
movaps %xmm2, %xmm1
cmpq %rsi, %r13
jne 0x3461c
jmp 0x34638
movaps %xmm1, %xmm2
movaps %xmm3, %xmm1
divss %xmm2, %xmm1
movss %xmm1, (%r9,%rcx,4)
incq %rcx
cmpq %r8, %rcx
jne 0x34607
xorps %xmm2, %xmm2
movsd -0x150(%rbp), %xmm0
xorps %xmm1, %xmm1
movsd %xmm1, -0xa8(%rbp)
ucomisd %xmm2, %xmm0
movq %r8, -0xc0(%rbp)
movq %r9, -0xe8(%rbp)
jb 0x3467d
sqrtsd %xmm0, %xmm0
jmp 0x34693
callq 0x22a0
movq -0xe8(%rbp), %r9
movq -0xc0(%rbp), %r8
movl 0x70(%rbp), %edi
movl -0x3c(%rbp), %eax
cmpl $0x0, -0x7c(%rbp)
jle 0x34f23
movq %r14, -0x178(%rbp)
cvtsd2ss %xmm0, %xmm0
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
mulss -0xd4(%rbp), %xmm0
movss %xmm0, -0xf0(%rbp)
leaq (,%r13,8), %rax
movq %rax, -0x188(%rbp)
xorl %ecx, %ecx
leaq 0xf(,%r13,4), %rax
andq $-0x10, %rax
movq %rax, -0x198(%rbp)
movapd 0x22bfe(%rip), %xmm5    # 0x572f0
movaps 0x22be7(%rip), %xmm6    # 0x572e0
movl $0x0, -0x9c(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xa8(%rbp)
movl $0x0, -0xd8(%rbp)
movq -0x50(%rbp), %rax
movq %rdx, -0x158(%rbp)
movq %rsp, -0x160(%rbp)
movq %r15, %rsi
movq %rax, -0x58(%rbp)
movq %rsp, %r15
subq %rbx, %r15
movq %r15, %rsp
cmpl $0x0, -0x68(%rbp)
jle 0x3475b
xorl %eax, %eax
movss (%r12,%rax,4), %xmm0
subss (%rsi,%rax,4), %xmm0
movss %xmm0, (%r15,%rax,4)
incq %rax
cmpq %rax, %rdx
jne 0x34742
movq %rsi, -0x168(%rbp)
movq %rcx, -0x98(%rbp)
movq %rsp, %r14
subq -0x198(%rbp), %r14
movq %r14, %rsp
testl %edi, %edi
jle 0x3480f
leaq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
xorl %ebx, %ebx
movl -0x3c(%rbp), %r12d
movq -0x1a8(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%rbx,8), %rsi
movq %r15, %rdi
movq -0x50(%rbp), %rdx
movl %r12d, %ecx
callq 0x107c4
movss %xmm0, (%r14,%rbx,4)
incq %rbx
cmpq %rbx, %r13
jne 0x34790
movq %rsp, %r12
movq -0x148(%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 0x347f0
movq %r12, %rdi
xorl %esi, %esi
movq -0x188(%rbp), %rdx
callq 0x2110
movl 0x70(%rbp), %edi
movq -0xc0(%rbp), %r8
movq -0xe8(%rbp), %r9
movapd 0x22aea(%rip), %xmm5    # 0x572f0
movaps 0x22ad3(%rip), %xmm6    # 0x572e0
jmp 0x34828
movq %rsp, %r12
movq -0x148(%rbp), %rax
subq %rax, %r12
movq %r12, %rsp
movq %rsp, %r15
subq %rax, %r15
movq %r15, %rsp
movq %rsp, %rbx
subq -0x1a0(%rbp), %rbx
movq %rbx, %rsp
cmpl $0x0, 0xf8(%rbp)
jle 0x348da
movq 0xe8(%rbp), %rax
movq 0x40(%rax), %rax
xorps %xmm0, %xmm0
xorl %ecx, %ecx
movsd 0x1c8ee(%rip), %xmm1    # 0x51148
xorpd %xmm2, %xmm2
testl %edi, %edi
jle 0x34883
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 0x34868
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 0x3485a
jmp 0x348e6
xorps %xmm0, %xmm0
movsd 0x1c862(%rip), %xmm8    # 0x51148
divsd -0x150(%rbp), %xmm0
ucomisd 0x1c882(%rip), %xmm0    # 0x51178
jb 0x34901
xorps %xmm7, %xmm7
sqrtsd %xmm0, %xmm7
jmp 0x3492f
movapd %xmm8, -0x50(%rbp)
callq 0x22a0
movapd -0x50(%rbp), %xmm8
movaps 0x229c7(%rip), %xmm6    # 0x572e0
movapd 0x229cf(%rip), %xmm5    # 0x572f0
movq -0xc0(%rbp), %r8
movl 0x70(%rbp), %edi
movapd %xmm0, %xmm7
movss -0xa0(%rbp), %xmm4
mulsd 0x26409(%rip), %xmm7    # 0x5ad48
movb $0x1, %r14b
movsd -0x128(%rbp), %xmm0
ucomisd %xmm7, %xmm0
ja 0x34dde
cmpl $0x0, 0xf8(%rbp)
jle 0x349f3
movapd %xmm7, %xmm0
divsd -0x180(%rbp), %xmm0
maxsd %xmm0, %xmm8
xorl %eax, %eax
xorl %ecx, %ecx
ucomisd 0x1c7c9(%rip), %xmm8    # 0x51148
movss (%rbx,%rax,4), %xmm0
jbe 0x34993
cvtss2sd %xmm0, %xmm0
divsd %xmm8, %xmm0
cvtsd2ss %xmm0, %xmm0
movaps %xmm0, %xmm1
andps %xmm6, %xmm1
movss -0xf0(%rbp), %xmm2
ucomiss %xmm1, %xmm2
jbe 0x349aa
incl %ecx
jmp 0x349e0
testl %edi, %edi
jle 0x349e0
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 0x349bf
incq %rax
cmpq %r8, %rax
jne 0x34976
xorps %xmm8, %xmm8
cvtsi2sd %ecx, %xmm8
jmp 0x349f8
xorpd %xmm8, %xmm8
xorps %xmm0, %xmm0
testl %edi, %edi
jle 0x34a2e
xorl %eax, %eax
movsd (%r12,%rax,8), %xmm1
movapd %xmm1, %xmm2
andpd %xmm5, %xmm2
xorps %xmm3, %xmm3
cvtss2sd %xmm0, %xmm3
ucomisd %xmm3, %xmm2
jbe 0x34a26
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
andps %xmm6, %xmm0
incq %rax
cmpq %rax, %r13
jne 0x34a01
ucomiss %xmm4, %xmm0
jbe 0x34ac1
movsd %xmm8, -0x50(%rbp)
divss %xmm0, %xmm4
movss %xmm4, -0xc8(%rbp)
cvtss2sd %xmm0, %xmm0
leaq 0x267f9(%rip), %rdi     # 0x5b24d
movb $0x1, %al
movsd %xmm7, -0x78(%rbp)
callq 0x20f0
xorps %xmm0, %xmm0
cvtss2sd -0xc8(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
leaq 0x267f3(%rip), %rdi     # 0x5b26d
movb $0x1, %al
callq 0x20f0
movsd -0xc8(%rbp), %xmm1
movsd -0x78(%rbp), %xmm7
movl 0x70(%rbp), %edi
divsd %xmm1, %xmm7
testl %edi, %edi
jle 0x34abb
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 0x34aa1
jmp 0x34ac1
movsd -0x50(%rbp), %xmm8
incl -0x9c(%rbp)
movsd -0xa8(%rbp), %xmm0
addsd %xmm8, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x128(%rbp), %xmm0
ucomisd %xmm7, %xmm0
ja 0x34dde
movsd %xmm7, -0x78(%rbp)
movl $0x3f800000, -0xe0(%rbp) # imm = 0x3F800000
movsd 0x1c643(%rip), %xmm1    # 0x51148
testl %edi, %edi
movq -0x118(%rbp), %rcx
jle 0x34b2b
xorl %eax, %eax
movsd (%rcx,%rax,8), %xmm0
addsd (%r12,%rax,8), %xmm0
movsd %xmm0, (%r15,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x34b12
movsd %xmm1, -0x50(%rbp)
movq -0xd0(%rbp), %rdx
movq $0x0, 0x28(%rdx)
cmpl $0x0, -0x30(%rbp)
movq -0x38(%rbp), %rcx
jle 0x34bab
xorl %ebx, %ebx
xorl %r14d, %r14d
leaq (%rcx,%rbx), %rsi
movq -0xd0(%rbp), %rax
leaq (%rax,%rbx), %rdi
movl $0xc0, %edx
callq 0x21b0
movq -0xd0(%rbp), %rdx
movq -0x38(%rbp), %rcx
testl %r14d, %r14d
je 0x34b9b
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 0x34b4e
movq %rdx, %r14
movq %rdx, %rdi
movq -0x30(%rbp), %rbx
movl %ebx, %esi
movq %r15, %rdx
movl 0x70(%rbp), %ecx
callq 0x15083
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 -0x70(%rbp), %rax
movq %rax, 0x48(%rsp)
movq -0xb0(%rbp), %rax
movq %rax, 0x40(%rsp)
movq -0x168(%rbp), %rax
movq %rax, 0x38(%rsp)
movq -0x58(%rbp), %rax
movq %rax, 0x30(%rsp)
movl %ebx, 0x8(%rsp)
movq -0x90(%rbp), %rax
movq %rax, (%rsp)
leaq -0xe0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x84(%rbp), %rdx
movss -0x80(%rbp), %xmm0
movss -0xdc(%rbp), %xmm1
movq -0x98(%rbp), %rcx
movq -0x120(%rbp), %r8
movq %r14, %r9
callq 0x3526e
addq $0x50, %rsp
testl %eax, %eax
jne 0x34ce3
cvtss2sd -0xe0(%rbp), %xmm3
movsd -0x50(%rbp), %xmm2
mulsd %xmm3, %xmm2
movsd -0x78(%rbp), %xmm1
mulsd %xmm3, %xmm1
movsd -0x128(%rbp), %xmm0
ucomisd %xmm1, %xmm0
ja 0x34dc9
movsd %xmm1, -0x78(%rbp)
leaq 0x2661e(%rip), %rdi     # 0x5b2b3
movsd %xmm3, -0xc8(%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 0x34b05
xorl %eax, %eax
movsd -0xc8(%rbp), %xmm2
movsd (%r12,%rax,8), %xmm0
mulsd %xmm2, %xmm0
movsd %xmm0, (%r12,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x34cc6
jmp 0x34b05
movss 0x341d1(%rip), %xmm0    # 0x68ebc
ucomiss -0x40(%rbp), %xmm0
seta -0x50(%rbp)
movq -0x140(%rbp), %r15
movq $0x0, 0x28(%r15)
cmpl $0x0, -0x30(%rbp)
movq -0x70(%rbp), %r12
movq -0xd0(%rbp), %rcx
jle 0x34d6a
xorl %ebx, %ebx
xorl %r14d, %r14d
leaq (%rcx,%rbx), %rsi
leaq (%r15,%rbx), %rdi
movl $0xc0, %edx
callq 0x21b0
movq -0xd0(%rbp), %rcx
testl %r14d, %r14d
je 0x34d5a
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 0x34d18
movq -0xf8(%rbp), %rdi
movl 0x70(%rbp), %ebx
movl %ebx, %esi
movq %r15, %rdx
movq -0x30(%rbp), %rcx
callq 0x16806
testl %ebx, %ebx
jle 0x34f0e
xorl %eax, %eax
movq -0x138(%rbp), %rcx
movq -0xf8(%rbp), %rdx
movq -0x118(%rbp), %rsi
movq -0x68(%rbp), %rbx
movq -0x58(%rbp), %r15
movq -0x60(%rbp), %rdi
movsd (%rdx,%rax,8), %xmm0
subsd (%rcx,%rax,8), %xmm0
movsd %xmm0, (%rsi,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x34dad
jmp 0x34f1a
movb $0x1, %r14b
leaq 0x264bb(%rip), %rdi     # 0x5b28e
movapd %xmm2, %xmm0
movb $0x1, %al
callq 0x20f0
movq -0x70(%rbp), %r12
movq -0x68(%rbp), %rbx
movq -0x58(%rbp), %r15
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x34eac
movq -0x108(%rbp), %rdi
movq %r15, %rsi
movq -0x190(%rbp), %rdx
movl %ebx, %ecx
callq 0x4dfa0
cvtsd2ss %xmm0, %xmm0
ucomiss 0x25f6a(%rip), %xmm0    # 0x5ad84
seta %al
orb %r14b, %al
testb $0x1, %al
je 0x34eac
movb %r14b, -0x50(%rbp)
testl %ebx, %ebx
movq -0x108(%rbp), %rcx
movq -0x158(%rbp), %rdx
jle 0x34e53
xorl %eax, %eax
movss (%r15,%rax,4), %xmm0
movss %xmm0, (%rcx,%rax,4)
incq %rax
cmpq %rax, %rdx
jne 0x34e40
movl -0xd8(%rbp), %r14d
incl %r14d
movq -0x100(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x178(%rbp), %rdx
movq -0x30(%rbp), %rbx
movl %ebx, %ecx
callq 0x4dfa0
cvtsd2ss %xmm0, %xmm0
movq -0x60(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movl %ebx, %edx
movq -0x90(%rbp), %rcx
movq 0x78(%rbp), %r8
movl %r14d, -0xd8(%rbp)
movl %r14d, %r9d
callq 0x3285f
movb -0x50(%rbp), %r14b
movl $0xa, %edi
callq 0x2060
testb %r14b, %r14b
movq -0x110(%rbp), %rbx
jne 0x34f36
movq -0x160(%rbp), %rsp
movq -0x98(%rbp), %rcx
incl %ecx
movq -0x168(%rbp), %rsi
movq %rsi, %rax
cmpl -0x7c(%rbp), %ecx
movl 0x70(%rbp), %edi
movq -0xc0(%rbp), %r8
movq -0xe8(%rbp), %r9
movq -0x158(%rbp), %rdx
movapd 0x223f1(%rip), %xmm5    # 0x572f0
movaps 0x223da(%rip), %xmm6    # 0x572e0
jne 0x34723
jmp 0x34f5f
movq -0x68(%rbp), %rbx
movq -0x58(%rbp), %r15
movq -0x60(%rbp), %rdi
movb -0x50(%rbp), %r14b
jmp 0x34dee
xorl %r15d, %r15d
movl $0x0, -0x9c(%rbp)
movq -0x50(%rbp), %rbx
jmp 0x34f68
xorps %xmm0, %xmm0
cvtss2sd -0x40(%rbp), %xmm0
leaq 0x26391(%rip), %rdi     # 0x5b2d6
movb $0x1, %al
callq 0x20f0
movq -0x160(%rbp), %rsp
movq %r15, %rbx
movq -0x98(%rbp), %r15
jmp 0x34f68
movl -0x7c(%rbp), %eax
movl %eax, %r15d
movq %rsi, %rbx
leaq 0x26387(%rip), %rdi     # 0x5b2f6
movl $0xe, %esi
movl $0x1, %edx
movq -0x120(%rbp), %r14
movq %r14, %rcx
callq 0x2290
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 -0xb0(%rbp), %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movq %rbx, -0x50(%rbp)
movq %rbx, 0x30(%rsp)
movq -0x30(%rbp), %rbx
movl %ebx, 0x8(%rsp)
movq -0x90(%rbp), %rax
movq %rax, (%rsp)
leaq -0x12c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x84(%rbp), %rdx
movss 0x1c133(%rip), %xmm1    # 0x51120
movss 0x1c127(%rip), %xmm2    # 0x5111c
movss -0x80(%rbp), %xmm0
movq %r15, -0x98(%rbp)
movl %r15d, %ecx
movq %r14, %r8
movq -0x140(%rbp), %r15
movq %r15, %r9
callq 0x3526e
addq $0x50, %rsp
leaq -0x84(%rbp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
leaq 0x262d6(%rip), %rdi     # 0x5b305
movb $0x1, %al
callq 0x20f0
leaq 0x26cd0(%rip), %rdi     # 0x5bd0d
callq 0x2090
movq -0xf8(%rbp), %r14
movq %r14, %rdi
movl 0x70(%rbp), %r12d
movl %r12d, %esi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x16806
movl %r12d, %edx
testl %r12d, %r12d
movq -0x170(%rbp), %r12
movq -0x138(%rbp), %rcx
jle 0x3508e
xorl %eax, %eax
movsd (%r14,%rax,8), %xmm0
subsd (%rcx,%rax,8), %xmm0
movsd %xmm0, (%r12,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x35075
movq %r12, %rdi
movq 0x68(%rbp), %rsi
callq 0x2eddc
movq $0x0, 0x28(%r15)
cmpl $0x0, -0x30(%rbp)
movq -0x38(%rbp), %rcx
jle 0x35100
xorl %ebx, %ebx
xorl %r14d, %r14d
leaq (%rcx,%rbx), %rsi
leaq (%r15,%rbx), %rdi
movl $0xc0, %edx
callq 0x21b0
movq -0x38(%rbp), %rcx
testl %r14d, %r14d
je 0x350f0
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 0x350b1
movq %r15, %rdi
movq -0x30(%rbp), %rbx
movl %ebx, %esi
movq %r12, %rdx
movl 0x70(%rbp), %ecx
callq 0x15083
leaq 0x261fc(%rip), %rdi     # 0x5b317
movl $0x16, %esi
movl $0x1, %edx
movq -0x120(%rbp), %r14
movq %r14, %rcx
callq 0x2290
subq $0x50, %rsp
leaq 0x40(%rbp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x20(%rsp)
movups %xmm0, 0x10(%rsp)
movq -0x70(%rbp), %rax
movq %rax, 0x48(%rsp)
movq -0xb0(%rbp), %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movq -0x50(%rbp), %rax
movq %rax, 0x30(%rsp)
movl %ebx, 0x8(%rsp)
movq -0x90(%rbp), %rax
movq %rax, (%rsp)
leaq -0x12c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x84(%rbp), %rbx
movss 0x1bf87(%rip), %xmm1    # 0x51120
movss 0x1bf7b(%rip), %xmm2    # 0x5111c
movq %rbx, %rdx
movss -0x80(%rbp), %xmm0
movq -0x98(%rbp), %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x3526e
addq $0x50, %rsp
xorps %xmm0, %xmm0
cvtss2sd (%rbx), %xmm0
leaq 0x26161(%rip), %rdi     # 0x5b32e
movl 0xf8(%rbp), %ebx
movl %ebx, %esi
movq 0xf0(%rbp), %rdx
movb $0x1, %al
callq 0x20f0
xorps %xmm1, %xmm1
cvtsi2sdl -0x9c(%rbp), %xmm1
movsd -0xa8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
leaq 0x2614c(%rip), %rdi     # 0x5b355
movl %ebx, %esi
movb $0x1, %al
callq 0x20f0
leaq 0x2616a(%rip), %rsi     # 0x5b383
movq %r14, %rdi
movl %ebx, %edx
movsd -0xa8(%rbp), %xmm0
movb $0x1, %al
callq 0x21a0
xorps %xmm0, %xmm0
cvtss2sd -0xd4(%rbp), %xmm0
leaq 0x26173(%rip), %rsi     # 0x5b3b2
movq %r14, %rdi
movb $0x1, %al
callq 0x21a0
movq %r14, %rdi
callq 0x20c0
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3525f
callq 0x20c0
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq