// File: /workspace/github_cpp_makefile_star2_O1/lagoproject[P]arti/analysis/cherenkov.cc
// Function: main
int main(int argc, char *argv[]) {

  char nfi[256]; // filename container
  char *ifiname=NULL; // input
  // reading arguments from command line
  for (int i=1;i<argc;i++) {
    char *tmparg=argv[i];
    if (*tmparg=='-') {
      switch (*(tmparg+1)) {
        case 'v':
          iverbose=1;
          break;
        case 'c':
          iline=1;
          i++; // discard "CERARY"
          nx=atoi(argv[++i]);
          ny=atoi(argv[++i]);
          dx=atof(argv[++i]);
          dy=atof(argv[++i]);
          rx=atof(argv[++i]);
          ry=atof(argv[++i]);
          break;
        case 'h':
        default:
          Usage(argv[0]);
          break;
      }
    }
    else {
      ifiname=argv[i];
    }
  }
  if (!ifiname) {
    cerr << endl << "Error: Missing filename" << endl << endl;
    Usage(argv[0]);
  }
  if (!iline) {
    cerr << endl << "Error: CERARY line is mandatory" << endl << endl;
    Usage(argv[0]);
  }

  // determine primary offsets...
  const double ext_mirr=2.; // some photons laid outside the mirror... bug in corsika? Asume 10% to avoid problems... Actually if should be lower than min(Dx/Rx,Dy/Ry)
  if (iverbose)
    cerr << "Array characteristics: " << endl << "Nx= " << nx << "; Ny= " << ny << "; Dx= "<< dx*cmtom << " m; Dy= "<< dy*cmtom << " m; Rx= "<< rx*cmtom << " m; Ry= "<< ry*cmtom << " m" << endl;
  if (ny>1) // one row is not 2d :P
    i2d=1;
  else // just in case ny=0
    ny=1;
  xMirrOff = rx/2. * ext_mirr;
  if (nx%2)
    xOff = dx * (nx - 1.) / 2.;
  else
    xOff = dx * nx  / 2.;

  yMirrOff = ry/2. * ext_mirr;
  if (ny%2)
    yOff = dy * (ny - 1.) / 2.;
  else
    yOff = dy * ny  / 2.;
  if (!dy)
    dy = 1.; // just to avoid problems 


  //open input
  snprintf(nfi,256,"%s",ifiname);
  Open(nfi);
  //open output
  char *ifile2;
  char ifile[256];
  ifile2=ifiname;
  //remove dirs
  if (strrchr(ifile2,'/')!=NULL) {
    ifile2=strrchr(ifile2,'/')+1;
  }
  snprintf(ifile, 256,"%s",ifile2);
  if (strrchr(ifile,'.')!=NULL) {
    if (strncmp(strrchr(ifile,'.'),".bz2",4)==0) { // remove .bz2 if present
      *(strrchr(ifile,'.'))='\0';
    }
  }
  if (strrchr(ifile,'.')!=NULL) {
    if (strncmp(strrchr(ifile,'.'),".dat",4)==0) { // remove .dat if present
      *(strrchr(ifile,'.'))='\0';
    }
  }

  // open output file (.hst) via fopen
  //secondaries
  snprintf(nfi,256,"%s.hst",ifile);
  if ((sec = fopen(nfi,"w"))==NULL) {
    fprintf(stderr,"Failed to open histogram file. Abort.\n");
    exit(1);
  }
  fprintf(sec, "# # # hst\n");
  fprintf(sec, "# # This is the histogram of radial distribution of cherenkov phontons - ARTI     %s\n", VERSION);
  fprintf(sec, "# # Array characteristics: Nx= %d columns; Ny= %d rows; Dx= %.3f m; Dy= %.3f m; Rx= %.3f m; Ry= %.3f m\n", nx, ny, dx*cmtom, dy*cmtom, rx*cmtom, ry*cmtom);
  fprintf(sec, "# # 4 column format is:\n");
  fprintf(sec, "# # x y photons hits\n");

  // stop talking, let's work
  // histograms...
  double data[block_cols];
  int read_line_error = 0, check = 0;
  for (int k=0; k<block_cols; k++)
    data[k] = 0.;
  long double photons[nx][ny];
  long int hits[nx][ny];
  long int badx=0, bady=0;
  int i=0, j=0;
  for (i=0; i<nx; i++) {
    for (j=0; j<ny; j++) {
      photons[i][j]=0.;
      hits[i][j]=0;
    }
  }
  if (iverbose)
    cerr << "Files opened. Reading cherenkov data blocks" << endl;
  while (fgets(line,250,fi)!=NULL) {
    read_line_error=0;
    do {
      check=sscanf(line, "%le %le %le %le %le %le %le\n", &data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6]);
    } while (check != block_cols && read_line_error++ < read_tries);
    lines++;
    if (iverbose)
      if (!(lines%100000))
        fprintf(stderr, "%ld lines processed up to now\r", lines);
    if (data[0]>0) {
      i=getXbin(data[1]);
      if (i>nx) {
        if (iverbose)
          fprintf(stderr, "\nWarning: skipping photon hitting outside the array (index %d) at line %ld (%s)\n",i,lines,ifile);
        badx++;
        continue;
      }
      j=getYbin(data[2]);
      if (j>ny) {
        if (iverbose)
          fprintf(stderr, "\nWarning: skipping photon hitting outside the array (index %d) at line %ld (%s)\n",j,lines,ifile);
        bady++;
        continue;
      }
      photons[i][j] += data[0];
      hits[i][j]++;
      pht_cter+=data[0];
      hit_cter++;
    }
  }
  if (iverbose)
    fprintf(stderr,"\nDone... printing histograms...\n");
  for (int j=0;j<ny;j++) {
    for (i=0;i<nx;i++) {
      fprintf (sec, "%.3lf %.3lf %Lf %ld\n", getXpos(i), getYpos(j), photons[i][j], hits[i][j]);
    }
    fprintf (sec,"\n");
  }
  fprintf (sec, "# In %ld lines, we found %ld hits corresponding to %Lf photons, and %ld photons laid outside the array(x=%ld, y=%ld)\n", lines, hit_cter, pht_cter,badx+bady,badx,bady);
  fclose(sec);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rsi, %r14
