// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/psd.cc
// Function: calcPoreSizeDistr(ATOM_NETWORK*, ATOM_NETWORK*, bool, double, double, int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, bool)
void calcPoreSizeDistr(ATOM_NETWORK *atmnet, ATOM_NETWORK *orgAtomnet, bool highAccuracy, double r_probe_chan, double r_probe, int numSamples, bool excludePockets, string histogramFile, string pointsFile, string nodeAndRadiiFile, string spheresDistFile, bool visualize, bool visVISIT){

    ofstream output; 
    if (!histogramFile.empty()) output.open(histogramFile.data());
    ofstream outfile;
    if (!pointsFile.empty()) outfile.open(pointsFile.data());
    ofstream nodeAndRadii;
    if (!nodeAndRadiiFile.empty()) nodeAndRadii.open(nodeAndRadiiFile.data());
    ofstream spheresDist;
  // Create an object that handles analysis of accessibility of sampled points
  AccessibilityClass accessAnalysis;
  if(highAccuracy) accessAnalysis.setupAndFindChannels(atmnet, orgAtomnet, highAccuracy, r_probe_chan, r_probe);
    else accessAnalysis.setupAndFindChannels(atmnet, atmnet, highAccuracy, r_probe_chan, r_probe);


  srand(randSeed);

//Vectors to store accessible points, inaccessible points, and accessible points which lie outside Voronoi nodes and edges. 
  vector<Point> axsPoint = vector<Point>();
  vector<Point> inaxsPoint = vector<Point>();

//List of largest sphere diameters for PSD histogram
  vector<double> diameterOfLargestSphere;

//List of sample points and radius of sphere that contains sample point for visualization in Visit
  vector <pair <Point, double> > axsPoint_and_radiiOfNodeSphere;
  vector <pair <Point, double> > axsPoint_and_radiiOfGhostSphere;
//List of node coordinates and radii for visualization
  vector <int> nodeIDs;
  vector <pair <Point, double> > coord_and_radiiOfNodeSphere;
  vector <pair <Point, double> > coord_and_radiiOfGhostSphere;
	vector <double> distanceBetweenNodeSpheres;
	vector <double> distanceBetweenGhostSpheres;

  int count = 0;
  int incount = 0;
  int outcount = 0;

//Generates random points across cell and tests accessibility.
  for(int i = 0; i < numSamples; i++){
    bool overlaps = false;
    bool inside = false;
    double aPoint = (rand()*1.0)/RAND_MAX;
    double bPoint = (rand()*1.0)/RAND_MAX;
    double cPoint = (rand()*1.0)/RAND_MAX;
    Point samplingPoint = atmnet->abc_to_xyz(aPoint, bPoint, cPoint);


    // Calling accessibility object to determine accessibility of the point (this replaced a big chunk of code by Thomas)
    double dist_var;
    pair<bool,bool> answer = (accessAnalysis.isVPointInsideAtomAndNotAccessible(samplingPoint, dist_var));
    inside = answer.first; overlaps = answer.second;
    if(accessAnalysis.needToResample() == true) i--; // the sampled point could not be analyzed in isVPointInsideAtomAndNotAccessible() function, resampling needed

    if(inside == false && excludePockets == false) overlaps = false; // if ignore inacceible pockets, treat the point as accessible (unless inside atom)




// Store sampled points that did not overlap with an atom but were inaccessible
    if(accessAnalysis.needToResample() == false && !inside && overlaps){
	Point abcCoords = Point(aPoint, bPoint, cPoint);
	Point coord = atmnet->abc_to_xyz(abcCoords);
	inaxsPoint.push_back(coord);
    }
// Store accessible points
    if(accessAnalysis.needToResample() == false &&!overlaps) {
	count++;     
	Point abcCoords = Point(aPoint, bPoint, cPoint);
	Point coords = atmnet->abc_to_xyz(abcCoords);
	axsPoint.push_back(coords); 
    }
  } // ends loop over all sampled points


  // Warn user if points were resampled
  int resampleCount =  accessAnalysis.getResampleCount();
  if(resampleCount != 0){
    cerr << "\n" << "\n"
         << "Warning: Resampled " << resampleCount << " points out of " << numSamples
         << " when analyzing " << atmnet->name << "\n"
         << "\n" << "\n";
  }


//Below are functions that go beyond accessible volume calcluation. Each accessible point is analyzed to find the largest encapsulating sphere


//Determine whether sample point is inside/outside node sphere
  for (int a=0; a<axsPoint.size(); a++){
    Point samplePt = axsPoint.at(a);
    Point maxNodeCoord = Point (0, 0, 0);
    double maxRadius = 0;
    for (int b=0; b<accessAnalysis.vornet.nodes.size(); b++)
      {
      bool access = accessAnalysis.accessInfo.at(b);
      if (access){
        Point nodePt = Point(accessAnalysis.vornet.nodes.at(b).x, accessAnalysis.vornet.nodes.at(b).y, accessAnalysis.vornet.nodes.at(b).z);
        double radius = accessAnalysis.vornet.nodes.at(b).rad_stat_sphere + r_probe;
        double sampToNode = accessAnalysis.analyzedAtomNet.calcDistanceXYZ(samplePt[0], samplePt[1], samplePt[2], nodePt[0], nodePt[1], nodePt[2]);
        bool inSphere = (sampToNode <= radius); 
        //if point is inside more than one sphere, chooses largest sphere (i.e. largest radius)
        if (inSphere){
          maxRadius = max(radius, maxRadius);
          //If query zpsd, this stores the largest node sphere and its coordinate for visualization in Visit
          if (visualize){
            if (radius==maxRadius){
               maxNodeCoord = nodePt; 
               }
            }
        } // ends if(inSphere)
      }
     }
    if (maxRadius==0) outcount++; 
    if (maxRadius!=0) incount++;





//Generate new "ghost" Voronoi cell
    double pointParticleRadius = r_probe;
//DEBUG next 4 lines
    voronoicell v(*(accessAnalysis.new_rad_con));
    accessAnalysis.new_rad_con->compute_ghost_cell(v, samplePt[0], samplePt[1], samplePt[2], pointParticleRadius);
    vector<double> vertexCoords;
    v.vertices(vertexCoords);

   //debug
   //cout << "number of ghost vertices = " << vertexCoords.size()/3 << "\n"; cout.flush();
   //for(unsigned int aa=0;aa<vertexCoords.size();aa++) cout << vertexCoords[aa] << " "; cout << "\n";

    vector <Point> pointVertexCoords;
    for (int c=0; c<vertexCoords.size(); c= c+3){
      Point vertexPoint = Point(vertexCoords.at(c), vertexCoords.at(c+1), vertexCoords.at(c+2));
      pointVertexCoords.push_back(vertexPoint);
    }

   //debug
   //cout << "vertex vector constructed \n"; cout.flush();

    double maxDistFromCtoV = 0;
    Point maxGhostCoord = Point (0, 0, 0);
//Calculate distance from center of cell to vertices
   for (int b=0; b<pointVertexCoords.size(); b++){
      Point vertexGlobalCoord = Point((samplePt[0]+pointVertexCoords.at(b)[0]), (samplePt[1]+pointVertexCoords.at(b)[1]), (samplePt[2]+pointVertexCoords.at(b)[2]));
      double calcDistFromCtoV = calcEuclideanDistance(pointVertexCoords.at(b)[0], pointVertexCoords.at(b)[1], pointVertexCoords.at(b)[2], 0.0, 0.0, 0.0) - pointParticleRadius;

      maxDistFromCtoV = max(maxDistFromCtoV, calcDistFromCtoV);
//If query zpsd, this stores the largest ghost sphere and its coordinate for visualization in Visit
      if (visualize){
        if (calcDistFromCtoV==maxDistFromCtoV){
          maxGhostCoord = vertexGlobalCoord;
        } 
      }
    }

  //debug:
  //cout << "getting ready for final comparison and assigment\n"; cout.flush();

//Compares node radius to biggest ghost radius and stores the larger of the two values accordingly
    double origNodeRadius = maxRadius;
    double ghostRadius = maxDistFromCtoV;  
    bool compareRadii = (origNodeRadius >= ghostRadius); 
    if (compareRadii) {
      diameterOfLargestSphere.push_back(2.0*origNodeRadius); 
      if (visualize){
      axsPoint_and_radiiOfNodeSphere.push_back(pair<Point, double>(samplePt, origNodeRadius));
      checkDuplicates(&(accessAnalysis.analyzedAtomNet), &(accessAnalysis.vornet), nodeIDs, coord_and_radiiOfNodeSphere, maxNodeCoord, origNodeRadius);
      }
    }
    if (!compareRadii) {
      diameterOfLargestSphere.push_back(2.0*ghostRadius);
      if (visualize){
        axsPoint_and_radiiOfGhostSphere.push_back(pair<Point, double>(samplePt, ghostRadius));
        coord_and_radiiOfGhostSphere.push_back(pair <Point, double> (maxGhostCoord, maxDistFromCtoV));
      }
    }

  //debug:
  //cout << "finishing pass in axsPoint loop\n"; cout.flush();

  }

  double volumeFraction = count*1.0/numSamples;
  double nodeVolFraction = incount*1.0/numSamples;
  double outFraction = outcount*1.0/numSamples;


  Histogram(output, BINSTEP, MAXBINS, diameterOfLargestSphere, count, nodeVolFraction, outFraction, numSamples);

  printf("Pore size distribution calculated.\n\n");

  if (visualize) {
    printFileCoords_Radii(outfile, axsPoint_and_radiiOfNodeSphere, axsPoint_and_radiiOfGhostSphere, distanceBetweenNodeSpheres, distanceBetweenGhostSpheres, false, -1, -1);
    printf("Points file generated.\n\n");
		if (!visVISIT){
                // here printing ZeoVis stuff
		}
		if (visVISIT) {
		  printFileCoords_Radii(nodeAndRadii, coord_and_radiiOfNodeSphere, coord_and_radiiOfGhostSphere, distanceBetweenNodeSpheres, distanceBetweenGhostSpheres, false, -1, -1);
		  printf("Radii file generated.\n");
		}
  }

  accessAnalysis.deconstruct();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x15a8, %rsp           # imm = 0x15A8
movq %r9, %r12
movl %r8d, 0x88(%rsp)
movl %ecx, 0x3c(%rsp)
movsd %xmm1, 0x80(%rsp)
movsd %xmm0, 0x20(%rsp)
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, 0x30(%rsp)
leaq 0x768(%rsp), %rdi
callq 0x4730
cmpq $0x0, 0x8(%r12)
je 0x682ab
movq (%r12), %rsi
leaq 0x768(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x4060
leaq 0x568(%rsp), %rdi
callq 0x4730
movq 0x15e0(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x682da
movq (%rax), %rsi
leaq 0x568(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x4060
leaq 0x368(%rsp), %rdi
callq 0x4730
movq 0x15e8(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x68309
movq (%rax), %rsi
leaq 0x368(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x4060
leaq 0x968(%rsp), %rdi
callq 0x4730
leaq 0xb68(%rsp), %rdi
callq 0x36c02
testb %r15b, %r15b
movq 0x30(%rsp), %rsi
cmoveq %rsi, %r14
movzbl %r15b, %ecx
leaq 0xb68(%rsp), %rdi
movq %r14, %rdx
movsd 0x20(%rsp), %xmm0
movsd 0x80(%rsp), %xmm1
callq 0x6e3ac
movl $0x3b4ca6f5, %edi       # imm = 0x3B4CA6F5
callq 0x4460
xorpd %xmm0, %xmm0
leaq 0xf0(%rsp), %rax
movapd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x260(%rsp), %rax
movapd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movapd %xmm0, 0xd0(%rsp)
andq $0x0, 0xe0(%rsp)
movapd %xmm0, 0x1f0(%rsp)
andq $0x0, 0x200(%rsp)
movapd %xmm0, 0x1d0(%rsp)
andq $0x0, 0x1e0(%rsp)
movapd %xmm0, 0x240(%rsp)
andq $0x0, 0x250(%rsp)
movapd %xmm0, 0x1b0(%rsp)
andq $0x0, 0x1c0(%rsp)
movapd %xmm0, 0x190(%rsp)
andq $0x0, 0x1a0(%rsp)
movapd %xmm0, 0x170(%rsp)
andq $0x0, 0x180(%rsp)
movapd %xmm0, 0x150(%rsp)
andq $0x0, 0x160(%rsp)
xorl %r15d, %r15d
leaq 0xb68(%rsp), %r13
leaq 0xb0(%rsp), %rbx
movl $0x0, 0x74(%rsp)
cmpl 0x3c(%rsp), %r15d
jge 0x685d4
callq 0x4170
cvtsi2sd %eax, %xmm1
movsd 0x98137(%rip), %xmm0    # 0x100580
divsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
callq 0x4170
cvtsi2sd %eax, %xmm0
divsd 0x9811c(%rip), %xmm0    # 0x100580
movsd %xmm0, 0x28(%rsp)
callq 0x4170
cvtsi2sd %eax, %xmm2
divsd 0x98105(%rip), %xmm2    # 0x100580
leaq 0x280(%rsp), %rdi
movq 0x30(%rsp), %rsi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd %xmm2, 0x48(%rsp)
callq 0x3f0e6
movq 0x290(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x280(%rsp), %xmm0
movupd %xmm0, (%rsp)
movq %r13, %rdi
leaq 0x130(%rsp), %rsi
callq 0x6e78c
movl %eax, %r14d
movq %r13, %rdi
callq 0x36d64
movl %eax, %r12d
movzwl %r14w, %eax
shrl $0x8, %eax
cmpb $0x0, 0x88(%rsp)
movl $0x0, %ebp
cmovnel %eax, %ebp
testb $0x1, %r14b
cmovnel %eax, %ebp
movq %r13, %rdi
callq 0x36d64
orb %r14b, %al
testb $0x1, %al
jne 0x6855c
testb $0x1, %bpl
je 0x6855c
leaq 0x50(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
callq 0x63c46
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x50(%rsp), %xmm0
movupd %xmm0, (%rsp)
movq %rbx, %r14
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x3e536
leaq 0x260(%rsp), %rdi
movq %r14, %rsi
callq 0x2468e
movq %r13, %rdi
callq 0x36d64
testb %al, %al
jne 0x685c3
testb $0x1, %bpl
jne 0x685c3
leaq 0x50(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
callq 0x63c46
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x50(%rsp), %xmm0
movupd %xmm0, (%rsp)
movq %rbx, %r14
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
callq 0x3e536
leaq 0xf0(%rsp), %rdi
movq %r14, %rsi
callq 0x2468e
incl 0x74(%rsp)
movzbl %r12b, %eax
negl %eax
addl %eax, %r15d
incl %r15d
jmp 0x6842d
movl 0x15a0(%rsp), %ebp
testl %ebp, %ebp
je 0x68689
movq 0xe7a06(%rip), %rdi     # 0x14fff0
leaq 0x99f8d(%rip), %rsi     # 0x10257e
callq 0x4480
leaq 0x99f81(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0x98132(%rip), %rsi     # 0x10073e
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movl %ebp, %esi
callq 0x4760
leaq 0x9812d(%rip), %rsi     # 0x100752
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movl 0x3c(%rsp), %esi
callq 0x4760
leaq 0xa5be6(%rip), %rsi     # 0x10e226
movq %rax, %rdi
callq 0x4480
movq 0x30(%rsp), %rsi
addq $0x320, %rsi            # imm = 0x320
movq %rax, %rdi
callq 0x43f0
leaq 0x99f1b(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0x99f0c(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
leaq 0x99efd(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
xorl %esi, %esi
leaq 0xb0(%rsp), %rbx
pushq $0x1
popq %r13
pushq $0x2
popq %r12
leaq 0x110(%rsp), %rbp
movl $0x0, 0x7c(%rsp)
movl $0x0, 0x78(%rsp)
movq 0xf8(%rsp), %rax
subq 0xf0(%rsp), %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %rsi, %rax
jbe 0x68dc1
leaq 0xf0(%rsp), %rdi
movq %rsi, 0x210(%rsp)
callq 0x246b4
movq 0x10(%rax), %rcx
movq %rcx, 0xc0(%rsp)
movupd (%rax), %xmm0
movapd %xmm0, 0xb0(%rsp)
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
leaq 0x130(%rsp), %rdi
callq 0x63c46
xorpd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
xorl %r14d, %r14d
movq 0x1480(%rsp), %rax
subq 0x1478(%rsp), %rax
sarq $0x6, %rax
cmpq %r14, %rax
jbe 0x688ed
leaq 0x14f8(%rsp), %rdi
movq %r14, %rsi
callq 0xaba4
testq %rdx, (%rax)
je 0x688e5
leaq 0x1478(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa848
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0xa848
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0xa848
movsd 0x10(%rax), %xmm2
leaq 0x280(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0x63c46
movq %r15, %rdi
movq %r14, %rsi
callq 0xa848
movsd 0x18(%rax), %xmm0
addsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
movl %r13d, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0x280(%rsp), %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
leaq 0x280(%rsp), %rdi
movl %r13d, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x218(%rsp)
leaq 0x280(%rsp), %rdi
movl %r12d, %esi
callq 0x63c78
movsd (%rax), %xmm5
leaq 0xfc8(%rsp), %rdi
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movsd 0x88(%rsp), %xmm3
movsd 0x218(%rsp), %xmm4
callq 0x3f636
movsd 0x20(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x688e5
movsd 0x40(%rsp), %xmm0
maxsd %xmm1, %xmm0
cmpb $0x0, 0x15f8(%rsp)
movsd %xmm0, 0x40(%rsp)
je 0x688e5
ucomisd %xmm0, %xmm1
jne 0x688e5
jp 0x688e5
movq 0x290(%rsp), %rax
movq %rax, 0x140(%rsp)
movupd 0x280(%rsp), %xmm0
movapd %xmm0, 0x130(%rsp)
incq %r14
jmp 0x68728
movq 0x1558(%rsp), %rsi
leaq 0x280(%rsp), %rdi
callq 0xb980
movq 0x1558(%rsp), %r14
movq %rbx, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movl %r13d, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x63c78
movsd (%rax), %xmm2
movq %r14, %rdi
leaq 0x280(%rsp), %rsi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x80(%rsp), %xmm3
callq 0x6a88c
xorpd %xmm0, %xmm0
movapd %xmm0, 0x90(%rsp)
andq $0x0, 0xa0(%rsp)
leaq 0x280(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xd9b42
movsd 0x40(%rsp), %xmm2
movapd %xmm2, %xmm0
xorpd %xmm1, %xmm1
cmpeqsd %xmm1, %xmm0
movq %xmm0, %rax
subl %eax, 0x7c(%rsp)
movapd %xmm2, %xmm0
cmpneqsd %xmm1, %xmm0
movq %xmm0, %rax
subl %eax, 0x78(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x110(%rsp)
andq $0x0, 0x120(%rsp)
xorl %r14d, %r14d
movq 0x98(%rsp), %rax
subq 0x90(%rsp), %rax
sarq $0x3, %rax
cmpq %r14, %rax
jbe 0x68a6b
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0xaa50
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
incq %r14
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0xaa50
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
incq %r14
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0xaa50
movsd (%rax), %xmm2
leaq 0x50(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0x63c46
movq %rbp, %rdi
leaq 0x50(%rsp), %rsi
callq 0x2468e
incq %r14
jmp 0x689d9
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
leaq 0x220(%rsp), %rdi
callq 0x63c46
xorpd %xmm0, %xmm0
movsd %xmm0, 0x30(%rsp)
xorl %r14d, %r14d
movq 0x118(%rsp), %rax
subq 0x110(%rsp), %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %r14, %rax
jbe 0x68c33
movq %rbx, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x246b4
movq %rax, %rdi
xorl %esi, %esi
callq 0x63c78
movsd 0x20(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movl %r13d, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x246b4
movq %rax, %rdi
movl %r13d, %esi
callq 0x63c78
movsd 0x28(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x246b4
movq %rax, %rdi
movl %r12d, %esi
callq 0x63c78
movsd 0x48(%rsp), %xmm2
addsd (%rax), %xmm2
leaq 0x50(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0x63c46
movq %rbp, %rdi
movq %r14, %rsi
callq 0x246b4
movq %rax, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x246b4
movq %rax, %rdi
movl %r13d, %esi
callq 0x63c78
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x246b4
movq %rax, %rdi
movl %r12d, %esi
callq 0x63c78
movsd (%rax), %xmm2
xorps %xmm3, %xmm3
xorps %xmm4, %xmm4
xorps %xmm5, %xmm5
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
callq 0x64934
subsd 0x80(%rsp), %xmm0
movapd %xmm0, %xmm1
maxsd 0x30(%rsp), %xmm1
cmpb $0x0, 0x15f8(%rsp)
je 0x68c25
ucomisd %xmm1, %xmm0
jne 0x68c25
jp 0x68c25
movq 0x60(%rsp), %rax
movq %rax, 0x230(%rsp)
movupd 0x50(%rsp), %xmm0
movapd %xmm0, 0x220(%rsp)
incq %r14
movsd %xmm1, 0x30(%rsp)
jmp 0x68a91
movsd 0x40(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jae 0x68ced
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xf9fe
cmpb $0x0, 0x15f8(%rsp)
je 0x68d8f
movq 0xc0(%rsp), %rax
movq %rax, 0x60(%rsp)
movaps 0xb0(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
leaq 0x1d0(%rsp), %rdi
leaq 0x50(%rsp), %r14
movq %r14, %rsi
callq 0x6aa2a
movq 0x230(%rsp), %rax
movq %rax, 0x60(%rsp)
movups 0x220(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
leaq 0x190(%rsp), %rdi
movq %r14, %rsi
callq 0x6aa2a
jmp 0x68d8f
addsd %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xf9fe
cmpb $0x0, 0x15f8(%rsp)
je 0x68d8f
movq 0xc0(%rsp), %rax
movq %rax, 0x60(%rsp)
movaps 0xb0(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
leaq 0x1f0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x6aa2a
movq 0x140(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x130(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xfc8(%rsp), %rdi
leaq 0x1430(%rsp), %rsi
leaq 0x240(%rsp), %rdx
leaq 0x1b0(%rsp), %rcx
movsd 0x40(%rsp), %xmm0
callq 0x690f9
movq %rbp, %rdi
callq 0xb83e
leaq 0x90(%rsp), %rdi
callq 0xb25c
leaq 0x280(%rsp), %rdi
callq 0xd6d3c
movq 0x210(%rsp), %rsi
incq %rsi
jmp 0x686b3
movl 0x3c(%rsp), %r8d
cvtsi2sd %r8d, %xmm0
cvtsi2sdl 0x78(%rsp), %xmm1
divsd %xmm0, %xmm1
cvtsi2sdl 0x7c(%rsp), %xmm2
divsd %xmm0, %xmm2
leaq 0x768(%rsp), %rdi
movsd 0x98409(%rip), %xmm0    # 0x1011f8
leaq 0xd0(%rsp), %rdx
movl $0x3e8, %esi            # imm = 0x3E8
movl 0x74(%rsp), %ecx
callq 0x691b7
leaq 0x9bdc6(%rip), %rdi     # 0x104bd2
callq 0x4670
cmpb $0x0, 0x15f8(%rsp)
je 0x68eb9
leaq 0x568(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
leaq 0x1d0(%rsp), %rdx
leaq 0x170(%rsp), %rcx
leaq 0x150(%rsp), %r8
movsd 0x97499(%rip), %xmm0    # 0x1002e8
xorl %r9d, %r9d
movapd %xmm0, %xmm1
callq 0x69508
leaq 0x9bd42(%rip), %rdi     # 0x104ba4
callq 0x4670
cmpb $0x0, 0x1600(%rsp)
je 0x68eb9
leaq 0x368(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
leaq 0x190(%rsp), %rdx
leaq 0x170(%rsp), %rcx
leaq 0x150(%rsp), %r8
movsd 0x97447(%rip), %xmm0    # 0x1002e8
xorl %r9d, %r9d
movapd %xmm0, %xmm1
callq 0x69508
leaq 0x9bd08(%rip), %rdi     # 0x104bbc
callq 0x4670
leaq 0xb68(%rsp), %rbx
movq %rbx, %rdi
callq 0x36e7a
leaq 0x150(%rsp), %rdi
callq 0xb25c
leaq 0x170(%rsp), %rdi
callq 0xb25c
leaq 0x190(%rsp), %rdi
callq 0x6a9b2
leaq 0x1b0(%rsp), %rdi
callq 0x6a9b2
leaq 0x240(%rsp), %rdi
callq 0xb290
leaq 0x1d0(%rsp), %rdi
callq 0x6a9b2
leaq 0x1f0(%rsp), %rdi
callq 0x6a9b2
leaq 0xd0(%rsp), %rdi
callq 0xb25c
leaq 0x260(%rsp), %rdi
callq 0xb83e
leaq 0xf0(%rsp), %rdi
callq 0xb83e
movq %rbx, %rdi
callq 0x36e9e
leaq 0x968(%rsp), %rdi
callq 0x4640
leaq 0x368(%rsp), %rdi
callq 0x4640
leaq 0x568(%rsp), %rdi
callq 0x4640
leaq 0x768(%rsp), %rdi
callq 0x4640
addq $0x15a8, %rsp           # imm = 0x15A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x68faf
jmp 0x68fb7
jmp 0x68fbf
movq %rax, %rbx
jmp 0x690b0
movq %rax, %rbx
jmp 0x690bd
movq %rax, %rbx
jmp 0x690ca
movq %rax, %rbx
jmp 0x690d7
movq %rax, %rbx
jmp 0x690e4
jmp 0x68ffb
jmp 0x68ffb
jmp 0x69004
jmp 0x69004
jmp 0x69004
jmp 0x69004
jmp 0x68ffb
jmp 0x68ffb
jmp 0x69004
jmp 0x69004
jmp 0x68ffb
jmp 0x68ffb
jmp 0x69004
jmp 0x68ffb
movq %rax, %rbx
jmp 0x69014
jmp 0x68ffb
jmp 0x68ffb
jmp 0x68ffb
movq %rax, %rbx
jmp 0x69021
jmp 0x68ffb
jmp 0x68ffb
jmp 0x68ffb
jmp 0x68ffb
movq %rax, %rbx
jmp 0x6902e
jmp 0x69004
jmp 0x69004
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0xb83e
leaq 0x90(%rsp), %rdi
callq 0xb25c
leaq 0x280(%rsp), %rdi
callq 0xd6d3c
leaq 0x150(%rsp), %rdi
callq 0xb25c
leaq 0x170(%rsp), %rdi
callq 0xb25c
leaq 0x190(%rsp), %rdi
callq 0x6a9b2
leaq 0x1b0(%rsp), %rdi
callq 0x6a9b2
leaq 0x240(%rsp), %rdi
callq 0xb290
leaq 0x1d0(%rsp), %rdi
callq 0x6a9b2
leaq 0x1f0(%rsp), %rdi
callq 0x6a9b2
leaq 0xd0(%rsp), %rdi
callq 0xb25c
leaq 0x260(%rsp), %rdi
callq 0xb83e
leaq 0xf0(%rsp), %rdi
callq 0xb83e
leaq 0xb68(%rsp), %rdi
callq 0x36e9e
leaq 0x968(%rsp), %rdi
callq 0x4640
leaq 0x368(%rsp), %rdi
callq 0x4640
leaq 0x568(%rsp), %rdi
callq 0x4640
leaq 0x768(%rsp), %rdi
callq 0x4640
movq %rbx, %rdi
callq 0x4780