// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/Fit_B_factors.c
// Function: Fit_fluctuations
float Fit_fluctuations(int FIT_B, float *B_TNM,
		       float *RMSD_NM, char *out,
		       float *Temp_comp, float Temp,
		       int anharmonic, struct Normal_Mode NM,
		       struct Reference Ref_kin, char *REF,
		       struct residue *seq1, int nres1, int nmr1,
		       atom *atoms1, char *nameout1,
		       float *factor_B, int *outlier_B)
{

  float *sigma2; char nameout[100];
  if(anharmonic==0){
    sigma2=NM.sigma2;
    sprintf(nameout, "%s", nameout1);
  }else{
    sigma2=NM.sigma2_anhar;
    sprintf(nameout, "%s.anharmonic", nameout1);
  }

  int i, k, N_ref=Ref_kin.N_ref;


  double bsum=0, bsum2=0; // mass_CA=0; 
  double pi=3.1415, norm_B=8.0*pi*pi/3;
  char BSEL[4]="CA";
  if(strcmp(REF, "CB")==0)strcpy(BSEL, "CB");
  int Na=0, j=0, Bref[nres1];
  float Xref[(3*nres1)];
  float *B_exp=malloc(N_ref*sizeof(float)), *B_pred_all=NULL;
  for(i=0; i<N_ref; i++){
    atom *atm=atoms1+Ref_kin.atom_num[i];
    if((strncmp(atm->name, BSEL, 2)!=0)&&
       ((seq1[atm->res].amm!='G')||(strncmp(atm->name, "CA", 2)!=0)))continue;
    Bref[Na]=Ref_kin.atom_num[i];
    B_TNM[Na]=Compute_correlation(NM.Cart,sigma2,NM.N,i,i);
    //if(ANM)B_TNM[Na]/=Ref_kin.mass_atom[i];
    //mass_CA+=Ref_kin.mass_atom[i];
    B_exp[Na]=atm->B_factor/norm_B; //
    bsum+=B_exp[Na]; bsum2+=B_exp[Na]*B_exp[Na];
    for(k=0; k<3; k++){Xref[j]=atm->r[k]; j++;}
    Na++;
  }
  bsum/=Na; bsum2=(bsum2/Na-bsum*bsum);
  float RMSD_crys=sqrt(bsum), RMSD_crys_int=-1;
  printf("%d %s atoms selected in %d residues\n", Na, BSEL, nres1);
  printf("RMSD of fluctuations (B fact tot)= %.3f\n", RMSD_crys);

  char ridge='C'; //'M'
  float bsmall=0.01, r_B=0, slope_B=0, slope_NoRot=0, f_dof[3]; 
  f_dof[0]=0; f_dof[1]=0; f_dof[2]=0;
  for(i=0; i<nres1; i++)outlier_B[i]=0; //modyves
  if((bsum < bsmall)||(bsum2<bsmall)||(nmr1)){
    //YYY this is a weird contstraint... ditches many cases..
    printf("WARNING, no Bfact fit bsum= %.2g var= %.2g nmr=%d\n",
	   bsum,bsum2,nmr1);
    free(B_exp);
    B_exp=NULL;
    RMSD_crys=0;
    // FIT_B=-1; // YYY this is probably necessary ?? Ugo: This is wrong
  }else{
    // Fit B factors
    // Fit without rotations
    float offset=0, r=Corr_coeff(B_TNM, B_exp, Na, &slope_NoRot, &offset);
    printf("r(B_pred,B_exp)= %.3f offset= %.3f force const factor=%.4g",
	   r, offset, 1./slope_NoRot);
    printf(" (2 var fit)\n");
    // Fit with rotations
    B_pred_all=malloc(nres1*sizeof(float));
    slope_B=Bfactors_fit(&r_B, outlier_B, f_dof, B_pred_all, B_exp, B_TNM,
			 Xref, Na, nameout1, ridge);
    printf("B-factor fit with rotations, force const factor= %.3g\n", slope_B);
    RMSD_crys_int=sqrt(RMSD_crys*RMSD_crys*f_dof[0]);
    if((r_B<R_MIN)||(slope_B<SLOPE_MIN)){
      printf("WARNING, r_B= %.2f or Bfact slope= %.2g too small\n",
	     r_B,slope_B); 
      if(FIT_B>0)FIT_B=0;
    }
  }

  /*if(FIT_B && ANISOU){
    float **aniso_pred=malloc(N_ref*sizeof(float **));
    Compute_anisou(aniso_pred, N_modes, N_ref, eigen_B, Cart_mode);
    int weight[N_ref];
    float dot_aniso=0, ov_aniso=0, delta_aniso=2.;
    float **aniso_exp=malloc(N_ref*sizeof(float **));
    int n_aniso=Compare_anisou(aniso_pred, aniso_exp, nca, model, inter,
    file_aniso, prot_name, N, weight,
    &dot_aniso, &ov_aniso, &delta_aniso);
    fprintf(file_sum, " %3d %.3f %6.3f %.4f",
    n_aniso, ov_aniso, dot_aniso, delta_aniso);
    }*/

  // factor for simulating ensemble
  if(slope_B){*factor_B=sqrt(slope_NoRot/slope_B);}
  else{*factor_B=-1;}

  double sum_sigma2=0;
  for(i=0; i<NM.N; i++)if(sigma2[i]>0)sum_sigma2+=sigma2[i];
  float kappa=1;
  if((FIT_B>0)&&(slope_B>0)){
    kappa=1./slope_B;
    printf("Force constant: %.4g x %.4g = %.4g    -> K0 = %.4g"
	   "  (Bfactor fit)\n", kappa,KAPPA,kappa*KAPPA,kappa*K0);
  }else if(FIT_B<0){
    kappa= sum_sigma2/(Ref_kin.mass_sum*RMSD_EXP*RMSD_EXP);
    printf("Force constant: %.4g x %.4g = %.4g     -> K0 = %.4g"
	   "   (<RMSD>= %.2f)\n", kappa,KAPPA,kappa*KAPPA,kappa*K0,RMSD_EXP);
  }else { //(FIT_B==0)||(slope_B<=0)
    kappa=1;
    printf("Force constant: %.4g x %.4g = %.4g    -> K0 = %.4g"
	   "    (Default value)\n", kappa,KAPPA,kappa*KAPPA,K0);
  }
  *RMSD_NM=sqrt(sum_sigma2/(Ref_kin.mass_sum*kappa));
  printf("RMSD of normal modes= %.3f (pred)\n", *RMSD_NM);
  if(FIT_B>0 && Temp>0){
    *Temp_comp=Temp;
  }else{
    //*Temp_comp=TEMP_DEF*kappa*KAPPA/KAPPA_DEF;
    *Temp_comp=TEMP_DEF;
  }

  if(anharmonic){sprintf(out,   "#B-factors, anharmonic analysis\n");}
  else{sprintf(out,   "#B-factors, harmonic analysis\n");}

  char tmp[60];
  sprintf(tmp, "r(B_pred,B_exp)       %.3f\n", r_B); strcat(out, tmp);
  sprintf(tmp, "Force constant factor %.3f\n", kappa); strcat(out, tmp);
  sprintf(tmp, "RMSD_crystal          %.3f (all)\n", RMSD_crys);
  strcat(out, tmp);
  sprintf(tmp, "RMSD_crystal          %.3f (internal)\n", RMSD_crys_int);
  strcat(out, tmp);
  sprintf(tmp, "RMSD_Norm.Modes       %.3f\n", *RMSD_NM); strcat(out, tmp);
  /*sprintf(tmp, "Estimated temperature %.1f (kappa= %.3g)\n",
   *Temp_comp, kappa*KAPPA); strcat(out, tmp);*/
  sprintf(tmp, "Internal_fluct        %.3f\n", f_dof[0]); strcat(out, tmp);
  sprintf(tmp, "Translation_fluct     %.3f\n", f_dof[1]); strcat(out, tmp);
  sprintf(tmp, "Rotation_fluct        %.3f\n", f_dof[2]); strcat(out, tmp);

  //  Print B factors
  // Rescale predicted B factors
  for(i=0; i<nres1; i++)B_TNM[i]/=kappa;
  Print_B_fact(B_TNM, B_pred_all, B_exp, Na, atoms1, Bref,
	      seq1, nameout, "Bfact", r_B, slope_B, f_dof, ridge);
  if(B_exp)free(B_exp);
  if(B_pred_all)free(B_pred_all);
  printf("FIT_B= %d kappa= %.3g\n", FIT_B, kappa);

  return(kappa);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq 0x148(%rbp), %rax
movq 0x140(%rbp), %rax
movq 0x138(%rbp), %rax
movq 0x130(%rbp), %rax
movl 0x128(%rbp), %eax
movl 0x120(%rbp), %eax
movq 0x118(%rbp), %rax
movq 0x110(%rbp), %rax
leaq 0xe0(%rbp), %rax
movq %rax, -0x1b0(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movss %xmm0, -0x34(%rbp)
movl %r9d, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jne 0x3b28a
movq -0x1a8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
leaq -0xb0(%rbp), %rdi
movq 0x138(%rbp), %rdx
leaq 0x4111d(%rip), %rsi     # 0x7c39e
movb $0x0, %al
callq 0x1200
jmp 0x3b2b8
movq -0x1a8(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0x40(%rbp)
leaq -0xb0(%rbp), %rdi
movq 0x138(%rbp), %rdx
leaq 0x43357(%rip), %rsi     # 0x7e608
movb $0x0, %al
callq 0x1200
movq -0x1b0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xbc(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xc8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd 0x4331b(%rip), %xmm0    # 0x7e600
movsd %xmm0, -0xd8(%rbp)
movsd 0x4117b(%rip), %xmm0    # 0x7c470
mulsd -0xd8(%rbp), %xmm0
mulsd -0xd8(%rbp), %xmm0
movsd 0x4112b(%rip), %xmm1    # 0x7c438
divsd %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
movl 0x3ad9d(%rip), %eax     # 0x760bc
movl %eax, -0xe4(%rbp)
movq 0x110(%rbp), %rdi
leaq 0x3b016(%rip), %rsi     # 0x76349
callq 0x1140
cmpl $0x0, %eax
jne 0x3b350
leaq -0xe4(%rbp), %rdi
leaq 0x3affe(%rip), %rsi     # 0x76349
callq 0x1060
movl $0x0, -0xe8(%rbp)
movl $0x0, -0xec(%rbp)
movl 0x120(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0xf8(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x1c0(%rbp)
movq %rcx, %rsp
movq %rax, -0x100(%rbp)
movl 0x120(%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, -0x1b8(%rbp)
movq %rcx, %rsp
movq %rax, -0x108(%rbp)
movslq -0xbc(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1180
movq %rax, -0x110(%rbp)
movq $0x0, -0x118(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0xbc(%rbp), %eax
jge 0x3b600
movq -0x1b0(%rbp), %rcx
movq 0x130(%rbp), %rax
movq 0x28(%rcx), %rcx
movslq -0xb4(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rdi
addq $0x18, %rdi
leaq -0xe4(%rbp), %rsi
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x3b497
movq 0x118(%rbp), %rax
movq -0x120(%rbp), %rcx
movslq 0x64(%rcx), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsbl 0x13(%rax), %eax
cmpl $0x47, %eax
jne 0x3b492
movq -0x120(%rbp), %rdi
addq $0x18, %rdi
leaq 0x3ae85(%rip), %rsi     # 0x76308
movl $0x2, %edx
callq 0x1050
cmpl $0x0, %eax
je 0x3b497
jmp 0x3b5ec
movq -0x1a8(%rbp), %rax
movq -0x1c0(%rbp), %rcx
movq -0x1b0(%rbp), %rdx
movq 0x28(%rdx), %rdx
movslq -0xb4(%rbp), %rsi
movl (%rdx,%rsi,4), %esi
movslq -0xe8(%rbp), %rdx
movl %esi, (%rcx,%rdx,4)
movq 0x38(%rax), %rdi
movq -0x40(%rbp), %rsi
movl (%rax), %edx
movl -0xb4(%rbp), %ecx
movl -0xb4(%rbp), %r8d
callq 0x3bf80
movq -0x18(%rbp), %rax
movslq -0xe8(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x120(%rbp), %rax
movss 0x1c(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
divsd -0xe0(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x110(%rbp), %rax
movslq -0xe8(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x110(%rbp), %rax
movslq -0xe8(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq -0x110(%rbp), %rax
movslq -0xe8(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x110(%rbp), %rax
movslq -0xe8(%rbp), %rcx
mulss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movl $0x0, -0xb8(%rbp)
cmpl $0x3, -0xb8(%rbp)
jge 0x3b5dd
movq -0x1b8(%rbp), %rax
movq -0x120(%rbp), %rcx
movslq -0xb8(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq -0xec(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x3b58a
movl -0xe8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe8(%rbp)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x3b3f1
cvtsi2sdl -0xe8(%rbp), %xmm1
movsd -0xc8(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0xd0(%rbp), %xmm1
cvtsi2sdl -0xe8(%rbp), %xmm0
divsd %xmm0, %xmm1
movsd -0xc8(%rbp), %xmm0
movsd -0xc8(%rbp), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0xc8(%rbp), %xmm0
callq 0x1220
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x124(%rbp)
movss 0x3a9e8(%rip), %xmm0    # 0x76070
movss %xmm0, -0x128(%rbp)
movl -0xe8(%rbp), %esi
leaq -0xe4(%rbp), %rdx
movl 0x120(%rbp), %ecx
leaq 0x42f6c(%rip), %rdi     # 0x7e616
movb $0x0, %al
callq 0x10d0
movss -0x124(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42f77(%rip), %rdi     # 0x7e63b
movb $0x1, %al
callq 0x10d0
movb $0x43, -0x129(%rbp)
movss 0x40d0e(%rip), %xmm0    # 0x7c3e8
movss %xmm0, -0x130(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x134(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x138(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x13c(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x148(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x144(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x140(%rbp)
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl 0x120(%rbp), %eax
jge 0x3b762
movq 0x148(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x3b72e
movsd -0xc8(%rbp), %xmm1
movss -0x130(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
ja 0x3b79f
movsd -0xd0(%rbp), %xmm1
movss -0x130(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
ja 0x3b79f
cmpl $0x0, 0x128(%rbp)
je 0x3b7ea
movsd -0xc8(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
movl 0x128(%rbp), %esi
leaq 0x42ea8(%rip), %rdi     # 0x7e664
movb $0x2, %al
callq 0x10d0
movq -0x110(%rbp), %rdi
callq 0x1040
movq $0x0, -0x110(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x124(%rbp)
jmp 0x3b99c
xorps %xmm0, %xmm0
movss %xmm0, -0x14c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x110(%rbp), %rsi
movl -0xe8(%rbp), %edx
leaq -0x13c(%rbp), %rcx
leaq -0x14c(%rbp), %r8
callq 0x15750
movss %xmm0, -0x150(%rbp)
movss -0x150(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x14c(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movss -0x13c(%rbp), %xmm2
cvtss2sd %xmm2, %xmm3
movsd 0x3a7fb(%rip), %xmm2    # 0x76048
divsd %xmm3, %xmm2
leaq 0x42e3f(%rip), %rdi     # 0x7e697
movb $0x3, %al
callq 0x10d0
leaq 0x42e6c(%rip), %rdi     # 0x7e6d2
movb $0x0, %al
callq 0x10d0
movslq 0x120(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1180
movq -0x1b8(%rbp), %r11
movq %rax, -0x118(%rbp)
movq 0x148(%rbp), %rsi
leaq -0x148(%rbp), %rdx
movq -0x118(%rbp), %rcx
movq -0x110(%rbp), %r8
movq -0x18(%rbp), %r9
movl -0xe8(%rbp), %r10d
movq 0x138(%rbp), %rax
leaq -0x134(%rbp), %rdi
subq $0x20, %rsp
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movsbl -0x129(%rbp), %eax
movl %eax, 0x18(%rsp)
callq 0x3c0a0
addq $0x20, %rsp
movss %xmm0, -0x138(%rbp)
movss -0x138(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42ddf(%rip), %rdi     # 0x7e6e0
movb $0x1, %al
callq 0x10d0
movss -0x124(%rbp), %xmm0
mulss -0x124(%rbp), %xmm0
mulss -0x148(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1220
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x128(%rbp)
movss -0x134(%rbp), %xmm1
leaq 0x50744(%rip), %rax     # 0x8c088
movss (%rax), %xmm0
ucomiss %xmm1, %xmm0
ja 0x3b965
movss -0x138(%rbp), %xmm1
leaq 0x50730(%rip), %rax     # 0x8c08c
movss (%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x3b99a
movss -0x134(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x138(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x42d93(%rip), %rdi     # 0x7e717
movb $0x2, %al
callq 0x10d0
cmpl $0x0, -0xc(%rbp)
jle 0x3b998
movl $0x0, -0xc(%rbp)
jmp 0x3b99a
jmp 0x3b99c
movss -0x138(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3b9b0
jp 0x3b9b0
jmp 0x3b9da
movss -0x13c(%rbp), %xmm0
divss -0x138(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x1220
cvtsd2ss %xmm0, %xmm0
movq 0x140(%rbp), %rax
movss %xmm0, (%rax)
jmp 0x3b9ed
movq 0x140(%rbp), %rax
movss 0x3a687(%rip), %xmm0    # 0x76070
movss %xmm0, (%rax)
xorps %xmm0, %xmm0
movsd %xmm0, -0x158(%rbp)
movl $0x0, -0xb4(%rbp)
movq -0x1a8(%rbp), %rcx
movl -0xb4(%rbp), %eax
cmpl (%rcx), %eax
jge 0x3ba62
movq -0x40(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x3ba4f
movq -0x40(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x158(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
jmp 0x3ba51
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x3ba02
movss 0x3a626(%rip), %xmm0    # 0x76090
movss %xmm0, -0x15c(%rbp)
cmpl $0x0, -0xc(%rbp)
jle 0x3bb10
movss -0x138(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x3bb10
movss -0x138(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x3a5a4(%rip), %xmm0    # 0x76048
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x15c(%rbp)
movss -0x15c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x50571(%rip), %rax     # 0x8c038
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movss -0x15c(%rbp), %xmm2
leaq 0x5055a(%rip), %rax     # 0x8c038
mulss (%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movss -0x15c(%rbp), %xmm3
cvtss2sd %xmm3, %xmm3
leaq 0x50547(%rip), %rax     # 0x8c040
mulsd (%rax), %xmm3
leaq 0x42c46(%rip), %rdi     # 0x7e74a
movb $0x4, %al
callq 0x10d0
jmp 0x3bc1d
cmpl $0x0, -0xc(%rbp)
jge 0x3bbc0
movq -0x1b0(%rbp), %rax
movsd -0x158(%rbp), %xmm0
movss 0x8(%rax), %xmm1
leaq 0x5055b(%rip), %rax     # 0x8c090
mulss (%rax), %xmm1
leaq 0x50550(%rip), %rax     # 0x8c090
mulss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x15c(%rbp)
movss -0x15c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x504cd(%rip), %rax     # 0x8c038
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movss -0x15c(%rbp), %xmm2
leaq 0x504b6(%rip), %rax     # 0x8c038
mulss (%rax), %xmm2
cvtss2sd %xmm2, %xmm2
movss -0x15c(%rbp), %xmm3
cvtss2sd %xmm3, %xmm3
leaq 0x504a3(%rip), %rax     # 0x8c040
mulsd (%rax), %xmm3
leaq 0x504e8(%rip), %rax     # 0x8c090
movss (%rax), %xmm4
cvtss2sd %xmm4, %xmm4
leaq 0x42bd6(%rip), %rdi     # 0x7e78d
movb $0x5, %al
callq 0x10d0
jmp 0x3bc1b
movss 0x3a4c8(%rip), %xmm0    # 0x76090
movss %xmm0, -0x15c(%rbp)
movss -0x15c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x50455(%rip), %rax     # 0x8c038
movss (%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movss -0x15c(%rbp), %xmm2
leaq 0x5043e(%rip), %rax     # 0x8c038
mulss (%rax), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x50437(%rip), %rax     # 0x8c040
movsd (%rax), %xmm3
leaq 0x42bbf(%rip), %rdi     # 0x7e7d3
movb $0x4, %al
callq 0x10d0
jmp 0x3bc1d
movq -0x1b0(%rbp), %rax
movsd -0x158(%rbp), %xmm0
movss 0x8(%rax), %xmm1
mulss -0x15c(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
callq 0x1220
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, (%rax)
movq -0x20(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42bb5(%rip), %rdi     # 0x7e81a
movb $0x1, %al
callq 0x10d0
cmpl $0x0, -0xc(%rbp)
jle 0x3bc8e
movss -0x34(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x3bc8e
movss -0x34(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, (%rax)
jmp 0x3bca1
leaq 0x4e4c3(%rip), %rax     # 0x8a158
movss (%rax), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, (%rax)
cmpl $0x0, -0x38(%rbp)
je 0x3bcbb
movq -0x28(%rbp), %rdi
leaq 0x42b8b(%rip), %rsi     # 0x7e83d
movb $0x0, %al
callq 0x1200
jmp 0x3bccd
movq -0x28(%rbp), %rdi
leaq 0x42b98(%rip), %rsi     # 0x7e85e
movb $0x0, %al
callq 0x1200
leaq -0x1a0(%rbp), %rdi
movss -0x134(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42b96(%rip), %rsi     # 0x7e87d
movb $0x1, %al
callq 0x1200
movq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11e0
leaq -0x1a0(%rbp), %rdi
movss -0x15c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42b81(%rip), %rsi     # 0x7e899
movb $0x1, %al
callq 0x1200
movq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11e0
leaq -0x1a0(%rbp), %rdi
movss -0x124(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42b6c(%rip), %rsi     # 0x7e8b5
movb $0x1, %al
callq 0x1200
movq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11e0
leaq -0x1a0(%rbp), %rdi
movss -0x128(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42b5d(%rip), %rsi     # 0x7e8d7
movb $0x1, %al
callq 0x1200
movq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11e0
leaq -0x1a0(%rbp), %rdi
movq -0x20(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42b53(%rip), %rsi     # 0x7e8fe
movb $0x1, %al
callq 0x1200
movq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11e0
leaq -0x1a0(%rbp), %rdi
movss -0x148(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42b3e(%rip), %rsi     # 0x7e91a
movb $0x1, %al
callq 0x1200
movq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11e0
leaq -0x1a0(%rbp), %rdi
movss -0x144(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42b29(%rip), %rsi     # 0x7e936
movb $0x1, %al
callq 0x1200
movq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11e0
leaq -0x1a0(%rbp), %rdi
movss -0x140(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42b14(%rip), %rsi     # 0x7e952
movb $0x1, %al
callq 0x1200
movq -0x28(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x11e0
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl 0x120(%rbp), %eax
jge 0x3be9f
movss -0x15c(%rbp), %xmm1
movq -0x18(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
divss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x3be5f
movq -0x1c0(%rbp), %r9
movq -0x18(%rbp), %rdi
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdx
movl -0xe8(%rbp), %ecx
movq 0x130(%rbp), %r8
movq 0x118(%rbp), %rbx
leaq -0xb0(%rbp), %r11
movss -0x134(%rbp), %xmm0
movss -0x138(%rbp), %xmm1
leaq -0x148(%rbp), %rax
leaq 0x42a7d(%rip), %r10     # 0x7e96e
subq $0x30, %rsp
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movsbl -0x129(%rbp), %eax
movl %eax, 0x20(%rsp)
callq 0x3a1c0
addq $0x30, %rsp
cmpq $0x0, -0x110(%rbp)
je 0x3bf32
movq -0x110(%rbp), %rdi
callq 0x1040
cmpq $0x0, -0x118(%rbp)
je 0x3bf48
movq -0x118(%rbp), %rdi
callq 0x1040
movl -0xc(%rbp), %esi
movss -0x15c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42a16(%rip), %rdi     # 0x7e974
movb $0x1, %al
callq 0x10d0
movss -0x15c(%rbp), %xmm0
movq -0xf8(%rbp), %rax
movq %rax, %rsp
leaq -0x8(%rbp), %rsp
popq %rbx
popq %rbp
retq
nop