cmpl $0x2, %edi
jl 0x1640
movl %edi, %r15d
movl $0x1, %r12d
xorl %ebx, %ebx
movslq %r12d, %r13
movq (%r14,%r13,8), %rax
cmpb $0x2d, (%rax)
jne 0x15b7
movzbl 0x1(%rax), %eax
cmpl $0x63, %eax
je 0x15bc
cmpl $0x76, %eax
jne 0x20a9
movl $0x1, 0x3b9f(%rip)      # 0x5154
jmp 0x1632
movq %rax, %rbx
jmp 0x1632
movl $0x1, 0x3caa(%rip)      # 0x5270
movq 0x10(%r14,%r13,8), %rdi
callq 0x1170
movl %eax, 0x3ca2(%rip)      # 0x5278
movq 0x18(%r14,%r13,8), %rdi
callq 0x1170
movl %eax, 0x3c96(%rip)      # 0x527c
movq 0x20(%r14,%r13,8), %rdi
callq 0x1130
movsd %xmm0, 0x3c88(%rip)     # 0x5280
movq 0x28(%r14,%r13,8), %rdi
callq 0x1130
movsd %xmm0, 0x3c7e(%rip)     # 0x5288
movq 0x30(%r14,%r13,8), %rdi
callq 0x1130
movsd %xmm0, 0x3c74(%rip)     # 0x5290
leal 0x7(%r13), %r12d
movq 0x38(%r14,%r13,8), %rdi
callq 0x1130
movsd %xmm0, 0x3c66(%rip)     # 0x5298
incl %r12d
cmpl %r15d, %r12d
jl 0x158d
jmp 0x1642
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x1fd4
cmpl $0x0, 0x3c1e(%rip)      # 0x5270
je 0x2013
cmpl $0x0, 0x3af5(%rip)      # 0x5154
je 0x17eb
movq 0x3984(%rip), %r14      # 0x4ff0
leaq 0x1c2b(%rip), %rsi      # 0x329e
movl $0x17, %edx
movq %r14, %rdi
callq 0x1110
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq %rax, %r14
leaq 0x1c05(%rip), %rsi      # 0x32b6
movl $0x4, %edx
movq %rax, %rdi
callq 0x1110
movl 0x3bb4(%rip), %esi      # 0x5278
movq %r14, %rdi
callq 0x11b0
movq %rax, %r14
leaq 0x1be5(%rip), %rsi      # 0x32bb
movl $0x6, %edx
movq %rax, %rdi
callq 0x1110
movl 0x3b93(%rip), %esi      # 0x527c
movq %r14, %rdi
callq 0x11b0
movq %rax, %r14
leaq 0x1bc7(%rip), %rsi      # 0x32c2
movl $0x6, %edx
movq %rax, %rdi
callq 0x1110
movsd 0x3b70(%rip), %xmm0     # 0x5280
mulsd 0x18f0(%rip), %xmm0     # 0x3008
movq %r14, %rdi
callq 0x11a0
movq %rax, %r14
leaq 0x1b9f(%rip), %rsi      # 0x32c9
movl $0x8, %edx
movq %rax, %rdi
callq 0x1110
movsd 0x3b49(%rip), %xmm0     # 0x5288
mulsd 0x18c1(%rip), %xmm0     # 0x3008
movq %r14, %rdi
callq 0x11a0
movq %rax, %r14
leaq 0x1b79(%rip), %rsi      # 0x32d2
movl $0x8, %edx
movq %rax, %rdi
callq 0x1110
movsd 0x3b22(%rip), %xmm0     # 0x5290
mulsd 0x1892(%rip), %xmm0     # 0x3008
movq %r14, %rdi
callq 0x11a0
movq %rax, %r14
leaq 0x1b53(%rip), %rsi      # 0x32db
movl $0x8, %edx
movq %rax, %rdi
callq 0x1110
movsd 0x186b(%rip), %xmm0     # 0x3008
mulsd 0x3af3(%rip), %xmm0     # 0x5298
movq %r14, %rdi
callq 0x11a0
movq %rax, %r14
leaq 0x1b2d(%rip), %rsi      # 0x32e4
movl $0x2, %edx
movq %rax, %rdi
callq 0x1110
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
leaq 0x3a8a(%rip), %rax      # 0x527c
cmpl $0x2, 0x3a83(%rip)      # 0x527c
leaq 0x3a74(%rip), %rcx      # 0x5274
cmovlq %rax, %rcx
movl $0x1, (%rcx)
movsd 0x17fe(%rip), %xmm0     # 0x3010
movsd 0x3a76(%rip), %xmm1     # 0x5290
mulsd %xmm0, %xmm1
addsd %xmm1, %xmm1
movl 0x3a50(%rip), %eax      # 0x5278
andl $-0x2, %eax
cvtsi2sd %eax, %xmm2
movsd %xmm1, 0x3a71(%rip)     # 0x52a8
mulsd 0x3a41(%rip), %xmm2     # 0x5280
mulsd %xmm0, %xmm2
movsd %xmm2, 0x3a55(%rip)     # 0x52a0
movsd 0x3a45(%rip), %xmm1     # 0x5298
mulsd %xmm0, %xmm1
addsd %xmm1, %xmm1
movsd %xmm1, 0x3a55(%rip)     # 0x52b8
movl 0x3a13(%rip), %eax      # 0x527c
movsd 0x3a17(%rip), %xmm1     # 0x5288
andl $-0x2, %eax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
movsd %xmm2, 0x3a25(%rip)     # 0x52b0
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x18a8
jp 0x18a8
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x39e0(%rip)      # 0x5288
leaq 0x17b1(%rip), %r14      # 0x3060
leaq -0x2c0(%rbp), %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1190
movq %r15, %rdi
callq 0x133c
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x10f0
leaq 0x1(%rax), %rcx
testq %rax, %rax
cmoveq %rbx, %rcx
leaq -0x1c0(%rbp), %rbx
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1190
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x10f0
testq %rax, %rax
je 0x1934
movq %rax, %rbx
leaq 0x1700(%rip), %rsi      # 0x3020
movl $0x4, %edx
movq %rax, %rdi
callq 0x1060
testl %eax, %eax
jne 0x1934
movb $0x0, (%rbx)
leaq -0x1c0(%rbp), %rdi
movl $0x2e, %esi
callq 0x10f0
testq %rax, %rax
je 0x1968
movq %rax, %rbx
leaq 0x1993(%rip), %rsi      # 0x32e7
movl $0x4, %edx
movq %rax, %rdi
callq 0x1060
testl %eax, %eax
jne 0x1968
movb $0x0, (%rbx)
leaq 0x197d(%rip), %rdx      # 0x32ec
leaq -0x2c0(%rbp), %rbx
leaq -0x1c0(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1190
leaq 0x1960(%rip), %rsi      # 0x32f3
movq %rbx, %rdi
callq 0x1100
movq %rax, 0x377e(%rip)      # 0x5120
testq %rax, %rax
je 0x20b1
leaq 0x196a(%rip), %rdi      # 0x331c
movl $0xa, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x11c0
movq 0x3755(%rip), %rdi      # 0x5120
leaq 0x1955(%rip), %rsi      # 0x3327
leaq 0x16db(%rip), %rdx      # 0x30b4
xorl %eax, %eax
callq 0x1150
movq 0x3739(%rip), %rdi      # 0x5120
movl 0x388b(%rip), %edx      # 0x5278
movl 0x3889(%rip), %ecx      # 0x527c
movsd 0x160d(%rip), %xmm4     # 0x3008
movsd 0x387d(%rip), %xmm0     # 0x5280
mulsd %xmm4, %xmm0
movsd 0x3879(%rip), %xmm1     # 0x5288
mulsd %xmm4, %xmm1
movsd 0x3875(%rip), %xmm2     # 0x5290
mulsd %xmm4, %xmm2
movsd 0x3871(%rip), %xmm3     # 0x5298
mulsd %xmm4, %xmm3
leaq 0x194b(%rip), %rsi      # 0x337d
movb $0x4, %al
callq 0x1150
movq 0x36e0(%rip), %rcx      # 0x5120
leaq 0x199e(%rip), %rdi      # 0x33e5
movl $0x18, %esi
movl $0x1, %edx
callq 0x11c0
movq 0x36c3(%rip), %rcx      # 0x5120
leaq 0x199a(%rip), %rdi      # 0x33fe
movl $0x15, %esi
movl $0x1, %edx
callq 0x11c0
movq %rsp, -0xb0(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x80(%rbp)
movapd %xmm0, -0x90(%rbp)
movapd %xmm0, -0xa0(%rbp)
movq $0x0, -0x70(%rbp)
movl 0x37d7(%rip), %eax      # 0x5278
movl 0x37d5(%rip), %ecx      # 0x527c
movq %rcx, -0x38(%rbp)
imulq %rcx, %rax
shlq $0x4, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x40(%rbp)
movq %rcx, %rsp
movl 0x37b2(%rip), %edx      # 0x5278
movl 0x37b0(%rip), %eax      # 0x527c
movq %rax, -0x30(%rbp)
imulq %rdx, %rax
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x48(%rbp)
movq %rcx, %rsp
movq %rdx, -0x60(%rbp)
testl %edx, %edx
jle 0x1b55
movq -0x30(%rbp), %r15
leaq (,%r15,8), %rbx
movq -0x38(%rbp), %r14
shlq $0x4, %r14
shlq $0x4, %r15
xorl %r12d, %r12d
movq -0x40(%rbp), %r13
cmpl $0x0, -0x30(%rbp)
fldz
jle 0x1b47
fstp %st(0)
movq %rbx, %rdi
imulq %r12, %rdi
addq -0x48(%rbp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1080
fldz
xorl %eax, %eax
fld %st(0)
fstpt (%r13,%rax)
addq $0x10, %rax
cmpq %rax, %r15
jne 0x1b37
fstp %st(0)
incq %r12
addq %r14, %r13
cmpq -0x60(%rbp), %r12
jne 0x1b14
cmpl $0x0, 0x35f8(%rip)      # 0x5154
je 0x1ba0
movq 0x348b(%rip), %rbx      # 0x4ff0
leaq 0x18a8(%rip), %rsi      # 0x3414
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x1110
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq 0x3571(%rip), %rdx      # 0x5118
leaq 0x35c2(%rip), %rdi      # 0x5170
movl $0xfa, %esi
callq 0x1180
testq %rax, %rax
movq -0x38(%rbp), %r15
movq -0x30(%rbp), %r12
je 0x1e2c
leaq 0x35a0(%rip), %rbx      # 0x5170
movq $0x0, -0x50(%rbp)
xorl %r13d, %r13d
xorl %r14d, %r14d
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0x1854(%rip), %rsi      # 0x3440
leaq -0xa0(%rbp), %rdx
leaq -0x98(%rbp), %rcx
leaq -0x90(%rbp), %r8
leaq -0x88(%rbp), %r9
xorl %eax, %eax
leaq -0x70(%rbp), %r10
pushq %r10
leaq -0x78(%rbp), %r10
pushq %r10
leaq -0x80(%rbp), %r10
pushq %r10
callq 0x10c0
addq $0x20, %rsp
cmpl $0x7, %eax
setne %al
cmpl $0xa, %r14d
leal 0x1(%r14), %ecx
setb %dl
movl %ecx, %r14d
testb %dl, %al
jne 0x1bde
movq 0x34ec(%rip), %rsi      # 0x5130
leaq 0x1(%rsi), %rcx
movq %rcx, %rax
movabsq $0x29f16b11c6d1e109, %rdx # imm = 0x29F16B11C6D1E109
imulq %rdx
movq %rcx, 0x34d1(%rip)      # 0x5130
cmpl $0x0, 0x34ee(%rip)      # 0x5154
je 0x1c8f
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0xe, %rdx
addq %rax, %rdx
imulq $0x186a0, %rdx, %rax    # imm = 0x186A0
negq %rax
addq %rsi, %rax
incq %rax
testq %rax, %rax
je 0x1d80
movsd -0xa0(%rbp), %xmm0
ucomisd 0x1379(%rip), %xmm0     # 0x3018
jbe 0x1d58
movsd -0x98(%rbp), %xmm1
addsd 0x35eb(%rip), %xmm1     # 0x52a0
addsd 0x35eb(%rip), %xmm1     # 0x52a8
divsd 0x35bb(%rip), %xmm1     # 0x5280
cvttsd2si %xmm1, %edx
cmpl %edx, 0x35a9(%rip)      # 0x5278
jl 0x1da0
movsd -0x90(%rbp), %xmm1
addsd 0x35cb(%rip), %xmm1     # 0x52b0
addsd 0x35cb(%rip), %xmm1     # 0x52b8
divsd 0x3593(%rip), %xmm1     # 0x5288
cvttsd2si %xmm1, %eax
cmpl %eax, 0x357d(%rip)      # 0x527c
jl 0x1dae
movsd %xmm0, -0xb8(%rbp)
fldl -0xb8(%rbp)
movslq %edx, %rcx
movq %rcx, %rdx
imulq %r15, %rdx
shlq $0x4, %rdx
cltq
imulq %r12, %rcx
movq -0x48(%rbp), %rsi
leaq (%rsi,%rcx,8), %rcx
incq (%rcx,%rax,8)
addq -0x40(%rbp), %rdx
shlq $0x4, %rax
fldt (%rax,%rdx)
fadd %st(1), %st
fstpt (%rax,%rdx)
fldt 0x33f7(%rip)            # 0x5140
faddp %st, %st(1)
fstpt 0x33ef(%rip)            # 0x5140
incq 0x33e0(%rip)            # 0x5138
movq 0x33b9(%rip), %rdx      # 0x5118
movq %rbx, %rdi
movl $0xfa, %esi
callq 0x1180
movl $0x0, %r14d
testq %rax, %rax
jne 0x1bde
jmp 0x1e37
movq 0x3249(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
leaq 0x16cc(%rip), %rsi      # 0x345d
movq %rcx, %rdx
xorl %eax, %eax
callq 0x1150
jmp 0x1c8f
cmpl $0x0, 0x33ad(%rip)      # 0x5154
jne 0x1dda
incq %r13
jmp 0x1dbb
cmpl $0x0, 0x339f(%rip)      # 0x5154
jne 0x1e02
incq -0x50(%rbp)
movq 0x3356(%rip), %rdx      # 0x5118
movq %rbx, %rdi
movl $0xfa, %esi
callq 0x1180
testq %rax, %rax
jne 0x1bdb
jmp 0x1e37
movq 0x31ef(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
movq 0x3345(%rip), %rcx      # 0x5130
leaq 0x168a(%rip), %rsi      # 0x347c
leaq -0x1c0(%rbp), %r8
xorl %eax, %eax
callq 0x1150
jmp 0x1da9
movq 0x31c7(%rip), %rcx      # 0x4fd0
movq (%rcx), %rdi
movq 0x331d(%rip), %rcx      # 0x5130
leaq 0x1662(%rip), %rsi      # 0x347c
movl %eax, %edx
leaq -0x1c0(%rbp), %r8
xorl %eax, %eax
callq 0x1150
jmp 0x1db7
xorl %r13d, %r13d
movq $0x0, -0x50(%rbp)
movq %r13, -0xa8(%rbp)
cmpl $0x0, 0x330f(%rip)      # 0x5154
jne 0x1fca
cmpl $0x0, 0x342a(%rip)      # 0x527c
jle 0x1f5f
shlq $0x3, -0x30(%rbp)
shlq $0x4, -0x38(%rbp)
movq $0x0, -0x58(%rbp)
cmpl $0x0, 0x3407(%rip)      # 0x5278
movsd 0x118f(%rip), %xmm2     # 0x3008
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
leaq 0x1666(%rip), %r13      # 0x34ee
jle 0x1f29
xorps %xmm0, %xmm0
cvtsi2sdl -0x58(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x40(%rbp), %r15
movq -0x48(%rbp), %r12
xorl %r14d, %r14d
movq %rdx, -0x30(%rbp)
movq 0x326f(%rip), %rdi      # 0x5120
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd 0x33bf(%rip), %xmm0     # 0x5280
subsd 0x33d7(%rip), %xmm0     # 0x52a0
movsd 0x33b7(%rip), %xmm1     # 0x5288
mulsd -0x60(%rbp), %xmm1
subsd 0x33d2(%rip), %xmm1     # 0x52b0
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
fldt (%r15)
movq (%r12), %rdx
subq $0x10, %rsp
fstpt (%rsp)
movq %r13, %rsi
movb $0x2, %al
movq %rcx, %rbx
callq 0x1150
movq -0x30(%rbp), %rdx
movq %rbx, %rcx
movsd 0x10f8(%rip), %xmm2     # 0x3008
addq $0x10, %rsp
incq %r14
movslq 0x335a(%rip), %rax      # 0x5278
addq %rdx, %r12
addq %rbx, %r15
cmpq %rax, %r14
jl 0x1eaa
movq 0x31f0(%rip), %rsi      # 0x5120
movl $0xa, %edi
callq 0x1140
movq -0x58(%rbp), %rdx
incq %rdx
movslq 0x3334(%rip), %rax      # 0x527c
addq $0x8, -0x48(%rbp)
addq $0x10, -0x40(%rbp)
movq %rdx, -0x58(%rbp)
cmpq %rax, %rdx
jl 0x1e6a
movq 0x31ba(%rip), %rdi      # 0x5120
movq 0x31c3(%rip), %rdx      # 0x5130
movq 0x31c4(%rip), %rcx      # 0x5138
fldt 0x31c6(%rip)            # 0x5140
subq $0x20, %rsp
movq -0x50(%rbp), %r8
movq %r8, 0x10(%rsp)
movq -0xa8(%rbp), %r9
addq %r9, %r8
fstpt (%rsp)
leaq 0x1568(%rip), %rsi      # 0x3503
xorl %eax, %eax
callq 0x1150
addq $0x20, %rsp
movq 0x3173(%rip), %rdi      # 0x5120
callq 0x10e0
movq -0xb0(%rbp), %rsp
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x11e0
jmp 0x1e4b
movq 0x3015(%rip), %rbx      # 0x4ff0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq %rax, %rbx
leaq 0x125a(%rip), %rsi      # 0x3266
movl $0x17, %edx
jmp 0x2050
movq 0x2fd6(%rip), %rbx      # 0x4ff0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq %rax, %rbx
leaq 0x1233(%rip), %rsi      # 0x327e
movl $0x1f, %edx
movq %rax, %rdi
callq 0x1110
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1090
movq (%r14), %rdi
callq 0x1423
callq 0x1202