// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movss %xmm0, -0xcc(%rbp)
movq %rdx, -0xe0(%rbp)
movq %rsi, %r15
movl %edi, -0x48(%rbp)
movq 0x138(%rbp), %rdx
movq 0x110(%rbp), %rbx
leaq 0x10(%rbp), %r14
movl %r9d, -0x6c(%rbp)
testl %r9d, %r9d
movq %rcx, -0xd8(%rbp)
movq %r8, -0x108(%rbp)
je 0x26d38
movq 0x88(%r14), %rax
movq %rax, -0x58(%rbp)
leaq 0x2c784(%rip), %rsi     # 0x534ac
leaq -0x1c0(%rbp), %rdi
xorl %eax, %eax
callq 0x2260
jmp 0x26d4f
movq 0x28(%r14), %rax
movq %rax, -0x58(%rbp)
leaq -0x1c0(%rbp), %rdi
movq %rdx, %rsi
callq 0x2080
movq %r15, -0x38(%rbp)
leaq 0xe0(%rbp), %rax
movslq (%rax), %r12
movl $0x4143, -0x3c(%rbp)    # imm = 0x4143
cmpb $0x43, (%rbx)
jne 0x26d7f
cmpb $0x42, 0x1(%rbx)
jne 0x26d7f
cmpb $0x0, 0x2(%rbx)
jne 0x26d7f
movb $0x0, -0x3a(%rbp)
movw $0x4243, -0x3c(%rbp)    # imm = 0x4243
movq %rsp, -0x110(%rbp)
movl 0x120(%rbp), %eax
movq %rax, %rdx
movl %edx, %eax
movq %rsp, %rcx
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0xf0(%rbp)
movq %rcx, %rsp
leal (%rdx,%rdx,2), %eax
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x60(%rbp)
movq %rcx, %rsp
movq %r12, %rdi
shlq $0x2, %rdi
callq 0x21d0
movq %rax, -0x68(%rbp)
leaq 0xe0(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xb0(%rbp)
movq 0x38(%r14), %rax
movq %rax, -0x98(%rbp)
movl (%r14), %eax
movq %rax, -0xe8(%rbp)
xorl %r15d, %r15d
testl %r12d, %r12d
movl $0x0, %eax
cmovgl %r12d, %eax
movq %rax, -0x30(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x90(%rbp)
xorl %r14d, %r14d
movq $0x0, -0x50(%rbp)
cmpq -0x30(%rbp), %r15
je 0x26f41
movq -0xb0(%rbp), %rax
movslq (%rax,%r15,4), %r13
imulq $0x70, %r13, %rax
movq 0x130(%rbp), %rcx
leaq (%rcx,%rax), %rbx
leaq (%rcx,%rax), %r12
addq $0x18, %r12
movq %r12, %rdi
leaq -0x3c(%rbp), %rsi
pushq $0x2
popq %rdx
callq 0x2070
testl %eax, %eax
je 0x26e98
movslq 0x64(%rbx), %rax
shlq $0x5, %rax
movq 0x118(%rbp), %rcx
cmpb $0x47, 0x13(%rcx,%rax)
jne 0x26f39
cmpb $0x43, (%r12)
jne 0x26f39
cmpb $0x41, 0x19(%rbx)
jne 0x26f39
movslq -0x50(%rbp), %r12
movq -0xf0(%rbp), %rax
movl %r13d, (%rax,%r12,4)
movq -0x98(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0xe8(%rbp), %rdx
movl %r15d, %ecx
movl %r15d, %r8d
callq 0x276bb
movq -0x38(%rbp), %rax
movss %xmm0, (%rax,%r12,4)
cvtss2sd 0x1c(%rbx), %xmm0
divsd 0x2c5c5(%rip), %xmm0    # 0x534a0
cvtsd2ss %xmm0, %xmm1
movaps %xmm1, %xmm0
mulss %xmm1, %xmm0
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtps2pd %xmm0, %xmm0
movq -0x68(%rbp), %rax
movss %xmm1, (%rax,%r12,4)
movslq %r14d, %rax
movq -0x60(%rbp), %rcx
leaq (%rcx,%rax,4), %rcx
xorl %eax, %eax
cmpq $0x3, %rax
je 0x26f18
cvtsd2ss (%rbx,%rax,8), %xmm1
movss %xmm1, (%rcx,%rax,4)
incq %rax
jmp 0x26f03
movapd -0x90(%rbp), %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, -0x90(%rbp)
addl %eax, %r14d
movq -0x50(%rbp), %rax
incl %eax
movq %rax, -0x50(%rbp)
incq %r15
jmp 0x26e2a
cvtsi2sdl -0x50(%rbp), %xmm1
movapd -0x90(%rbp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movsd %xmm1, -0xb8(%rbp)
divsd %xmm1, %xmm0
movapd 0x2415a(%rip), %xmm1    # 0x4b0c0
xorpd %xmm0, %xmm1
ucomisd %xmm1, %xmm0
movapd %xmm0, -0xb0(%rbp)
movapd %xmm1, -0x100(%rbp)
jb 0x26f86
sqrtsd %xmm0, %xmm0
jmp 0x26f8b
callq 0x2290
movl -0x48(%rbp), %r14d
movq -0x38(%rbp), %r15
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x30(%rbp)
leaq 0x2c517(%rip), %rdi     # 0x534ba
xorl %ebx, %ebx
leaq -0x3c(%rbp), %rdx
movq -0x50(%rbp), %rsi
movl 0x120(%rbp), %r13d
movl %r13d, %ecx
xorl %eax, %eax
callq 0x20f0
cvtss2sd -0x30(%rbp), %xmm0
leaq 0x2c515(%rip), %rdi     # 0x534df
movsd %xmm0, -0x98(%rbp)
movb $0x1, %al
callq 0x20f0
andl $0x0, -0x74(%rbp)
andl $0x0, -0x70(%rbp)
andq $0x0, -0xc8(%rbp)
andl $0x0, -0xc0(%rbp)
testl %r13d, %r13d
movl $0x0, %r12d
cmovgl %r13d, %r12d
movq 0x148(%rbp), %rax
movl 0x128(%rbp), %esi
movapd -0xb0(%rbp), %xmm0
movapd -0x100(%rbp), %xmm1
cmpq %rbx, %r12
je 0x27028
andl $0x0, (%rax,%rbx,4)
incq %rbx
jmp 0x2701a
movapd -0x90(%rbp), %xmm2
divsd -0xb8(%rbp), %xmm2
mulsd %xmm0, %xmm1
addsd %xmm2, %xmm1
movsd 0x2a2a0(%rip), %xmm2    # 0x512e8
ucomisd %xmm0, %xmm2
jbe 0x271a0
leaq 0x2c4af(%rip), %rdi     # 0x53508
movb $0x2, %al
callq 0x20f0
movq -0x68(%rbp), %rdi
callq 0x2050
movss 0x23f93(%rip), %xmm0    # 0x4b004
xorpd %xmm1, %xmm1
movsd %xmm1, -0x98(%rbp)
movsd 0x28fbb(%rip), %xmm1    # 0x50040
movsd %xmm1, -0x48(%rbp)
xorps %xmm1, %xmm1
movss %xmm1, -0x60(%rbp)
movq $0x0, -0x100(%rbp)
movss %xmm1, -0xb0(%rbp)
xorpd %xmm2, %xmm2
movq $0x0, -0x68(%rbp)
movl -0x6c(%rbp), %ebx
movq -0x58(%rbp), %rcx
movq 0x140(%rbp), %rax
movss %xmm0, (%rax)
xorl %eax, %eax
movq -0xe8(%rbp), %rdx
testl %edx, %edx
cmovlel %eax, %edx
xorps %xmm3, %xmm3
xorps %xmm0, %xmm0
cmpq %rax, %rdx
je 0x270f3
movss (%rcx,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x270ee
cvtss2sd %xmm1, %xmm1
addsd %xmm1, %xmm3
incq %rax
jmp 0x270d7
testl %r14d, %r14d
movss %xmm2, -0x90(%rbp)
movsd %xmm3, -0x38(%rbp)
jle 0x2715b
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm2
jbe 0x2715b
movss 0x23efb(%rip), %xmm3    # 0x4b010
divss %xmm2, %xmm3
movss %xmm3, -0x30(%rbp)
cvtss2sd %xmm3, %xmm0
leaq 0x3cf4f(%rip), %rax     # 0x64078
movss (%rax), %xmm2
cvtss2sd %xmm2, %xmm1
mulss %xmm3, %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x3cf40(%rip), %rax     # 0x64080
movsd (%rax), %xmm3
mulsd %xmm0, %xmm3
leaq 0x2c491(%rip), %rdi     # 0x535e0
movb $0x4, %al
callq 0x20f0
jmp 0x27323
testl %r14d, %r14d
js 0x272b2
leaq 0x3cf0d(%rip), %rax     # 0x64078
cvtss2sd (%rax), %xmm1
leaq 0x3cf0a(%rip), %rax     # 0x64080
movsd (%rax), %xmm3
leaq 0x2c4e8(%rip), %rdi     # 0x53669
movsd 0x23ebf(%rip), %xmm0    # 0x4b048
movaps %xmm1, %xmm2
movb $0x4, %al
callq 0x20f0
movss 0x23e75(%rip), %xmm1    # 0x4b010
jmp 0x27328
testl %esi, %esi
jne 0x27052
ucomisd %xmm1, %xmm2
ja 0x27052
leaq -0x150(%rbp), %r14
andl $0x0, (%r14)
leaq -0x70(%rbp), %r15
movq -0x38(%rbp), %rdi
movq -0x68(%rbp), %rbx
movq %rbx, %rsi
movq -0x50(%rbp), %r13
movl %r13d, %edx
movq %r15, %rcx
movq %r14, %r8
callq 0xfe18
cvtss2sd %xmm0, %xmm0
cvtss2sd (%r14), %xmm1
cvtss2sd (%r15), %xmm3
movq -0x38(%rbp), %r15
movsd 0x23e50(%rip), %xmm2    # 0x4b048
divsd %xmm3, %xmm2
leaq 0x2c338(%rip), %rdi     # 0x5353b
movb $0x3, %al
callq 0x20f0
leaq 0x2c75a(%rip), %rdi     # 0x5396b
callq 0x2090
movl 0x120(%rbp), %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x21d0
leaq -0x74(%rbp), %rdi
leaq -0xc8(%rbp), %r14
movq 0x148(%rbp), %rsi
movq %r14, %rdx
movq %rax, %rcx
movq %rax, -0x100(%rbp)
movq %rbx, %r8
movq %r15, %r9
pushq $0x43
pushq 0x138(%rbp)
pushq %r13
pushq -0x60(%rbp)
callq 0x27737
addq $0x20, %rsp
movss %xmm0, -0x90(%rbp)
cvtss2sd %xmm0, %xmm0
leaq 0x2c300(%rip), %rdi     # 0x53576
movsd %xmm0, -0xb8(%rbp)
movb $0x1, %al
callq 0x20f0
movss -0x30(%rbp), %xmm0
mulss %xmm0, %xmm0
movss (%r14), %xmm1
mulss %xmm1, %xmm0
xorpd %xmm2, %xmm2
ucomiss %xmm2, %xmm0
movss %xmm1, -0x60(%rbp)
jb 0x275f1
sqrtss %xmm0, %xmm3
jmp 0x275f9
leaq 0x3ce17(%rip), %rax     # 0x640d0
movss (%rax), %xmm4
leaq 0xe0(%rbp), %rax
movss 0x8(%rax), %xmm0
mulss %xmm4, %xmm0
mulss %xmm4, %xmm0
cvtss2sd %xmm0, %xmm0
movsd -0x38(%rbp), %xmm1
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm3
movss %xmm3, -0x30(%rbp)
cvtss2sd %xmm3, %xmm0
leaq 0x3cd86(%rip), %rax     # 0x64078
movss (%rax), %xmm2
cvtss2sd %xmm2, %xmm1
mulss %xmm3, %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x3cd77(%rip), %rax     # 0x64080
movsd (%rax), %xmm3
mulsd %xmm0, %xmm3
cvtss2sd %xmm4, %xmm4
leaq 0x2c307(%rip), %rdi     # 0x53623
movb $0x5, %al
callq 0x20f0
movss -0x30(%rbp), %xmm1
leaq 0xe0(%rbp), %rax
movss 0x8(%rax), %xmm0
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm2
movsd -0x38(%rbp), %xmm0
divsd %xmm2, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
movss %xmm1, -0x30(%rbp)
jb 0x2735a
sqrtsd %xmm0, %xmm0
jmp 0x2735f
callq 0x2290
cvtsd2ss %xmm0, %xmm0
movq -0xe0(%rbp), %rax
movss %xmm0, (%rax)
cvtss2sd %xmm0, %xmm0
leaq 0x2c337(%rip), %rdi     # 0x536b0
movb $0x1, %al
callq 0x20f0
leaq 0x3ae11(%rip), %rax     # 0x62198
movss (%rax), %xmm0
movss -0xcc(%rbp), %xmm3
movaps %xmm3, %xmm1
testl %r14d, %r14d
jg 0x2739e
movaps %xmm0, %xmm1
xorpd %xmm2, %xmm2
cmpltss %xmm3, %xmm2
andps %xmm2, %xmm1
andnps %xmm0, %xmm2
orps %xmm1, %xmm2
movq -0x108(%rbp), %rax
movss %xmm2, (%rax)
testl %ebx, %ebx
je 0x273e5
movups 0x2c31d(%rip), %xmm0    # 0x536e3
movq -0xd8(%rbp), %r13
movups %xmm0, 0x10(%r13)
movups 0x2c2fa(%rip), %xmm0    # 0x536d3
movups %xmm0, (%r13)
movb $0x0, 0x20(%r13)
jmp 0x27404
movups 0x2c317(%rip), %xmm0    # 0x53703
movq -0xd8(%rbp), %r13
movups %xmm0, 0xf(%r13)
movups 0x2c2f5(%rip), %xmm0    # 0x536f4
movups %xmm0, (%r13)
cvtss2sd -0xb0(%rbp), %xmm0
leaq 0x2c300(%rip), %rsi     # 0x53713
leaq -0x150(%rbp), %rbx
movq %rbx, %rdi
movb $0x1, %al
callq 0x2260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2240
cvtss2sd -0x30(%rbp), %xmm0
leaq 0x2c2f4(%rip), %rsi     # 0x5372f
movq %rbx, %rdi
movsd %xmm0, -0x38(%rbp)
movb $0x1, %al
callq 0x2260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2240
leaq 0x2c2ef(%rip), %rsi     # 0x5374b
movq %rbx, %rdi
movsd -0x98(%rbp), %xmm0
movb $0x1, %al
callq 0x2260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2240
leaq 0x2c2ed(%rip), %rsi     # 0x5376d
movq %rbx, %rdi
movsd -0x48(%rbp), %xmm0
movb $0x1, %al
callq 0x2260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2240
movq -0xe0(%rbp), %rax
cvtss2sd (%rax), %xmm0
leaq 0x2c2e8(%rip), %rsi     # 0x53794
movq %rbx, %rdi
movb $0x1, %al
callq 0x2260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2240
cvtss2sd -0x60(%rbp), %xmm0
leaq 0x2c2e3(%rip), %rsi     # 0x537b0
movq %rbx, %rdi
movb $0x1, %al
callq 0x2260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2240
cvtss2sd -0xc4(%rbp), %xmm0
leaq 0x2c2db(%rip), %rsi     # 0x537cc
movq %rbx, %rdi
movb $0x1, %al
callq 0x2260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2240
cvtss2sd -0xc0(%rbp), %xmm0
leaq 0x2c2d3(%rip), %rsi     # 0x537e8
movq %rbx, %rdi
movb $0x1, %al
callq 0x2260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2240
movss -0x30(%rbp), %xmm2
xorl %eax, %eax
movss -0x90(%rbp), %xmm1
cmpq %rax, %r12
je 0x27553
movss (%r15,%rax,4), %xmm0
divss %xmm2, %xmm0
movss %xmm0, (%r15,%rax,4)
incq %rax
jmp 0x27539
subq $0x8, %rsp
leaq -0xc8(%rbp), %rax
leaq 0x2c29f(%rip), %r10     # 0x53804
leaq -0x1c0(%rbp), %r11
movq %r15, %rdi
movq -0x100(%rbp), %r15
movq %r15, %rsi
movq -0x68(%rbp), %rbx
movq %rbx, %rdx
movq -0x50(%rbp), %rcx
movq 0x130(%rbp), %r8
movq -0xf0(%rbp), %r9
movss -0xb0(%rbp), %xmm0
pushq $0x43
pushq %rax
pushq %r10
pushq %r11
pushq 0x118(%rbp)
callq 0x262c8
addq $0x30, %rsp
movq %rbx, %rdi
callq 0x2050
movq %r15, %rdi
callq 0x2050
leaq 0x2c243(%rip), %rdi     # 0x5380a
movl %r14d, %esi
movsd -0x38(%rbp), %xmm0
movb $0x1, %al
callq 0x20f0
movq -0x110(%rbp), %rsp
movss -0x30(%rbp), %xmm0
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x21c0
movaps %xmm0, %xmm3
movl -0x48(%rbp), %r14d
movss -0x74(%rbp), %xmm1
leaq 0x3cabf(%rip), %rax     # 0x640c8
movss (%rax), %xmm0
movss %xmm1, -0xb0(%rbp)
ucomiss %xmm1, %xmm0
movl -0x6c(%rbp), %ebx
movss -0x90(%rbp), %xmm2
ja 0x27635
leaq 0x3caa0(%rip), %rax     # 0x640cc
movss (%rax), %xmm0
ucomiss %xmm2, %xmm0
jbe 0x2766e
cvtss2sd -0xb0(%rbp), %xmm0
leaq 0x2bf69(%rip), %rdi     # 0x535ad
movsd -0xb8(%rbp), %xmm1
movb $0x2, %al
movss %xmm3, -0x30(%rbp)
callq 0x20f0
movss -0x30(%rbp), %xmm3
movss -0x90(%rbp), %xmm2
movl %r14d, %eax
sarl $0x1f, %eax
andl %eax, %r14d
movq -0x58(%rbp), %rcx
cvtss2sd %xmm3, %xmm0
movsd %xmm0, -0x48(%rbp)
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm2
jne 0x27685
jnp 0x2769c
movss -0x70(%rbp), %xmm0
divss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jb 0x276a9
sqrtss %xmm0, %xmm0
jmp 0x270b8
movss 0x23960(%rip), %xmm0    # 0x4b004
jmp 0x270b8
callq 0x21c0
movss -0x90(%rbp), %xmm2
jmp 0x270b4