// File: /workspace/github_c_makefile_star2_O2/ugobas[P]tnm/mutation.c
// Function: Predict_mutations
void Predict_mutations(struct Normal_Mode NM, float KAPPA,
		       atom *atoms, int natoms,
		       int N_axes, struct Reference Ref_kin, 
		       struct interaction *Int_list, int N_int,
		       struct residue *seq, int Nres,
		       char *nameout1, char *Mut_para,
		       int PRED_MUT, int IWT)
{
  int i_rank[20]; // For RMSD[a_wt] //IWT=3, 
  int ALLPAIR=0; if(PRED_MUT==2)ALLPAIR=1;

  // Exponent of the force for computation
  Read_pred_para(Mut_para);
  Exp=(1.+EXP_FORCE)/2;
  REXP=pow(RC, EXP_FORCE); scale_C=KAPPA*REXP;
  float C_size=C_SIZE*scale_C, C_stab=C_STAB*scale_C, C_dist=C_DIST*scale_C;
  Normalize_parameters();

  /* For all positions in the protein and all possible amino acid changes,
     predict the structural effect of the mutation */

  float *sigma2=NM.sigma2;
  /**************************************************************************
           Prepare reference atoms and determine their displacement str_diff_3
  ****************************************************************************/

  // Match any atom to closest kinetic atom
  int N_kin=Ref_kin.N_ref, N_Cart=3*N_kin, kin_atom[natoms]; 
  Match_atoms(kin_atom, atoms, natoms, Ref_kin.atom_num, N_kin);

  // Extract one reference atom per residue
  int resatom[Nres];
  int Na=Extract_reference_atoms(resatom, atoms, natoms, seq, Nres);

  // Contact list
  int *nc, **clist, **cnum;
  Get_contact_list(&nc, &clist, &cnum, Nres, atoms, Int_list, N_int);

  // Output files
  char para[200], head[800],tmp[50];
  sprintf(para, "# Mutation par.: C_SIZE= %.3g C_STAB= %.3g C_DIST=%.3g IWT=%d",
	  C_SIZE, C_STAB, C_DIST, IWT);
  strcpy(head, "#Mut\tncont");
  for(int a=0; a<20; a++){
    sprintf(tmp, "\t%c", AA_code[a]); strcat(head, tmp);
  }
  strcat(head,"\n");

  char name[200]; sprintf(name,"%s.mut_RMSD.dat", nameout1);
  char what[200]="Predicted RMSD of all mutations from WT";
  FILE *file_rmsd=fopen(name, "w");
  fprintf(file_rmsd, "# %s\n%s\n%s", what, para, head);
  printf("Writing %s in %s\n", what,name);

  sprintf(name,"%s.mut_DE.dat", nameout1);
  strcpy(what, "Predicted DE of all mutations from WT");
  FILE *file_de=fopen(name, "w");
  fprintf(file_de, "# %s\n%s\n%s", what,para,head);
  printf("Writing %s in %s\n",what, name);

  FILE *file_de_all=NULL, *file_rmsd_all=NULL;
  if(ALLPAIR){
    strcpy(head, "#pos");
    for(int a=0; a<20; a++){
      for(int b=a+1; b<20; b++){
	sprintf(tmp, "\t%c%c", AA_code[a], AA_code[b]);
	strcat(head, tmp);
      }
    }
    strcat(head,"\n");

    strcpy(what, "Predicted RMSD of all pairs of mutations");
    sprintf(name,"%s.mut_RMSD_all.dat", nameout1);
    file_rmsd_all=fopen(name, "w");
    fprintf(file_rmsd_all, "# %s\n%s\n%s", what,para,head);
    printf("Writing %s in %s\n",what, name);

    strcpy(what, "Predicted DE of all pairs of mutations");
    sprintf(name,"%s.mut_DE_all.dat", nameout1);
    file_de_all=fopen(name, "w");
    fprintf(file_de_all, "# %s\n%s\n%s", what,para,head);
    printf("Writing %s in %s\n",what, name);
  }

  FILE *file3=NULL;
  if(0){
    strcpy(what, "Predicted RMSD and DE of all mutations from WT");
    sprintf(name,"%s.mut_all.dat", nameout1);
    fopen(name, "w");
    printf("Writing %s in %s\n",what, name);
    fprintf(file3, "# %s\nRMSD DE\n", what);
  }

  FILE *file4=NULL;
  if(0){
    sprintf(what, "Predicted force of all mutations from WT");
    sprintf(name,"%s.mut_force.dat", nameout1);
    file4=fopen(name, "w");
    printf("Writing %s in %s\n",what, name);
    fprintf(file4, "# %s\n%s\n%s", what, para, head);
  }

  // Define memory
  float Force[N_Cart], Force_coeff[NM.N];
  int N3=3*Na;
  float pred_mut_Cart[N_Cart], pred_mut_Tors[N_axes],
    pred_mut_3[N3], pred_mut_2[Na]; // pred_mut_tot_2[Na];

  int Nmut=1, Posmut[1]; char AAwt[1], AAmut[1];
  float MSD_mut[20][20], MSD_cross=0, MSD[20];
  float DE_pred[20][20], DE[20];
  double RMSD_prof[Na]; for(int i=0; i<Na; i++)RMSD_prof[i]=0;
  for(int ipos=0; ipos<Nres; ipos++){
    printf("%d ",ipos);
    Posmut[0]=ipos; AAwt[0]=seq[ipos].amm; AAmut[0]='A';
    int wt=seq[ipos].i_aa;
    int mut_neigh[Na], n_cont_mut;
    Mut_neighbor(mut_neigh, Na, AAwt, Posmut, AAmut, Nmut,
		 clist, cnum, Int_list, atoms, Nres);
    char out[80]; int a, b;
    sprintf(out,"%c%s\t%d",AAwt[0],seq[ipos].pdbres, nc[ipos]); //ipos+1
    fprintf(file_rmsd,"%s",out);
    fprintf(file_de,"%s",out);
    if(file4)fprintf(file4,"%s",out);
    for(a=0; a<20; a++){
      if(a==wt){DE[a]=1000; MSD[a]=1000; continue;}
      AAmut[0]=AA_code[a];
      Pred_mut_str(C_size, C_stab, C_dist,
		   DE+a, MSD+a, &MSD_cross,
		   NULL, NULL, NULL, NULL,
		   pred_mut_3, pred_mut_2, NULL, Na,
		   &n_cont_mut, Force, Force_coeff,
		   pred_mut_Cart, N_Cart, pred_mut_Tors, N_axes, 
		   AAwt, Posmut, AAmut, Nmut,
		   clist, cnum, Int_list, seq, Na,
		   atoms, resatom, Ref_kin, kin_atom, NM, sigma2,
		   NULL, NULL, NULL, NULL);
      for(int i=0; i<Na; i++)RMSD_prof[i]+=pred_mut_2[i];
      if(file4){
	double F=0;
	if(AAmut[0]!=AAwt[0]){
	  for(int i=0; i<Na; i++)F+=Force[i]*Force[i];
	  F=sqrt(F/Na);
	}
	fprintf(file4,"\t%.2g",F);
      }
    }
    // Compute mutation to same a.a. as mean of IWT lowest ones
    if(IWT>0){
      DE[wt]=10000; f_sort(DE, 20, i_rank);
      double Y=0; for(a=0; a<IWT; a++)Y+=DE[i_rank[19-a]]; DE[wt]=Y/IWT;
      MSD[wt]=10000; f_sort(MSD, 20, i_rank);
      Y=0; for(a=0; a<IWT; a++)Y+=MSD[i_rank[19-a]]; MSD[wt]=Y/IWT;
    }else{
      double sum=0, norm=0; float *x=DE, p;
      for(a=0; a<20; a++){
	if(a!=wt){p=exp(-x[a]); sum+=x[a]*p; norm+=p;}
      }
      if(norm){x[wt]=sum/norm;}else{x[wt]=0;}
      sum=0; norm=0; x=MSD;
      for(a=0; a<20; a++){
	if(a!=wt){p=exp(-x[a]); sum+=x[a]*p; norm+=p;}
      }
      if(norm){x[wt]=sum/norm;}else{x[wt]=0;}
    }
    for(a=0; a<20; a++){
      float RMSD_mut=sqrt(MSD[a]);
      fprintf(file_rmsd,"\t%.2g",RMSD_mut);
      fprintf(file_de,"\t%.3g",DE[a]);
      if(file3)fprintf(file3,"%.2g %.3g\n", RMSD_mut, DE[a]);
    }
    fprintf(file_rmsd,"\n");
    fprintf(file_de,"\n");
    if(file3)fprintf(file3,"\n");
    if(file4)fprintf(file4,"\n");

    if(ALLPAIR){
      // Compute all pairs
      for(a=0; a<20; a++){
	if(a==wt)continue;
	DE_pred[a][wt]=DE[a];
	DE_pred[wt][a]=DE[a];
	MSD_mut[a][wt]=MSD[a];
	MSD_mut[wt][a]=MSD[a];
	AAwt[0]=AA_code[a];
	for(b=a+1; b<20; b++){
	  if(b==wt){continue;}
	  AAmut[0]=AA_code[b];
	  Pred_mut_str(C_size, C_stab, C_dist,
		       &(DE_pred[a][b]), &(MSD_mut[a][b]), &MSD_cross,
		       NULL, NULL, NULL, NULL,
		       pred_mut_3, pred_mut_2, NULL, Na,
		       &n_cont_mut, Force, Force_coeff,
		       pred_mut_Cart, N_Cart, pred_mut_Tors, N_axes, 
		       AAwt, Posmut, AAmut, Nmut,
		       clist, cnum, Int_list, seq, Na,
		       atoms, resatom, Ref_kin, kin_atom, NM, sigma2,
		       NULL, NULL, NULL, NULL);
	}
      } // end pairs
      // print all pairs
      char out[20];
      sprintf(out,"%c%s",AA_code[wt],seq[ipos].pdbres); //ipos+1
      fprintf(file_rmsd_all,"%s", out);
      fprintf(file_de_all,"%s", out);
      for(a=0; a<20; a++){
	for(b=a+1; b<20; b++){
	  fprintf(file_rmsd_all,"\t%.2g",sqrt(MSD_mut[a][b]));
	  fprintf(file_de_all,"\t%.3g",DE_pred[a][b]);
	}
      }
      fprintf(file_rmsd_all,"\n");
      fprintf(file_de_all,"\n");
    } // end ALLPAIR
  }
  fclose(file_rmsd);
  fclose(file_de);
  if(file3)fclose(file3);
  if(file4)fclose(file4);
  if(file_de_all)fclose(file_de_all);
  if(file_rmsd_all)fclose(file_rmsd_all);

  // Print profile RMSD
  int NMUT=19*Nres;
  sprintf(name,"%s.mut_prof_RMSD.dat",nameout1);
  FILE *file1=fopen(name,"w");
  printf("Printing profile of structural RMSD in %s\n",name);
  fprintf(file1,"# Profile of structural deviations");
  fprintf(file1," averaged over %d simulated point mutations\n",NMUT);
  fprintf(file1,"# 1=res 2=n_contact 3=predicted RMSD from w.t.\n");
  for(int i=0; i<Na; i++){
    fprintf(file1,"%c%d\t%d\t%.3f\n",
	    seq[i].amm, i+1, nc[i], sqrt(RMSD_prof[i]/NMUT));
  }
  fclose(file1);
  printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1508, %rsp           # imm = 0x1508
movq %r9, %rbx
movq %r8, -0x48(%rbp)
movq %rcx, -0x90(%rbp)
movl %edx, -0x68(%rbp)
movl %esi, %r15d
movq %rdi, %r14
movss %xmm0, -0x38(%rbp)
leaq 0xe0(%rbp), %r12
leaq 0x10(%rbp), %r13
movq 0x120(%rbp), %rdi
callq 0x383bd
cvtss2sd 0x39e26(%rip), %xmm1    # 0x74594
movsd 0x108d2(%rip), %xmm0    # 0x4b048
addsd %xmm1, %xmm0
mulsd 0x108ee(%rip), %xmm0    # 0x4b070
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x39e0a(%rip)    # 0x74598
cvtss2sd 0x297ae(%rip), %xmm0    # 0x63f44
callq 0x20a0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x297a1(%rip)    # 0x63f48
movss -0x38(%rbp), %xmm1
mulss %xmm0, %xmm1
movss %xmm1, -0x38(%rbp)
movss %xmm1, 0x39ddf(%rip)    # 0x7459c
movss 0x2978b(%rip), %xmm0    # 0x63f50
movss %xmm0, -0x54(%rbp)
movss 0x29782(%rip), %xmm0    # 0x63f54
movss %xmm0, -0x50(%rbp)
movss 0x29779(%rip), %xmm0    # 0x63f58
movss %xmm0, -0x4c(%rbp)
callq 0x3a3d7
movq %rsp, -0x158(%rbp)
movq 0x28(%r13), %rax
movq %rax, -0x148(%rbp)
movl (%r12), %r8d
movl %r15d, %eax
movq %rsp, %rdi
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rdi
movq %rdi, %rsp
movq 0x28(%r12), %rcx
movq %rdi, -0x140(%rbp)
movq %r14, %rsi
movl %r15d, %edx
movq %r8, -0x40(%rbp)
callq 0x38630
movq %rsp, %rdi
movl 0x110(%rbp), %r8d
leaq 0xf(,%r8,4), %rax
andq $-0x10, %rax
subq %rax, %rdi
movq %rdi, %rsp
movq %rdi, -0x138(%rbp)
movq %r14, %rsi
movl %r15d, %edx
movq %rbx, -0x98(%rbp)
movq %rbx, %rcx
movq %r8, %rbx
callq 0x3b855
movq %rax, -0x88(%rbp)
subq $0x8, %rsp
leaq -0x150(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
movl %ebx, %ecx
movq %r14, -0xb0(%rbp)
movq %r14, %r8
movq -0x90(%rbp), %r9
pushq -0x48(%rbp)
callq 0x1d96c
popq %rax
popq %rcx
cvtss2sd 0x2969e(%rip), %xmm0    # 0x63f50
cvtss2sd 0x2969a(%rip), %xmm1    # 0x63f54
cvtss2sd 0x29696(%rip), %xmm2    # 0x63f58
leaq 0x1c00b(%rip), %rsi     # 0x568d4
leaq -0x3a0(%rbp), %rdi
movl 0x130(%rbp), %edx
movb $0x3, %al
callq 0x2260
movabsq $0x6f636e0974754d23, %rax # imm = 0x6F636E0974754D23
leaq -0x8b0(%rbp), %rbx
movq %rax, (%rbx)
movl $0x746e6f, 0x7(%rbx)    # imm = 0x746E6F
leaq 0x1ce9c(%rip), %r14     # 0x5779b
leaq -0x2d0(%rbp), %r15
xorl %r12d, %r12d
cmpq $0x14, %r12
je 0x3a93b
leaq 0x29862(%rip), %rax     # 0x64178
movq (%rax), %rax
movsbl (%rax,%r12), %edx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2260
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2240
incq %r12
jmp 0x3a909
leaq -0x8b0(%rbp), %rbx
movq %rbx, %rdi
callq 0x20d0
movw $0xa, -0x8b0(%rbp,%rax)
leaq 0x1bfc2(%rip), %rsi     # 0x5691d
leaq -0x470(%rbp), %r15
movq %r15, %rdi
movq 0x118(%rbp), %r13
movq %r13, %rdx
xorl %eax, %eax
callq 0x2260
leaq 0x1c1f3(%rip), %rsi     # 0x56b70
leaq -0x590(%rbp), %r12
movl $0xc8, %edx
movq %r12, %rdi
callq 0x21a0
leaq 0x167b8(%rip), %rsi     # 0x51150
movq %r15, %rdi
callq 0x2210
leaq 0x1bf86(%rip), %r14     # 0x5692d
leaq -0x3a0(%rbp), %rcx
movq %rax, -0xe8(%rbp)
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbx, %r8
xorl %eax, %eax
callq 0x2190
leaq 0x1bf69(%rip), %rbx     # 0x56938
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x20f0
leaq 0x1bf64(%rip), %rsi     # 0x5694a
movq %r15, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2260
movabsq $0x5457206d6f7266, %rax # imm = 0x5457206D6F7266
movq %rax, 0x1e(%r12)
movups 0x1bf4f(%rip), %xmm0    # 0x56958
movaps %xmm0, (%r12)
movups 0x1bf53(%rip), %xmm0    # 0x56968
movaps %xmm0, 0x10(%r12)
movq %r15, %rdi
leaq 0x1672b(%rip), %rsi     # 0x51150
callq 0x2210
movq %rax, -0x80(%rbp)
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
leaq -0x3a0(%rbp), %rcx
leaq -0x8b0(%rbp), %r8
xorl %eax, %eax
callq 0x2190
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x20f0
movq -0x40(%rbp), %rax
leal (%rax,%rax,2), %eax
movl %eax, -0x64(%rbp)
cmpl $0x2, 0x128(%rbp)
jne 0x3aae2
leaq -0x8b0(%rbp), %rbx
movb $0x0, 0x4(%rbx)
movl $0x736f7023, (%rbx)     # imm = 0x736F7023
pushq $0x1
popq %r12
leaq 0x1bef8(%rip), %r14     # 0x56983
leaq -0x2d0(%rbp), %r15
xorl %r13d, %r13d
movq %r12, -0x40(%rbp)
cmpq $0x14, %r13
je 0x3aaf7
cmpq $0x14, %r12
je 0x3aad6
leaq 0x296cc(%rip), %rax     # 0x64178
movq (%rax), %rax
movsbl (%rax,%r13), %edx
movsbl (%rax,%r12), %ecx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2260
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2240
incq %r12
jmp 0x3aa9f
incq %r13
movq -0x40(%rbp), %r12
incq %r12
jmp 0x3aa95
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
jmp 0x3ac21
leaq -0x8b0(%rbp), %rbx
movq %rbx, %rdi
callq 0x20d0
movw $0xa, -0x8b0(%rbp,%rax)
movups 0x1be72(%rip), %xmm0    # 0x56989
leaq -0x590(%rbp), %r15
movaps %xmm0, (%r15)
movups 0x1be70(%rip), %xmm0    # 0x56999
movaps %xmm0, 0x10(%r15)
movups 0x1be6d(%rip), %xmm0    # 0x569a2
movups %xmm0, 0x19(%r15)
leaq 0x1be71(%rip), %rsi     # 0x569b2
leaq -0x470(%rbp), %r12
movq %r12, %rdi
movq 0x118(%rbp), %r13
movq %r13, %rdx
xorl %eax, %eax
callq 0x2260
leaq 0x165ed(%rip), %r14     # 0x51150
movq %r12, %rdi
movq %r14, %rsi
callq 0x2210
leaq 0x1bdb8(%rip), %rsi     # 0x5692d
leaq -0x3a0(%rbp), %rcx
movq %rax, -0x40(%rbp)
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %r8
xorl %eax, %eax
callq 0x2190
leaq 0x1bda1(%rip), %rbx     # 0x56938
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x20f0
movabsq $0x736e6f69746174, %rax # imm = 0x736E6F69746174
movq %rax, 0x1f(%r15)
movups 0x1be0a(%rip), %xmm0    # 0x569c6
movaps %xmm0, (%r15)
movups 0x1be0f(%rip), %xmm0    # 0x569d6
movaps %xmm0, 0x10(%r15)
leaq 0x1be1a(%rip), %rsi     # 0x569ed
movq %r12, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2260
movq %r12, %rdi
movq %r14, %rsi
callq 0x2210
movq %rax, -0x48(%rbp)
movq %rax, %rdi
leaq 0x1bd34(%rip), %rsi     # 0x5692d
movq %r15, %rdx
leaq -0x3a0(%rbp), %rcx
leaq -0x8b0(%rbp), %r8
xorl %eax, %eax
callq 0x2190
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x20f0
movss -0x38(%rbp), %xmm1
movss -0x54(%rbp), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, -0x54(%rbp)
movss -0x50(%rbp), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, -0x50(%rbp)
movss -0x4c(%rbp), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, -0x4c(%rbp)
movl -0x64(%rbp), %eax
movq %rsp, %rcx
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x130(%rbp)
movq %rcx, %rsp
leaq 0x10(%rbp), %rcx
movl (%rcx), %ecx
movq %rsp, %rdx
leaq 0xf(,%rcx,4), %rcx
andq $-0x10, %rcx
subq %rcx, %rdx
movq %rdx, -0x128(%rbp)
movq %rdx, %rsp
movq -0x88(%rbp), %rdx
leal (%rdx,%rdx,2), %ecx
movq %rsp, %rsi
subq %rax, %rsi
movq %rsi, -0x120(%rbp)
movq %rsi, %rsp
movl -0x68(%rbp), %eax
movq %rsp, %rsi
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rsi
movq %rsi, -0x118(%rbp)
movq %rsi, %rsp
leaq 0xf(,%rcx,4), %rax
andq $-0x10, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x110(%rbp)
movq %rcx, %rsp
movl %edx, %eax
movq %rsp, %rcx
leaq 0xf(,%rax,4), %rsi
andq $-0x10, %rsi
movq %rsi, -0x168(%rbp)
subq %rsi, %rcx
movq %rcx, %rsp
andl $0x0, -0x74(%rbp)
movq %rsp, %rbx
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
testl %edx, %edx
movl $0x0, %eax
cmovlel %eax, %edx
movq -0xe8(%rbp), %r13
cmpq %rax, %rdx
je 0x3ad3d
andq $0x0, (%rbx,%rax,8)
incq %rax
jmp 0x3ad2e
movl 0x130(%rbp), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0xf0(%rbp)
movl 0x110(%rbp), %esi
movq %rsi, %rdi
testl %edi, %edi
movl $0x0, %esi
cmovgl %edi, %esi
movq %rsi, -0x170(%rbp)
movl %eax, %esi
negq %rsi
pushq $0x1
popq %rax
movl %eax, -0x70(%rbp)
xorl %r12d, %r12d
movq %rdx, -0xf8(%rbp)
movq %rcx, -0xa8(%rbp)
movq %rsi, -0x160(%rbp)
cmpq -0x170(%rbp), %r12
je 0x3b6ee
leaq 0x1aaf6(%rip), %rdi     # 0x55896
movl %r12d, %esi
xorl %eax, %eax
callq 0x20f0
movq %rsp, -0x180(%rbp)
movl %r12d, -0x6c(%rbp)
movq %r12, %rax
shlq $0x5, %rax
movq -0x98(%rbp), %rcx
leaq (%rcx,%rax), %r15
addq $0xd, %r15
movsbl 0x6(%r15), %eax
movl %eax, -0x38(%rbp)
movb %al, -0x2a(%rbp)
movb $0x41, -0x29(%rbp)
movswq 0x7(%r15), %r14
movq %rsp, %rdi
subq -0x168(%rbp), %rdi
movq %rdi, %rsp
subq $0x8, %rsp
movq -0x88(%rbp), %rsi
leaq -0x2a(%rbp), %rdx
leaq -0x6c(%rbp), %rcx
leaq -0x29(%rbp), %r8
pushq $0x1
popq %r9
movl 0x110(%rbp), %eax
pushq %rax
pushq -0xb0(%rbp)
pushq -0x90(%rbp)
pushq -0xb8(%rbp)
pushq -0xc0(%rbp)
callq 0x38803
addq $0x30, %rsp
movq -0x150(%rbp), %rax
movq %r12, -0xa0(%rbp)
movl (%rax,%r12,4), %r8d
leaq -0x4c0(%rbp), %r12
movq %r12, %rdi
leaq 0x1bbad(%rip), %rsi     # 0x569ff
movl -0x38(%rbp), %edx
movq %r15, -0x178(%rbp)
movq %r15, %rcx
xorl %eax, %eax
callq 0x2260
movq %r12, %rdi
movq %r13, %rsi
callq 0x2100
movq %r12, %rdi
movl $0x447a0000, %r12d      # imm = 0x447A0000
movq -0x80(%rbp), %rsi
callq 0x2100
movq -0xa8(%rbp), %r10
movq %r14, -0x60(%rbp)
movl %r14d, %eax
xorl %r15d, %r15d
movq %rax, -0x38(%rbp)
cmpq $0x14, %r15
je 0x3b0ab
cmpq %rax, %r15
jne 0x3aec0
movl %r12d, -0x220(%rbp,%rax,4)
movl %r12d, -0x1d0(%rbp,%rax,4)
incq %r15
movq -0x38(%rbp), %rax
jmp 0x3ae98
leaq 0x292b1(%rip), %rax     # 0x64178
movq (%rax), %rax
movb (%rax,%r15), %al
movb %al, -0x29(%rbp)
leaq -0x220(,%r15,4), %rax
addq %rbp, %rax
leaq -0x1d0(,%r15,4), %rdx
addq %rbp, %rdx
movq -0xc0(%rbp), %r8
movq -0xb8(%rbp), %r9
subq $0x1f0, %rsp            # imm = 0x1F0
leaq 0xf0(%rsp), %rdi
pushq $0x1a
popq %rcx
leaq 0x10(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xe0(%rbp), %rcx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0xd8(%rsp)
movups %xmm1, 0xc8(%rsp)
movups %xmm0, 0xb8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x1d8(%rsp)
movups %xmm0, 0x1c8(%rsp)
movq -0x148(%rbp), %rcx
movq %rcx, 0x1c0(%rsp)
movq -0x140(%rbp), %rcx
movq %rcx, 0xe8(%rsp)
movq -0x138(%rbp), %rcx
movq %rcx, 0xb0(%rsp)
movq -0xb0(%rbp), %rcx
movq %rcx, 0xa8(%rsp)
movq -0x88(%rbp), %rsi
movl %esi, 0xa0(%rsp)
movq -0x98(%rbp), %rcx
movq %rcx, 0x98(%rsp)
movq -0x90(%rbp), %rcx
movq %rcx, 0x90(%rsp)
movq %r9, 0x88(%rsp)
movq %r8, 0x80(%rsp)
leaq -0x29(%rbp), %rcx
movq %rcx, 0x70(%rsp)
leaq -0x6c(%rbp), %rcx
movq %rcx, 0x68(%rsp)
leaq -0x2a(%rbp), %rcx
movq %rcx, 0x60(%rsp)
movl -0x68(%rbp), %ecx
movl %ecx, 0x58(%rsp)
movq -0x118(%rbp), %rcx
movq %rcx, 0x50(%rsp)
movl -0x64(%rbp), %ecx
movl %ecx, 0x48(%rsp)
movq -0x120(%rbp), %rcx
movq %rcx, 0x40(%rsp)
movq -0x128(%rbp), %rcx
movq %rcx, 0x38(%rsp)
movq -0x130(%rbp), %rcx
movq %rcx, 0x30(%rsp)
leaq -0xc4(%rbp), %rcx
movq %rcx, 0x28(%rsp)
movl %esi, 0x20(%rsp)
movq %r10, 0x10(%rsp)
movq -0x110(%rbp), %rcx
movq %rcx, 0x8(%rsp)
movl $0x1, 0x78(%rsp)
andq $0x0, 0x18(%rsp)
andq $0x0, (%rsp)
movss -0x54(%rbp), %xmm0
movss -0x50(%rbp), %xmm1
movss -0x4c(%rbp), %xmm2
movq %rax, %rdi
movq %rdx, %rsi
leaq -0x74(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x39698
movq -0xa8(%rbp), %r10
movq -0xf8(%rbp), %rcx
addq $0x1f0, %rsp            # imm = 0x1F0
xorl %eax, %eax
cmpq %rax, %rcx
je 0x3aeb7
cvtss2sd (%r10,%rax,4), %xmm0
addsd (%rbx,%rax,8), %xmm0
movsd %xmm0, (%rbx,%rax,8)
incq %rax
jmp 0x3b08d
cmpl $0x0, 0x130(%rbp)
jle 0x3b17f
movq -0x60(%rbp), %rax
movl $0x461c4000, -0x220(%rbp,%rax,4) # imm = 0x461C4000
leaq -0x220(%rbp), %rdi
pushq $0x14
popq %rsi
leaq -0x290(%rbp), %rdx
callq 0x254d8
xorpd %xmm0, %xmm0
xorl %eax, %eax
movq -0x160(%rbp), %r15
movq -0xa0(%rbp), %r12
cmpq %rax, %r15
je 0x3b110
movslq -0x244(%rbp,%rax,4), %rcx
cvtss2sd -0x220(%rbp,%rcx,4), %xmm1
addsd %xmm1, %xmm0
decq %rax
jmp 0x3b0f1
divsd -0xf0(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x60(%rbp), %rax
movss %xmm0, -0x220(%rbp,%rax,4)
movl $0x461c4000, -0x1d0(%rbp,%rax,4) # imm = 0x461C4000
leaq -0x1d0(%rbp), %rdi
pushq $0x14
popq %rsi
leaq -0x290(%rbp), %rdx
callq 0x254d8
xorps %xmm0, %xmm0
xorl %eax, %eax
cmpq %rax, %r15
je 0x3b16e
movslq -0x244(%rbp,%rax,4), %rcx
cvtss2sd -0x1d0(%rbp,%rcx,4), %xmm1
addsd %xmm1, %xmm0
decq %rax
jmp 0x3b14f
divsd -0xf0(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
jmp 0x3b295
xorps %xmm1, %xmm1
xorl %r14d, %r14d
movq -0xa0(%rbp), %r12
cmpq $0x14, %r14
je 0x3b1e5
cmpq %r14, %rax
je 0x3b1e0
movss -0x220(%rbp,%r14,4), %xmm0
xorps 0x156b8(%rip), %xmm0    # 0x50860
cvtss2sd %xmm0, %xmm0
movaps %xmm1, -0xe0(%rbp)
callq 0x22a0
movq -0x38(%rbp), %rax
cvtsd2ss %xmm0, %xmm0
movss -0x220(%rbp,%r14,4), %xmm1
mulss %xmm0, %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtps2pd %xmm1, %xmm0
movapd -0xe0(%rbp), %xmm1
addpd %xmm0, %xmm1
incq %r14
jmp 0x3b18c
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
ucomisd 0xfe5c(%rip), %xmm0     # 0x4b050
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
jne 0x3b203
jp 0x3b203
xorps %xmm0, %xmm0
movq -0x60(%rbp), %rax
movss %xmm0, -0x220(%rbp,%rax,4)
xorpd %xmm1, %xmm1
xorl %r14d, %r14d
movq -0x38(%rbp), %rax
cmpq $0x14, %r14
je 0x3b275
cmpq %r14, %rax
je 0x3b270
movss -0x1d0(%rbp,%r14,4), %xmm0
xorps 0x15629(%rip), %xmm0    # 0x50860
cvtss2sd %xmm0, %xmm0
movapd %xmm1, -0xe0(%rbp)
callq 0x22a0
movq -0x38(%rbp), %rax
cvtsd2ss %xmm0, %xmm0
movss -0x1d0(%rbp,%r14,4), %xmm1
mulss %xmm0, %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
cvtps2pd %xmm1, %xmm0
movapd -0xe0(%rbp), %xmm1
addpd %xmm0, %xmm1
incq %r14
jmp 0x3b21b
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
ucomisd 0xfdcb(%rip), %xmm0     # 0x4b050
jne 0x3b28d
jnp 0x3b6dd
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movq -0x60(%rbp), %rax
movss %xmm0, -0x1d0(%rbp,%rax,4)
xorl %r15d, %r15d
cmpq $0x14, %r15
je 0x3b2ff
movss -0x1d0(%rbp,%r15,4), %xmm0
ucomiss 0xfd50(%rip), %xmm0     # 0x4b00c
jb 0x3b2c4
sqrtss %xmm0, %xmm0
jmp 0x3b2c9
callq 0x21c0
cvtss2sd %xmm0, %xmm0
movq %r13, %rdi
leaq 0x1b730(%rip), %rsi     # 0x56a07
movb $0x1, %al
callq 0x2190
cvtss2sd -0x220(%rbp,%r15,4), %xmm0
movq -0x80(%rbp), %rdi
leaq 0x164f1(%rip), %rsi     # 0x517e4
movb $0x1, %al
callq 0x2190
incq %r15
jmp 0x3b2a5
pushq $0xa
popq %r15
movl %r15d, %edi
movq %r13, %rsi
callq 0x2140
movl %r15d, %edi
movq -0x80(%rbp), %rsi
callq 0x2140
cmpl $0x2, 0x128(%rbp)
jne 0x3b6ce
leaq -0x152c(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0xeec(%rbp), %rax
movq %rax, -0x108(%rbp)
pushq $0x1
popq %rax
movq %rax, -0x100(%rbp)
xorl %ecx, %ecx
movq -0x38(%rbp), %rax
cmpq $0x14, %rcx
je 0x3b5df
movq %rcx, %r14
cmpq %rax, %rcx
jne 0x3b384
movq %r14, %rcx
incq %rcx
incq -0x100(%rbp)
addq $0x54, -0x108(%rbp)
addq $0x54, -0xe0(%rbp)
jmp 0x3b353
movss -0x220(%rbp,%r14,4), %xmm0
imulq $0x50, %r14, %rax
leaq (%rax,%rbp), %rcx
addq $-0xef0, %rcx           # imm = 0xF110
movq -0x60(%rbp), %rsi
movss %xmm0, (%rcx,%rsi,4)
imulq $0x50, %rsi, %rcx
leaq (%rcx,%rbp), %rdx
addq $-0xef0, %rdx           # imm = 0xF110
movss %xmm0, (%rdx,%r14,4)
movss -0x1d0(%rbp,%r14,4), %xmm0
leaq -0x1530(%rbp,%rax), %rax
movss %xmm0, (%rax,%rsi,4)
leaq -0x1530(%rbp,%rcx), %rax
movss %xmm0, (%rax,%r14,4)
leaq 0x28d91(%rip), %rax     # 0x64178
movq (%rax), %rax
movb (%rax,%r14), %al
movb %al, -0x2a(%rbp)
movq -0x38(%rbp), %rax
movq -0xe0(%rbp), %r13
movq -0x108(%rbp), %r15
movq -0x100(%rbp), %r12
cmpq $0x14, %r12
je 0x3b365
cmpq %r12, %rax
je 0x3b5cf
leaq 0x28d54(%rip), %rax     # 0x64178
movq (%rax), %rax
movb (%rax,%r12), %al
movb %al, -0x29(%rbp)
movq -0xc0(%rbp), %rax
movq -0xb8(%rbp), %rdx
subq $0x1f0, %rsp            # imm = 0x1F0
leaq 0xf0(%rsp), %rdi
pushq $0x1a
popq %rcx
leaq 0x10(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xe0(%rbp), %rcx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0xd8(%rsp)
movups %xmm1, 0xc8(%rsp)
movups %xmm0, 0xb8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x1d8(%rsp)
movups %xmm0, 0x1c8(%rsp)
movq -0x148(%rbp), %rcx
movq %rcx, 0x1c0(%rsp)
movq -0x140(%rbp), %rcx
movq %rcx, 0xe8(%rsp)
movq -0x138(%rbp), %rcx
movq %rcx, 0xb0(%rsp)
movq -0xb0(%rbp), %rcx
movq %rcx, 0xa8(%rsp)
movq -0x88(%rbp), %rsi
movl %esi, 0xa0(%rsp)
movq -0x98(%rbp), %rcx
movq %rcx, 0x98(%rsp)
movq -0x90(%rbp), %rcx
movq %rcx, 0x90(%rsp)
movq %rdx, 0x88(%rsp)
movq %rax, 0x80(%rsp)
leaq -0x29(%rbp), %rax
movq %rax, 0x70(%rsp)
leaq -0x6c(%rbp), %rax
movq %rax, 0x68(%rsp)
leaq -0x2a(%rbp), %rax
movq %rax, 0x60(%rsp)
movl -0x68(%rbp), %eax
movl %eax, 0x58(%rsp)
movq -0x118(%rbp), %rax
movq %rax, 0x50(%rsp)
movl -0x64(%rbp), %eax
movl %eax, 0x48(%rsp)
movq -0x120(%rbp), %rax
movq %rax, 0x40(%rsp)
movq -0x128(%rbp), %rax
movq %rax, 0x38(%rsp)
movq -0x130(%rbp), %rax
movq %rax, 0x30(%rsp)
leaq -0xc4(%rbp), %rax
movq %rax, 0x28(%rsp)
movl %esi, 0x20(%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0x110(%rbp), %rax
movq %rax, 0x8(%rsp)
movl $0x1, 0x78(%rsp)
andq $0x0, 0x18(%rsp)
andq $0x0, (%rsp)
movss -0x54(%rbp), %xmm0
movss -0x50(%rbp), %xmm1
movss -0x4c(%rbp), %xmm2
movq %r15, %rdi
movq %r13, %rsi
leaq -0x74(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x39698
movq -0x38(%rbp), %rax
addq $0x1f0, %rsp            # imm = 0x1F0
incq %r12
addq $0x4, %r15
addq $0x4, %r13
jmp 0x3b40a
leaq 0x28b92(%rip), %rax     # 0x64178
movq (%rax), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %edx
leaq -0x240(%rbp), %r15
movq %r15, %rdi
leaq 0x17cda(%rip), %rsi     # 0x532dc
movq -0x178(%rbp), %rcx
xorl %eax, %eax
callq 0x2260
movq %r15, %rdi
movq -0x40(%rbp), %rsi
callq 0x2100
movq %r15, %rdi
movq -0x48(%rbp), %rsi
callq 0x2100
leaq -0xef0(%rbp), %r15
leaq -0x1530(%rbp), %r12
xorl %r13d, %r13d
cmpq $0x14, %r13
je 0x3b6a4
pushq $0x1
popq %r14
leaq (%r14,%r13), %rax
cmpq $0x14, %rax
je 0x3b697
cvtss2sd (%r12,%r14,4), %xmm0
ucomisd 0xf9f5(%rip), %xmm0     # 0x4b050
jb 0x3b663
sqrtsd %xmm0, %xmm0
jmp 0x3b668
callq 0x2290
movq -0x40(%rbp), %rdi
leaq 0x1b394(%rip), %rsi     # 0x56a07
movb $0x1, %al
callq 0x2190
cvtss2sd (%r15,%r14,4), %xmm0
movq -0x48(%rbp), %rdi
leaq 0x16159(%rip), %rsi     # 0x517e4
movb $0x1, %al
callq 0x2190
incq %r14
jmp 0x3b643
incq %r13
addq $0x54, %r12
addq $0x54, %r15
jmp 0x3b639
pushq $0xa
popq %r15
movl %r15d, %edi
movq -0x40(%rbp), %rsi
callq 0x2140
movl %r15d, %edi
movq -0x48(%rbp), %rsi
callq 0x2140
movq -0xe8(%rbp), %r13
movq -0xa0(%rbp), %r12
movq -0x180(%rbp), %rsp
incq %r12
jmp 0x3ad8c
movq -0x60(%rbp), %rax
andl $0x0, -0x1d0(%rbp,%rax,4)
jmp 0x3b2a2
movq %r13, %rdi
callq 0x20c0
movq -0x80(%rbp), %rdi
callq 0x20c0
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x3b70d
callq 0x20c0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3b71b
callq 0x20c0
movl 0x110(%rbp), %eax
imull $0x13, %eax, %r14d
leaq 0x1b2e1(%rip), %rsi     # 0x56a0d
xorl %r12d, %r12d
leaq -0x470(%rbp), %r15
movq %r15, %rdi
movq 0x118(%rbp), %rdx
xorl %eax, %eax
callq 0x2260
leaq 0x15a02(%rip), %rsi     # 0x51150
movq %r15, %rdi
callq 0x2210
movq %rax, %r13
leaq 0x1b2c2(%rip), %rdi     # 0x56a22
movq %r15, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x1b2dc(%rip), %rdi     # 0x56a4d
pushq $0x22
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %r13, %rcx
callq 0x2280
leaq 0x1b2e6(%rip), %rsi     # 0x56a70
movq %r13, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x2190
leaq 0x1b2ff(%rip), %rdi     # 0x56a9d
pushq $0x2f
popq %rsi
movq %r15, %rdx
movq %r13, -0x40(%rbp)
movq %r13, %rcx
callq 0x2280
cvtsi2sd %r14d, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0xf8(%rbp), %r13
shlq $0x2, %r13
cmpq %r12, %r13
movq -0x98(%rbp), %rax
je 0x3b82e
movsbl 0x13(%rax,%r12,8), %r15d
movq -0x150(%rbp), %rax
movl (%rax,%r12), %r14d
movsd (%rbx,%r12,2), %xmm0
divsd -0x48(%rbp), %xmm0
ucomisd 0xf85b(%rip), %xmm0     # 0x4b050
jb 0x3b7fd
sqrtsd %xmm0, %xmm0
jmp 0x3b802
callq 0x2290
movq -0x40(%rbp), %rdi
leaq 0x1b2c0(%rip), %rsi     # 0x56acd
movl %r15d, %edx
movl -0x70(%rbp), %r15d
movl %r15d, %ecx
movl %r14d, %r8d
movb $0x1, %al
callq 0x2190
addq $0x4, %r12
incl %r15d
movl %r15d, -0x70(%rbp)
jmp 0x3b7c5
movq -0x40(%rbp), %rdi
callq 0x20c0
pushq $0xa
popq %rdi
callq 0x2060
movq -0x158(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq