// File: /workspace/github_c_makefile_star2_O1/ugobas[P]tnm/simulation.c
// Function: Internal_differences
void  Internal_differences(struct bond *bonds, struct bond *bonds2,
			   int natoms, char *prots)
{
  int PRINT_ALL=0;
  if(PRINT_ALL){
    char name[80]; sprintf(name, "Internal_coordinates_%s.dat", prots);
    FILE *file=fopen(name, "w"); // Write internal coordinates
    fprintf(file,
	    "#1=l1 2=l2 3=cos(th1) 4=cos(th2) 5=phi1 6=phi2 atom res\n");
    for(int i=0; i<natoms; i++){
      struct bond *bond1=bonds+i; if(bond1->atom==NULL)break;
      if(bond1->atom->main==0)continue;
      if(bond1->atom->ali<0)continue;
      struct bond *bond2=bonds2+bond1->atom->ali;
      struct bond *b1=bond1->previous;
      if(b1 &&(b1->atom->ali>=0)){
	b1=b1->previous;
	if(b1 &&(b1->atom->ali>=0)){
	  fprintf(file, "%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%s\t%d\n", 
		  bond1->l, bond2->l,
		  bond1->r_cos_theta/bond1->l, bond2->r_cos_theta/bond2->l,
		  bond1->phi, bond2->phi, bond1->atom->name, bond1->atom->res);
	}
      }
    }
    fclose(file); printf("Writing %s\n", name);
  }

  int n[3], k, a;
  double diff1[3], diff2[3], diff1_aa[3][20], diff2_aa[3][20], n_aa[3][20];
  //float diff[3][natoms];  //diff[k][n[k]]=d;
  for(k=0; k<3; k++){  
    n[k]=0; diff1[k]=0; diff2[k]=0;
    for(a=0; a<20; a++){
      n_aa[k][a]=0; diff1_aa[k][a]=0; diff2_aa[k][a]=0;
    }
  }
  Atom_type("CA"); // Needed to initialize num_BB
  double internal[3][num_BB], internal_2[3][num_BB];
  int n_int[3][num_BB];
  for(k=0; k<3; k++){
    for(a=0; a<num_BB; a++){
      internal[k][a]=0; internal_2[k][a]=0; n_int[k][a]=0;
    }
  }

  float pi=3.1415925, deg=180.0/pi, twopi=2*pi;
  float d, m;
  struct bond *bond1=bonds, *bond2=bonds2, *b1;
  float omega2[natoms];
  for(int i=0; i<natoms; i++){
    bond1=bonds+i;
    int na=Atom_type(bond1->atom->name);
    if(na<0)continue;
    if((bond1->len>=0)||(bond1->angle>=0))continue;  // exclude pseudo-bonds
    if((bond1->atom->ali<0))continue;
    a=Code_AA(bond1->atom->aa);
    bond2=bonds2+bond1->atom->ali; b1=bond1->previous;
    if(b1 &&(b1->atom->ali>=0)){
      k=0; // bond length
      d=bond1->l; // l1
      internal[k][na]+=d; internal_2[k][na]+=d*d;
      d=bond2->l; // l2
      internal[k][na]+=d; internal_2[k][na]+=d*d; n_int[k][na]+=2;
      d= bond1->l-bond2->l; // difference
      diff1[k]+=d; diff2[k]+=d*d; n[k]++;
      if((a>=0)&&(a<20)){
	diff1_aa[k][a]+=d; diff2_aa[k][a]+=d*d; n_aa[k][a]++;
      }
      b1=b1->previous;
      if(b1 && (b1->atom->ali>=0)){
	k=1;  // bond angle
	float s1, c1=Cos_sin(&s1, bond1->r_cos_theta/bond1->l);
	float s2, c2=Cos_sin(&s2, bond2->r_cos_theta/bond2->l);

	d=acos(c1); // theta1
	internal[k][na]+=d; internal_2[k][na]+=d*d;
	d=acos(c2); // theta2
	internal[k][na]+=d; internal_2[k][na]+=d*d; n_int[k][na]+=2;
	d=asin(s2*c1-s1*c2); // difference
	diff1[k]+=d; diff2[k]+=d*d; n[k]++;
	if((a>=0)&&(a<20)){
	  diff1_aa[k][a]+=d; diff2_aa[k][a]+=d*d; n_aa[k][a]++;
	}
	b1=b1->previous;
	if(b1 && (b1->atom->ali>=0)){
	  k=2;  // torsion angle
	  d=bond1->phi; // phi1
	  internal[k][na]+=d; internal_2[k][na]+=d*d;
	  d=bond2->phi; // phi2
	  internal[k][na]+=d; internal_2[k][na]+=d*d; n_int[k][na]+=2;
	  omega2[i]=bond2->phi;
	  d=bond1->phi-bond2->phi; // difference
	  if(d>pi){d-=twopi;}else if(d<-pi){d+=twopi;}
	  bond1->d_phi=fabs(d)*deg; // difference in degrees
	  diff1[k]+=d; diff2[k]+=d*d; n[k]++;
	  if((a>=0)&&(a<20)){
	    diff1_aa[k][a]+=d; diff2_aa[k][a]+=d*d; n_aa[k][a]++;
	  }
	}
      }
    }
  }

  char name[100]; sprintf(name, "Internal_differences_%s.dat", prots);
  FILE *file_out=fopen(name, "w"); printf("Writing %s\n", name);
  fprintf(file_out, "# atom\tn\t3=len s.e.\t5=angle s.e.\t7=torsion\n"); 
  for(a=0; a<num_BB; a++){
    fprintf(file_out, "# %s\t%d ", BB_name[a], n_int[1][a]);
    for(k=0; k<3; k++){
      Ave_se(&(internal[k][a]), &(internal_2[k][a]), n_int[k][a]);
      fprintf(file_out, "\t%.3f %.3f", internal[k][a], internal_2[k][a]);
    }
    fprintf(file_out, "\n");
  }
  fprintf(file_out, "#\n");
  for(k=0; k<3; k++){
    if(k==0){     fprintf(file_out, "# Bond lengths:   ");}
    else if(k==1){fprintf(file_out, "# Bond angles:    ");}
    else if(k==2){fprintf(file_out, "# Torsion angles: ");}
    diff1[k]/=n[k]; diff2[k]/=n[k];
    d=sqrt((diff2[k]-diff1[k]*diff1[k])/(n[k]-1));
    fprintf(file_out, "<d>= %7.4f s.e.= %.4f t= %5.1f RMSD= %.3f n= %.0f\n",
	    diff1[k], d, diff1[k]/d, sqrt(diff2[k]), (float)n[k]);
  }
  fprintf(file_out, "#aa Bond lengths: 2=mean 3=RMSD ");
  fprintf(file_out, "Bond angles: 4=mean 5=RMSD ");
  fprintf(file_out, "Torsion angles: 6=mean 7=RMSD 8=n\n");
  for(a=0; a<20; a++){
    fprintf(file_out, "%c", AA_code[a]);
    for(k=0; k<3; k++){
      if(n_aa[k][a]){
	m=diff1_aa[k][a]/n_aa[k][a];
	d=sqrt(diff2_aa[k][a]/n_aa[k][a]);
      }else{
	m=0; d=0;
      }
      fprintf(file_out, "\t%.3f\t%.3f", m, d);
    }
    fprintf(file_out, "\t%.0f\n", n_aa[0][a]);
  }

  printf("# List of residues with D_omega > %d\n", D_omega_thr);
  printf("#Atom Res nres d_phi\n");
  fprintf(file_out, "# List of residues with D_omega > %d\n", D_omega_thr);
  fprintf(file_out, "#Atom Res nres d_omega omega1 omega2\n");
  bond1=bonds;
  for(int i=0; i<natoms; i++){
    atom *atom=bond1->atom;
    if((strncmp(atom->name, "CA", 2)==0)&&(bond1->d_phi > D_omega_thr)){
      fprintf(file_out, "%s %c%dch%d  %d %.0f %.0f\n",
	      atom->name, atom->aa, atom->res, atom->chain+1,
	      bond1->d_phi, bond1->phi*deg, omega2[i]*deg);
      printf("%s %c%d %d\n", atom->name, atom->aa, atom->res, bond1->d_phi);
    }
    bond1++;
  }

  fclose(file_out);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x778, %rsp            # imm = 0x778
movq %rcx, -0x180(%rbp)
movl %edx, -0x70(%rbp)
movq %rsi, -0x178(%rbp)
movq %rdi, -0x120(%rbp)
leaq -0x370(%rbp), %rdi
xorl %ebx, %ebx
movl $0x1e0, %edx            # imm = 0x1E0
movq %rdi, -0x150(%rbp)
xorl %esi, %esi
callq 0x2110
leaq -0x730(%rbp), %rdi
movl $0x1e0, %edx            # imm = 0x1E0
movq %rdi, -0x148(%rbp)
xorl %esi, %esi
callq 0x2110
leaq -0x550(%rbp), %rdi
movl $0x1e0, %edx            # imm = 0x1E0
movq %rdi, -0x140(%rbp)
xorl %esi, %esi
callq 0x2110
xorl %eax, %eax
movl $0x0, -0x7c(%rbp,%rax,4)
movq %rbx, -0x100(%rbp,%rax,8)
movq %rbx, -0xe0(%rbp,%rax,8)
incq %rax
cmpq $0x3, %rax
jne 0x39429
leaq 0x1bd19(%rip), %rdi     # 0x5516a
callq 0x10374
movq %rsp, -0x188(%rbp)
leaq 0x2f184(%rip), %rcx     # 0x685e8
movl (%rcx), %edx
movq %rsp, %r12
leaq (%rdx,%rdx,2), %rax
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movl (%rcx), %r13d
leaq (,%r13,2), %rax
addq %r13, %rax
movq %rsp, %rsi
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
subq %rcx, %rsi
movq %rsi, %rsp
movq %rsp, %rcx
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x38(%rbp)
movq %rcx, %rsp
movq %rdx, -0xb8(%rbp)
leaq (,%rdx,8), %rax
movq %rax, -0x40(%rbp)
leaq (,%r13,8), %rax
movq %rax, -0x88(%rbp)
leaq (,%r13,4), %rbx
movl $0x3, %r14d
xorl %r15d, %r15d
movq %r12, -0x90(%rbp)
movq %rsi, -0x58(%rbp)
movq %rbx, -0x138(%rbp)
movq %r13, -0x50(%rbp)
testl %r13d, %r13d
jle 0x39556
leaq (%rsi,%r15,2), %rbx
movq -0x38(%rbp), %rax
addq %r15, %rax
movq %rax, -0x48(%rbp)
movq %r12, %rdi
xorl %esi, %esi
movq -0x88(%rbp), %r13
movq %r13, %rdx
callq 0x2110
movq %rbx, %rdi
movq -0x138(%rbp), %rbx
xorl %esi, %esi
movq %r13, %rdx
callq 0x2110
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %r13
xorl %esi, %esi
movq %rbx, %rdx
callq 0x2110
movq -0x58(%rbp), %rsi
addq %rbx, %r15
addq -0x40(%rbp), %r12
decq %r14
jne 0x39504
movl -0x70(%rbp), %ecx
movl %ecx, %eax
movq %rsp, %rdx
movq %rax, -0x88(%rbp)
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rdx
movq %rdx, -0x128(%rbp)
movq %rdx, %rsp
movsd -0x100(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x7c(%rbp), %edx
movq -0x38(%rbp), %rbx
leaq (%rbx,%r13,4), %rax
movq %rax, -0x130(%rbp)
testl %ecx, %ecx
jle 0x39c44
movl %edx, -0x6c(%rbp)
movq -0x90(%rbp), %r14
movq -0xb8(%rbp), %rax
leaq (%r14,%rax,8), %rcx
movq %rcx, -0x118(%rbp)
leaq (%rsi,%r13,8), %rcx
movq %rcx, -0x110(%rbp)
shlq $0x4, %rax
addq %r14, %rax
movq %rax, -0xb8(%rbp)
leaq (%rbx,%r13,8), %rax
movq %rax, -0x170(%rbp)
shlq $0x4, %r13
addq %rsi, %r13
movq %r13, -0x50(%rbp)
movsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x74(%rbp), %eax
movl %eax, -0x64(%rbp)
xorl %r15d, %r15d
movq -0x120(%rbp), %r13
movq (%r13), %rdi
addq $0x18, %rdi
callq 0x10374
testl %eax, %eax
js 0x39681
cmpl $0x0, 0x34(%r13)
jns 0x39681
cmpl $0x0, 0x38(%r13)
js 0x39699
incq %r15
addq $0xc0, %r13
cmpq %r15, -0x88(%rbp)
jne 0x39662
jmp 0x39bf3
movl %eax, %r12d
movq (%r13), %rax
cmpl $0x0, 0x54(%rax)
js 0x39681
movsbl 0x68(%rax), %edi
callq 0x1fbd8
movq 0x28(%r13), %rsi
testq %rsi, %rsi
je 0x39681
movq (%rsi), %rcx
cmpl $0x0, 0x54(%rcx)
movq -0x58(%rbp), %rdx
js 0x39681
movq (%r13), %rcx
movslq 0x54(%rcx), %rcx
leaq (%rcx,%rcx,2), %rdi
shlq $0x6, %rdi
movsd 0x58(%r13), %xmm0
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm1
xorps %xmm2, %xmm2
cvtss2sd %xmm1, %xmm2
movl %r12d, %r12d
addsd (%r14,%r12,8), %xmm2
addq -0x178(%rbp), %rdi
movsd %xmm2, (%r14,%r12,8)
mulss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
addsd (%rdx,%r12,8), %xmm1
movsd %xmm1, (%rdx,%r12,8)
movsd 0x58(%rdi), %xmm3
cvtsd2ss %xmm3, %xmm4
cvtss2sd %xmm4, %xmm5
addsd %xmm2, %xmm5
movsd %xmm5, (%r14,%r12,8)
mulss %xmm4, %xmm4
xorps %xmm2, %xmm2
cvtss2sd %xmm4, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rdx,%r12,8)
addl $0x2, (%rbx,%r12,4)
movaps %xmm0, %xmm1
subsd %xmm3, %xmm1
xorps %xmm2, %xmm2
cvtsd2ss %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtss2sd %xmm2, %xmm1
mulss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
cmpl $0x13, %eax
ja 0x397ae
movl %eax, %ecx
movsd -0x730(%rbp,%rcx,8), %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, -0x730(%rbp,%rcx,8)
movsd -0x550(%rbp,%rcx,8), %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, -0x550(%rbp,%rcx,8)
movsd -0x370(%rbp,%rcx,8), %xmm3
addsd 0x1789b(%rip), %xmm3    # 0x51040
movsd %xmm3, -0x370(%rbp,%rcx,8)
movsd -0xc0(%rbp), %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, -0xc0(%rbp)
movsd -0x48(%rbp), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, -0x48(%rbp)
incl -0x6c(%rbp)
movq 0x28(%rsi), %rdx
testq %rdx, %rdx
je 0x39681
movq (%rdx), %rcx
cmpl $0x0, 0x54(%rcx)
js 0x39681
movsd 0x60(%r13), %xmm1
divsd %xmm0, %xmm1
xorps %xmm4, %xmm4
cvtsd2ss %xmm1, %xmm4
xorps %xmm0, %xmm0
movss %xmm0, -0x60(%rbp)
movss 0x17802(%rip), %xmm1    # 0x51010
ucomiss %xmm1, %xmm4
xorps %xmm2, %xmm2
movaps %xmm1, %xmm3
movl %eax, -0xc8(%rbp)
movq %rdi, -0x108(%rbp)
movq %rdx, -0x168(%rbp)
ja 0x3988f
movss 0x177cf(%rip), %xmm0    # 0x51004
ucomiss %xmm4, %xmm0
movaps %xmm0, %xmm3
ja 0x3988f
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x177ed(%rip), %xmm0    # 0x51040
subsd %xmm1, %xmm0
ucomisd 0x17801(%rip), %xmm0    # 0x51060
jb 0x39867
sqrtsd %xmm0, %xmm0
jmp 0x3987d
movss %xmm4, -0x2c(%rbp)
callq 0x2290
movss -0x2c(%rbp), %xmm4
movq -0x108(%rbp), %rdi
xorps %xmm2, %xmm2
cvtsd2ss %xmm0, %xmm2
movaps %xmm4, %xmm3
movss 0x17781(%rip), %xmm1    # 0x51010
movsd 0x60(%rdi), %xmm0
divsd 0x58(%rdi), %xmm0
xorps %xmm4, %xmm4
cvtsd2ss %xmm0, %xmm4
ucomiss %xmm1, %xmm4
movss %xmm2, -0xc4(%rbp)
movss %xmm3, -0x5c(%rbp)
ja 0x3990c
movss 0x1774a(%rip), %xmm0    # 0x51004
ucomiss %xmm4, %xmm0
movaps %xmm0, %xmm1
ja 0x3990c
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x17768(%rip), %xmm0    # 0x51040
subsd %xmm1, %xmm0
ucomisd 0x1777c(%rip), %xmm0    # 0x51060
jb 0x398ec
sqrtsd %xmm0, %xmm0
jmp 0x39900
movss %xmm4, -0x2c(%rbp)
callq 0x2290
movss -0x2c(%rbp), %xmm4
movss -0x5c(%rbp), %xmm3
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x60(%rbp)
movaps %xmm4, %xmm1
movss %xmm1, -0x2c(%rbp)
xorps %xmm0, %xmm0
cvtss2sd %xmm3, %xmm0
callq 0x2150
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movq -0x118(%rbp), %rax
addsd (%rax,%r12,8), %xmm1
movsd %xmm1, -0x160(%rbp)
movsd %xmm1, (%rax,%r12,8)
mulss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x110(%rbp), %rax
addsd (%rax,%r12,8), %xmm0
movsd %xmm0, -0x158(%rbp)
movsd %xmm0, (%rax,%r12,8)
xorps %xmm0, %xmm0
cvtss2sd -0x2c(%rbp), %xmm0
callq 0x2150
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
addsd -0x160(%rbp), %xmm1
movq -0x118(%rbp), %rax
movsd %xmm1, (%rax,%r12,8)
mulss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x158(%rbp), %xmm0
movq -0x110(%rbp), %rax
movsd %xmm0, (%rax,%r12,8)
movq -0x130(%rbp), %rax
addl $0x2, (%rax,%r12,4)
movss -0xc4(%rbp), %xmm1
mulss -0x2c(%rbp), %xmm1
movss -0x60(%rbp), %xmm0
mulss -0x5c(%rbp), %xmm0
subss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x2250
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
mulss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
movl -0xc8(%rbp), %edx
cmpl $0x13, %edx
ja 0x39a49
movl %edx, %eax
movsd -0x690(%rbp,%rax,8), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, -0x690(%rbp,%rax,8)
movsd -0x4b0(%rbp,%rax,8), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, -0x4b0(%rbp,%rax,8)
movsd -0x2d0(%rbp,%rax,8), %xmm2
addsd 0x17600(%rip), %xmm2    # 0x51040
movsd %xmm2, -0x2d0(%rbp,%rax,8)
incl -0x68(%rbp)
movsd -0xb0(%rbp), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, -0xb0(%rbp)
movsd -0xa8(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
movq -0x168(%rbp), %rax
movq 0x28(%rax), %rax
testq %rax, %rax
movq -0x108(%rbp), %rsi
je 0x39681
movq (%rax), %rax
cmpl $0x0, 0x54(%rax)
js 0x39681
movsd 0x68(%r13), %xmm0
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm1
xorps %xmm2, %xmm2
cvtss2sd %xmm1, %xmm2
movq -0xb8(%rbp), %rax
addsd (%rax,%r12,8), %xmm2
movsd %xmm2, (%rax,%r12,8)
mulss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x50(%rbp), %rcx
addsd (%rcx,%r12,8), %xmm1
movsd %xmm1, (%rcx,%r12,8)
movsd 0x68(%rsi), %xmm3
cvtsd2ss %xmm3, %xmm4
cvtss2sd %xmm4, %xmm5
addsd %xmm2, %xmm5
movsd %xmm5, (%rax,%r12,8)
movq -0x128(%rbp), %rax
movss %xmm4, (%rax,%r15,4)
mulss %xmm4, %xmm4
xorps %xmm2, %xmm2
cvtss2sd %xmm4, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rcx,%r12,8)
movq -0x170(%rbp), %rax
addl $0x2, (%rax,%r12,4)
subsd %xmm3, %xmm0
cvtsd2ss %xmm0, %xmm0
ucomiss 0x212c1(%rip), %xmm0    # 0x5adf0
jbe 0x39b3b
addss 0x212c3(%rip), %xmm0    # 0x5adfc
jmp 0x39b50
movss 0x212b1(%rip), %xmm1    # 0x5adf4
ucomiss %xmm0, %xmm1
jbe 0x39b50
addss 0x212a8(%rip), %xmm0    # 0x5adf8
incl -0x64(%rbp)
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movaps %xmm1, %xmm2
andps 0x1d7cc(%rip), %xmm2    # 0x57330
mulsd 0x2125c(%rip), %xmm2    # 0x5adc8
cvttsd2si %xmm2, %eax
movw %ax, 0x70(%r13)
movsd -0xa0(%rbp), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, -0xa0(%rbp)
mulss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd -0x98(%rbp), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, -0x98(%rbp)
cmpl $0x13, %edx
ja 0x39681
movl %edx, %eax
addsd -0x5f0(%rbp,%rax,8), %xmm1
movsd %xmm1, -0x5f0(%rbp,%rax,8)
addsd -0x410(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x410(%rbp,%rax,8)
movsd -0x230(%rbp,%rax,8), %xmm0
addsd 0x1745b(%rip), %xmm0    # 0x51040
movsd %xmm0, -0x230(%rbp,%rax,8)
jmp 0x39681
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x78(%rbp)
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0x98(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x6c(%rbp), %edx
jmp 0x39c4b
movq -0x90(%rbp), %r14
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movl %edx, -0x7c(%rbp)
leaq 0x21cbf(%rip), %rsi     # 0x5b931
leaq -0x7a0(%rbp), %r12
movq %r12, %rdi
movq -0x180(%rbp), %rdx
xorl %eax, %eax
callq 0x2260
leaq 0x1d5af(%rip), %rsi     # 0x57240
movq %r12, %rdi
callq 0x2210
movq %rax, %r15
leaq 0x18038(%rip), %rdi     # 0x51cdb
movq %r12, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x21c99(%rip), %rdi     # 0x5b94d
movl $0x2b, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2280
leaq 0x2e91b(%rip), %rax     # 0x685e8
cmpl $0x0, (%rax)
jle 0x39e00
xorl %ecx, %ecx
movq %rbx, -0x38(%rbp)
leaq (%rcx,%rcx,2), %rdx
addq 0x2d2f1(%rip), %rdx     # 0x66fd8
movq -0x130(%rbp), %rax
movq %rcx, -0x50(%rbp)
movl (%rax,%rcx,4), %ecx
movq %r15, %rbx
movq %r15, %rdi
leaq 0x21c77(%rip), %rsi     # 0x5b979
xorl %eax, %eax
callq 0x2190
movl $0x3, %r15d
movq %r14, -0x90(%rbp)
movq %r14, %r13
xorl %r14d, %r14d
movq -0x58(%rbp), %r12
movq -0x38(%rbp), %rax
movl (%rax,%r14), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd (%r13), %xmm2
divsd %xmm1, %xmm2
movsd (%r12,%r14,2), %xmm0
divsd %xmm1, %xmm0
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd %xmm2, (%r13)
divsd %xmm1, %xmm0
ucomisd 0x172f6(%rip), %xmm0    # 0x51060
jb 0x39d75
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x39d8c
movsd %xmm2, -0x48(%rbp)
callq 0x2290
movsd -0x48(%rbp), %xmm2
movq -0x58(%rbp), %r12
movapd %xmm0, %xmm1
movsd %xmm1, (%r12,%r14,2)
movq %rbx, %rdi
leaq 0x21be6(%rip), %rsi     # 0x5b982
movapd %xmm2, %xmm0
movb $0x2, %al
callq 0x2190
addq -0x138(%rbp), %r14
addq -0x40(%rbp), %r13
decq %r15
jne 0x39d20
movl $0xa, %edi
movq %rbx, %r15
movq %rbx, %rsi
callq 0x2140
movq -0x50(%rbp), %rcx
incq %rcx
leaq 0x2e80f(%rip), %rax     # 0x685e8
movslq (%rax), %rax
movq -0x38(%rbp), %rbx
addq $0x4, %rbx
addq $0x8, %r12
movq %r12, -0x58(%rbp)
movq -0x90(%rbp), %r14
addq $0x8, %r14
cmpq %rax, %rcx
jl 0x39cd8
leaq 0x227b0(%rip), %rdi     # 0x5c5b7
movl $0x2, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2280
leaq 0x220b0(%rip), %r12     # 0x5bed0
xorl %r13d, %r13d
leaq 0x21b9c(%rip), %r14     # 0x5b9c6
movq %r15, %rbx
cmpq $0x2, %r13
ja 0x39e53
movslq (%r12), %rdi
leaq 0x22092(%rip), %rax     # 0x5bed0
addq %rax, %rdi
movl $0x12, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2280
movl -0x7c(%rbp,%r13,4), %r15d
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd -0x100(%rbp,%r13,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, -0x100(%rbp,%r13,8)
movsd -0xe0(%rbp,%r13,8), %xmm2
divsd %xmm0, %xmm2
movsd %xmm1, -0x38(%rbp)
mulsd %xmm1, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
leal -0x1(%r15), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd %xmm2, -0xe0(%rbp,%r13,8)
divsd %xmm1, %xmm0
ucomisd 0x171a8(%rip), %xmm0    # 0x51060
jb 0x39ec0
sqrtsd %xmm0, %xmm0
jmp 0x39ecf
movsd %xmm2, -0x40(%rbp)
callq 0x2290
movsd -0x40(%rbp), %xmm2
ucomisd 0x17189(%rip), %xmm2    # 0x51060
jb 0x39ee2
xorps %xmm3, %xmm3
sqrtsd %xmm2, %xmm3
jmp 0x39ef9
movsd %xmm0, -0x40(%rbp)
movapd %xmm2, %xmm0
callq 0x2290
movapd %xmm0, %xmm3
movsd -0x40(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
xorps %xmm4, %xmm4
cvtsi2ss %r15d, %xmm4
cvtss2sd %xmm4, %xmm4
movq %rbx, %rdi
movq %r14, %rsi
movb $0x5, %al
callq 0x2190
incq %r13
addq $0x4, %r12
cmpq $0x3, %r13
jne 0x39e2d
leaq 0x21ab7(%rip), %rdi     # 0x5b9f9
movl $0x20, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2280
leaq 0x21abf(%rip), %rdi     # 0x5ba1a
movl $0x1b, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2280
leaq 0x21ac2(%rip), %rdi     # 0x5ba36
movl $0x22, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2280
xorl %r13d, %r13d
leaq 0x21ac9(%rip), %r14     # 0x5ba59
leaq 0x21acd(%rip), %r12     # 0x5ba64
leaq 0x2f1da(%rip), %rax     # 0x69178
movq (%rax), %rax
movsbl (%rax,%r13), %edi
movq %rbx, %rsi
callq 0x2140
xorl %r15d, %r15d
movq -0x150(%rbp), %rax
movsd (%rax,%r15), %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
xorpd %xmm1, %xmm1
jne 0x39fce
jnp 0x3a032
movq -0x148(%rbp), %rax
movsd (%rax,%r15), %xmm1
movq -0x140(%rbp), %rax
movsd (%rax,%r15), %xmm0
divsd %xmm2, %xmm0
ucomisd 0x1706c(%rip), %xmm0    # 0x51060
jb 0x39ffc
sqrtsd %xmm0, %xmm0
jmp 0x3a015
movsd %xmm2, -0x38(%rbp)
movsd %xmm1, -0x40(%rbp)
callq 0x2290
movsd -0x40(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
divsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
xorps %xmm2, %xmm2
cvtsd2ss %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtss2sd %xmm2, %xmm1
movq %rbx, %rdi
movq %r14, %rsi
movb $0x2, %al
callq 0x2190
addq $0xa0, %r15
cmpq $0x1e0, %r15            # imm = 0x1E0
jne 0x39fb1
movsd -0x370(%rbp,%r13,8), %xmm0
movq %rbx, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x2190
incq %r13
addq $0x8, -0x150(%rbp)
addq $0x8, -0x148(%rbp)
addq $0x8, -0x140(%rbp)
cmpq $0x14, %r13
jne 0x39f97
leaq 0x2f02a(%rip), %r15     # 0x690c0
movl (%r15), %esi
leaq 0x219cb(%rip), %r14     # 0x5ba6b
movq %r14, %rdi
xorl %eax, %eax
callq 0x20f0
leaq 0x21d22(%rip), %rdi     # 0x5bdd3
callq 0x2090
movl (%r15), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2190
leaq 0x219c4(%rip), %rdi     # 0x5ba91
movl $0x25, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2280
cmpl $0x0, -0x70(%rbp)
movq -0x120(%rbp), %r14
jle 0x3a1b5
addq $0x70, %r14
xorl %r12d, %r12d
movq -0x70(%r14), %r15
leaq 0x18(%r15), %r13
movl $0x2, %edx
movq %r13, %rdi
leaq 0x1b05c(%rip), %rsi     # 0x5516a
callq 0x2070
testl %eax, %eax
jne 0x3a19e
movswl (%r14), %r10d
leaq 0x2ef9a(%rip), %rax     # 0x690c0
cmpl %r10d, (%rax)
jge 0x3a19e
movsbl 0x68(%r15), %ecx
movl 0x64(%r15), %r8d
movl 0x6c(%r15), %r9d
incl %r9d
movsd -0x8(%r14), %xmm0
mulsd 0x20c7f(%rip), %xmm0    # 0x5adc8
movq -0x128(%rbp), %rax
movss (%rax,%r12,4), %xmm1
mulss 0x20ca2(%rip), %xmm1    # 0x5ae00
cvtss2sd %xmm1, %xmm1
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0x21947(%rip), %rsi     # 0x5bab7
movq %r13, %rdx
movb $0x2, %al
pushq %r10
callq 0x2190
addq $0x10, %rsp
movsbl 0x68(%r15), %edx
movl 0x64(%r15), %ecx
movswl (%r14), %r8d
leaq 0x2193e(%rip), %rdi     # 0x5bad2
movq %r13, %rsi
xorl %eax, %eax
callq 0x20f0
incq %r12
addq $0xc0, %r14
cmpq %r12, -0x88(%rbp)
jne 0x3a0f7
movq %rbx, %rdi
callq 0x20c0
movq -0x188(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq