// File: /workspace/github_cpp_makefile_star2_O3/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 0x1fd6
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 0x20ab
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
testq %rbx, %rbx
je 0x1fd6
cmpl $0x0, 0x3c22(%rip)      # 0x5270
je 0x2015
cmpl $0x0, 0x3af9(%rip)      # 0x5154
je 0x17e7
movq 0x3988(%rip), %r14      # 0x4ff0
leaq 0x1c2f(%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 0x1c09(%rip), %rsi      # 0x32b6
movl $0x4, %edx
movq %rax, %rdi
callq 0x1110
movl 0x3bb8(%rip), %esi      # 0x5278
movq %r14, %rdi
callq 0x11b0
movq %rax, %r14
leaq 0x1be9(%rip), %rsi      # 0x32bb
movl $0x6, %edx
movq %rax, %rdi
callq 0x1110
movl 0x3b97(%rip), %esi      # 0x527c
movq %r14, %rdi
callq 0x11b0
movq %rax, %r14
leaq 0x1bcb(%rip), %rsi      # 0x32c2
movl $0x6, %edx
movq %rax, %rdi
callq 0x1110
movsd 0x3b74(%rip), %xmm0     # 0x5280
mulsd 0x18f4(%rip), %xmm0     # 0x3008
movq %r14, %rdi
callq 0x11a0
movq %rax, %r14
leaq 0x1ba3(%rip), %rsi      # 0x32c9
movl $0x8, %edx
movq %rax, %rdi
callq 0x1110
movsd 0x3b4d(%rip), %xmm0     # 0x5288
mulsd 0x18c5(%rip), %xmm0     # 0x3008
movq %r14, %rdi
callq 0x11a0
movq %rax, %r14
leaq 0x1b7d(%rip), %rsi      # 0x32d2
movl $0x8, %edx
movq %rax, %rdi
callq 0x1110
movsd 0x3b26(%rip), %xmm0     # 0x5290
mulsd 0x1896(%rip), %xmm0     # 0x3008
movq %r14, %rdi
callq 0x11a0
movq %rax, %r14
leaq 0x1b57(%rip), %rsi      # 0x32db
movl $0x8, %edx
movq %rax, %rdi
callq 0x1110
movsd 0x186f(%rip), %xmm0     # 0x3008
mulsd 0x3af7(%rip), %xmm0     # 0x5298
movq %r14, %rdi
callq 0x11a0
movq %rax, %r14
leaq 0x1b31(%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 0x3a8e(%rip), %rax      # 0x527c
movl 0x3a88(%rip), %ecx      # 0x527c
cmpl $0x2, %ecx
leaq 0x3a76(%rip), %rdx      # 0x5274
cmovlq %rax, %rdx
movl $0x1, %eax
cmovgel %ecx, %eax
movl $0x1, (%rdx)
movsd 0x17f8(%rip), %xmm0     # 0x3010
movsd 0x3a70(%rip), %xmm1     # 0x5290
mulsd %xmm0, %xmm1
addsd %xmm1, %xmm1
movsd %xmm1, 0x3a78(%rip)     # 0x52a8
movl 0x3a42(%rip), %ecx      # 0x5278
andl $-0x2, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
mulsd 0x3a38(%rip), %xmm1     # 0x5280
mulsd %xmm0, %xmm1
movsd %xmm1, 0x3a4c(%rip)     # 0x52a0
movsd 0x3a3c(%rip), %xmm1     # 0x5298
mulsd %xmm0, %xmm1
addsd %xmm1, %xmm1
movsd %xmm1, 0x3a4c(%rip)     # 0x52b8
movsd 0x3a14(%rip), %xmm1     # 0x5288
andl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
cvtsi2sd %eax, %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
movsd %xmm2, 0x3a23(%rip)     # 0x52b0
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x18aa
jp 0x18aa
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x39de(%rip)      # 0x5288
leaq 0x17af(%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 0x1936
movq %rax, %rbx
leaq 0x16fe(%rip), %rsi      # 0x3020
movl $0x4, %edx
movq %rax, %rdi
callq 0x1060
testl %eax, %eax
jne 0x1936
movb $0x0, (%rbx)
leaq -0x1c0(%rbp), %rdi
movl $0x2e, %esi
callq 0x10f0
testq %rax, %rax
je 0x196a
movq %rax, %rbx
leaq 0x1991(%rip), %rsi      # 0x32e7
movl $0x4, %edx
movq %rax, %rdi
callq 0x1060
testl %eax, %eax
jne 0x196a
movb $0x0, (%rbx)
leaq 0x197b(%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 0x195e(%rip), %rsi      # 0x32f3
movq %rbx, %rdi
callq 0x1100
movq %rax, 0x377c(%rip)      # 0x5120
testq %rax, %rax
je 0x20b3
leaq 0x1968(%rip), %rdi      # 0x331c
movl $0xa, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x11c0
movq 0x3753(%rip), %rdi      # 0x5120
leaq 0x1953(%rip), %rsi      # 0x3327
leaq 0x16d9(%rip), %rdx      # 0x30b4
xorl %eax, %eax
callq 0x1150
movq 0x3737(%rip), %rdi      # 0x5120
movl 0x3889(%rip), %edx      # 0x5278
movl 0x3887(%rip), %ecx      # 0x527c
movsd 0x160b(%rip), %xmm4     # 0x3008
movsd 0x387b(%rip), %xmm0     # 0x5280
mulsd %xmm4, %xmm0
movsd 0x3877(%rip), %xmm1     # 0x5288
mulsd %xmm4, %xmm1
movsd 0x3873(%rip), %xmm2     # 0x5290
mulsd %xmm4, %xmm2
movsd 0x386f(%rip), %xmm3     # 0x5298
mulsd %xmm4, %xmm3
leaq 0x1949(%rip), %rsi      # 0x337d
movb $0x4, %al
callq 0x1150
movq 0x36de(%rip), %rcx      # 0x5120
leaq 0x199c(%rip), %rdi      # 0x33e5
movl $0x18, %esi
movl $0x1, %edx
callq 0x11c0
movq 0x36c1(%rip), %rcx      # 0x5120
leaq 0x1998(%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 0x37d5(%rip), %eax      # 0x5278
movl 0x37d3(%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 0x37b0(%rip), %edx      # 0x5278
movl 0x37ae(%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 0x1b57
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 0x1b49
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 0x1b39
fstp %st(0)
incq %r12
addq %r14, %r13
cmpq -0x60(%rbp), %r12
jne 0x1b16
cmpl $0x0, 0x35f6(%rip)      # 0x5154
je 0x1ba2
movq 0x3489(%rip), %rbx      # 0x4ff0
leaq 0x18a6(%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 0x356f(%rip), %rdx      # 0x5118
leaq 0x35c0(%rip), %rdi      # 0x5170
movl $0xfa, %esi
callq 0x1180
testq %rax, %rax
movq -0x38(%rbp), %r15
movq -0x30(%rbp), %r12
je 0x1e2e
leaq 0x359e(%rip), %rbx      # 0x5170
movq $0x0, -0x50(%rbp)
xorl %r13d, %r13d
xorl %r14d, %r14d
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0x1852(%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 0x1be0
movq 0x34ea(%rip), %rsi      # 0x5130
leaq 0x1(%rsi), %rcx
movq %rcx, %rax
movabsq $0x29f16b11c6d1e109, %rdx # imm = 0x29F16B11C6D1E109
imulq %rdx
movq %rcx, 0x34cf(%rip)      # 0x5130
cmpl $0x0, 0x34ec(%rip)      # 0x5154
je 0x1c91
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 0x1d82
movsd -0xa0(%rbp), %xmm0
ucomisd 0x1377(%rip), %xmm0     # 0x3018
jbe 0x1d5a
movsd -0x98(%rbp), %xmm1
addsd 0x35e9(%rip), %xmm1     # 0x52a0
addsd 0x35e9(%rip), %xmm1     # 0x52a8
divsd 0x35b9(%rip), %xmm1     # 0x5280
cvttsd2si %xmm1, %edx
cmpl %edx, 0x35a7(%rip)      # 0x5278
jl 0x1da2
movsd -0x90(%rbp), %xmm1
addsd 0x35c9(%rip), %xmm1     # 0x52b0
addsd 0x35c9(%rip), %xmm1     # 0x52b8
divsd 0x3591(%rip), %xmm1     # 0x5288
cvttsd2si %xmm1, %eax
cmpl %eax, 0x357b(%rip)      # 0x527c
jl 0x1db0
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 0x33f5(%rip)            # 0x5140
faddp %st, %st(1)
fstpt 0x33ed(%rip)            # 0x5140
incq 0x33de(%rip)            # 0x5138
movq 0x33b7(%rip), %rdx      # 0x5118
movq %rbx, %rdi
movl $0xfa, %esi
callq 0x1180
movl $0x0, %r14d
testq %rax, %rax
jne 0x1be0
jmp 0x1e39
movq 0x3247(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
leaq 0x16ca(%rip), %rsi      # 0x345d
movq %rcx, %rdx
xorl %eax, %eax
callq 0x1150
jmp 0x1c91
cmpl $0x0, 0x33ab(%rip)      # 0x5154
jne 0x1ddc
incq %r13
jmp 0x1dbd
cmpl $0x0, 0x339d(%rip)      # 0x5154
jne 0x1e04
incq -0x50(%rbp)
movq 0x3354(%rip), %rdx      # 0x5118
movq %rbx, %rdi
movl $0xfa, %esi
callq 0x1180
testq %rax, %rax
jne 0x1bdd
jmp 0x1e39
movq 0x31ed(%rip), %rax      # 0x4fd0
movq (%rax), %rdi
movq 0x3343(%rip), %rcx      # 0x5130
leaq 0x1688(%rip), %rsi      # 0x347c
leaq -0x1c0(%rbp), %r8
xorl %eax, %eax
callq 0x1150
jmp 0x1dab
movq 0x31c5(%rip), %rcx      # 0x4fd0
movq (%rcx), %rdi
movq 0x331b(%rip), %rcx      # 0x5130
leaq 0x1660(%rip), %rsi      # 0x347c
movl %eax, %edx
leaq -0x1c0(%rbp), %r8
xorl %eax, %eax
callq 0x1150
jmp 0x1db9
xorl %r13d, %r13d
movq $0x0, -0x50(%rbp)
movq %r13, -0xa8(%rbp)
cmpl $0x0, 0x330d(%rip)      # 0x5154
jne 0x1fcc
cmpl $0x0, 0x3428(%rip)      # 0x527c
jle 0x1f61
shlq $0x3, -0x30(%rbp)
shlq $0x4, -0x38(%rbp)
movq $0x0, -0x58(%rbp)
cmpl $0x0, 0x3405(%rip)      # 0x5278
movsd 0x118d(%rip), %xmm2     # 0x3008
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rdx
leaq 0x1664(%rip), %r13      # 0x34ee
jle 0x1f2b
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 0x326d(%rip), %rdi      # 0x5120
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd 0x33bd(%rip), %xmm0     # 0x5280
subsd 0x33d5(%rip), %xmm0     # 0x52a0
movsd 0x33b5(%rip), %xmm1     # 0x5288
mulsd -0x60(%rbp), %xmm1
subsd 0x33d0(%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 0x10f6(%rip), %xmm2     # 0x3008
addq $0x10, %rsp
incq %r14
movslq 0x3358(%rip), %rax      # 0x5278
addq %rdx, %r12
addq %rbx, %r15
cmpq %rax, %r14
jl 0x1eac
movq 0x31ee(%rip), %rsi      # 0x5120
movl $0xa, %edi
callq 0x1140
movq -0x58(%rbp), %rdx
incq %rdx
movslq 0x3332(%rip), %rax      # 0x527c
addq $0x8, -0x48(%rbp)
addq $0x10, -0x40(%rbp)
movq %rdx, -0x58(%rbp)
cmpq %rax, %rdx
jl 0x1e6c
movq 0x31b8(%rip), %rdi      # 0x5120
movq 0x31c1(%rip), %rdx      # 0x5130
movq 0x31c2(%rip), %rcx      # 0x5138
fldt 0x31c4(%rip)            # 0x5140
subq $0x20, %rsp
movq -0x50(%rbp), %r8
movq %r8, 0x10(%rsp)
movq -0xa8(%rbp), %r9
addq %r9, %r8
fstpt (%rsp)
leaq 0x1566(%rip), %rsi      # 0x3503
xorl %eax, %eax
callq 0x1150
addq $0x20, %rsp
movq 0x3171(%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 0x1e4d
movq 0x3013(%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 0x1258(%rip), %rsi      # 0x3266
movl $0x17, %edx
jmp 0x2052
movq 0x2fd4(%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 0x1231(%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