// File: /workspace/github_c_makefile_star2_O2/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 $0x748, %rsp            # imm = 0x748
movq %rcx, -0x160(%rbp)
movl %edx, %r14d
movq %rsi, -0x70(%rbp)
movq %rdi, -0xf8(%rbp)
leaq -0x3b0(%rbp), %rax
leaq -0x770(%rbp), %rcx
leaq -0x590(%rbp), %rdx
xorl %esi, %esi
movl $0xa0, %edi
cmpq $0x3, %rsi
je 0x3486b
andl $0x0, -0x64(%rbp,%rsi,4)
andq $0x0, -0xe0(%rbp,%rsi,8)
andq $0x0, -0xc0(%rbp,%rsi,8)
xorl %r8d, %r8d
cmpq $0x14, %r8
je 0x3485d
andq $0x0, (%rax,%r8,8)
andq $0x0, (%rcx,%r8,8)
andq $0x0, (%rdx,%r8,8)
incq %r8
jmp 0x34843
incq %rsi
addq %rdi, %rax
addq %rdi, %rcx
addq %rdi, %rdx
jmp 0x34823
leaq 0x1a87c(%rip), %rdi     # 0x4f0ee
callq 0xf464
movq %rsp, -0x168(%rbp)
leaq 0x2ed63(%rip), %rcx     # 0x635e8
movl (%rcx), %r10d
movq %rsp, %r12
imulq $0x18, %r10, %rax
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movl (%rcx), %r11d
leaq (%r11,%r11,2), %rax
movq %rsp, %rdi
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
subq %rcx, %rdi
movq %rdi, %rsp
movq %rsp, %r8
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %r8
movq %r8, %rsp
xorl %eax, %eax
testl %r11d, %r11d
movl $0x0, %ecx
cmovgl %r11d, %ecx
leaq (,%r11,4), %rdx
movq %rdx, -0x80(%rbp)
leaq (,%r11,8), %rdx
leaq (,%r10,8), %rsi
movq %rsi, -0x110(%rbp)
movq %r12, %rsi
movq %rdi, -0x38(%rbp)
movq %r8, -0x30(%rbp)
cmpq $0x3, %rax
je 0x3493f
xorl %r9d, %r9d
cmpq %r9, %rcx
je 0x3492c
andq $0x0, (%rsi,%r9,8)
andq $0x0, (%rdi,%r9,8)
andl $0x0, (%r8,%r9,4)
incq %r9
jmp 0x34913
incq %rax
addq -0x80(%rbp), %r8
addq %rdx, %rdi
addq -0x110(%rbp), %rsi
jmp 0x3490a
movl %r14d, %eax
movq %rsp, %rcx
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x100(%rbp)
movq %rcx, %rsp
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x58(%rbp)
leaq (%r12,%r10,8), %rax
movq %rax, -0xf0(%rbp)
movq -0x38(%rbp), %rax
leaq (%rax,%r11,8), %rcx
movq %rcx, -0xe8(%rbp)
movq -0x30(%rbp), %rcx
leaq (%rcx,%r11,4), %rdx
movq %rdx, -0x108(%rbp)
shlq $0x4, %r10
addq %r12, %r10
movq %r10, -0x158(%rbp)
leaq (%rcx,%r11,8), %rcx
movq %rcx, -0x148(%rbp)
shlq $0x4, %r11
addq %rax, %r11
movq %r11, -0x150(%rbp)
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x54(%rbp)
xorl %r13d, %r13d
testl %r14d, %r14d
cmovlel %r13d, %r14d
movq -0xf8(%rbp), %r15
cmpq %r13, %r14
je 0x34ea0
movq (%r15), %rdi
addq $0x18, %rdi
callq 0xf464
testl %eax, %eax
js 0x34a52
cmpl $0x0, 0x34(%r15)
jns 0x34a52
cmpl $0x0, 0x38(%r15)
js 0x34a5e
incq %r13
addq $0xc0, %r15
jmp 0x34a2b
movl %eax, %ebx
movq (%r15), %rax
cmpl $0x0, 0x54(%rax)
js 0x34a52
movsbl 0x68(%rax), %edi
callq 0x1d91c
movq 0x28(%r15), %rdx
testq %rdx, %rdx
je 0x34a52
movq (%rdx), %rcx
cmpl $0x0, 0x54(%rcx)
js 0x34a52
movq (%r15), %rcx
movslq 0x54(%rcx), %rcx
imulq $0xc0, %rcx, %rdi
movsd 0x58(%r15), %xmm0
cvtsd2ss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm2
movl %ebx, %r8d
addsd (%r12,%r8,8), %xmm2
mulss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x38(%rbp), %rcx
addsd (%rcx,%r8,8), %xmm1
addq -0x70(%rbp), %rdi
movsd 0x58(%rdi), %xmm3
cvtsd2ss %xmm3, %xmm4
cvtss2sd %xmm4, %xmm5
addsd %xmm2, %xmm5
movsd %xmm5, (%r12,%r8,8)
mulss %xmm4, %xmm4
cvtss2sd %xmm4, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%rcx,%r8,8)
movq -0x30(%rbp), %rcx
addl $0x2, (%rcx,%r8,4)
movaps %xmm0, %xmm1
subsd %xmm3, %xmm1
cvtsd2ss %xmm1, %xmm2
cvtss2sd %xmm2, %xmm1
mulss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
movl %eax, %esi
cmpl $0x13, %eax
ja 0x34b55
movsd -0x770(%rbp,%rsi,8), %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, -0x770(%rbp,%rsi,8)
movsd -0x590(%rbp,%rsi,8), %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, -0x590(%rbp,%rsi,8)
movsd -0x3b0(%rbp,%rsi,8), %xmm3
addsd 0x164fc(%rip), %xmm3    # 0x4b048
movsd %xmm3, -0x3b0(%rbp,%rsi,8)
movsd -0x48(%rbp), %xmm3
addsd %xmm1, %xmm3
movsd %xmm3, -0x48(%rbp)
movsd -0x40(%rbp), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, -0x40(%rbp)
incl -0x78(%rbp)
movq 0x28(%rdx), %rdx
testq %rdx, %rdx
je 0x34a52
movq (%rdx), %rcx
cmpl $0x0, 0x54(%rcx)
js 0x34a52
movq %rdx, -0x130(%rbp)
movsd 0x60(%r15), %xmm1
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movq %r8, -0x138(%rbp)
movq %rdi, %rbx
leaq -0x1d0(%rbp), %rdi
movl %eax, -0xa4(%rbp)
movq %rsi, -0x140(%rbp)
callq 0x35669
movss %xmm0, -0x50(%rbp)
movsd 0x60(%rbx), %xmm0
movq %rbx, -0x118(%rbp)
divsd 0x58(%rbx), %xmm0
movq -0x138(%rbp), %rbx
cvtsd2ss %xmm0, %xmm0
leaq -0xa8(%rbp), %rdi
callq 0x35669
movss %xmm0, -0x4c(%rbp)
cvtss2sd -0x50(%rbp), %xmm0
callq 0x2150
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm1
movq -0xf0(%rbp), %rax
addsd (%rax,%rbx,8), %xmm1
movsd %xmm1, -0x120(%rbp)
mulss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movq -0xe8(%rbp), %rax
addsd (%rax,%rbx,8), %xmm0
movsd %xmm0, -0x128(%rbp)
cvtss2sd -0x4c(%rbp), %xmm0
callq 0x2150
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm1
addsd -0x120(%rbp), %xmm1
movq -0xf0(%rbp), %rax
movsd %xmm1, (%rax,%rbx,8)
mulss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x108(%rbp), %rax
addl $0x2, (%rax,%rbx,4)
addsd -0x128(%rbp), %xmm0
movq -0xe8(%rbp), %rax
movsd %xmm0, (%rax,%rbx,8)
movss -0x4c(%rbp), %xmm1
mulss -0x1d0(%rbp), %xmm1
movss -0x50(%rbp), %xmm0
mulss -0xa8(%rbp), %xmm0
subss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x2250
movq -0x140(%rbp), %rsi
movl -0xa4(%rbp), %edx
cvtsd2ss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm0
mulss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
cmpl $0x13, %edx
ja 0x34d16
movsd -0x6d0(%rbp,%rsi,8), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, -0x6d0(%rbp,%rsi,8)
movsd -0x4f0(%rbp,%rsi,8), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, -0x4f0(%rbp,%rsi,8)
movsd -0x310(%rbp,%rsi,8), %xmm2
addsd 0x1633b(%rip), %xmm2    # 0x4b048
movsd %xmm2, -0x310(%rbp,%rsi,8)
movq -0x130(%rbp), %rax
movq 0x28(%rax), %rax
testq %rax, %rax
je 0x34e70
movq (%rax), %rax
cmpl $0x0, 0x54(%rax)
js 0x34e70
movsd 0x68(%r15), %xmm2
cvtsd2ss %xmm2, %xmm3
cvtss2sd %xmm3, %xmm4
movq -0x158(%rbp), %rax
addsd (%rax,%rbx,8), %xmm4
mulss %xmm3, %xmm3
cvtss2sd %xmm3, %xmm3
movq -0x150(%rbp), %rcx
addsd (%rcx,%rbx,8), %xmm3
movq -0x118(%rbp), %rdi
movsd 0x68(%rdi), %xmm5
cvtsd2ss %xmm5, %xmm6
cvtss2sd %xmm6, %xmm7
addsd %xmm4, %xmm7
movsd %xmm7, (%rax,%rbx,8)
movq -0x100(%rbp), %rax
movss %xmm6, (%rax,%r13,4)
mulss %xmm6, %xmm6
cvtss2sd %xmm6, %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, (%rcx,%rbx,8)
movq -0x148(%rbp), %rax
addl $0x2, (%rax,%rbx,4)
subsd %xmm5, %xmm2
cvtsd2ss %xmm2, %xmm2
ucomiss 0x1ff46(%rip), %xmm2    # 0x54d00
jbe 0x34dc6
addss 0x1ff48(%rip), %xmm2    # 0x54d0c
jmp 0x34ddb
movss 0x1ff36(%rip), %xmm3    # 0x54d04
ucomiss %xmm2, %xmm3
jbe 0x34ddb
addss 0x1ff2d(%rip), %xmm2    # 0x54d08
cvtss2sd %xmm2, %xmm3
movaps %xmm3, %xmm4
andps 0x1c457(%rip), %xmm4    # 0x51240
mulsd 0x1fecf(%rip), %xmm4    # 0x54cc0
cvttsd2si %xmm4, %eax
movw %ax, 0x70(%r15)
incl -0x54(%rbp)
movsd -0x88(%rbp), %xmm4
addsd %xmm3, %xmm4
movsd %xmm4, -0x88(%rbp)
mulss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
movsd -0x90(%rbp), %xmm4
addsd %xmm2, %xmm4
movsd %xmm4, -0x90(%rbp)
cmpl $0x13, %edx
ja 0x34e70
addsd -0x630(%rbp,%rsi,8), %xmm3
movsd %xmm3, -0x630(%rbp,%rsi,8)
addsd -0x450(%rbp,%rsi,8), %xmm2
movsd %xmm2, -0x450(%rbp,%rsi,8)
movsd -0x270(%rbp,%rsi,8), %xmm2
addsd 0x161e1(%rip), %xmm2    # 0x4b048
movsd %xmm2, -0x270(%rbp,%rsi,8)
incl -0x58(%rbp)
movsd -0xa0(%rbp), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, -0xa0(%rbp)
movsd -0x98(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x34a52
movq %r14, -0x70(%rbp)
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0x98(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x60(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x5c(%rbp)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x64(%rbp)
leaq 0x20932(%rip), %rsi     # 0x55849
leaq -0x1d0(%rbp), %rbx
movq %rbx, %rdi
movq -0x160(%rbp), %rdx
xorl %eax, %eax
callq 0x2260
leaq 0x1c21a(%rip), %rsi     # 0x51150
movq %rbx, %rdi
callq 0x2210
movq %rax, %r15
leaq 0x16d5f(%rip), %rdi     # 0x4bca7
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x2090c(%rip), %rdi     # 0x55865
pushq $0x2b
popq %rsi
pushq $0x1
popq %rdx
movq %r15, %rcx
callq 0x2280
leaq 0x2092c(%rip), %rbx     # 0x5589a
xorl %ecx, %ecx
leaq 0x2e671(%rip), %rax     # 0x635e8
movslq (%rax), %rax
cmpq %rax, %rcx
jge 0x3507a
leaq (%rcx,%rcx,2), %rdx
addq 0x2d04a(%rip), %rdx     # 0x61fd8
movq -0x108(%rbp), %rax
movq %rcx, -0x78(%rbp)
movl (%rax,%rcx,4), %ecx
movq %r15, %rdi
leaq 0x208eb(%rip), %rsi     # 0x55891
xorl %eax, %eax
callq 0x2190
movq %r12, -0x40(%rbp)
movq %r12, %r14
xorl %r13d, %r13d
pushq $0x3
popq %r12
subq $0x1, %r12
jb 0x35051
movq -0x30(%rbp), %rax
movl (%rax,%r13), %eax
cvtsi2sd %eax, %xmm1
movsd (%r14), %xmm2
divsd %xmm1, %xmm2
movq -0x38(%rbp), %rcx
movsd (%rcx,%r13,2), %xmm0
divsd %xmm1, %xmm0
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
decl %eax
cvtsi2sd %eax, %xmm1
movsd %xmm2, (%r14)
divsd %xmm1, %xmm0
ucomisd 0x16045(%rip), %xmm0    # 0x4b050
jb 0x35013
sqrtsd %xmm0, %xmm1
jmp 0x35026
movsd %xmm2, -0x48(%rbp)
callq 0x2290
movsd -0x48(%rbp), %xmm2
movapd %xmm0, %xmm1
movq -0x38(%rbp), %rax
movsd %xmm1, (%rax,%r13,2)
movq %r15, %rdi
movq %rbx, %rsi
movapd %xmm2, %xmm0
movb $0x2, %al
callq 0x2190
addq -0x80(%rbp), %r13
addq -0x110(%rbp), %r14
jmp 0x34fbb
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x2140
movq -0x78(%rbp), %rcx
incq %rcx
addq $0x4, -0x30(%rbp)
addq $0x8, -0x38(%rbp)
movq -0x40(%rbp), %r12
addq $0x8, %r12
jmp 0x34f70
leaq 0x2145e(%rip), %rdi     # 0x564df
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r15, %rcx
callq 0x2280
xorl %r14d, %r14d
leaq 0x20d57(%rip), %rbx     # 0x55df0
leaq 0x2083e(%rip), %r13     # 0x558de
cmpq $0xc, %r14
je 0x35191
movslq (%r14,%rbx), %rdi
addq %rbx, %rdi
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
movq %r15, %rcx
callq 0x2280
movl -0x64(%rbp,%r14), %r12d
cvtsi2sd %r12d, %xmm0
movsd -0xe0(%rbp,%r14,2), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, -0xe0(%rbp,%r14,2)
movsd -0xc0(%rbp,%r14,2), %xmm2
divsd %xmm0, %xmm2
movsd %xmm1, -0x38(%rbp)
mulsd %xmm1, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
leal -0x1(%r12), %eax
cvtsi2sd %eax, %xmm1
movsd %xmm2, -0xc0(%rbp,%r14,2)
divsd %xmm1, %xmm0
ucomisd 0x15f31(%rip), %xmm0    # 0x4b050
jb 0x35127
sqrtsd %xmm0, %xmm0
jmp 0x35136
movsd %xmm2, -0x30(%rbp)
callq 0x2290
movsd -0x30(%rbp), %xmm2
ucomisd 0x15f12(%rip), %xmm2    # 0x4b050
jb 0x35146
sqrtsd %xmm2, %xmm3
jmp 0x3515d
movsd %xmm0, -0x30(%rbp)
movapd %xmm2, %xmm0
callq 0x2290
movapd %xmm0, %xmm3
movsd -0x30(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
cvtsi2ss %r12d, %xmm4
cvtss2sd %xmm4, %xmm4
movq %r15, %rdi
movq %r13, %rsi
movb $0x5, %al
callq 0x2190
addq $0x4, %r14
jmp 0x350a0
leaq 0x20779(%rip), %rdi     # 0x55911
pushq $0x20
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq %r15, %rcx
callq 0x2280
leaq 0x20782(%rip), %rdi     # 0x55932
pushq $0x1b
popq %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x2280
leaq 0x20789(%rip), %rdi     # 0x5594e
pushq $0x22
popq %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x2280
leaq -0x3b0(%rbp), %r14
leaq -0x770(%rbp), %r13
leaq -0x590(%rbp), %rbx
xorl %r12d, %r12d
cmpq $0x14, %r12
je 0x352d3
leaq 0x2ef7c(%rip), %rax     # 0x64178
movq (%rax), %rax
movq %r12, -0x80(%rbp)
movsbl (%rax,%r12), %edi
movq %r15, %rsi
callq 0x2140
xorl %r12d, %r12d
cmpq $0x1e0, %r12            # imm = 0x1E0
je 0x352a0
movsd (%r14,%r12), %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
xorps %xmm1, %xmm1
jne 0x35235
jnp 0x35283
movsd (%r13,%r12), %xmm1
movsd (%rbx,%r12), %xmm0
divsd %xmm2, %xmm0
ucomisd 0x15e02(%rip), %xmm0    # 0x4b050
jb 0x35256
sqrtsd %xmm0, %xmm0
jmp 0x3526f
movsd %xmm2, -0x38(%rbp)
movsd %xmm1, -0x30(%rbp)
callq 0x2290
movsd -0x30(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
divsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm2
cvtss2sd %xmm1, %xmm0
cvtss2sd %xmm2, %xmm1
movq %r15, %rdi
leaq 0x206e4(%rip), %rsi     # 0x55971
movb $0x2, %al
callq 0x2190
addq $0xa0, %r12
jmp 0x35213
movq -0x80(%rbp), %r12
movsd -0x3b0(%rbp,%r12,8), %xmm0
movq %r15, %rdi
leaq 0x206c4(%rip), %rsi     # 0x5597c
movb $0x1, %al
callq 0x2190
incq %r12
addq $0x8, %r14
addq $0x8, %r13
addq $0x8, %rbx
jmp 0x351eb
leaq 0x2ede6(%rip), %r14     # 0x640c0
movl (%r14), %esi
leaq 0x2069f(%rip), %rbx     # 0x55983
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20f0
leaq 0x209f6(%rip), %rdi     # 0x55ceb
callq 0x2090
movl (%r14), %edx
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2190
leaq 0x20698(%rip), %rdi     # 0x559a9
pushq $0x25
popq %rsi
pushq $0x1
popq %rdx
movq %r15, %rcx
callq 0x2280
movq -0xf8(%rbp), %rax
addq $0x70, %rax
xorl %ebx, %ebx
movq -0x70(%rbp), %r13
cmpq %rbx, %r13
je 0x353fa
movq -0x70(%rax), %r12
cmpb $0x43, 0x18(%r12)
jne 0x353ec
cmpb $0x41, 0x19(%r12)
jne 0x353ec
movswl (%rax), %r10d
cmpl %r10d, (%r14)
jge 0x353ec
leaq 0x18(%r12), %r13
movsbl 0x68(%r12), %ecx
movl 0x64(%r12), %r8d
movl 0x6c(%r12), %r9d
incl %r9d
movsd -0x8(%rax), %xmm0
mulsd 0x1f939(%rip), %xmm0    # 0x54cc0
movq -0x100(%rbp), %rdx
movss (%rdx,%rbx,4), %xmm1
mulss 0x1f975(%rip), %xmm1    # 0x54d10
cvtss2sd %xmm1, %xmm1
subq $0x8, %rsp
movq %rax, %r14
movq %r15, %rdi
leaq 0x2061f(%rip), %rsi     # 0x559cf
movq %r13, %rdx
movb $0x2, %al
pushq %r10
callq 0x2190
popq %rcx
popq %rdx
movsbl 0x68(%r12), %edx
movl 0x64(%r12), %ecx
movswl (%r14), %r8d
leaq 0x20616(%rip), %rdi     # 0x559ea
movq %r13, %rsi
movq -0x70(%rbp), %r13
xorl %eax, %eax
callq 0x20f0
movq %r14, %rax
leaq 0x2ecd4(%rip), %r14     # 0x640c0
incq %rbx
addq $0xc0, %rax
jmp 0x35330
movq %r15, %rdi
callq 0x20c0
movq -0x168(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq