// File: /workspace/github_c_makefile_star2_O1/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 $0x2cc8, %rsp           # imm = 0x2CC8
movq %rsi, %r14
movl %edi, %r15d
movl $0x800, 0x328(%rsp) # imm = 0x800
xorl %r12d, %r12d
movl %r12d, 0x2a4(%rsp)
movl %r12d, 0x2ac(%rsp)
movl %r12d, 0x2d8(%rsp)
movss 0x304(%rsp), %xmm0
movss %xmm0, 0x2a0(%rsp)
cmpl $0x2, %edi
jl 0x176c
movss 0x308(%rsp), %xmm0
movss %xmm0, 0x2f0(%rsp)
movss 0x30c(%rsp), %xmm0
movss %xmm0, 0x288(%rsp)
movl %r15d, 0x2e8(%rsp)
movl %r15d, %ebp
movl $0x1, 0x27c(%rsp)
xorps %xmm0, %xmm0
movl $0x2, %r15d
leaq 0x4c32(%rip), %rbx      # 0x6080
movl $0x0, 0x2c0(%rsp)
movq $0x0, 0x2b0(%rsp)
movl $0x0, 0x2c8(%rsp)
movl $0x0, 0x280(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq -0x8(%r14,%r15,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x1511
movzbl 0x1(%rsi), %eax
addl $-0x41, %eax
cmpl $0x12, %eax
ja 0x1511
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movaps %xmm0, 0x290(%rsp)
addq $0x2, %rsi
movq %rsi, %rdi
leaq 0x4c50(%rip), %rsi      # 0x610a
leaq 0x28c(%rsp), %rdx
xorl %eax, %eax
callq 0x1180
movss 0x28c(%rsp), %xmm0
movss %xmm0, 0x2f0(%rsp)
movaps %xmm0, %xmm1
addss 0x4b4a(%rip), %xmm1     # 0x6030
xorps %xmm0, %xmm0
movss %xmm0, 0x2a0(%rsp)
ucomiss 0x4b3b(%rip), %xmm1     # 0x6034
jbe 0x1503
addss 0x4b35(%rip), %xmm1     # 0x6038
movss %xmm1, 0x288(%rsp)
jmp 0x16de
movl $0x1, %r13d
jmp 0x16e6
movaps %xmm0, 0x290(%rsp)
addq $0x2, %rsi
movq %rsi, %rdi
leaq 0x558(%rsp), %rsi
callq 0x3a4d
movq %rax, 0x310(%rsp)
testq %rax, %rax
je 0x16d2
movl 0x694(%rsp), %r12d
movss 0x56c(%rsp), %xmm0
xorps 0x4aaf(%rip), %xmm0     # 0x6010
jmp 0x16e6
movl $0x1, 0x280(%rsp)
jmp 0x16e6
movl $0x1, 0x2c8(%rsp)
jmp 0x16e6
addq $0x2, %rsi
leaq 0x4d0(%rsp), %rdi
jmp 0x168f
movaps %xmm0, 0x290(%rsp)
addq $0x2, %rsi
movq %rsi, %rdi
leaq 0x4b5a(%rip), %rsi      # 0x6107
leaq 0x2d8(%rsp), %rdx
leaq 0x2d4(%rsp), %rcx
xorl %eax, %eax
callq 0x1180
cmpl $0x1, %eax
jg 0x16de
movl $0x3f000000, 0x2d4(%rsp) # imm = 0x3F000000
jmp 0x16de
addq $0x2, %rsi
leaq 0x450(%rsp), %rdi
movaps %xmm0, 0x290(%rsp)
callq 0x1050
movaps 0x290(%rsp), %xmm0
movl $0x1, 0x2c0(%rsp)
jmp 0x16e6
addq $0x2, %rsi
leaq 0x360(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x354(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x350(%rsp), %rax
movq %rax, (%rsp)
movq %rsi, %rdi
leaq 0x4ab6(%rip), %rsi      # 0x60f8
leaq 0x284(%rsp), %rdx
leaq 0x340(%rsp), %rcx
leaq 0x344(%rsp), %r8
leaq 0x348(%rsp), %r9
xorl %eax, %eax
movaps %xmm0, 0x290(%rsp)
callq 0x1180
movaps 0x290(%rsp), %xmm0
movq %rax, 0x2b0(%rsp)
jmp 0x16e6
addq $0x2, %rsi
leaq 0x3d0(%rsp), %rdi
movaps %xmm0, 0x290(%rsp)
callq 0x1050
jmp 0x16de
addq $0x2, %rsi
movq %rsi, %rdi
leaq 0x4a5e(%rip), %rsi      # 0x610a
leaq 0x2a4(%rsp), %rdx
xorl %eax, %eax
movaps %xmm0, 0x290(%rsp)
callq 0x1180
jmp 0x16de
movl $0x0, 0x27c(%rsp)
jmp 0x16e6
movq $0x0, 0x310(%rsp)
movaps 0x290(%rsp), %xmm0
testl %r13d, %r13d
jne 0x16fb
leaq 0x1(%r15), %rax
cmpq %rbp, %r15
movq %rax, %r15
jb 0x1481
movss 0x2f0(%rsp), %xmm1
movss %xmm1, 0x308(%rsp)
movss 0x288(%rsp), %xmm1
movss %xmm1, 0x30c(%rsp)
cmpl $0x0, 0x27c(%rsp)
setne %cl
cmpl $0x0, 0x2c0(%rsp)
sete 0x27c(%rsp)
cmpl $0x0, 0x280(%rsp)
sete 0x27b(%rsp)
cmpl $0x0, 0x2c8(%rsp)
sete 0x27a(%rsp)
movl 0x2e8(%rsp), %r15d
movq 0x2b0(%rsp), %rdx
jmp 0x178e
xorps %xmm0, %xmm0
movb $0x1, 0x27b(%rsp)
xorl %r13d, %r13d
movb $0x1, 0x27a(%rsp)
xorl %edx, %edx
movb $0x1, %cl
movb $0x1, 0x27c(%rsp)
movb %cl, 0x280(%rsp)
movaps %xmm0, 0x290(%rsp)
movl %r12d, 0x2ac(%rsp)
movss 0x2a0(%rsp), %xmm0
movss %xmm0, 0x304(%rsp)
movl $0x1, %ebp
movq $0x0, 0x2b8(%rsp)
xorl %r12d, %r12d
movq %rdx, 0x2b0(%rsp)
leal -0x1(%rdx), %eax
cmpl $0x6, %eax
ja 0x20f9
leaq 0x48e6(%rip), %rcx      # 0x60cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
xorl %ebx, %ebx
jmpq *%rax
xorps %xmm0, %xmm0
cvtss2sd 0x284(%rsp), %xmm0
mulsd 0x4843(%rip), %xmm0     # 0x6048
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x284(%rsp)
movl $0x1, %eax
movq %rax, 0x2b8(%rsp)
movb $0x1, %bl
xorl %r12d, %r12d
jmp 0x1943
movss 0x28c(%rsp), %xmm0
subss 0x340(%rsp), %xmm0
movss 0x344(%rsp), %xmm1
movss 0x348(%rsp), %xmm2
leaq 0x3a0(%rsp), %rdi
callq 0x4598
xorps %xmm1, %xmm1
cvtss2sd 0x284(%rsp), %xmm1
mulsd 0x47e2(%rip), %xmm1     # 0x6050
addsd 0x47e2(%rip), %xmm1     # 0x6058
addsd 0x47e2(%rip), %xmm1     # 0x6060
movsd 0x47e2(%rip), %xmm0     # 0x6068
callq 0x1080
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x284(%rsp)
movl $0x3, %eax
jmp 0x1936
movss 0x28c(%rsp), %xmm0
subss 0x340(%rsp), %xmm0
movss 0x344(%rsp), %xmm1
leaq 0x3a0(%rsp), %rdi
callq 0x47c1
xorps %xmm0, %xmm0
cvtss2sd 0x284(%rsp), %xmm0
mulsd 0x4792(%rip), %xmm0     # 0x6070
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x284(%rsp)
movl $0x2, %eax
jmp 0x1936
movss 0x28c(%rsp), %xmm0
leaq 0x340(%rsp), %rdi
leaq 0x3a0(%rsp), %rsi
callq 0x488a
xorps %xmm0, %xmm0
cvtss2sd 0x284(%rsp), %xmm0
mulsd 0x4724(%rip), %xmm0     # 0x6048
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x284(%rsp)
movl $0x4, %eax
movq %rax, 0x2b8(%rsp)
movb $0x1, %r12b
movb $0x1, %bl
movl %r13d, %ebp
cmpb $0x0, 0x280(%rsp)
je 0x196d
leaq 0x4d0(%rsp), %rdi
movl $0x2e, %esi
callq 0x10c0
incq %rax
movq %rax, 0x2c0(%rsp)
cmpb $0x0, 0x27c(%rsp)
jne 0x1994
leaq 0x450(%rsp), %rdi
movl $0x2e, %esi
callq 0x10c0
incq %rax
movq %rax, 0x2e8(%rsp)
cmpl $0x1, %r15d
movq 0x2c0(%rsp), %rdx
je 0x2100
testl %ebp, %ebp
jne 0x2100
cmpl $0x1, 0x2b0(%rsp)
setne %al
movb 0x280(%rsp), %cl
xorb $0x1, %cl
orb %al, %cl
jne 0x19d0
cmpb $0x61, (%rdx)
jne 0x2100
movl $0x0, 0x300(%rsp)
movq $0x0, 0x2f8(%rsp)
testb %bl, %bl
je 0x1e5b
xorl %ecx, %ecx
movb 0x280(%rsp), %bl
testq %rcx, %rcx
sete %al
cmpq $0x3, %rcx
sete %dl
orb %al, %dl
movq %rcx, 0x2c8(%rsp)
leaq (%rcx,%rcx,2), %rax
leaq (%rsp,%rax,4), %rax
addq $0x3a0, %rax            # imm = 0x3A0
movq %rax, 0x2f0(%rsp)
xorb $0x1, %dl
movb %dl, 0x2a0(%rsp)
xorl %ebp, %ebp
movss 0x284(%rsp), %xmm0
testb %r12b, %r12b
je 0x1a4c
movq 0x2f0(%rsp), %rax
mulss (%rax,%rbp,4), %xmm0
testb %bl, %bl
movss %xmm0, 0x2b0(%rsp)
je 0x1b09
leaq 0x4d0(%rsp), %rdi
leaq 0x7d0(%rsp), %rsi
callq 0x3a4d
testq %rax, %rax
je 0x1e33
movq %rax, %r15
cmpb $0x0, 0x27c(%rsp)
jne 0x1aa9
leaq 0x450(%rsp), %rdi
leaq 0xa48(%rsp), %rsi
callq 0x3a4d
movq %rax, %r13
testq %rax, %rax
je 0x1cff
cmpq $0x0, 0x2c8(%rsp)
je 0x1b6d
cmpl %r14d, 0x90c(%rsp)
jne 0x1d07
movl 0x288(%rsp), %eax
cmpl %eax, 0xb84(%rsp)
sete %al
orb 0x27c(%rsp), %al
jne 0x1d2a
movq 0x850d(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x4e76(%rip), %rsi      # 0x696b
leaq 0x450(%rsp), %rdx
movl 0x288(%rsp), %ecx
jmp 0x1d23
testq %rbp, %rbp
setne %al
orb 0x2a0(%rsp), %al
jne 0x1b2e
leaq 0x45eb(%rip), %rdi      # 0x610a
leaq 0x32c(%rsp), %rsi
xorl %eax, %eax
callq 0x11f0
leaq 0x45d5(%rip), %rdi      # 0x610a
leaq 0x330(%rsp), %rsi
xorl %eax, %eax
callq 0x11f0
movss 0x2b0(%rsp), %xmm0
mulss 0x330(%rsp), %xmm0
addss 0x2f8(%rsp,%rbp,4), %xmm0
movss %xmm0, 0x2f8(%rsp,%rbp,4)
jmp 0x1e33
movl $0x278, %edx            # imm = 0x278
leaq 0x558(%rsp), %rdi
leaq 0x7d0(%rsp), %rsi
callq 0x1130
movss 0x7d0(%rsp), %xmm4
movss 0x7e4(%rsp), %xmm1
movss %xmm4, 0x2a8(%rsp)
movl 0x90c(%rsp), %r14d
movl %r14d, 0x2dc(%rsp,%rbp,4)
movss %xmm1, 0x364(%rsp,%rbp,4)
movss 0x7e8(%rsp), %xmm0
movss %xmm0, 0x334(%rsp,%rbp,4)
cmpb $0x0, 0x27c(%rsp)
jne 0x1c78
movss %xmm1, 0x394(%rsp,%rbp,4)
movss 0xa5c(%rsp), %xmm3
movss 0xa60(%rsp), %xmm2
movss %xmm3, 0x388(%rsp,%rbp,4)
ucomiss %xmm3, %xmm1
jp 0x1c11
minss %xmm1, %xmm3
movss %xmm3, 0x364(%rsp,%rbp,4)
ucomiss %xmm2, %xmm0
jp 0x1c23
maxss %xmm0, %xmm2
movss %xmm2, 0x334(%rsp,%rbp,4)
movss 0x334(%rsp,%rbp,4), %xmm0
movss 0x364(%rsp,%rbp,4), %xmm1
subss %xmm1, %xmm0
divss %xmm4, %xmm0
addss 0x43f7(%rip), %xmm0     # 0x603c
cvttss2si %xmm0, %eax
movl %eax, 0x2dc(%rsp,%rbp,4)
decl %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movl 0xb84(%rsp), %eax
movl %eax, 0x288(%rsp)
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x334(%rsp,%rbp,4)
movss %xmm4, 0x320(%rsp)
movss 0x7fc(%rsp), %xmm0
movss %xmm0, 0x31c(%rsp)
movss 0x800(%rsp), %xmm0
movss %xmm0, 0x318(%rsp)
movslq 0x2dc(%rsp,%rbp,4), %rdi
movl $0x4, %esi
callq 0x1110
movq %rax, 0x370(%rsp,%rbp,8)
testq %rbp, %rbp
jne 0x1d2a
movss 0x2d8(%rsp), %xmm0
ucomiss 0x436c(%rip), %xmm0     # 0x6040
jbe 0x1d2a
movss 0x2d4(%rsp), %xmm1
movss 0x320(%rsp), %xmm2
leaq 0x2ac(%rsp), %rdi
callq 0x210f
movq %rax, 0x310(%rsp)
jmp 0x1d2a
xorl %r13d, %r13d
jmp 0x1e33
movq 0x82ea(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x4c53(%rip), %rsi      # 0x696b
leaq 0x4d0(%rsp), %rdx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x1120
movq 0x370(%rsp,%rbp,8), %rbx
testl %r14d, %r14d
movss 0x2b0(%rsp), %xmm1
jle 0x1d61
movl %r14d, %eax
xorl %ecx, %ecx
movss (%r15,%rcx,4), %xmm0
mulss %xmm1, %xmm0
addss (%rbx,%rcx,4), %xmm0
movss %xmm0, (%rbx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x1d45
movq %r15, %rdi
callq 0x1040
movq 0x2c0(%rsp), %r15
incb (%r15)
cmpb $0x0, 0x27c(%rsp)
jne 0x1e04
cmpl $0x0, 0x288(%rsp)
movss 0x2b0(%rsp), %xmm2
jle 0x1df2
movss 0x394(%rsp,%rbp,4), %xmm0
subss 0x388(%rsp,%rbp,4), %xmm0
andps 0x4272(%rip), %xmm0     # 0x6020
xorps %xmm1, %xmm1
cvtss2sd 0x2a8(%rsp), %xmm1
cvtss2sd %xmm0, %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cltq
leaq (%rbx,%rax,4), %rax
movl 0x288(%rsp), %ecx
xorl %edx, %edx
movss (%r13,%rdx,4), %xmm0
mulss %xmm2, %xmm0
addss (%rax,%rdx,4), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rcx
jne 0x1dd5
movq %r13, %rdi
callq 0x1040
movq 0x2e8(%rsp), %rax
incb (%rax)
cmpb $0x39, (%r15)
jne 0x1e2c
movb $0x61, (%r15)
cmpb $0x0, 0x27c(%rsp)
movb 0x280(%rsp), %bl
jne 0x1e33
movq 0x2e8(%rsp), %rax
addb $0x28, (%rax)
jmp 0x1e33
movb 0x280(%rsp), %bl
incq %rbp
cmpq $0x3, %rbp
jne 0x1a31
movq 0x2c8(%rsp), %rcx
incq %rcx
cmpq 0x2b8(%rsp), %rcx
jne 0x19f8
jmp 0x1e62
movb 0x280(%rsp), %bl
testb %bl, %bl
je 0x209b
movss 0x2a4(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x1ea9
leaq 0x2a8(%rsp), %rdi
leaq 0x2a4(%rsp), %rsi
leaq 0x328(%rsp), %rdx
leaq 0x324(%rsp), %rcx
leaq 0xcc0(%rsp), %r8
callq 0x55e1
xorl %r14d, %r14d
leaq 0xcc0(%rsp), %rbx
movq 0x310(%rsp), %r15
movb 0x27b(%rsp), %bpl
movb 0x27a(%rsp), %r12b
movl 0x2ac(%rsp), %esi
testl %esi, %esi
jle 0x1eef
movq 0x370(%rsp,%r14,8), %rdx
movl 0x2dc(%rsp,%r14,4), %ecx
movq %r15, %rdi
callq 0x276a
testb %bpl, %bpl
jne 0x1f12
movq 0x370(%rsp,%r14,8), %rdi
movl 0x2dc(%rsp,%r14,4), %esi
movss 0x2a8(%rsp), %xmm0
callq 0x2e20
testb %r12b, %r12b
jne 0x1f35
movq 0x370(%rsp,%r14,8), %rdi
movl 0x2dc(%rsp,%r14,4), %esi
movss 0x2a8(%rsp), %xmm0
callq 0x2f36
movss 0x2a4(%rsp), %xmm0
ucomiss 0x40fb(%rip), %xmm0     # 0x6040
jbe 0x1f66
movl 0x324(%rsp), %esi
movq 0x370(%rsp,%r14,8), %rdx
movl 0x2dc(%rsp,%r14,4), %ecx
movq %rbx, %rdi
callq 0x276a
incq %r14
cmpq $0x3, %r14
jne 0x1ecc
leaq 0x3d0(%rsp), %rdi
callq 0x10a0
movq %rax, %rbx
cmpl $0x0, 0x2ac(%rsp)
jne 0x1fa4
leaq 0x3d0(%rsp), %rdi
callq 0x10a0
movw $0x69, 0x3d0(%rsp,%rax)
leaq 0x558(%rsp), %r15
movss 0x31c(%rsp), %xmm0
movss %xmm0, 0x2c(%r15)
movss 0x318(%rsp), %xmm0
movss %xmm0, 0x30(%r15)
movss 0x28c(%rsp), %xmm0
movss %xmm0, 0xcc(%r15)
leaq 0x4105(%rip), %r13      # 0x60e8
leaq 0x4102(%rip), %rbp      # 0x60ec
leaq 0x3d0(%rsp), %r12
xorl %r14d, %r14d
movb (%r13), %al
movb %al, 0x3cf(%rsp,%rbx)
movss 0x364(%rsp,%r14), %xmm0
movaps 0x290(%rsp), %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x56c(%rsp)
movss 0x334(%rsp,%r14), %xmm0
subss %xmm1, %xmm0
movss %xmm0, 0x570(%rsp)
movl 0x2dc(%rsp,%r14), %eax
movl %eax, 0x694(%rsp)
movss (%r14,%rbp), %xmm0
movss %xmm0, 0x640(%rsp)
movss 0x304(%rsp,%r14), %xmm0
movss %xmm0, 0x63c(%rsp)
movq 0x370(%rsp,%r14,2), %rax
movl $0x4f, %ecx
movq %rsp, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r12, %rdi
movq %rax, %rsi
callq 0x3b2e
addq $0x4, %r14
incq %r13
cmpq $0xc, %r14
jne 0x1ff5
jmp 0x20e5
xorps %xmm0, %xmm0
cvtss2sd 0x32c(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x28c(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x2f8(%rsp), %xmm2
xorps %xmm3, %xmm3
cvtss2sd 0x2fc(%rsp), %xmm3
xorps %xmm4, %xmm4
cvtss2sd 0x300(%rsp), %xmm4
leaq 0x48b4(%rip), %rdi      # 0x6992
movb $0x5, %al
callq 0x10b0
xorl %eax, %eax
addq $0x2cc8, %rsp           # imm = 0x2CC8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x1946
movq %r14, %rdi
callq 0x1250
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x20e7