// File: Luthaf[P]zeopp/area_and_volume.cc
// Function: determineAccessibility(ATOM_NETWORK*, double, double, bool, std::vector<bool, std::allocator<bool>>*, VORONOI_NETWORK*)
void determineAccessibility(ATOM_NETWORK *atmnet, double r_probe_chan, double r_probe, bool excludePockets, vector<bool> *isAccessible, VORONOI_NETWORK *pointSet) {
  // Create a temporary copy of the atomic network in which each atom's radius has been increased by the probe radius
  ATOM_NETWORK newAtomNet;
  atmnet->copy(&newAtomNet);
  for(int i = 0; i < newAtomNet.numAtoms; i++){ newAtomNet.atoms[i].radius += r_probe; }  

  // Calculate and store the Voronoi network for this new atomic network
  VORONOI_NETWORK vornet;
  vector<BASIC_VCELL> vorcells;
  vector<VOR_CELL> advCells;

  container_periodic_poly *new_rad_con = (container_periodic_poly *)performVoronoiDecomp(true, &newAtomNet, &vornet, advCells, false, vorcells);

  vector<CHANNEL> channels = vector<CHANNEL>();
  vector<bool> accessInfo = vector<bool> ();
  CHANNEL::findChannels(&vornet, max(0.0, r_probe_chan - r_probe), &accessInfo, &channels);
  srand(randSeed);

  vector<Point> axsPoints = vector<Point> ();
  vector<Point> inaxsPoints = vector<Point> ();
  vector< pair<int, Point> > resampledInfo = vector< pair<int, Point> > ();  // List of resampled points and the id of the Voronoi cell to which they belong
  int resampleCount = 0;

  int num_accessible = 0;

  for(unsigned int i = 0; i < pointSet->nodes.size(); i++){
    bool overlaps = false;

    Point samplingPoint;
    if(resampleCount>0) {
      double change = 0.000001;
      samplingPoint = Point(pointSet->nodes.at(i).x+change, pointSet->nodes.at(i).y+change, pointSet->nodes.at(i).z+change);
    } else samplingPoint = Point(pointSet->nodes.at(i).x, pointSet->nodes.at(i).y, pointSet->nodes.at(i).z);

    double newAtomX, newAtomY, newAtomZ;
    int minAtomID;
    bool foundCell = new_rad_con->find_voronoi_cell(samplingPoint[0], samplingPoint[1], samplingPoint[2], newAtomX, newAtomY, newAtomZ, minAtomID);
    if(!foundCell){
	    cerr << "Error: Unable to find Voronoi cell for sampled point in AV calculation." << "\n"
	    << "Occurred for structure " << newAtomNet.name << "\n"
	    << "Exiting..." << "\n";
    	exit(1);
    }

    ATOM curAtom = atmnet->atoms[minAtomID];

    // Adjust sampling point so that it lies within the Voronoi cell of interest constructed previously
    samplingPoint = (samplingPoint.add(Point(curAtom.x, curAtom.y, curAtom.z).subtract(Point(newAtomX, newAtomY, newAtomZ))));

    double minDist = calcEuclideanDistance(samplingPoint[0], samplingPoint[1], samplingPoint[2], curAtom.x, curAtom.y, curAtom.z);
    if(minDist < r_probe + curAtom.radius - 0.00000001) overlaps = true;
    
    // If necessary, check Voronoi nodes of cell to determine accessibility of point
    if(!overlaps && excludePockets){
      BASIC_VCELL vcell = vorcells[minAtomID];
      Point circCenter = Point(curAtom.x, curAtom.y, curAtom.z);
      double samplingRadius = minDist;
      Point sampleRay = Point(samplingPoint[0]-curAtom.x, samplingPoint[1]-curAtom.y, samplingPoint[2]-curAtom.z);
      
      // Scan the nodes in the Voronoi cell to find if line can be drawn from the node to the sampling point
      bool foundNode = false;
      if(vcell.getNumNodes() == 0){
	      cerr << "Error: Voronoi cell of sampled point does not have any nodes" << "\n"
	      << "Point: " << samplingPoint[0] << " " << samplingPoint[1] << " " << samplingPoint[2] << "\n"
	      << "Voronoi cell is #" << minAtomID << " in structure " << newAtomNet.name << "\n"
	      << "Please contact the source code provider." << "\n"
	      << "Exiting..." << "\n";
	      exit(1);
      }
      for(int k = 0; k < vcell.getNumNodes(); k++){
	      Point nodePoint = vcell.getNodeCoord(k);  
	      bool nodeInsideSphere = (calcEuclideanDistance(nodePoint[0], nodePoint[1], nodePoint[2], circCenter[0], circCenter[1], circCenter[2]) < samplingRadius);
	      if(!nodeInsideSphere){
	        Point otherRay = samplingPoint.subtract(nodePoint);
	        double dotProduct = sampleRay.dot_product(otherRay);
          double dotProductMax = 1e-5;
	        if(dotProduct > dotProductMax) {
	          // Angle is less than 90 degrees and so the line segment intersects twice,
      	    // making the path not viable
	        }
	        else {
	          // Angle is at least 90 degrees and so the line segment interesects only once, 
	          // thereby representing a viable path
	          foundNode = true;
	          overlaps = !accessInfo.at(vcell.getNodeID(k));
	          break;
	        }
	      }
      }

      // Sampling failed due to lying on Voronoi cell face and numerical inaccurarcy. 
      // Record failure, resample and notify user later
      if(!foundNode){
	      resampleCount++;
	      resampledInfo.push_back(pair<int, Point> (minAtomID, samplingPoint));
	      i--;
      } else resampleCount = 0;
    }

    if(resampleCount==0) {
      if(!overlaps) num_accessible++;
      if(!overlaps) isAccessible->push_back(true); else isAccessible->push_back(false);
    }
  }

  // Warn user if points were resampled
  if(resampleCount != 0){
    cerr << "\n" << "\n"
    << "Warning: Resampled " << resampleCount << " points (preset coords, not random samples) out of " << pointSet->nodes.size()  
    << " when analyzing " << atmnet->name << "\n"
    << "\n" << "\n"; 
  }

  //FREE MEMORY
  delete new_rad_con;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xba0, %rsp            # imm = 0xBA0
movb %sil, %al
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
leaq -0x490(%rbp), %rdi
movq %rdi, -0x8a0(%rbp)
callq 0x95350
movq -0x8a0(%rbp), %rsi
movq -0x8(%rbp), %rdi
callq 0x96980
jmp 0x7b0fe
movl $0x0, -0x4a0(%rbp)
movl -0x4a0(%rbp), %eax
cmpl -0x380(%rbp), %eax
jge 0x7b177
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x8a8(%rbp)
leaq -0x490(%rbp), %rdi
addq $0x2f0, %rdi            # imm = 0x2F0
movslq -0x4a0(%rbp), %rsi
callq 0xfcc0
movsd -0x8a8(%rbp), %xmm0
addsd 0x30(%rax), %xmm0
movsd %xmm0, 0x30(%rax)
movl -0x4a0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4a0(%rbp)
jmp 0x7b108
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x498(%rbp)
movl %eax, -0x49c(%rbp)
jmp 0x7c366
leaq -0x518(%rbp), %rdi
callq 0x99ba0
jmp 0x7b185
leaq -0x530(%rbp), %rdi
movq %rdi, -0x8b8(%rbp)
callq 0xfce0
leaq -0x548(%rbp), %rdi
movq %rdi, -0x8c0(%rbp)
callq 0xfd00
movq -0x8c0(%rbp), %rcx
movq -0x8b8(%rbp), %r9
movl $0x1, %edi
leaq -0x490(%rbp), %rsi
leaq -0x518(%rbp), %rdx
xorl %r8d, %r8d
callq 0x6950
movq %rax, -0x8b0(%rbp)
jmp 0x7b1dd
movq -0x8b0(%rbp), %rax
movq %rax, -0x550(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8e0(%rbp)
movaps %xmm0, -0x570(%rbp)
movq $0x0, -0x560(%rbp)
leaq -0x570(%rbp), %rdi
callq 0x84dd0
movaps -0x8e0(%rbp), %xmm0
movaps %xmm0, -0x590(%rbp)
movaps %xmm0, -0x5a0(%rbp)
movq $0x0, -0x580(%rbp)
leaq -0x5a0(%rbp), %rdi
callq 0xf670
movq $0x0, -0x5a8(%rbp)
movsd -0x10(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x5b0(%rbp)
leaq -0x5a8(%rbp), %rdi
leaq -0x5b0(%rbp), %rsi
callq 0x64c70
movq %rax, -0x8c8(%rbp)
jmp 0x7b27c
movq -0x8c8(%rbp), %rax
movsd (%rax), %xmm0
leaq -0x518(%rbp), %rdi
leaq -0x5a0(%rbp), %rsi
leaq -0x570(%rbp), %rdx
callq 0xc9cc0
jmp 0x7b2a3
movl $0x3b4ca6f5, %edi       # imm = 0x3B4CA6F5
callq 0x5510
leaq -0x5c8(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x52a0
leaq -0x5c8(%rbp), %rdi
callq 0xed40
leaq -0x5e0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x52a0
leaq -0x5e0(%rbp), %rdi
callq 0xed40
leaq -0x5f8(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x52a0
leaq -0x5f8(%rbp), %rdi
callq 0x84df0
movl $0x0, -0x5fc(%rbp)
movl $0x0, -0x600(%rbp)
movl $0x0, -0x604(%rbp)
movl -0x604(%rbp), %eax
movq %rax, -0x8e8(%rbp)
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
callq 0xf270
movq %rax, %rcx
movq -0x8e8(%rbp), %rax
cmpq %rcx, %rax
jae 0x7c118
movb $0x0, -0x605(%rbp)
leaq -0x620(%rbp), %rdi
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0xe9c70
jmp 0x7b373
cmpl $0x0, -0x5fc(%rbp)
jle 0x7b4d4
movabsq $0x3eb0c6f7a0b5ed8d, %rax # imm = 0x3EB0C6F7A0B5ED8D
movq %rax, -0x628(%rbp)
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
movl -0x604(%rbp), %eax
movl %eax, %esi
callq 0xf390
movq %rax, -0x8f0(%rbp)
jmp 0x7b3af
movq -0x8f0(%rbp), %rax
movsd (%rax), %xmm0
movsd -0x628(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x900(%rbp)
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
movl -0x604(%rbp), %eax
movl %eax, %esi
callq 0xf390
movq %rax, -0x8f8(%rbp)
jmp 0x7b3ec
movq -0x8f8(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd -0x628(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x910(%rbp)
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
movl -0x604(%rbp), %eax
movl %eax, %esi
callq 0xf390
movq %rax, -0x908(%rbp)
jmp 0x7b42a
movsd -0x910(%rbp), %xmm1
movsd -0x900(%rbp), %xmm0
movq -0x908(%rbp), %rax
movsd 0x10(%rax), %xmm2
movsd -0x628(%rbp), %xmm3
addsd %xmm3, %xmm2
leaq -0x640(%rbp), %rdi
callq 0xe9c70
jmp 0x7b460
movq -0x640(%rbp), %rax
movq %rax, -0x620(%rbp)
movq -0x638(%rbp), %rax
movq %rax, -0x618(%rbp)
movq -0x630(%rbp), %rax
movq %rax, -0x610(%rbp)
jmp 0x7b5a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x498(%rbp)
movl %eax, -0x49c(%rbp)
jmp 0x7c342
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x498(%rbp)
movl %eax, -0x49c(%rbp)
jmp 0x7c32a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x498(%rbp)
movl %eax, -0x49c(%rbp)
jmp 0x7c306
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
movl -0x604(%rbp), %eax
movl %eax, %esi
callq 0xf390
movq %rax, -0x918(%rbp)
jmp 0x7b4f2
movq -0x918(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x928(%rbp)
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
movl -0x604(%rbp), %eax
movl %eax, %esi
callq 0xf390
movq %rax, -0x920(%rbp)
jmp 0x7b523
movq -0x920(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x938(%rbp)
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
movl -0x604(%rbp), %eax
movl %eax, %esi
callq 0xf390
movq %rax, -0x930(%rbp)
jmp 0x7b555
movsd -0x938(%rbp), %xmm1
movsd -0x928(%rbp), %xmm0
movq -0x930(%rbp), %rax
movsd 0x10(%rax), %xmm2
leaq -0x658(%rbp), %rdi
callq 0xe9c70
jmp 0x7b57f
movq -0x658(%rbp), %rax
movq %rax, -0x620(%rbp)
movq -0x650(%rbp), %rax
movq %rax, -0x618(%rbp)
movq -0x648(%rbp), %rax
movq %rax, -0x610(%rbp)
movq -0x550(%rbp), %rax
movq %rax, -0x948(%rbp)
leaq -0x620(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0x940(%rbp)
jmp 0x7b5ce
movq -0x940(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x958(%rbp)
leaq -0x620(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0x950(%rbp)
jmp 0x7b5fb
movq -0x950(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x968(%rbp)
leaq -0x620(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0x960(%rbp)
jmp 0x7b628
movsd -0x968(%rbp), %xmm1
movsd -0x958(%rbp), %xmm0
movq -0x948(%rbp), %rdi
movq -0x960(%rbp), %rax
movsd (%rax), %xmm2
leaq -0x660(%rbp), %rsi
leaq -0x668(%rbp), %rdx
leaq -0x670(%rbp), %rcx
leaq -0x674(%rbp), %r8
callq 0x1ed560
movb %al, -0x969(%rbp)
jmp 0x7b673
movb -0x969(%rbp), %al
andb $0x1, %al
movb %al, -0x675(%rbp)
testb $0x1, -0x675(%rbp)
jne 0x7b755
movq 0x1f795b(%rip), %rdi    # 0x272ff0
leaq 0x17b41e(%rip), %rsi    # 0x1f6aba
callq 0x5540
movq %rax, -0x978(%rbp)
jmp 0x7b6aa
movq -0x978(%rbp), %rdi
leaq 0x17df6d(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0x980(%rbp)
jmp 0x7b6c6
movq -0x980(%rbp), %rdi
leaq 0x17b42e(%rip), %rsi    # 0x1f6b02
callq 0x5540
movq %rax, -0x988(%rbp)
jmp 0x7b6e2
movq -0x988(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x5480
movq %rax, -0x990(%rbp)
jmp 0x7b6fe
movq -0x990(%rbp), %rdi
leaq 0x17df19(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0x998(%rbp)
jmp 0x7b71a
movq -0x998(%rbp), %rdi
leaq 0x17fbf2(%rip), %rsi    # 0x1fb31a
callq 0x5540
movq %rax, -0x9a0(%rbp)
jmp 0x7b736
movq -0x9a0(%rbp), %rdi
leaq 0x17dee1(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0x7b74b
movl $0x1, %edi
callq 0x67c0
movq -0x8(%rbp), %rdi
addq $0x2f0, %rdi            # imm = 0x2F0
movslq -0x674(%rbp), %rsi
callq 0xfcc0
movq %rax, %rsi
leaq -0x710(%rbp), %rdi
callq 0xf0d0
jmp 0x7b77d
movsd -0x710(%rbp), %xmm0
movsd -0x708(%rbp), %xmm1
movsd -0x700(%rbp), %xmm2
leaq -0x758(%rbp), %rdi
callq 0xe9c70
jmp 0x7b7a3
movsd -0x660(%rbp), %xmm0
movsd -0x668(%rbp), %xmm1
movsd -0x670(%rbp), %xmm2
leaq -0x770(%rbp), %rdi
callq 0xe9c70
jmp 0x7b7c9
movq -0x760(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movups -0x770(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x740(%rbp), %rdi
leaq -0x758(%rbp), %rsi
callq 0xe9ef0
jmp 0x7b7f6
movq -0x730(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movups -0x740(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x728(%rbp), %rdi
leaq -0x620(%rbp), %rsi
callq 0xe9cb0
jmp 0x7b823
movq -0x718(%rbp), %rax
movq %rax, -0x610(%rbp)
movups -0x728(%rbp), %xmm0
movaps %xmm0, -0x620(%rbp)
leaq -0x620(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0x9a8(%rbp)
jmp 0x7b856
movq -0x9a8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x9b8(%rbp)
leaq -0x620(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0x9b0(%rbp)
jmp 0x7b883
movq -0x9b0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x9c8(%rbp)
leaq -0x620(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0x9c0(%rbp)
jmp 0x7b8b0
movsd -0x9c8(%rbp), %xmm1
movsd -0x9b8(%rbp), %xmm0
movq -0x9c0(%rbp), %rax
movsd (%rax), %xmm2
movsd -0x710(%rbp), %xmm3
movsd -0x708(%rbp), %xmm4
movsd -0x700(%rbp), %xmm5
callq 0xebaf0
movsd %xmm0, -0x9d0(%rbp)
jmp 0x7b8f2
movsd -0x9d0(%rbp), %xmm0
movsd %xmm0, -0x778(%rbp)
movsd -0x778(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
addsd -0x6e0(%rbp), %xmm0
movsd 0x17acf1(%rip), %xmm2   # 0x1f6610
subsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7b949
movb $0x1, -0x605(%rbp)
jmp 0x7b949
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x498(%rbp)
movl %eax, -0x49c(%rbp)
jmp 0x7c107
testb $0x1, -0x605(%rbp)
jne 0x7c09a
testb $0x1, -0x19(%rbp)
je 0x7c09a
movslq -0x674(%rbp), %rsi
leaq -0x530(%rbp), %rdi
callq 0x162f0
movq %rax, %rsi
leaq -0x7a8(%rbp), %rdi
callq 0x17040
jmp 0x7b984
movsd -0x710(%rbp), %xmm0
movsd -0x708(%rbp), %xmm1
movsd -0x700(%rbp), %xmm2
leaq -0x7c0(%rbp), %rdi
callq 0xe9c70
jmp 0x7b9aa
movsd -0x778(%rbp), %xmm0
movsd %xmm0, -0x7c8(%rbp)
leaq -0x620(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0x9d8(%rbp)
jmp 0x7b9d1
movq -0x9d8(%rbp), %rax
movsd (%rax), %xmm0
movsd -0x710(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x9e8(%rbp)
leaq -0x620(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0x9e0(%rbp)
jmp 0x7ba0a
movq -0x9e0(%rbp), %rax
movsd (%rax), %xmm0
movsd -0x708(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x9f8(%rbp)
leaq -0x620(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0x9f0(%rbp)
jmp 0x7ba43
movsd -0x9f8(%rbp), %xmm1
movsd -0x9e8(%rbp), %xmm0
movq -0x9f0(%rbp), %rax
movsd (%rax), %xmm2
movsd -0x700(%rbp), %xmm3
subsd %xmm3, %xmm2
leaq -0x7e0(%rbp), %rdi
callq 0xe9c70
jmp 0x7ba78
movb $0x0, -0x7e1(%rbp)
leaq -0x7a8(%rbp), %rdi
callq 0xbd460
movl %eax, -0x9fc(%rbp)
jmp 0x7ba93
movl -0x9fc(%rbp), %eax
cmpl $0x0, %eax
jne 0x7bd16
movq 0x1f7547(%rip), %rdi    # 0x272ff0
leaq 0x17b06a(%rip), %rsi    # 0x1f6b1a
callq 0x5540
movq %rax, -0xa08(%rbp)
jmp 0x7babe
movq -0xa08(%rbp), %rdi
leaq 0x17db59(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0xa10(%rbp)
jmp 0x7bada
movq -0xa10(%rbp), %rdi
leaq 0x17b06f(%rip), %rsi    # 0x1f6b57
callq 0x5540
movq %rax, -0xa18(%rbp)
jmp 0x7baf6
leaq -0x620(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0xa20(%rbp)
jmp 0x7bb0d
movq -0xa18(%rbp), %rdi
movq -0xa20(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0xa28(%rbp)
jmp 0x7bb2d
movq -0xa28(%rbp), %rdi
leaq 0x180773(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0xa30(%rbp)
jmp 0x7bb49
leaq -0x620(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0xa38(%rbp)
jmp 0x7bb63
movq -0xa30(%rbp), %rdi
movq -0xa38(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0xa40(%rbp)
jmp 0x7bb83
movq -0xa40(%rbp), %rdi
leaq 0x18071d(%rip), %rsi    # 0x1fc2ae
callq 0x5540
movq %rax, -0xa48(%rbp)
jmp 0x7bb9f
leaq -0x620(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0xa50(%rbp)
jmp 0x7bbb9
movq -0xa48(%rbp), %rdi
movq -0xa50(%rbp), %rax
movsd (%rax), %xmm0
callq 0x5980
movq %rax, -0xa58(%rbp)
jmp 0x7bbd9
movq -0xa58(%rbp), %rdi
leaq 0x17da3e(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0xa60(%rbp)
jmp 0x7bbf5
movq -0xa60(%rbp), %rdi
leaq 0x17af5c(%rip), %rsi    # 0x1f6b5f
callq 0x5540
movq %rax, -0xa68(%rbp)
jmp 0x7bc11
movq -0xa68(%rbp), %rdi
movl -0x674(%rbp), %esi
callq 0x58d0
movq %rax, -0xa70(%rbp)
jmp 0x7bc2c
movq -0xa70(%rbp), %rdi
leaq 0x17af37(%rip), %rsi    # 0x1f6b71
callq 0x5540
movq %rax, -0xa78(%rbp)
jmp 0x7bc48
movq -0xa78(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x5480
movq %rax, -0xa80(%rbp)
jmp 0x7bc64
movq -0xa80(%rbp), %rdi
leaq 0x17d9b3(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0xa88(%rbp)
jmp 0x7bc80
movq -0xa88(%rbp), %rdi
leaq 0x17aef2(%rip), %rsi    # 0x1f6b80
callq 0x5540
movq %rax, -0xa90(%rbp)
jmp 0x7bc9c
movq -0xa90(%rbp), %rdi
leaq 0x17d97b(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0xa98(%rbp)
jmp 0x7bcb8
movq -0xa98(%rbp), %rdi
leaq 0x17f654(%rip), %rsi    # 0x1fb31a
callq 0x5540
movq %rax, -0xaa0(%rbp)
jmp 0x7bcd4
movq -0xaa0(%rbp), %rdi
leaq 0x17d943(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0x7bce9
movl $0x1, %edi
callq 0x67c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x498(%rbp)
movl %eax, -0x49c(%rbp)
leaq -0x7a8(%rbp), %rdi
callq 0x138c0
jmp 0x7c107
movl $0x0, -0x7e8(%rbp)
movl -0x7e8(%rbp), %eax
movl %eax, -0xaa8(%rbp)
leaq -0x7a8(%rbp), %rdi
callq 0xbd460
movl %eax, -0xaa4(%rbp)
jmp 0x7bd40
movl -0xaa8(%rbp), %eax
movl -0xaa4(%rbp), %ecx
cmpl %ecx, %eax
jge 0x7c02b
movl -0x7e8(%rbp), %edx
leaq -0x800(%rbp), %rdi
leaq -0x7a8(%rbp), %rsi
callq 0xbd480
jmp 0x7bd6f
leaq -0x800(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0xab0(%rbp)
jmp 0x7bd86
movq -0xab0(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xac0(%rbp)
leaq -0x800(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0xab8(%rbp)
jmp 0x7bdb3
movq -0xab8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xad0(%rbp)
leaq -0x800(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0xac8(%rbp)
jmp 0x7bde0
movq -0xac8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xae0(%rbp)
leaq -0x7c0(%rbp), %rdi
xorl %esi, %esi
callq 0xe9d70
movq %rax, -0xad8(%rbp)
jmp 0x7be0a
movq -0xad8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xaf0(%rbp)
leaq -0x7c0(%rbp), %rdi
movl $0x1, %esi
callq 0xe9d70
movq %rax, -0xae8(%rbp)
jmp 0x7be37
movq -0xae8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xb00(%rbp)
leaq -0x7c0(%rbp), %rdi
movl $0x2, %esi
callq 0xe9d70
movq %rax, -0xaf8(%rbp)
jmp 0x7be64
movsd -0xb00(%rbp), %xmm4
movsd -0xaf0(%rbp), %xmm3
movsd -0xae0(%rbp), %xmm2
movsd -0xad0(%rbp), %xmm1
movsd -0xac0(%rbp), %xmm0
movq -0xaf8(%rbp), %rax
movsd (%rax), %xmm5
callq 0xebaf0
movsd %xmm0, -0xb08(%rbp)
jmp 0x7bea6
movsd -0xb08(%rbp), %xmm1
movsd -0x7c8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
seta %al
andb $0x1, %al
movb %al, -0x801(%rbp)
testb $0x1, -0x801(%rbp)
jne 0x7c015
movq -0x7f0(%rbp), %rax
movq %rax, -0x830(%rbp)
movups -0x800(%rbp), %xmm0
movaps %xmm0, -0x840(%rbp)
movq -0x830(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x840(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x820(%rbp), %rdi
leaq -0x620(%rbp), %rsi
callq 0xe9ef0
jmp 0x7bf1b
movq -0x810(%rbp), %rax
movq %rax, -0x850(%rbp)
movups -0x820(%rbp), %xmm0
movaps %xmm0, -0x860(%rbp)
movq -0x850(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x860(%rbp), %xmm0
movups %xmm0, (%rax)
leaq -0x7e0(%rbp), %rdi
callq 0xea050
movsd %xmm0, -0xb10(%rbp)
jmp 0x7bf65
movsd -0xb10(%rbp), %xmm0
movsd %xmm0, -0x848(%rbp)
movsd 0x17a69b(%rip), %xmm0   # 0x1f6618
movsd %xmm0, -0x868(%rbp)
movsd -0x848(%rbp), %xmm0
ucomisd -0x868(%rbp), %xmm0
jbe 0x7bf99
jmp 0x7c013
movb $0x1, -0x7e1(%rbp)
movl -0x7e8(%rbp), %esi
leaq -0x7a8(%rbp), %rdi
callq 0xbd4d0
movl %eax, -0xb14(%rbp)
jmp 0x7bfba
movl -0xb14(%rbp), %eax
movslq %eax, %rsi
leaq -0x5a0(%rbp), %rdi
callq 0xfff0
movq %rdx, -0xb28(%rbp)
movq %rax, -0xb20(%rbp)
jmp 0x7bfdf
movq -0xb28(%rbp), %rax
movq -0xb20(%rbp), %rcx
movq %rcx, -0x878(%rbp)
movq %rax, -0x870(%rbp)
leaq -0x878(%rbp), %rdi
callq 0x101a0
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x605(%rbp)
jmp 0x7c02b
jmp 0x7c015
jmp 0x7c017
movl -0x7e8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7e8(%rbp)
jmp 0x7bd20
testb $0x1, -0x7e1(%rbp)
jne 0x7c084
movl -0x5fc(%rbp), %eax
incl %eax
movl %eax, -0x5fc(%rbp)
leaq -0x898(%rbp), %rdi
leaq -0x674(%rbp), %rsi
leaq -0x620(%rbp), %rdx
callq 0x84e40
jmp 0x7c05e
leaq -0x5f8(%rbp), %rdi
leaq -0x898(%rbp), %rsi
callq 0x84e10
jmp 0x7c073
movl -0x604(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x604(%rbp)
jmp 0x7c08e
movl $0x0, -0x5fc(%rbp)
leaq -0x7a8(%rbp), %rdi
callq 0x138c0
cmpl $0x0, -0x5fc(%rbp)
jne 0x7c0e7
testb $0x1, -0x605(%rbp)
jne 0x7c0bb
movl -0x600(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x600(%rbp)
testb $0x1, -0x605(%rbp)
jne 0x7c0d6
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0xf700
jmp 0x7c0d4
jmp 0x7c0e5
movq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0xf700
jmp 0x7c0e3
jmp 0x7c0e5
jmp 0x7c0e7
leaq -0x710(%rbp), %rdi
callq 0xf200
movl -0x604(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x604(%rbp)
jmp 0x7b328
leaq -0x710(%rbp), %rdi
callq 0xf200
jmp 0x7c306
cmpl $0x0, -0x5fc(%rbp)
je 0x7c260
movq 0x1f6ec4(%rip), %rdi    # 0x272ff0
leaq 0x17d4f2(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0xb30(%rbp)
jmp 0x7c141
movq -0xb30(%rbp), %rdi
leaq 0x17d4d6(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0xb38(%rbp)
jmp 0x7c15d
movq -0xb38(%rbp), %rdi
leaq 0x17a633(%rip), %rsi    # 0x1f679e
callq 0x5540
movq %rax, -0xb40(%rbp)
jmp 0x7c179
movq -0xb40(%rbp), %rdi
movl -0x5fc(%rbp), %esi
callq 0x58d0
movq %rax, -0xb48(%rbp)
jmp 0x7c194
movq -0xb48(%rbp), %rdi
leaq 0x17aa07(%rip), %rsi    # 0x1f6ba9
callq 0x5540
movq %rax, -0xb50(%rbp)
jmp 0x7c1b0
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
callq 0xf270
movq -0xb50(%rbp), %rdi
movq %rax, %rsi
callq 0x5160
movq %rax, -0xb58(%rbp)
jmp 0x7c1d5
movq -0xb58(%rbp), %rdi
leaq 0x18d592(%rip), %rsi    # 0x209775
callq 0x5540
movq %rax, -0xb60(%rbp)
jmp 0x7c1f1
movq -0xb60(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x320, %rsi            # imm = 0x320
callq 0x5480
movq %rax, -0xb68(%rbp)
jmp 0x7c211
movq -0xb68(%rbp), %rdi
leaq 0x17d406(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0xb70(%rbp)
jmp 0x7c22d
movq -0xb70(%rbp), %rdi
leaq 0x17d3ea(%rip), %rsi    # 0x1f9625
callq 0x5540
movq %rax, -0xb78(%rbp)
jmp 0x7c249
movq -0xb78(%rbp), %rdi
leaq 0x17d3ce(%rip), %rsi    # 0x1f9625
callq 0x5540
jmp 0x7c25e
jmp 0x7c260
movq -0x550(%rbp), %rax
movq %rax, -0xb80(%rbp)
cmpq $0x0, %rax
je 0x7c291
movq -0xb80(%rbp), %rdi
callq 0xece0
movq -0xb80(%rbp), %rdi
movl $0x298, %esi            # imm = 0x298
callq 0x5570
leaq -0x5f8(%rbp), %rdi
callq 0x84e80
leaq -0x5e0(%rbp), %rdi
callq 0xefe0
leaq -0x5c8(%rbp), %rdi
callq 0xefe0
leaq -0x5a0(%rbp), %rdi
callq 0xf9b0
leaq -0x570(%rbp), %rdi
callq 0x84ee0
leaq -0x548(%rbp), %rdi
callq 0xfd20
leaq -0x530(%rbp), %rdi
callq 0xfd80
leaq -0x518(%rbp), %rdi
callq 0xf8a0
leaq -0x490(%rbp), %rdi
callq 0xfde0
addq $0xba0, %rsp            # imm = 0xBA0
popq %rbp
retq
leaq -0x5f8(%rbp), %rdi
callq 0x84e80
leaq -0x5e0(%rbp), %rdi
callq 0xefe0
leaq -0x5c8(%rbp), %rdi
callq 0xefe0
leaq -0x5a0(%rbp), %rdi
callq 0xf9b0
leaq -0x570(%rbp), %rdi
callq 0x84ee0
leaq -0x548(%rbp), %rdi
callq 0xfd20
leaq -0x530(%rbp), %rdi
callq 0xfd80
leaq -0x518(%rbp), %rdi
callq 0xf8a0
leaq -0x490(%rbp), %rdi
callq 0xfde0
movq -0x498(%rbp), %rdi
callq 0x58f0
nop