// File: /workspace/github_c_makefile_star2_O2/YunyiQian[P]multitel3/multisyn.c
// Function: main
int main(int argc, char **argv) {
  int	i,j,k,nn,ns,npt[3],npt1,npt2,error,intg,diff,src_type,filter,pt_shift;
  char	nam1[128],nam2[128],outnm[128],*ccc,*ddd,com[3]={'z','r','t'};
  int	dynamic=1,core=0;
  float	coef,rad[4][3],m0,az,*grn1,*grn2,*syn[3],*src,*pt,disp[3],mt[3][3];
  float cmpinc[3]={0,90.,90.}, cmpaz[3];
  float dt, dura, rise, tp, ts, tmp, dist, shift;
  float	*trapezoid(float, float, float, int *);
  float b[3],b1[3],b2[3],e[3],e1[3],e2[3];
  SACHEAD	hd,hd1,hd2;
#ifdef SAC_LIB
  char type[2] = {'B','P'}, proto[2] = {'B','U'};
  float	sn[30], sd[30];
  double f1, f2;
  long int order, nsects;
#endif
  void  fttq_(float *, float *, int *, int *, float *);
  int	mftm=2048, nftm;
  float	tstar=0., ftm[2048];

  /* input parameters */
  ns = 0;
  dura = 0.;
  src_type=0;
  intg=0;
  diff=0;
  filter=0;
  shift=0.;
  error = 0;
  for (i=1; !error && i < argc; i++) {
     if (argv[i][0] == '-') {
	switch(argv[i][1]) {

 	   case 'A':
	      sscanf(&argv[i][2], "%f",&az);
	      cmpaz[0] = 0.;
	      cmpaz[1] = az;
	      cmpaz[2] = az+90.;
	      if (cmpaz[2] > 360.) cmpaz[2] -= 360.;
	      break;
      
      case 'C':
         strcpy(nam2,&argv[i][2]);
         core = 1;
	      break;

 	   case 'D':
	      j = sscanf(&argv[i][2], "%f/%f",&dura,&rise);
	      if (j<2) rise = 0.5;
	      break;

#ifdef SAC_LIB
 	   case 'F':
	      filter = 1;
	      j = sscanf(&argv[i][2], "%lf/%lf/%ld",&f1,&f2,&order);
	      if (j<3) order = 4;
	      break;
#endif

 	   case 'G':
	      strcpy(nam1,&argv[i][2]);
	      break;

	   case 'I':
	      intg = 1;
	      break;

	   case 'J':
	      diff = 1;
	      break;

 	   case 'M':
	      src_type = sscanf(&argv[i][2], "%f/%f/%f/%f/%f/%f/%f",&m0,&mt[0][0],&mt[0][1],&mt[0][2],&mt[1][1],&mt[1][2],&mt[2][2]);
	      break;

 	   case 'O':
	      strcpy(outnm, &argv[i][2]);
	      break;

	   case 'P':
	      dynamic = 0;
	      break;

	   case 'Q':
	      sscanf(&argv[i][2], "%f",&tstar);
	      break;

 	   case 'S':
	      if ( (src=read_sac(&argv[i][2],&hd)) != NULL ) {
                 ns = hd.npts;
		 shift = -hd.b;
	      }
	      break;

	   default:
	      error = 1;
	      break;
	}
     }
        else error = 1;
  }

  switch (src_type) {
  case 1:
     nn = 1;
     m0 = m0*1.0e-20;
     break;
  case 3:
     nn = 2;
     sf_radiat(az-mt[0][0],mt[0][1],rad);
     m0 = m0*1.0e-15;
     break;
  case 4:
     nn = 3;
     dc_radiat(az-mt[0][0],mt[0][1],mt[0][2],rad);
     m0 = pow(10.,1.5*m0+16.1-20);
     break;
  case 7:
     nn = 4;
     mt_radiat(az,mt,rad);
     m0 = m0*1.0e-20;
     break;
  default:
     error = 1;
  }

  if (dynamic) ccc = strrchr(nam1, (int) '.') + 1;
  if (core) ddd = strrchr(nam2, (int) '.') + 1;

  if(argc == 1 || error || (dynamic && src_type == 1 && (*ccc) != 'a') ) {
     fprintf(stderr,"Usage: %s -Mmag([[/Strike/Dip]/Rake]|/Mxx/Mxy/Mxz/Myy/Myz/Mzz) -Aazimuth ([-SsrcFunctionName | -Ddura[/rise]] [-Ff1/f2[/n]] [-I | -J] -OoutName.z -GFirstCompOfGreen | -P)\n\
   Compute displacements in cm in the up, radial, and transverse (clockwise) directions produced by difference seismic sources\n\
   -M Specify source magnitude and orientation or moment-tensor\n\
      For double-couple, mag is Mw, strike/dip/rake are in A&R convention\n\
      For explosion; mag in in dyne-cm, no strike, dip, and rake needed\n\
      For single-force source; mag is in dyne, only strike and dip are needed\n\
      For moment-tensor; mag in dyne-cm, x=N,y=E,z=Down\n\
   -A Set station azimuth in degree measured from the North\n\
   -C Give the name of the first component of the core FK Green function\n\
   -D Specify the source time function as a trapezoid,\n\
      give the total duration and rise-time (0-0.5, default 0.5=triangle)\n\
   -F apply n-th order Butterworth band-pass filter, SAC lib required (off, n=4, must be < 10)\n\
   -G Give the name of the first component of the direct FK Green function\n\
   -I Integration once\n\
   -J Differentiate the synthetics\n\
   -O Output SAC file name\n\
   -P Compute static displacement, input Green functions from stdin in the form\n\
	distance Z45 R45 T45 ZDD RDD TDD ZSS RSS TSS [distance ZEX REX TEX]\n\
      The displacements will be output to stdout in the form of\n\
	distance azimuth z r t\n\
   -Q Convolve a Futterman Q operator of tstar (no)\n\
   -S Specify the SAC file name of the source time function (its sum. must be 1)\n\
   Examples:\n\
   * To compute three-component velocity at N33.5E azimuth from a Mw 4.5\n\
earthquake (strike 355, dip 80, rake -70), use:\n\
	multisyn -M4.5/355/80/-70 -D1 -A33.5 -OPAS.z -Gsp6direct_10/50.grn.0 -Csp6core_10/50.grn.0\n\
   * To compute the static displacements from the same earthquake, use:\n\
	nawk \'$1==50\' st.out | multisyn -M4.5/355/80/-70 -A33.5 -P\n\
   * To compute displacement from an explosion, use:\n\
   	multisyn -M3.3e20 -D1 -A33.5 -OPAS.z -Gsp6direct_10/50.grn.a -Csp6core_10/50.grn.a\n\
      or\n\
        multisyn -M3.3e20/1/0/0/1/0/1 -D1 -A33.5 -OPAS.z -Gsp6direct_10/50.grn.0 -Csp6core_10/50.grn.0\n\
	\n",argv[0]);
    return -1;
  }

  for(j=0; j<3; j++) disp[j] = 0.;
  for(i=0; i<nn; i++) {	/* sum up contribution from a DD, DS, SS, and EX */
//   for(i=0; i<1; i++) {	/* sum up contribution from a DD, DS, SS, and EX */
     for(j=0; j<3; j++) {
	coef = m0; if (nn>1) coef *= rad[i][j];
	if (!dynamic) {
	   if ((i==0||i==3) && j==0) scanf("%f",&dist);
	   scanf("%f",&tmp);
	   disp[j] += coef*tmp;
	   continue;
	}
        if ( (grn1=read_sac(nam1,&hd1)) == NULL ) continue;
        if (core) {
           if ( (grn2=read_sac(nam2,&hd2)) == NULL ) continue;
        }

	if ( i==0 ) {
      hd = hd1;
      dt = hd1.delta;
      npt1 = hd1.npts;
      npt[j] = npt1;
      b[j] = hd1.b;
      e[j] = hd1.e;
      if (core) {
         b1[j] = hd1.b;
         e1[j] = hd1.e;
         b2[j] = hd2.b;
         e2[j] = hd2.e;
         npt2 = hd2.npts;
         if ( b1[j]<=b2[j] ) b[j] = b1[j];
         if ( b1[j]>b2[j] ) b[j] = b2[j];
         if ( e1[j]>=e2[j] ) e[j] = e1[j];
         if ( e1[j]<e2[j] ) e[j] = e2[j];
         npt[j] = (int) ((e[j]-b[j])/dt+2);
         e[j] = b[j]+(npt[j]-1)*dt;
      }
	   tp = hd1.t1; ts = hd1.t2;
  	   syn[j]=(float *) calloc(npt[j], sizeof(float));
	   if (dura>0.&& j==0) src = trapezoid(dura,rise,dt,&ns);
	}
	else if (hd1.npts != npt1) {
	   fprintf(stderr,"number points in %s not agree with %d\n",nam1,npt1);
	}
   else if (core) {
	   if (hd2.npts != npt2) {
         fprintf(stderr,"number points in %s not agree with %d\n",nam2,npt2);
      }
   }
        for(pt=syn[j],k=0;k<npt1;k++,pt++) (*pt) += coef*grn1[k];
        free(grn1);
        (*ccc)++;
        if (core) {
           pt_shift = (int) (fabs(b1[j]-b2[j])/dt);
           for(pt=syn[j]+pt_shift,k=0;k<npt2;k++,pt++) (*pt) += coef*grn2[k];
           free(grn2);
           (*ddd)++;
        }
        
	if (*ccc == '9') {
      (*ccc)+=40;	/* explosion components start at 'a' instead of '0' */
      if (core) (*ddd)+=40;
   }
     }
  }

  if (!dynamic) {
     printf("%8.2f %8.2f %10.3e %10.3e %10.3e\n",dist,az,disp[0],disp[1],disp[2]);
     return 0;
  }

  /* convolve a source time function. integrate or filtering if needed */
#ifdef SAC_LIB
  if (filter) design(order, type, proto, 1., 1., f1, f2, (double) dt, sn, sd, &nsects);
#endif
  if (tstar>0.) fttq_(&dt,&tstar,&mftm,&nftm,ftm);
  for(j=0;j<3;j++) {
     if (ns > 0) conv(src,ns,syn[j],npt[j]);
     if (intg) cumsum(syn[j],npt[j],dt);
     if (diff) diffrt(syn[j],npt[j],dt);
#ifdef SAC_LIB
     if (filter) apply(syn[j],(long int)npt,0,sn,sd,nsects);
#endif
     if (tstar>0.) conv(ftm,nftm,syn[j],npt[j]);
  }

  /* output */
  ccc = outnm + strlen(outnm) - 1;
  if (ns == 0) strcat(outnm,"i");
//   hd.b -= shift;
//   hd.e -= shift;
  hd.t1 = tp; hd.t2 = ts;
  hd.az = az;
  for(j=0;j<3;j++) {
     *ccc = com[j];
     hd.b = b[j]-shift;
     hd.e = e[j]-shift;
     hd.npts = npt[j];
     hd.cmpinc = cmpinc[j];
     hd.cmpaz  = cmpaz[j];
     write_sac(outnm,hd,syn[j]);
  }

  return 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2cd8, %rsp           # imm = 0x2CD8
movq %rsi, %r14
movl $0x800, 0x2f8(%rsp) # imm = 0x800
leaq 0x290(%rsp), %rax
andl $0x0, (%rax)
leaq 0x2cc(%rsp), %rax
andl $0x0, (%rax)
movl %edi, 0x2b8(%rsp)
movslq %edi, %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x340(%rsp)
pushq $0x1
popq %rbp
movl $0x0, 0x298(%rsp)
pushq $0x1
popq %r13
leaq 0x4d0d(%rip), %rbx      # 0x609c
xorl %r12d, %r12d
movl $0x0, 0x2c4(%rsp)
movl $0x0, 0x2c0(%rsp)
movq $0x0, 0x2d0(%rsp)
movl %ebp, 0x284(%rsp)
movl $0x0, 0x288(%rsp)
testl %r12d, %r12d
jne 0x1641
cmpq %r15, %r13
jge 0x1641
movq (%r14,%r13,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x144d
movzbl 0x1(%rsi), %eax
addl $-0x41, %eax
cmpl $0x12, %eax
ja 0x144d
xorl %r12d, %r12d
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
addq $0x2, %rsi
xorl %r12d, %r12d
movq %rsi, %rdi
leaq 0x4d00(%rip), %rsi      # 0x610a
leaq 0x28c(%rsp), %rdx
xorl %eax, %eax
callq 0x1170
movss 0x28c(%rsp), %xmm0
movss %xmm0, 0x2a8(%rsp)
addss 0x4c11(%rip), %xmm0     # 0x6044
ucomiss 0x4c0e(%rip), %xmm0     # 0x6048
jbe 0x1639
addss 0x4c04(%rip), %xmm0     # 0x604c
jmp 0x1639
movl %ebp, %r12d
jmp 0x1639
movss %xmm0, 0x27c(%rsp)
addq $0x2, %rsi
movq %rsi, %rdi
leaq 0x568(%rsp), %rsi
callq 0x3685
xorl %r12d, %r12d
movq %rax, 0x2e8(%rsp)
testq %rax, %rax
je 0x1624
movl 0x6a4(%rsp), %eax
movl %eax, 0x298(%rsp)
movss 0x57c(%rsp), %xmm0
xorps 0x4bcc(%rip), %xmm0     # 0x6070
movaps %xmm0, 0x340(%rsp)
jmp 0x1630
movl %ebp, 0x2c4(%rsp)
jmp 0x1639
movl %ebp, 0x2c0(%rsp)
jmp 0x1639
addq $0x2, %rsi
leaq 0x4e0(%rsp), %rdi
jmp 0x15d9
movss %xmm0, 0x27c(%rsp)
addq $0x2, %rsi
xorl %r12d, %r12d
movq %rsi, %rdi
leaq 0x4c13(%rip), %rsi      # 0x6107
leaq 0x2cc(%rsp), %rdx
leaq 0x2c8(%rsp), %rcx
xorl %eax, %eax
callq 0x1170
cmpl $0x1, %eax
jg 0x1630
movl $0x3f000000, 0x2c8(%rsp) # imm = 0x3F000000
jmp 0x1630
addq $0x2, %rsi
leaq 0x460(%rsp), %rdi
movss %xmm0, 0x27c(%rsp)
callq 0x1050
movss 0x27c(%rsp), %xmm0
movl %ebp, 0x288(%rsp)
jmp 0x1639
addq $0x2, %rsi
leaq 0x330(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x324(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x320(%rsp), %rax
movq %rax, (%rsp)
xorl %r12d, %r12d
movq %rsi, %rdi
leaq 0x4b6e(%rip), %rsi      # 0x60f8
leaq 0x280(%rsp), %rdx
leaq 0x310(%rsp), %rcx
leaq 0x314(%rsp), %r8
leaq 0x318(%rsp), %r9
xorl %eax, %eax
movss %xmm0, 0x27c(%rsp)
callq 0x1170
movss 0x27c(%rsp), %xmm0
movq %rax, 0x2d0(%rsp)
jmp 0x1639
addq $0x2, %rsi
leaq 0x3e0(%rsp), %rdi
movss %xmm0, 0x27c(%rsp)
callq 0x1050
jmp 0x1630
addq $0x2, %rsi
xorl %r12d, %r12d
movq %rsi, %rdi
leaq 0x4b10(%rip), %rsi      # 0x610a
leaq 0x290(%rsp), %rdx
xorl %eax, %eax
movss %xmm0, 0x27c(%rsp)
callq 0x1170
jmp 0x1630
xorl %r12d, %r12d
movl $0x0, 0x284(%rsp)
jmp 0x1639
movq $0x0, 0x2e8(%rsp)
movss 0x27c(%rsp), %xmm0
incq %r13
jmp 0x13c6
movss 0x2a8(%rsp), %xmm1
movss %xmm1, 0x338(%rsp)
movss %xmm0, 0x33c(%rsp)
movl 0x298(%rsp), %eax
movl %eax, 0x2ac(%rsp)
andl $0x0, 0x334(%rsp)
pushq $0x1
popq %rbx
movq $0x0, 0x2b0(%rsp)
movq $0x0, 0x298(%rsp)
movq 0x2d0(%rsp), %r13
leal -0x1(%r13), %eax
cmpl $0x6, %eax
ja 0x1f54
leaq 0x49d7(%rip), %rcx      # 0x6080
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movl 0x284(%rsp), %r15d
movl 0x2b8(%rsp), %ebp
jmpq *%rax
cvtss2sd 0x280(%rsp), %xmm0
mulsd 0x4936(%rip), %xmm0     # 0x6008
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x280(%rsp)
pushq $0x1
popq %rax
movq %rax, 0x2b0(%rsp)
movq $0x0, 0x298(%rsp)
jmp 0x1809
movss 0x28c(%rsp), %xmm0
subss 0x310(%rsp), %xmm0
movss 0x314(%rsp), %xmm1
movss 0x318(%rsp), %xmm2
leaq 0x3b0(%rsp), %rdi
callq 0x4178
cvtss2sd 0x280(%rsp), %xmm1
mulsd 0x48d3(%rip), %xmm1     # 0x6010
addsd 0x48d3(%rip), %xmm1     # 0x6018
addsd 0x48d3(%rip), %xmm1     # 0x6020
movsd 0x48d3(%rip), %xmm0     # 0x6028
callq 0x1080
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x280(%rsp)
pushq $0x3
jmp 0x17f6
movss 0x28c(%rsp), %xmm0
subss 0x310(%rsp), %xmm0
movss 0x314(%rsp), %xmm1
leaq 0x3b0(%rsp), %rdi
callq 0x436b
cvtss2sd 0x280(%rsp), %xmm0
mulsd 0x4889(%rip), %xmm0     # 0x6030
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x280(%rsp)
pushq $0x2
jmp 0x17f6
movss 0x28c(%rsp), %xmm0
leaq 0x310(%rsp), %rdi
leaq 0x3b0(%rsp), %rsi
callq 0x4421
cvtss2sd 0x280(%rsp), %xmm0
mulsd 0x4821(%rip), %xmm0     # 0x6008
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x280(%rsp)
pushq $0x4
popq %rax
movq %rax, 0x2b0(%rsp)
movb $0x1, %al
movq %rax, 0x298(%rsp)
movl %r12d, %ebx
testl %r15d, %r15d
je 0x1829
leaq 0x4e0(%rsp), %rdi
pushq $0x2e
popq %rsi
callq 0x10c0
movq %rax, %r12
incq %r12
jmp 0x1829
cmpl $0x0, 0x288(%rsp)
je 0x1850
leaq 0x460(%rsp), %rdi
pushq $0x2e
popq %rsi
callq 0x10c0
incq %rax
movq %rax, 0x368(%rsp)
jmp 0x1850
cmpl $0x1, %ebp
je 0x1f68
testl %ebx, %ebx
jne 0x1f68
testl %r15d, %r15d
je 0x1877
cmpl $0x1, %r13d
jne 0x1877
cmpb $0x61, (%r12)
jne 0x1f68
xorl %eax, %eax
cmpq $0x3, %rax
je 0x188c
andl $0x0, 0x304(%rsp,%rax,4)
incq %rax
jmp 0x1879
xorl %ecx, %ecx
cmpq 0x2b0(%rsp), %rcx
je 0x1ccd
testq %rcx, %rcx
sete %al
cmpq $0x3, %rcx
sete %dl
orb %al, %dl
movq %rcx, 0x2b8(%rsp)
imulq $0xc, %rcx, %rax
addq %rsp, %rax
addq $0x3b0, %rax            # imm = 0x3B0
movq %rax, 0x2d0(%rsp)
xorb $0x1, %dl
movb %dl, 0x2a8(%rsp)
xorl %ebx, %ebx
cmpq $0x3, %rbx
je 0x1cbd
movss 0x280(%rsp), %xmm0
cmpb $0x0, 0x298(%rsp)
je 0x18fe
movq 0x2d0(%rsp), %rax
mulss (%rax,%rbx,4), %xmm0
movss %xmm0, 0x27c(%rsp)
testl %r15d, %r15d
je 0x19c8
leaq 0x4e0(%rsp), %rdi
leaq 0x7e0(%rsp), %rsi
callq 0x3685
testq %rax, %rax
je 0x1cb5
movq %rax, %r14
cmpl $0x0, 0x288(%rsp)
je 0x195c
leaq 0x460(%rsp), %rdi
leaq 0xa58(%rsp), %rsi
callq 0x3685
movq %rax, %r13
testq %rax, %rax
je 0x1b81
cmpq $0x0, 0x2b8(%rsp)
je 0x1a2c
cmpl %ebp, 0x91c(%rsp)
jne 0x1b89
cmpl $0x0, 0x288(%rsp)
je 0x1bab
movl 0x2a4(%rsp), %eax
cmpl %eax, 0xb94(%rsp)
movss 0x27c(%rsp), %xmm1
je 0x1bb4
movq 0x864e(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x4fb7(%rip), %rsi      # 0x696b
leaq 0x460(%rsp), %rdx
movl 0x2a4(%rsp), %ecx
jmp 0x1ba4
testq %rbx, %rbx
setne %al
orb 0x2a8(%rsp), %al
jne 0x19ed
leaq 0x472c(%rip), %rdi      # 0x610a
leaq 0x2fc(%rsp), %rsi
xorl %eax, %eax
callq 0x11e0
leaq 0x4716(%rip), %rdi      # 0x610a
leaq 0x300(%rsp), %rsi
xorl %eax, %eax
callq 0x11e0
movss 0x27c(%rsp), %xmm0
mulss 0x300(%rsp), %xmm0
addss 0x304(%rsp,%rbx,4), %xmm0
movss %xmm0, 0x304(%rsp,%rbx,4)
jmp 0x1cb5
movl $0x278, %edx            # imm = 0x278
leaq 0x568(%rsp), %rdi
leaq 0x7e0(%rsp), %rsi
callq 0x1120
movss 0x7e0(%rsp), %xmm4
movss 0x7f4(%rsp), %xmm0
movss %xmm4, 0x294(%rsp)
movl 0x91c(%rsp), %ebp
movl %ebp, 0x2dc(%rsp,%rbx,4)
movss %xmm0, 0x37c(%rsp,%rbx,4)
movss 0x7f8(%rsp), %xmm1
movss %xmm1, 0x370(%rsp,%rbx,4)
movl %ebp, %eax
cmpl $0x0, 0x288(%rsp)
je 0x1b14
movss %xmm0, 0x394(%rsp,%rbx,4)
movss 0xa6c(%rsp), %xmm3
movss 0xa70(%rsp), %xmm2
movss %xmm3, 0x388(%rsp,%rbx,4)
ucomiss %xmm3, %xmm0
jp 0x1acf
minss %xmm0, %xmm3
movss %xmm3, 0x37c(%rsp,%rbx,4)
movaps %xmm3, %xmm0
movl 0xb94(%rsp), %eax
movl %eax, 0x2a4(%rsp)
maxss %xmm1, %xmm2
subss %xmm0, %xmm2
divss %xmm4, %xmm2
addss 0x454f(%rip), %xmm2     # 0x6040
cvttss2si %xmm2, %eax
leal -0x1(%rax), %ecx
cvtsi2ss %ecx, %xmm1
movl %eax, 0x2dc(%rsp,%rbx,4)
mulss %xmm4, %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0x370(%rsp,%rbx,4)
movss %xmm4, 0x2f0(%rsp)
movsd 0x80c(%rsp), %xmm0
movaps %xmm0, 0x3a0(%rsp)
movslq %eax, %rdi
pushq $0x4
popq %rsi
callq 0x1100
movq %rax, 0x350(%rsp,%rbx,8)
testq %rbx, %rbx
jne 0x1bab
movss 0x2cc(%rsp), %xmm0
ucomiss 0x44fa(%rip), %xmm0     # 0x6050
jbe 0x1bab
movss 0x2c8(%rsp), %xmm1
movss 0x2f0(%rsp), %xmm2
leaq 0x2ac(%rsp), %rdi
callq 0x1f88
movq %rax, 0x2e8(%rsp)
jmp 0x1bab
xorl %r13d, %r13d
jmp 0x1cb5
movq 0x8468(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x4dd1(%rip), %rsi      # 0x696b
leaq 0x4e0(%rsp), %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1110
movss 0x27c(%rsp), %xmm1
movq 0x350(%rsp,%rbx,8), %r15
testl %ebp, %ebp
movl $0x0, %eax
cmovgl %ebp, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x1be8
movss (%r14,%rcx,4), %xmm0
mulss %xmm1, %xmm0
addss (%r15,%rcx,4), %xmm0
movss %xmm0, (%r15,%rcx,4)
incq %rcx
jmp 0x1bc8
movq %r14, %rdi
callq 0x1040
movb (%r12), %al
incb %al
movb %al, (%r12)
cmpl $0x0, 0x288(%rsp)
je 0x1ca4
movss 0x394(%rsp,%rbx,4), %xmm0
subss 0x388(%rsp,%rbx,4), %xmm0
andps 0x443f(%rip), %xmm0     # 0x6060
cvtss2sd 0x294(%rsp), %xmm1
cvtss2sd %xmm0, %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cltq
leaq (%r15,%rax,4), %rax
movl 0x2a4(%rsp), %edx
testl %edx, %edx
movl $0x0, %ecx
cmovgl %edx, %ecx
xorl %edx, %edx
movl 0x284(%rsp), %r15d
movq 0x368(%rsp), %r14
movss 0x27c(%rsp), %xmm1
cmpq %rdx, %rcx
je 0x1c87
movss (%r13,%rdx,4), %xmm0
mulss %xmm1, %xmm0
addss (%rax,%rdx,4), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
jmp 0x1c68
movq %r13, %rdi
callq 0x1040
incb (%r14)
cmpb $0x39, (%r12)
jne 0x1cb5
movb $0x61, (%r12)
addb $0x28, (%r14)
jmp 0x1cb5
cmpb $0x39, %al
jne 0x1cad
movb $0x61, (%r12)
movl 0x284(%rsp), %r15d
incq %rbx
jmp 0x18d4
movq 0x2b8(%rsp), %rcx
incq %rcx
jmp 0x188e
testl %r15d, %r15d
je 0x1f05
movss 0x290(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x1d15
leaq 0x294(%rsp), %rdi
leaq 0x290(%rsp), %rsi
leaq 0x2f8(%rsp), %rdx
leaq 0x2f4(%rsp), %rcx
leaq 0xcd0(%rsp), %r8
callq 0x508f
xorl %r14d, %r14d
leaq 0xcd0(%rsp), %rbx
movl 0x2c4(%rsp), %ebp
movl 0x2c0(%rsp), %r15d
movq 0x2e8(%rsp), %r12
cmpq $0x3, %r14
je 0x1de2
movl 0x2ac(%rsp), %esi
testl %esi, %esi
jle 0x1d64
movq 0x350(%rsp,%r14,8), %rdx
movl 0x2dc(%rsp,%r14,4), %ecx
movq %r12, %rdi
callq 0x2580
testl %ebp, %ebp
je 0x1d86
movq 0x350(%rsp,%r14,8), %rdi
movl 0x2dc(%rsp,%r14,4), %esi
movss 0x294(%rsp), %xmm0
callq 0x2bb4
testl %r15d, %r15d
je 0x1da9
movq 0x350(%rsp,%r14,8), %rdi
movl 0x2dc(%rsp,%r14,4), %esi
movss 0x294(%rsp), %xmm0
callq 0x2cb9
movss 0x290(%rsp), %xmm0
ucomiss 0x4297(%rip), %xmm0     # 0x6050
jbe 0x1dda
movl 0x2f4(%rsp), %esi
movq 0x350(%rsp,%r14,8), %rdx
movl 0x2dc(%rsp,%r14,4), %ecx
movq %rbx, %rdi
callq 0x2580
incq %r14
jmp 0x1d37
leaq 0x3e0(%rsp), %rdi
callq 0x10a0
movq %rax, %rbx
cmpl $0x0, 0x2ac(%rsp)
jne 0x1e13
leaq 0x3e0(%rsp), %rdi
callq 0x10a0
movw $0x69, 0x3e0(%rsp,%rax)
leaq 0x568(%rsp), %rax
movaps 0x3a0(%rsp), %xmm0
movlps %xmm0, 0x2c(%rax)
movss 0x28c(%rsp), %xmm0
movss %xmm0, 0xcc(%rax)
movaps 0x340(%rsp), %xmm0
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movaps %xmm0, 0x340(%rsp)
leaq 0x4295(%rip), %rbp      # 0x60e8
leaq 0x4292(%rip), %r14      # 0x60ec
pushq $0x4f
popq %r12
leaq 0x3e0(%rsp), %r13
xorl %r15d, %r15d
cmpq $0xc, %r15
je 0x1f40
movb (%rbp), %al
movb %al, 0x3df(%rsp,%rbx)
movss 0x370(%rsp,%r15), %xmm0
movss 0x37c(%rsp,%r15), %xmm1
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
subps 0x340(%rsp), %xmm1
movlps %xmm1, 0x57c(%rsp)
movl 0x2dc(%rsp,%r15), %eax
movl %eax, 0x6a4(%rsp)
movss (%r15,%r14), %xmm0
movss %xmm0, 0x650(%rsp)
movss 0x334(%rsp,%r15), %xmm0
movss %xmm0, 0x64c(%rsp)
movq 0x350(%rsp,%r15,2), %rax
movq %r12, %rcx
movq %rsp, %rdi
leaq 0x568(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r13, %rdi
movq %rax, %rsi
callq 0x3762
addq $0x4, %r15
incq %rbp
jmp 0x1e69
cvtss2sd 0x2fc(%rsp), %xmm0
cvtss2sd 0x28c(%rsp), %xmm1
cvtss2sd 0x304(%rsp), %xmm2
cvtss2sd 0x308(%rsp), %xmm3
cvtss2sd 0x30c(%rsp), %xmm4
leaq 0x4a59(%rip), %rdi      # 0x6992
movb $0x5, %al
callq 0x10b0
xorl %eax, %eax
addq $0x2cd8, %rsp           # imm = 0x2CD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x284(%rsp), %r15d
movl 0x2b8(%rsp), %ebp
jmp 0x180c
movq 0x8089(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movq (%r14), %rdx
leaq 0x4191(%rip), %rsi      # 0x610d
xorl %eax, %eax
callq 0x1110
pushq $-0x1
popq %rax
jmp 0x1f42