// File: /workspace/github_c_makefile_star2_O2/ugobas[P]tnm/nma.c
// Function: Compute_Hessian_TNM
void Compute_Hessian_TNM(double **Hessian,  // Output
			 double **T_sqrt, float **T_sqrt_inv,
			 struct interaction *Int_list, int N_int,
			 atom *atoms, int N_atoms, struct axe *axes,
			 int nmain, int N_axes, int N_modes,
			 struct chain *chains, int Nchain, int kinetic,
			 float K_OMEGA, float K_PSI,
			 float K_PHI, float K_CHI,
			 float K_BA, float K_BL)
{


  // Compute transformed jacobian
  // Jtilde_ia = sum_b J_ib T_sqrt_inv_ab = eta_ia X r_i - tau_ia
  // eta_ak = sum_b chi_kb v_b T_sqrt_inv_ab
  // tau_ak = sum_b chi_kb shift_b T_sqrt_inv_ab
  //
  printf("Computing torsional Hessian matrix\n");

  int i, j, k, l, n, a;
  for(i=0; i<N_axes; i++)for(j=0; j<N_axes; j++)Hessian[i][j]=0;

  double **eta_iaj[N_axes], **tau_iaj[N_axes];
  for(i=0; i<N_axes; i++){
    eta_iaj[i]=Allocate_mat2_d(N_modes, 3);
    tau_iaj[i]=Allocate_mat2_d(N_modes, 3);
  }

  if(kinetic==0){
    for(a=0; a<N_axes; a++){
      struct axe *a_axe=axes+a;
      for(i=a; i<N_modes; i++){
	double *eta=eta_iaj[i][a], *tau=tau_iaj[i][a];
	for(j=0; j<3; j++){
	  eta[j]=a_axe->rot[j];
	  tau[j]=a_axe->shift[j];
	}
      }
    }

  }else if(T_sqrt_inv){

    for(i=0; i<N_axes; i++){
      struct axe *i_axe=axes+i;
      // eta_ia = sum_{ini_chain<=b<=i} v_b T_sqrt_inv_ab
      for(a=0; a<N_modes; a++){
	double *eta=eta_iaj[i][a], *tau=tau_iaj[i][a];
	if(i_axe->previous >=0){
	  double *eta_prev=eta_iaj[i_axe->previous][a];
	  double *tau_prev=tau_iaj[i_axe->previous][a];
	  for(j=0; j<3; j++){
	    eta[j]=eta_prev[j]; tau[j]=tau_prev[j];
	  }
	}else{
	  for(j=0; j<3; j++){eta[j]=0; tau[j]=0;}
	}
	for(j=0; j<3; j++){
	  eta[j]+=(i_axe->rot[j])*T_sqrt_inv[a][i];
	  tau[j]+=(i_axe->shift[j])*T_sqrt_inv[a][i];
	}
      }
    }
  }else{   // Cholevsky decomposition has been successfully performed
    // Solve L eta_ia = v(i) by forward substitution
    // Note that v_b(i) =0 for b>rotable_i
    printf("Computing Hessian with Cholevsky decomposition\n");
    double X[N_axes], Y[N_axes];
    int main1=-1, main2=-1, side1=-1, side2=-1;
    for(i=0; i<N_axes; i++){

      for(l=0; l<N_axes; l++)Y[l]=0;
      Axes_path(&main1, &main2, &side1, &side2, axes, i, nmain, N_axes);
      double **eta=eta_iaj[i], **tau=tau_iaj[i];

      for(j=0; j<3; j++){
	for(l=main1; l<=main2; l++)Y[l]=axes[l].rot[j];
	if(side1>=0)for(l=side1; l<=side2; l++)Y[l]=axes[l].rot[j];
	Forward_substitution(X, T_sqrt, Y, N_axes);
	for(a=0; a<N_axes; a++)eta[a][j]=X[a];
	//
	for(l=main1; l<=main2; l++)Y[l]=axes[l].shift[j];
	if(side1>=0)for(l=side1; l<=side2; l++)Y[l]=axes[l].shift[j];
	Forward_substitution(X, T_sqrt, Y, N_axes);
	for(a=0; a<N_axes; a++)tau[a][j]=X[a];
      }
    }
  }

  // Compute Hessian in double precision (only upper diagonal)

  double **zero=Allocate_mat2_d(N_modes, 3);
  int N_cont[Nchain], n_inter=0;
  for(i=0; i<Nchain; i++)N_cont[i]=0;

  for(n=0; n<N_int; n++){
    atom *atom1=atoms+Int_list[n].i1;
    atom *atom2=atoms+Int_list[n].i2;

    if(atom1->chain==atom2->chain){
      N_cont[atom1->chain]++; // Intrachain contact
    }else{
      n_inter++;  // Interchain contact
    }

    // Determine set of rotable axes
    int ilast;
    double **eta_1, **tau_1, **eta_2, **tau_2;
    double eta[3], tau[3];
    if(atom1->last_dof_side >= 0){
      ilast=atom1->last_dof_side;
    }else{
      ilast=atom1->last_dof_main;
    }
    if(ilast>=0){
      eta_1=eta_iaj[ilast];
      tau_1=tau_iaj[ilast];
    }else{
      eta_1=zero; tau_1=zero;
    }

    if(atom2->last_dof_side >= 0){
      ilast=atom2->last_dof_side;
    }else{
      ilast=atom2->last_dof_main;
    }
    if(ilast>=0){
      eta_2=eta_iaj[ilast];
      tau_2=tau_iaj[ilast];
    }else{
      eta_2=zero; tau_2=zero;
    }

    // Compute r_ij/|r_ij|
    double r21[3], cr21[3], r1[3], r2[3];
    for(j=0; j<3; j++){
      r1[j]=atom1->r[j];
      r2[j]=atom2->r[j];
      r21[j]=r2[j]-r1[j];
    }
    Vector_product_d(cr21, r2, r1); //cr21= r2 X r1

    double h=Int_list[n].sec_der;
    h/=(r21[0]*r21[0]+r21[1]*r21[1]+r21[2]*r21[2]);

    double dk[N_modes];
    for(k=0; k< N_modes; k++){
      for(j=0; j<3; j++){
	eta[j]=eta_2[k][j]-eta_1[k][j];
	tau[j]=tau_2[k][j]-tau_1[k][j];    // For kinetic=0 eta,tau=0, wrong!
      }
      dk[k]=Scalar_product_3_d(cr21, eta)- // 03/2023: OK
	Scalar_product_3_d(r21, tau);
      double Hk=h*dk[k];
      for(l=0; l<=k; l++){
	Hessian[l][k] += Hk*dk[l];
      }
    }
  }

  for(i=0; i<Nchain; i++)
    printf("chain %d (%c): %3d contacts\n", i, chains[i].label, N_cont[i]);
  if(Nchain>1)printf("%d interchain contacts\n", n_inter);

  if((K_OMEGA==0)&&(K_PHI==0)&&(K_PSI==0)&&(K_CHI==0)&&(K_BA==0)&&(K_BL==0))
    goto upper_diagonal;

  // Hessian of the torsional potential K(a)*(theta_a-theta0_a)^2
  printf("Computing torsional potential\n");

  if(kinetic==0){
    struct axe *ax=axes;
    for(k=0; k<N_axes; k++){
      if(ax->type=='f'){Hessian[k][k]+=K_PHI;}
      else if(ax->type=='p'){Hessian[k][k]+=K_PSI;}
      else if(ax->type=='l'){Hessian[k][k]+=K_BL;}
      else if(ax->type=='a'){Hessian[k][k]+=K_BA;}
      else if(ax->type=='t'){Hessian[k][k]+=K_PHI;}
      else if(ax->type=='o'){Hessian[k][k]+=K_OMEGA;}
      else if(ax->type=='s'){Hessian[k][k]+=K_CHI;}
      ax++;
    }

  }else if(T_sqrt_inv){
    for(k=0; k<N_modes; k++){
      float *tk=T_sqrt_inv[k];
      for(l=0; l<=k; l++){
	float *tl=T_sqrt_inv[l];
	double H_Phi=0, H_Psi=0, H_Ome=0, H_Chi=0, H_BA=0, H_BL=0, H_BT=0;
	struct axe *ax=axes;
	for(i=0; i<N_axes; i++){
	  if(ax->type=='f'){H_Phi+=tk[i]*tl[i];}
	  else if(ax->type=='p'){H_Psi+=tk[i]*tl[i];}
	  else if(ax->type=='l'){H_BL+=tk[i]*tl[i];}
	  else if(ax->type=='a'){H_BA+=tk[i]*tl[i];}
	  else if(ax->type=='t'){H_BT+=tk[i]*tl[i];}
	  else if(ax->type=='o'){H_Ome+=tk[i]*tl[i];}
	  else if(ax->type=='s'){H_Chi+=tk[i]*tl[i];}
	  ax++;
	}
	double HH=K_PHI*H_Phi;
	if(H_Psi)HH+=K_PSI*H_Psi;
	if(H_Ome)HH+=K_OMEGA*H_Ome;
	if(H_Chi)HH+=K_CHI*H_Chi;
	if(H_BL)HH+=K_BL*H_BL;
	if(H_BA)HH+=K_BA*H_BA;
	if(H_BT)HH+=K_PHI*H_BT;
	Hessian[l][k]+=HH;
      }
    }
  }else{ // Cholevsky decomposition
    double X[N_axes], Y[N_axes], *Y2[N_axes];
    for(i=0; i<N_axes; i++){
      Y[i]=0; Y2[i]=malloc(N_axes*sizeof(double));
      for(k=0; k<N_axes; k++)Y2[i][k]=0;
    }
    for(i=0; i<N_axes; i++){
      char type=axes[i].type;
      if(type=='f'){Y[i]=K_PHI;}
      else if(type=='p'){Y[i]=K_PSI;}
      else if(type=='l'){Y[i]=K_BL;}
      else if(type=='a'){Y[i]=K_BA;}
      else if(type=='t'){Y[i]=K_PHI;}
      else if(type=='o'){Y[i]=K_OMEGA;}
      else if(type=='s'){Y[i]=K_CHI;}
      if(Y[i]){
	Forward_substitution(X, T_sqrt, Y, N_axes);
	for(k=0; k<N_axes; k++)Y2[k][i]=X[k];
	Y[i]=0;
      }
    }
    for(k=0; k<N_axes; k++){
      Forward_substitution(X, T_sqrt, Y2[k], N_axes);
      for(l=0; l<=k; l++)Hessian[l][k]+=X[l];
    }
    for(i=0; i<N_axes; i++)free(Y2[i]);
  }

  // Upper diagonal; store to float
 upper_diagonal:
  for(k=0; k<N_modes; k++){
    for(l=0; l<k; l++){
      Hessian[k][l]=Hessian[l][k];
    }
  }

  if(DBG_NMA){
    // Print
    if(kinetic==0){printf("Kinetic energy not considered\n");}
    if(T_sqrt_inv==NULL){printf("Cholevsky decomposition\n");}
    else{printf("Diagonalization of kinetic energy\n");}
    printf("V''(r^PDB): ");
    for(n=0; n<N_int; n++)
      printf(" %.2g:%.2g", Int_list[n].r0,Int_list[n].sec_der);
    //printf(" %d-%d",Int_list[n].i1, Int_list[n].i2);
    printf("\n");
    int ini=N_modes-20;
    printf("###  Kinetic energy matrix:\n");
    for(k=ini; k<N_modes; k++){
      if(T_sqrt_inv==0)
	for(j=k+1; j<N_axes; j++)T_sqrt[k][j]=0;
      for(l=ini; l<=k; l++){
	double sum=0;
	for(j=0; j<N_axes; j++)
	  sum+=T_sqrt[k][j]*T_sqrt[l][j];
	printf(" %.4g", sum);
      }
      printf("\n");
    }
    if(T_sqrt_inv){
      printf("###  T_sqrt T_sqrt_inv:\n");
      for(k=ini; k<N_modes; k++){
	for(l=ini; l<=k; l++){
	  double sum=0;
	  for(j=0; j<N_axes; j++)
	    sum+=T_sqrt_inv[k][j]*T_sqrt[j][l];
	  printf(" %.4f", sum);
	}
	printf("\n");
      }
    }
    printf("###  |eta_ai|\n");
    for(k=ini; k<N_modes; k++){
      for(i=ini; i<N_modes; i++){
	double sum=0, *eta=eta_iaj[i][k];
	for(j=0; j<3; j++)sum+=eta[j]*eta[j];
	printf("%.2g ",sqrt(sum));
      }
      printf("\n");
    }
    printf("### |tau_ai|   (shift)\n");
    for(k=ini; k<N_modes; k++){
      for(i=ini; i<N_modes; i++){
	double sum=0, *tau=tau_iaj[i][k];
	for(j=0; j<3; j++)sum+=tau[j]*tau[j];
	printf("%.2g ",sqrt(sum));
      }
      printf("  %.3g", sqrt(Scalar_product_3_d(axes[k].shift, axes[k].shift)));
      printf("\n");
    }
    printf("###  Potential energy matrix H~:\n");
    for(k=ini; k<N_modes; k++){
      for(l=ini; l<=k; l++)printf(" %.4g", Hessian[k][l]);
      printf("\n");
    }
    printf("Atoms last dof (mainchain): ");
    for(i=0; i<100; i++)printf("%d ", atoms[i].last_dof_main);
    printf("\n");
    exit(8);
  }

  // Cleaning
  Empty_matrix_d(zero, N_modes);
  for(i=0; i<N_axes; i++){
    Empty_matrix_d(eta_iaj[i], N_modes);
    Empty_matrix_d(tau_iaj[i], N_modes);
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movss %xmm5, -0x64(%rbp)
movss %xmm4, -0x54(%rbp)
movss %xmm3, -0x60(%rbp)
movss %xmm2, -0x68(%rbp)
movss %xmm1, -0x5c(%rbp)
movss %xmm0, -0x58(%rbp)
movq %r9, -0xc8(%rbp)
movq %r8, -0xd0(%rbp)
movq %rcx, -0xe8(%rbp)
movq %rdx, -0x48(%rbp)
movq %rsi, -0x78(%rbp)
movq %rdi, %rbx
movl 0x28(%rbp), %r14d
leaq 0x3149e(%rip), %rdi     # 0x53335
callq 0x2090
movq %rbx, %rsi
xorl %eax, %eax
testl %r14d, %r14d
movl $0x0, %edi
cmovgl %r14d, %edi
cmpq %rdi, %rax
je 0x21ecc
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x21ec7
movq (%rsi,%rax,8), %rdx
andq $0x0, (%rdx,%rcx,8)
incq %rcx
jmp 0x21eb4
incq %rax
jmp 0x21ead
movq %rdi, -0x38(%rbp)
movl %r14d, %eax
movq %rsp, %r12
movq %rax, -0x80(%rbp)
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq %rsp, %r13
movq %rax, -0xf8(%rbp)
subq %rax, %r13
movq %r13, %rsp
xorl %r14d, %r14d
pushq $0x3
popq %rbx
movq %rsi, -0x88(%rbp)
cmpq %r14, -0x38(%rbp)
je 0x21f35
movl 0x30(%rbp), %r15d
movl %r15d, %edi
movl %ebx, %esi
callq 0x43878
movq %rax, (%r12,%r14,8)
movl %r15d, %edi
movl %ebx, %esi
callq 0x43878
movq %rax, (%r13,%r14,8)
incq %r14
jmp 0x21f09
cmpl $0x0, 0x48(%rbp)
movq -0xc8(%rbp), %r14
movq %r13, -0xf0(%rbp)
movq %r12, -0x90(%rbp)
je 0x22061
cmpq $0x0, -0x48(%rbp)
je 0x220d2
xorl %eax, %eax
movl 0x30(%rbp), %ecx
movq %rcx, %rdx
testl %edx, %edx
movl $0x0, %ecx
cmovgl %edx, %ecx
movq 0x18(%rbp), %rdx
addq $0x60, %rdx
cmpq -0x38(%rbp), %rax
je 0x22384
imulq $0x158, %rax, %rsi      # imm = 0x158
addq 0x18(%rbp), %rsi
xorl %edi, %edi
cmpq %rcx, %rdi
je 0x22052
movq (%r12,%rax,8), %r8
movq (%r8,%rdi,8), %r8
movq (%r13,%rax,8), %r9
movq (%r9,%rdi,8), %r9
movslq 0x2c(%rsi), %r11
testq %r11, %r11
js 0x21fe9
movq (%r12,%r11,8), %r10
movq (%r10,%rdi,8), %r10
movq (%r13,%r11,8), %r11
movq (%r11,%rdi,8), %r11
xorl %ebx, %ebx
cmpq $0x3, %rbx
je 0x22001
movsd (%r10,%rbx,8), %xmm0
movsd %xmm0, (%r8,%rbx,8)
movsd (%r11,%rbx,8), %xmm0
movsd %xmm0, (%r9,%rbx,8)
incq %rbx
jmp 0x21fc6
xorl %r10d, %r10d
cmpq $0x3, %r10
je 0x22001
andq $0x0, (%r8,%r10,8)
andq $0x0, (%r9,%r10,8)
incq %r10
jmp 0x21fec
movq -0x48(%rbp), %r10
movq (%r10,%rdi,8), %r10
cvtss2sd (%r10,%rax,4), %xmm0
xorl %r10d, %r10d
cmpq $0x3, %r10
je 0x2204a
movsd -0x18(%rdx,%r10,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%r8,%r10,8), %xmm1
movsd %xmm1, (%r8,%r10,8)
movsd (%rdx,%r10,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%r9,%r10,8), %xmm1
movsd %xmm1, (%r9,%r10,8)
incq %r10
jmp 0x22012
incq %rdi
jmp 0x21f90
incq %rax
addq $0x158, %rdx            # imm = 0x158
jmp 0x21f79
movq 0x18(%rbp), %rax
addq $0x60, %rax
xorl %ecx, %ecx
cmpq -0x38(%rbp), %rcx
je 0x22384
movl 0x30(%rbp), %edx
movq %rdx, %rsi
cmpl %ecx, %esi
movl %ecx, %edx
cmovgl %esi, %edx
movq %rcx, %rsi
cmpq %rdx, %rsi
je 0x220c7
movq (%r12,%rsi,8), %rdi
movq (%rdi,%rcx,8), %rdi
movq (%r13,%rsi,8), %r8
movq (%r8,%rcx,8), %r8
xorl %r9d, %r9d
cmpq $0x3, %r9
je 0x220c2
movsd -0x18(%rax,%r9,8), %xmm0
movsd %xmm0, (%rdi,%r9,8)
movsd (%rax,%r9,8), %xmm0
movsd %xmm0, (%r8,%r9,8)
incq %r9
jmp 0x2209e
incq %rsi
jmp 0x22085
incq %rcx
addq $0x158, %rax            # imm = 0x158
jmp 0x2206b
leaq 0x3127f(%rip), %rdi     # 0x53358
callq 0x2090
movq %rsp, -0xc0(%rbp)
movq %rsp, %rbx
movq -0xf8(%rbp), %rax
subq %rax, %rbx
movq %rbx, %rsp
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
leaq -0x170(%rbp), %rax
orl $-0x1, (%rax)
leaq -0x150(%rbp), %rax
orl $-0x1, (%rax)
leaq -0x110(%rbp), %rax
orl $-0x1, (%rax)
leaq -0x130(%rbp), %rax
orl $-0x1, (%rax)
movq 0x18(%rbp), %r8
leaq 0x48(%r8), %rax
movq %rax, -0xd8(%rbp)
leaq 0x60(%r8), %rax
movq %rax, -0xa0(%rbp)
xorl %r14d, %r14d
movq -0x80(%rbp), %rdx
cmpq -0x38(%rbp), %r14
je 0x2236f
xorl %eax, %eax
cmpq %rax, %rdx
je 0x22162
andq $0x0, (%r12,%rax,8)
incq %rax
jmp 0x22153
leaq -0x170(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0x110(%rbp), %rdx
leaq -0x130(%rbp), %rcx
movl %r14d, %r9d
movl 0x28(%rbp), %eax
pushq %rax
movl 0x20(%rbp), %eax
pushq %rax
callq 0x230a9
movq -0x80(%rbp), %rdx
addq $0x10, %rsp
movq -0x90(%rbp), %rax
movq (%rax,%r14,8), %rsi
movq %r14, -0xe0(%rbp)
movq (%r13,%r14,8), %rdi
movslq -0x170(%rbp), %rax
movslq -0x150(%rbp), %r14
movl -0x110(%rbp), %ecx
movl -0x130(%rbp), %r13d
movq %rax, -0x30(%rbp)
imulq $0x158, %rax, %r8       # imm = 0x158
movq -0xd8(%rbp), %rax
leaq (%rax,%r8), %r9
movq %rcx, -0x50(%rbp)
imulq $0x158, %rcx, %rcx      # imm = 0x158
leaq (%rax,%rcx), %r10
movq -0xa0(%rbp), %rax
addq %rax, %r8
movq %r8, -0x40(%rbp)
addq %rax, %rcx
movq %rcx, -0x70(%rbp)
xorl %r15d, %r15d
movq %rsi, -0xb0(%rbp)
movq %rdi, -0xa8(%rbp)
cmpq $0x3, %r15
je 0x22355
movq %r9, %rax
movq -0x30(%rbp), %rcx
cmpq %r14, %rcx
jg 0x2223e
movsd (%rax), %xmm0
movsd %xmm0, (%r12,%rcx,8)
incq %rcx
addq $0x158, %rax            # imm = 0x158
jmp 0x22224
cmpl $0x0, -0x50(%rbp)
js 0x22265
movq %r10, %rax
movq -0x50(%rbp), %rcx
cmpl %ecx, %r13d
jl 0x22265
movsd (%rax), %xmm0
movsd %xmm0, (%r12,%rcx,8)
incq %rcx
addq $0x158, %rax            # imm = 0x158
jmp 0x2224b
movq %r10, -0xb8(%rbp)
movq %r9, -0x98(%rbp)
movq %rbx, %rdi
movq -0x78(%rbp), %rsi
movq %r12, %rdx
movl 0x28(%rbp), %ecx
callq 0x43a6b
xorl %eax, %eax
movq -0x80(%rbp), %rdx
movq -0xb0(%rbp), %rsi
cmpq %rax, %rdx
je 0x222ab
movsd (%rbx,%rax,8), %xmm0
movq (%rsi,%rax,8), %rcx
movsd %xmm0, (%rcx,%r15,8)
incq %rax
jmp 0x22292
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq %r14, %rcx
jg 0x222cd
movsd (%rax), %xmm0
movsd %xmm0, (%r12,%rcx,8)
incq %rcx
addq $0x158, %rax            # imm = 0x158
jmp 0x222b3
cmpl $0x0, -0x50(%rbp)
js 0x222f5
movq -0x70(%rbp), %rax
movq -0x50(%rbp), %rcx
cmpl %ecx, %r13d
jl 0x222f5
movsd (%rax), %xmm0
movsd %xmm0, (%r12,%rcx,8)
incq %rcx
addq $0x158, %rax            # imm = 0x158
jmp 0x222db
movq %rbx, %rdi
movq -0x78(%rbp), %rsi
movq %r12, %rdx
movl 0x28(%rbp), %ecx
callq 0x43a6b
xorl %eax, %eax
movq -0x80(%rbp), %rdx
movq -0xa8(%rbp), %rdi
movq -0x98(%rbp), %r9
movq -0xb8(%rbp), %r10
cmpq %rax, %rdx
je 0x2233b
movsd (%rbx,%rax,8), %xmm0
movq (%rdi,%rax,8), %rcx
movsd %xmm0, (%rcx,%r15,8)
incq %rax
jmp 0x22322
incq %r15
addq $0x8, %r9
addq $0x8, %r10
addq $0x8, -0x40(%rbp)
addq $0x8, -0x70(%rbp)
jmp 0x22213
movq -0xe0(%rbp), %r14
incq %r14
movq 0x18(%rbp), %r8
movq -0xf0(%rbp), %r13
jmp 0x22147
movq -0xc0(%rbp), %rsp
movq -0xc8(%rbp), %r14
movq -0x90(%rbp), %r12
pushq $0x3
popq %rsi
movl 0x30(%rbp), %edi
callq 0x43878
movq %rax, -0xa0(%rbp)
movl 0x40(%rbp), %ecx
movl %ecx, %eax
movq %rsp, %rdx
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rdx
movq %rdx, -0x70(%rbp)
movq %rdx, %rsp
xorl %eax, %eax
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
movq -0x70(%rbp), %rcx
cmpq %rax, %rdx
je 0x223d2
andl $0x0, (%rcx,%rax,4)
incq %rax
jmp 0x223c4
movq %rdx, -0xe0(%rbp)
movl 0x30(%rbp), %eax
movq %rax, %rcx
movl %ecx, %eax
xorl %edi, %edi
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
movq %rdx, -0x30(%rbp)
movq -0xd0(%rbp), %rcx
testl %ecx, %ecx
cmovlel %edi, %ecx
movq %rcx, -0xd0(%rbp)
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
movq %rax, -0xd8(%rbp)
movl $0x0, -0xc0(%rbp)
cmpq -0xd0(%rbp), %rdi
je 0x2267c
imulq $0xc8, %rdi, %r15
movq -0xe8(%rbp), %rcx
movslq (%rcx,%r15), %rax
imulq $0x70, %rax, %rax
movslq 0x4(%rcx,%r15), %rcx
imulq $0x70, %rcx, %rcx
movslq 0x6c(%r14,%rax), %rdx
cmpl 0x6c(%r14,%rcx), %edx
jne 0x22462
movq -0x70(%rbp), %rsi
incl (%rsi,%rdx,4)
jmp 0x22468
incl -0xc0(%rbp)
movq %rdi, -0xb0(%rbp)
addq %r14, %rax
movl 0x5c(%rax), %edx
testl %edx, %edx
jns 0x22492
movl 0x58(%rax), %edx
movq -0xa0(%rbp), %rsi
movq %rsi, -0x40(%rbp)
movq %rsi, -0x98(%rbp)
testl %edx, %edx
js 0x224a8
movl %edx, %edx
movq (%r12,%rdx,8), %rsi
movq %rsi, -0x98(%rbp)
movq (%r13,%rdx,8), %rdx
movq %rdx, -0x40(%rbp)
addq %r14, %rcx
movl 0x5c(%rcx), %edx
testl %edx, %edx
jns 0x224c3
movl 0x58(%rcx), %edx
movq -0xa0(%rbp), %rbx
movq %rbx, %r14
testl %edx, %edx
js 0x224ce
movl %edx, %edx
movq (%r12,%rdx,8), %rbx
movq (%r13,%rdx,8), %r14
addq -0xe8(%rbp), %r15
xorl %edx, %edx
cmpq $0x3, %rdx
je 0x2250b
movsd (%rax,%rdx,8), %xmm0
movsd %xmm0, -0x1b0(%rbp,%rdx,8)
movsd (%rcx,%rdx,8), %xmm1
movsd %xmm1, -0x190(%rbp,%rdx,8)
subsd %xmm0, %xmm1
movsd %xmm1, -0x110(%rbp,%rdx,8)
incq %rdx
jmp 0x224d7
leaq -0x130(%rbp), %rdi
leaq -0x190(%rbp), %rsi
leaq -0x1b0(%rbp), %rdx
callq 0xf8f7
movq %rsp, -0xa8(%rbp)
movsd 0x28(%r15), %xmm2
movsd -0x110(%rbp), %xmm0
movsd -0x108(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd -0x100(%rbp), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd %xmm2, -0xb8(%rbp)
movq %rsp, %r12
subq -0xd8(%rbp), %r12
movq %r12, %rsp
xorl %r15d, %r15d
pushq $0x1
popq %r13
cmpq -0x30(%rbp), %r15
je 0x22651
movq (%rbx,%r15,8), %rax
movq -0x98(%rbp), %rcx
movq (%rcx,%r15,8), %rcx
movq (%r14,%r15,8), %rdx
movq -0x40(%rbp), %rsi
movq (%rsi,%r15,8), %rsi
xorl %edi, %edi
cmpq $0x18, %rdi
je 0x225d7
movsd (%rax,%rdi), %xmm0
subsd (%rcx,%rdi), %xmm0
movsd %xmm0, -0x170(%rbp,%rdi)
movsd (%rdx,%rdi), %xmm0
subsd (%rsi,%rdi), %xmm0
movsd %xmm0, -0x150(%rbp,%rdi)
addq $0x8, %rdi
jmp 0x225a5
leaq -0x130(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0xf96f
movsd %xmm0, -0x50(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0xf96f
movsd -0x50(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%r12,%r15,8)
mulsd -0xb8(%rbp), %xmm1
xorl %eax, %eax
movq -0x88(%rbp), %rdx
cmpq %rax, %r13
je 0x22646
movq (%rdx,%rax,8), %rcx
movsd (%r12,%rax,8), %xmm0
mulsd %xmm1, %xmm0
addsd (%rcx,%r15,8), %xmm0
movsd %xmm0, (%rcx,%r15,8)
incq %rax
jmp 0x22622
incq %r15
incq %r13
jmp 0x2257e
movq -0xa8(%rbp), %rsp
movq -0xb0(%rbp), %rdi
incq %rdi
movq -0xc8(%rbp), %r14
movq -0xf0(%rbp), %r13
movq -0x90(%rbp), %r12
jmp 0x22421
movq 0x38(%rbp), %rax
addq $0x34, %rax
leaq 0x3058d(%rip), %rbx     # 0x52c18
xorl %r12d, %r12d
movq 0x18(%rbp), %r14
cmpq %r12, -0xe0(%rbp)
je 0x226c2
movsbl (%rax), %edx
movq -0x70(%rbp), %rcx
movl (%rcx,%r12,4), %ecx
movq %rbx, %rdi
movl %r12d, %esi
movq %rax, %r15
xorl %eax, %eax
callq 0x20f0
movq %r15, %rax
incq %r12
addq $0x70, %rax
jmp 0x22692
cmpl $0x2, 0x40(%rbp)
jl 0x226dc
leaq 0x30566(%rip), %rdi     # 0x52c35
movl -0xc0(%rbp), %esi
xorl %eax, %eax
callq 0x20f0
xorps %xmm0, %xmm0
movss -0x64(%rbp), %xmm1
ucomiss %xmm0, %xmm1
movl 0x28(%rbp), %eax
cltq
movq %rax, -0x50(%rbp)
movq -0x90(%rbp), %r15
movq -0x38(%rbp), %r12
movss -0x54(%rbp), %xmm1
jne 0x227f1
jp 0x227f1
ucomiss %xmm0, %xmm1
jne 0x227f1
jp 0x227f1
movss -0x60(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jne 0x227f1
jp 0x227f1
movss -0x5c(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jne 0x227f1
jp 0x227f1
movss -0x58(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jne 0x227f1
jp 0x227f1
movss -0x68(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jne 0x227f1
jp 0x227f1
xorl %eax, %eax
movq -0x88(%rbp), %rsi
cmpq -0x30(%rbp), %rax
je 0x2279d
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x22798
movq (%rsi,%rcx,8), %rdx
movsd (%rdx,%rax,8), %xmm0
movq (%rsi,%rax,8), %rdx
movsd %xmm0, (%rdx,%rcx,8)
incq %rcx
jmp 0x2277c
incq %rax
jmp 0x22774
cmpl $0x0, 0x51b6c(%rip)     # 0x74310
jne 0x22cff
movq -0xa0(%rbp), %rdi
movl 0x30(%rbp), %esi
callq 0x4372a
xorl %ebx, %ebx
cmpq %rbx, %r12
je 0x227e2
movq (%r15,%rbx,8), %rdi
movl 0x30(%rbp), %r14d
movl %r14d, %esi
callq 0x4372a
movq (%r13,%rbx,8), %rdi
movl %r14d, %esi
callq 0x4372a
incq %rbx
jmp 0x227bb
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30b8f(%rip), %rdi     # 0x53387
callq 0x2090
cmpl $0x0, 0x48(%rbp)
je 0x22a8e
cmpq $0x0, -0x48(%rbp)
je 0x22b0a
cvtss2sd -0x68(%rbp), %xmm0
cvtss2sd -0x5c(%rbp), %xmm1
cvtss2sd -0x58(%rbp), %xmm2
cvtss2sd -0x60(%rbp), %xmm3
cvtss2sd -0x64(%rbp), %xmm4
cvtss2sd -0x54(%rbp), %xmm5
pushq $0x1
popq %rax
xorl %ecx, %ecx
xorpd %xmm6, %xmm6
leaq 0x30288(%rip), %rdx     # 0x52ac8
cmpq -0x30(%rbp), %rcx
je 0x2276b
movq -0x48(%rbp), %rsi
movq (%rsi,%rcx,8), %rsi
xorl %edi, %edi
cmpq %rax, %rdi
je 0x22a83
movq -0x48(%rbp), %r8
movq (%r8,%rdi,8), %r8
xorpd %xmm13, %xmm13
xorl %r9d, %r9d
xorpd %xmm12, %xmm12
xorpd %xmm11, %xmm11
xorpd %xmm10, %xmm10
xorpd %xmm8, %xmm8
xorpd %xmm9, %xmm9
xorpd %xmm7, %xmm7
movq %r14, %r10
cmpq %r9, %r12
je 0x2296f
movzbl (%r10), %r11d
leal -0x66(%r11), %ebx
cmpl $0xe, %ebx
ja 0x228c8
movslq (%rdx,%rbx,4), %r11
addq %rdx, %r11
jmpq *%r11
movss (%rsi,%r9,4), %xmm14
mulss (%r8,%r9,4), %xmm14
cvtss2sd %xmm14, %xmm14
addsd %xmm14, %xmm13
jmp 0x22960
cmpl $0x61, %r11d
jne 0x22960
movss (%rsi,%r9,4), %xmm14
mulss (%r8,%r9,4), %xmm14
cvtss2sd %xmm14, %xmm14
addsd %xmm14, %xmm8
jmp 0x22960
movss (%rsi,%r9,4), %xmm14
mulss (%r8,%r9,4), %xmm14
cvtss2sd %xmm14, %xmm14
addsd %xmm14, %xmm11
jmp 0x22960
movss (%rsi,%r9,4), %xmm14
mulss (%r8,%r9,4), %xmm14
cvtss2sd %xmm14, %xmm14
addsd %xmm14, %xmm7
jmp 0x22960
movss (%rsi,%r9,4), %xmm14
mulss (%r8,%r9,4), %xmm14
cvtss2sd %xmm14, %xmm14
addsd %xmm14, %xmm12
jmp 0x22960
movss (%rsi,%r9,4), %xmm14
mulss (%r8,%r9,4), %xmm14
cvtss2sd %xmm14, %xmm14
addsd %xmm14, %xmm9
jmp 0x22960
movss (%rsi,%r9,4), %xmm14
mulss (%r8,%r9,4), %xmm14
cvtss2sd %xmm14, %xmm14
addsd %xmm14, %xmm10
addq $0x158, %r10            # imm = 0x158
incq %r9
jmp 0x2288d
mulsd %xmm0, %xmm13
movaps %xmm1, %xmm14
mulsd %xmm12, %xmm14
addsd %xmm13, %xmm14
cmpneqsd %xmm6, %xmm12
movapd %xmm12, %xmm15
andnpd %xmm13, %xmm15
andpd %xmm14, %xmm12
orpd %xmm15, %xmm12
movaps %xmm2, %xmm13
mulsd %xmm11, %xmm13
addsd %xmm12, %xmm13
cmpneqsd %xmm6, %xmm11
movapd %xmm11, %xmm14
andnpd %xmm12, %xmm14
andpd %xmm13, %xmm11
orpd %xmm14, %xmm11
movaps %xmm3, %xmm12
mulsd %xmm10, %xmm12
addsd %xmm11, %xmm12
cmpneqsd %xmm6, %xmm10
movapd %xmm10, %xmm13
andnpd %xmm11, %xmm13
andpd %xmm12, %xmm10
orpd %xmm13, %xmm10
movaps %xmm4, %xmm11
mulsd %xmm9, %xmm11
addsd %xmm10, %xmm11
cmpneqsd %xmm6, %xmm9
movapd %xmm9, %xmm12
andnpd %xmm10, %xmm12
andpd %xmm11, %xmm9
orpd %xmm12, %xmm9
movaps %xmm5, %xmm10
mulsd %xmm8, %xmm10
addsd %xmm9, %xmm10
cmpneqsd %xmm6, %xmm8
movapd %xmm8, %xmm11
andnpd %xmm9, %xmm11
andpd %xmm10, %xmm8
orpd %xmm11, %xmm8
movapd %xmm0, %xmm9
mulsd %xmm7, %xmm9
addsd %xmm8, %xmm9
cmpneqsd %xmm6, %xmm7
movapd %xmm7, %xmm10
andnpd %xmm8, %xmm10
andpd %xmm9, %xmm7
orpd %xmm10, %xmm7
movq -0x88(%rbp), %r8
movq (%r8,%rdi,8), %r8
addsd (%r8,%rcx,8), %xmm7
movsd %xmm7, (%r8,%rcx,8)
incq %rdi
jmp 0x22854
incq %rcx
incq %rax
jmp 0x22840
xorl %eax, %eax
leaq 0x300a9(%rip), %rcx     # 0x52b40
movq %r14, %rdx
movss -0x54(%rbp), %xmm1
cmpq %rax, %r12
je 0x2276b
movzbl (%rdx), %esi
leal -0x66(%rsi), %edi
cmpl $0xe, %edi
ja 0x22ac8
movslq (%rcx,%rdi,4), %rsi
addq %rcx, %rsi
movss -0x68(%rbp), %xmm0
jmpq *%rsi
movss -0x64(%rbp), %xmm0
jmp 0x22ae5
movaps %xmm1, %xmm0
cmpl $0x61, %esi
je 0x22ae5
jmp 0x22afe
movss -0x60(%rbp), %xmm0
jmp 0x22ae5
movss -0x58(%rbp), %xmm0
jmp 0x22ae5
movss -0x5c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x88(%rbp), %rsi
movq (%rsi,%rax,8), %rsi
addsd (%rsi,%rax,8), %xmm0
movsd %xmm0, (%rsi,%rax,8)
addq $0x158, %rdx            # imm = 0x158
incq %rax
jmp 0x22a9f
movq %rsp, -0xa8(%rbp)
movq %rsp, %rbx
movq -0xf8(%rbp), %rax
subq %rax, %rbx
movq %rbx, %rsp
movq %rsp, %rdx
subq %rax, %rdx
movq %rdx, %rsp
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
movq -0x50(%rbp), %rax
leaq (,%rax,8), %rax
movq %rax, -0x40(%rbp)
xorl %r14d, %r14d
movq %rdx, %r15
cmpq -0x38(%rbp), %r14
je 0x22b7e
andq $0x0, (%rdx,%r14,8)
movq -0x40(%rbp), %rdi
callq 0x21d0
movq -0x80(%rbp), %rdx
movq %rax, (%r12,%r14,8)
xorl %ecx, %ecx
cmpq %rcx, %rdx
je 0x22b76
andq $0x0, (%rax,%rcx,8)
incq %rcx
jmp 0x22b67
incq %r14
movq %r15, %rdx
jmp 0x22b49
cvtss2sd -0x60(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
cvtss2sd -0x58(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
cvtss2sd -0x68(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
cvtss2sd -0x54(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
cvtss2sd -0x64(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
cvtss2sd -0x5c(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
xorl %r14d, %r14d
cmpq -0x38(%rbp), %r14
je 0x22c82
imulq $0x158, %r14, %rax      # imm = 0x158
movq 0x18(%rbp), %rcx
movzbl (%rcx,%rax), %eax
leal -0x66(%rax), %ecx
cmpl $0xe, %ecx
ja 0x22bfe
leaq 0x2ff16(%rip), %rsi     # 0x52b04
movslq (%rsi,%rcx,4), %rax
addq %rsi, %rax
jmpq *%rax
movsd -0x40(%rbp), %xmm0
jmp 0x22c35
cmpl $0x61, %eax
jne 0x22c0d
movsd -0xb0(%rbp), %xmm0
jmp 0x22c35
movsd (%rdx,%r14,8), %xmm0
jmp 0x22c3b
movsd -0x80(%rbp), %xmm0
jmp 0x22c35
movsd -0x98(%rbp), %xmm0
jmp 0x22c35
movsd -0xb8(%rbp), %xmm0
jmp 0x22c35
movsd -0x70(%rbp), %xmm0
movsd %xmm0, (%rdx,%r14,8)
ucomisd 0x2840d(%rip), %xmm0    # 0x4b050
jne 0x22c47
jnp 0x22c7a
movq %rbx, %rdi
movq -0x78(%rbp), %rsi
movl 0x28(%rbp), %ecx
callq 0x43a6b
xorl %eax, %eax
cmpq %rax, -0x38(%rbp)
je 0x22c72
movsd (%rbx,%rax,8), %xmm0
movq (%r12,%rax,8), %rcx
movsd %xmm0, (%rcx,%r14,8)
incq %rax
jmp 0x22c58
movq %r15, %rdx
andq $0x0, (%r15,%r14,8)
incq %r14
jmp 0x22bc6
pushq $0x1
popq %r14
xorl %r15d, %r15d
cmpq -0x38(%rbp), %r15
je 0x22cd2
movq (%r12,%r15,8), %rdx
movq %rbx, %rdi
movq -0x78(%rbp), %rsi
movl 0x28(%rbp), %ecx
callq 0x43a6b
xorl %eax, %eax
movq -0x88(%rbp), %rdx
cmpq %rax, %r14
je 0x22cca
movsd (%rbx,%rax,8), %xmm0
movq (%rdx,%rax,8), %rcx
addsd (%rcx,%r15,8), %xmm0
movsd %xmm0, (%rcx,%r15,8)
incq %rax
jmp 0x22cab
incq %r15
incq %r14
jmp 0x22c89
xorl %ebx, %ebx
cmpq %rbx, -0x38(%rbp)
je 0x22ce8
movq (%r12,%rbx,8), %rdi
callq 0x2050
incq %rbx
jmp 0x22cd4
movq -0xa8(%rbp), %rsp
movq -0x90(%rbp), %r15
movq -0x38(%rbp), %r12
jmp 0x2276b
cmpl $0x0, 0x48(%rbp)
jne 0x22d11
leaq 0x30699(%rip), %rdi     # 0x533a5
callq 0x2090
cmpq $0x0, -0x48(%rbp)
leaq 0x2f45c(%rip), %rax     # 0x52179
leaq 0x3069f(%rip), %rdi     # 0x533c3
cmoveq %rax, %rdi
callq 0x2090
leaq 0x2ff19(%rip), %rdi     # 0x52c4d
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x20f0
imulq $0xc8, -0xd0(%rbp), %r15
leaq 0x2ff0a(%rip), %rbx     # 0x52c5a
cmpq %r14, %r15
je 0x22d7d
movq -0xe8(%rbp), %rax
movsd 0x20(%rax,%r14), %xmm0
movsd 0x28(%rax,%r14), %xmm1
movq %rbx, %rdi
movb $0x2, %al
callq 0x20f0
addq $0xc8, %r14
jmp 0x22d50
pushq $0xa
popq %rdi
callq 0x2060
movl 0x30(%rbp), %eax
movq %rax, %r14
leal -0x14(%rax), %ebx
leaq 0x30650(%rip), %rdi     # 0x533e5
callq 0x2090
movslq %ebx, %r13
movslq %r14d, %r12
leaq 0x1(%r13), %r14
leaq 0x29436(%rip), %r15     # 0x4c1e1
movq %r13, -0x30(%rbp)
cmpq %r12, %r13
movq -0x78(%rbp), %rdx
jge 0x22e29
cmpq $0x0, -0x48(%rbp)
je 0x22e12
movq -0x30(%rbp), %rbx
cmpq %r13, %rbx
jg 0x22e02
xorpd %xmm0, %xmm0
xorl %eax, %eax
cmpq %rax, -0x38(%rbp)
je 0x22def
movq (%rdx,%r13,8), %rcx
movsd (%rcx,%rax,8), %xmm1
movq (%rdx,%rbx,8), %rcx
mulsd (%rcx,%rax,8), %xmm1
addsd %xmm1, %xmm0
incq %rax
jmp 0x22dce
movq %r15, %rdi
movb $0x1, %al
callq 0x20f0
movq -0x78(%rbp), %rdx
incq %rbx
jmp 0x22dc3
pushq $0xa
popq %rdi
callq 0x2060
incq %r13
incq %r14
jmp 0x22daf
movq %r14, %rax
cmpq -0x50(%rbp), %rax
jge 0x22dbf
movq (%rdx,%r13,8), %rcx
andq $0x0, (%rcx,%rax,8)
incq %rax
jmp 0x22e15
cmpq $0x0, -0x48(%rbp)
jne 0x2302f
leaq 0x305de(%rip), %rdi     # 0x53419
callq 0x2090
leaq 0x2f786(%rip), %rbx     # 0x525cd
pushq $0xa
popq %r15
movq -0x30(%rbp), %r14
cmpq %r12, %r14
jge 0x22ebb
movq -0x30(%rbp), %r13
cmpq %r12, %r13
jge 0x22eae
movq -0x90(%rbp), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%r14,8), %rax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
cmpq $0x3, %rcx
je 0x22e8a
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rcx
jmp 0x22e72
ucomisd 0x281be(%rip), %xmm0    # 0x4b050
jb 0x22e9a
sqrtsd %xmm0, %xmm0
jmp 0x22e9f
callq 0x2290
movq %rbx, %rdi
movb $0x1, %al
callq 0x20f0
incq %r13
jmp 0x22e58
movl %r15d, %edi
callq 0x2060
incq %r14
jmp 0x22e4f
leaq 0x30565(%rip), %rdi     # 0x53427
callq 0x2090
leaq 0x2f6ff(%rip), %rbx     # 0x525cd
pushq $0xa
popq %r13
movq -0x30(%rbp), %r14
cmpq %r12, %r14
jge 0x22f87
movq -0x30(%rbp), %r15
cmpq %r12, %r15
jge 0x22f39
movq -0xf0(%rbp), %rax
movq (%rax,%r15,8), %rax
movq (%rax,%r14,8), %rax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
cmpq $0x3, %rcx
je 0x22f15
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rcx
jmp 0x22efd
ucomisd 0x28133(%rip), %xmm0    # 0x4b050
jb 0x22f25
sqrtsd %xmm0, %xmm0
jmp 0x22f2a
callq 0x2290
movq %rbx, %rdi
movb $0x1, %al
callq 0x20f0
incq %r15
jmp 0x22ee3
imulq $0x158, %r14, %rax      # imm = 0x158
movq 0x18(%rbp), %rcx
leaq (%rcx,%rax), %rdi
addq $0x60, %rdi
movq %rdi, %rsi
callq 0xf96f
ucomisd 0x280f4(%rip), %xmm0    # 0x4b050
jb 0x22f64
sqrtsd %xmm0, %xmm0
jmp 0x22f69
callq 0x2290
leaq 0x2fcfb(%rip), %rdi     # 0x52c6b
movb $0x1, %al
callq 0x20f0
movl %r13d, %edi
callq 0x2060
incq %r14
jmp 0x22ed6
leaq 0x304b0(%rip), %rdi     # 0x5343e
callq 0x2090
pushq $0xa
popq %rbx
leaq 0x29244(%rip), %r15     # 0x4c1e1
movq -0x30(%rbp), %r14
cmpq %r12, %r14
jge 0x22fe2
movq -0x30(%rbp), %r13
movq -0x88(%rbp), %rax
cmpq %r14, %r13
jg 0x22fd6
movq (%rax,%r14,8), %rax
movsd (%rax,%r13,8), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x20f0
movq -0x88(%rbp), %rax
incq %r13
jmp 0x22fb1
movl %ebx, %edi
callq 0x2060
incq %r14
jmp 0x22fa1
leaq 0x2fc89(%rip), %rdi     # 0x52c72
xorl %eax, %eax
callq 0x20f0
pushq $0x58
popq %r14
leaq 0x3289b(%rip), %rbx     # 0x55896
movq -0xc8(%rbp), %r15
cmpq $0x2c18, %r14           # imm = 0x2C18
je 0x2301f
movl (%r15,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20f0
addq $0x70, %r14
jmp 0x23002
pushq $0xa
popq %rdi
callq 0x2060
pushq $0x8
popq %rdi
callq 0x2270
leaq 0x303cb(%rip), %rdi     # 0x53401
callq 0x2090
pushq $0xa
popq %rbx
leaq 0x2fc20(%rip), %r15     # 0x52c65
movq -0x30(%rbp), %r14
cmpq %r12, %r14
movq -0x78(%rbp), %rdx
jge 0x22e34
movq -0x30(%rbp), %r13
cmpq %r14, %r13
jg 0x2309d
xorps %xmm0, %xmm0
xorl %eax, %eax
cmpq %rax, -0x38(%rbp)
je 0x2308a
movq -0x48(%rbp), %rcx
movq (%rcx,%r14,8), %rcx
cvtss2sd (%rcx,%rax,4), %xmm1
movq (%rdx,%rax,8), %rcx
mulsd (%rcx,%r13,8), %xmm1
addsd %xmm1, %xmm0
incq %rax
jmp 0x23064
movq %r15, %rdi
movb $0x1, %al
callq 0x20f0
movq -0x78(%rbp), %rdx
incq %r13
jmp 0x2305a
movl %ebx, %edi
callq 0x2060
incq %r14
jmp 0x23049