// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/area_and_volume.cc
// Function: NEWcalcASA(MATERIAL*, double, int)
double NEWcalcASA(MATERIAL *Mat, double r_probe, int sampleDensity){
//numSamplesiATOM_NETWORK *hiaccatmnet, ATOM_NETWORK *orgatmnet, bool highAccuracy, double r_probe_chan, double r_probe, double rho_crystal, int numSamples, bool excludePockets, ostream &output, char *filename, bool visualize, bool VisITflag, bool LiverpoolFlag, bool ExtendedOutputFlag){


  // Inital checks
  if(!(Mat->accessAnalysis.alreadySegmentedFlag))
      {
      cerr << "Cannot run calcAV without prior accessibility analysis.\nExiting with return 0\n";
      return 0;
      }

  // Setting parameters
  Mat->ASAprobeRadius = r_probe;

  // Setting pointer to the original atom network (not one modified by -ha)
  ATOM_NETWORK *atmnet; // pointed to the analyzed (original atomsnet)
  atmnet = Mat->accessAnalysis.orgAtomNet;


  // commenting out removeOverlappedNodes() but not really sure it affects results. This function 
  // modifies the voronoi network so, if executed, may have effect on other functions, e.g. ones
  // triggered by -vol
  // accessAnalysis.removeOverlappedNodes();

  srand(randSeed);

  bool excludePockets = true; // this is default (in old version, without voro-stuff it was used)

  int numSamples; // number of samples per atom


  // inits of ASA data structures in MATERIALS class
  Mat->ASAaxsPoints.clear(); // List of accessible points to be visualized in ZeoVis/VISIT
  Mat->ASAaxsPointsChannelIDs.clear();  // corresponding channel IDs
  Mat->ASAinaxsPoints.clear(); // List of inaccessible points to be visualized in ZeoVis/VISIT
  Mat->ASAinaxsPointsPocketIDs.clear(); // corresponding pocket IDs
  Mat->ASAtotal = 0;
  Mat->ASAtotal_inaxs = 0;
  Mat->ASAnumSamples = 0;

  Mat->ASA_inChannel.clear(); Mat->ASA_inChannel.resize(Mat->accessAnalysis.n_channels,0);
  Mat->ASA_inPocket.clear(); Mat->ASA_inPocket.resize(Mat->accessAnalysis.n_pockets,0);

  //vectors that store SA contributions per atom (a pair of accessible and inaccessible)
  Mat->ASAhistogramSAperAtom.clear();


  // Sample around each of the network's atoms
  for(int i = 0; i < atmnet->numAtoms; i++){
    int count = 0;
    int count_inaxs = 0;
    // MC statistics can be collected w.r.t to identified channels and inaccessible pockets
    vector<int> count_inChannel(Mat->accessAnalysis.n_channels,0);
    vector<int> count_inPocket(Mat->accessAnalysis.n_pockets,0);

    // calculate number of samples per atom (from sample density)
    numSamples = (int)((4.0 * PI * pow((atmnet->atoms.at(i).radius + r_probe),2)) * sampleDensity);
    Mat->ASAnumSamples +=numSamples;

    for(int j = 0; j < numSamples; j++){
      bool overlaps = false;
      bool inside = false;

      // Randomly sample point on a sphere of radius 1
      double theta = (rand()*1.0/RAND_MAX)*2*PI;
      double cosphi = 1.0 - (rand()*1.0/RAND_MAX)*2.0;
      double phi = acos(cosphi);

      // Convert spherical coordinates to xyz coordinates
      double xpoint = sin(phi)*cos(theta); //Don't need abs(sin(phi)) becase phi is from 0 to PI
      double ypoint = sin(phi)*sin(theta);
      double zpoint = cosphi;	
      
      // Scale the point to lie on a radius of r_probe + r_atom#i
      xpoint *= (atmnet->atoms[i].radius + r_probe);
      ypoint *= (atmnet->atoms[i].radius + r_probe);
      zpoint *= (atmnet->atoms[i].radius + r_probe);

      // Convert (x,y,z) coordinates to ones relative to the unit cell vectors
      Point abc_coords = atmnet->xyz_to_abc(xpoint, ypoint, zpoint);

      // Transform coords relative to the atom center into ones relative to the unit cell vectors
      double newAPoint = abc_coords[0] + atmnet->atoms[i].a_coord;
      double newBPoint = abc_coords[1] + atmnet->atoms[i].b_coord;
      double newCPoint = abc_coords[2] + atmnet->atoms[i].c_coord;

      Point samplingPoint = atmnet->abc_to_xyz(newAPoint, newBPoint, newCPoint);


      // Calling accessibility object to determine accessibility of the point (this replaced a big chunk of code by Thomas)
      pair<bool,bool> answer = (Mat->accessAnalysis.isSPointInsideAtomAndNotAccessible(samplingPoint, i));
      inside = answer.first; overlaps = answer.second;
      if(Mat->accessAnalysis.needToResample() == true) j--; // the sampled point could not be analyzed in isSPointInsideAtomAndNotAccessible() 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 within atom for later visualization
      if(Mat->accessAnalysis.needToResample() == false && !inside) {
	Point abcCoords = Point(newAPoint, newBPoint, newCPoint);
//	Point coords = atmnet->abc_to_xyz(atmnet->shiftABCInUC(abcCoords)); // to be removed, new function stores fractional coordinates
        Point coords = atmnet->shiftABCInUC(abcCoords);
	if(overlaps)
          {
          count_inaxs++;
	  Mat->ASAinaxsPoints.push_back(coords);
          pair <int,int> CoP = Mat->accessAnalysis.lastChannelOrPocket();
          if(CoP.first!=-1)
            {
            cout << "Error: CoP.first!=-1 in pocket, consult source code provider\n";
            } else {
            count_inPocket[CoP.second]++;
            };
          Mat->ASAinaxsPointsPocketIDs.push_back(CoP.second);
          }
	else
          {
	  Mat->ASAaxsPoints.push_back(coords);
          count++;
          pair <int,int> CoP = Mat->accessAnalysis.lastChannelOrPocket();
          if(CoP.second!=-1)
            {
            cout << "Error: CoP.second!=-1 in channel, consult source code provider\n";
            } else {
            count_inChannel[CoP.first]++;
            };
          Mat->ASAaxsPointsChannelIDs.push_back(CoP.first);
          };
      }

//      if(accessAnalysis.needToResample() == false && !overlaps)
//        count++;
    }
   
    // SA per atom (in accessible space and in inaccessible pockets)
    double SAperAtom = (1.0*count)/numSamples * 4.0 * PI * pow((atmnet->atoms.at(i).radius + r_probe),2);
    double SAperAtom_inaxs = (1.0*count_inaxs)/numSamples * 4.0 * PI * pow((atmnet->atoms.at(i).radius + r_probe),2);

    //Increment total surface area by fraction of atom that is accessible
    Mat->ASAtotal += SAperAtom;
    //and inaccessible
    Mat->ASAtotal_inaxs += SAperAtom_inaxs;

    // SA per channel and pocket
    for(unsigned int m = 0; m < Mat->ASA_inChannel.size(); m++)
      {
      Mat->ASA_inChannel[m] += (1.0*count_inChannel[m])/numSamples * 4.0 * PI * pow((atmnet->atoms.at(i).radius + r_probe),2);
      };
    for(unsigned int m = 0; m < Mat->ASA_inPocket.size(); m++)
      {
      Mat->ASA_inPocket[m] += (1.0*count_inPocket[m])/numSamples * 4.0 * PI * pow((atmnet->atoms.at(i).radius + r_probe),2);
      };

    Mat->ASAhistogramSAperAtom.push_back(pair <double,double> (SAperAtom,SAperAtom_inaxs));

  } // ends the main ASA sampling loop (over atoms)

  // Write the necessary commands to the output stream
  // necessary to visualize the sampling

  /* Now moved to a different function */
  /*
  if(visualize){
    if(VisITflag == false)
      {
      reportPoints(output, axsPoints, inaxsPoints);
      }
    else{
      if(LiverpoolFlag == false)
        {
        //report points in std. VisIt format
        reportPointsVisIT(output, axsPoints, inaxsPoints);
        }
      else{
      //report points in Liverpool format
      vector<Point> LiverpoolAxsPoints = vector<Point> ();
      vector<Point> LiverpoolInaxsPoints = vector<Point> ();
      for(unsigned i = 0; i < axsPoints.size(); i++)
         {
         LiverpoolAxsPoints.push_back(atmnet->xyz_to_abc(axsPoints[i]));
         };
      for(unsigned j = 0; j < inaxsPoints.size(); j++)
         {
         LiverpoolInaxsPoints.push_back(atmnet->xyz_to_abc(inaxsPoints[j]));
         };
//      reportPointsVisIT(output, LiverpoolAxsPoints, LiverpoolInaxsPoints);
      reportPointsVisIT(output, LiverpoolAxsPoints, axsPointsChannelIDs, LiverpoolInaxsPoints, inaxsPointsPocketIDs);
      };
      };
    //reportResampledPoints(output, resampledInfo);
  }

  */ // ends writing vis files

  cout << "Total number of ASA MC samples = " << Mat->ASAnumSamples << "\n";
    
    // Warn user if points were resampled
  int resampleCount =  Mat->accessAnalysis.getResampleCount();
  if(resampleCount != 0){
    cerr << "\n" << "\n"
  	 << "Warning: Resampled " << resampleCount << " points out of " << Mat->ASAnumSamples
	 << "\n" << "\n"; 
  }
  return Mat->ASAtotal;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
cmpb $0x0, 0xb1d(%rdi)
je 0x36133
movl %esi, %ebx
movq %rdi, %r12
movsd %xmm0, 0x28(%rsp)
movsd %xmm0, 0xd40(%rdi)
movq 0x990(%rdi), %rax
movq %rax, 0x30(%rsp)
movl $0x3b4ca6f5, %edi       # imm = 0x3B4CA6F5
callq 0x4460
movq 0xd60(%r12), %rax
cmpq %rax, 0xd68(%r12)
je 0x35998
movq %rax, 0xd68(%r12)
movq 0xd78(%r12), %rax
cmpq %rax, 0xd80(%r12)
je 0x359b2
movq %rax, 0xd80(%r12)
movq 0xd90(%r12), %rax
cmpq %rax, 0xd98(%r12)
je 0x359cc
movq %rax, 0xd98(%r12)
movq 0xda8(%r12), %rax
cmpq %rax, 0xdb0(%r12)
je 0x359e6
movq %rax, 0xdb0(%r12)
andl $0x0, 0xd48(%r12)
leaq 0xdc0(%r12), %r13
xorps %xmm0, %xmm0
movups %xmm0, 0xd50(%r12)
movq 0xdc0(%r12), %rax
cmpq %rax, 0xdc8(%r12)
je 0x35a1d
movq %rax, 0xdc8(%r12)
movslq 0xa68(%r12), %rsi
leaq 0xb0(%rsp), %rdx
andq $0x0, (%rdx)
movq %r13, %rdi
callq 0x3713c
leaq 0xdd8(%r12), %rax
movq %rax, 0x78(%rsp)
movq 0xdd8(%r12), %rax
cmpq %rax, 0xde0(%r12)
je 0x35a60
movq %rax, 0xde0(%r12)
movslq 0xa6c(%r12), %rsi
leaq 0xb0(%rsp), %rdx
andq $0x0, (%rdx)
movq 0x78(%rsp), %rdi
callq 0x3713c
movq 0xdf0(%r12), %rax
cmpq %rax, 0xdf8(%r12)
je 0x35a98
movq %rax, 0xdf8(%r12)
leaq 0x990(%r12), %rax
movq %rax, 0x70(%rsp)
leaq 0xd60(%r12), %rax
movq %rax, 0x100(%rsp)
leaq 0xd78(%r12), %rax
movq %rax, 0xf0(%rsp)
leaq 0xd90(%r12), %rax
movq %rax, 0xf8(%rsp)
leaq 0xda8(%r12), %rax
movq %rax, 0xe8(%rsp)
leaq 0xd50(%r12), %rax
movq %rax, 0x90(%rsp)
leaq 0xdf0(%r12), %rax
movq %rax, 0xc8(%rsp)
movq 0x30(%rsp), %rax
leaq 0x2f0(%rax), %rbp
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0xe0(%rsp)
xorl %ebx, %ebx
leaq 0x98(%rsp), %r15
movq %r12, 0xd8(%rsp)
movq %r13, 0xd0(%rsp)
movq 0x30(%rsp), %rax
movslq 0x110(%rax), %rax
cmpq %rax, %rbx
jge 0x3614f
movslq 0xa68(%r12), %rsi
andl $0x0, 0x108(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x108(%rsp), %r14
movq %r14, %rdx
movq %r15, %rcx
callq 0x2a44a
movslq 0xa6c(%r12), %rsi
andl $0x0, 0x98(%rsp)
movq %r14, %rdi
movq %r15, %rdx
leaq 0x120(%rsp), %rcx
callq 0x2a44a
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xa73a
movq %rbx, %rcx
movq 0x70(%rsp), %rbx
movsd 0x30(%rax), %xmm0
addsd 0x28(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd 0xca9fb(%rip), %xmm0    # 0x1005c0
mulsd 0xe0(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x4c(%rsp)
addl %eax, 0xd48(%r12)
xorl %r15d, %r15d
movq %rcx, 0x38(%rsp)
imulq $0x98, %rcx, %r13
movl $0x0, 0x44(%rsp)
movl $0x0, 0x48(%rsp)
cmpl 0x4c(%rsp), %r15d
jge 0x35ef8
callq 0x4170
cvtsi2sd %eax, %xmm0
divsd 0xca967(%rip), %xmm0    # 0x100580
addsd %xmm0, %xmm0
mulsd 0xca98b(%rip), %xmm0    # 0x1005b0
movsd %xmm0, 0x50(%rsp)
callq 0x4170
cvtsi2sd %eax, %xmm0
divsd 0xca97c(%rip), %xmm0    # 0x1005b8
addsd %xmm0, %xmm0
addsd 0xc6410(%rip), %xmm0    # 0xfc058
movsd %xmm0, 0x20(%rsp)
callq 0x4450
movsd %xmm0, 0x80(%rsp)
callq 0x4110
movsd %xmm0, 0x60(%rsp)
movsd 0x50(%rsp), %xmm0
callq 0x47e0
mulsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0x80(%rsp), %xmm0
callq 0x4110
movsd %xmm0, 0x80(%rsp)
movsd 0x50(%rsp), %xmm0
callq 0x4110
movsd 0x80(%rsp), %xmm1
mulsd %xmm0, %xmm1
movq 0x30(%rsp), %rsi
movq 0x2f0(%rsi), %rax
movsd 0x30(%rax,%r13), %xmm2
addsd 0x28(%rsp), %xmm2
movsd 0x60(%rsp), %xmm0
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
mulsd 0x20(%rsp), %xmm2
leaq 0x98(%rsp), %r14
movq %r14, %rdi
callq 0x3f1ce
movq %r14, %rdi
xorl %esi, %esi
callq 0x63c78
movsd (%rax), %xmm0
movq (%rbp), %rax
addsd 0x18(%rax,%r13), %xmm0
movsd %xmm0, 0x50(%rsp)
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0x63c78
movsd (%rax), %xmm0
movq (%rbp), %rax
addsd 0x20(%rax,%r13), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
pushq $0x2
popq %rsi
callq 0x63c78
movsd (%rax), %xmm2
movq 0x30(%rsp), %rsi
movq 0x2f0(%rsi), %rax
addsd 0x28(%rax,%r13), %xmm2
leaq 0x120(%rsp), %rdi
movsd 0x50(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd %xmm2, 0x60(%rsp)
callq 0x3f0e6
movq 0x130(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x120(%rsp), %xmm0
movupd %xmm0, (%rsp)
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq 0x6fea0
movl %eax, %r12d
movq %rbx, %rdi
callq 0x36f4c
movl %eax, %r14d
movq %rbx, %rdi
callq 0x36f4c
orb %r12b, %al
testb $0x1, %al
jne 0x35ee2
leaq 0x150(%rsp), %rdi
movsd 0x50(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd 0x60(%rsp), %xmm2
callq 0x63c46
movq 0x160(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x150(%rsp), %xmm0
movupd %xmm0, (%rsp)
leaq 0x138(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x3f94a
btl $0x8, %r12d
jb 0x35e4b
movq 0x100(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x2468e
movq 0x70(%rsp), %rdi
callq 0x36f90
movq %rax, 0x88(%rsp)
movabsq $-0x100000001, %rcx     # imm = 0xFFFFFFFEFFFFFFFF
cmpq %rcx, %rax
jbe 0x35e88
movq 0xb0(%rsp), %rcx
cltq
incl (%rcx,%rax,4)
jmp 0x35e9b
movq 0xf8(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x2468e
movq 0x70(%rsp), %rdi
callq 0x36f90
movq %rax, 0x88(%rsp)
cmpl $-0x1, %eax
jne 0x35eb6
sarq $0x20, %rax
movq 0x108(%rsp), %rcx
incl (%rcx,%rax,4)
jmp 0x35ec9
movq 0x11a131(%rip), %rdi    # 0x14ffc0
leaq 0xca868(%rip), %rsi     # 0x1006fe
callq 0x4480
movq 0xf0(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x9434
incl 0x48(%rsp)
jmp 0x35ee2
movq 0x11a103(%rip), %rdi    # 0x14ffc0
leaq 0xca7fc(%rip), %rsi     # 0x1006c0
callq 0x4480
movq 0xe8(%rsp), %rdi
leaq 0x8c(%rsp), %rsi
callq 0x9434
incl 0x44(%rsp)
movzbl %r14b, %eax
negl %eax
addl %eax, %r15d
incl %r15d
movq 0x70(%rsp), %rbx
jmp 0x35bfd
movq %rbp, %rdi
movq 0x38(%rsp), %rbx
movq %rbx, %rsi
callq 0xa73a
cvtsi2sdl 0x4c(%rsp), %xmm0
cvtsi2sdl 0x48(%rsp), %xmm1
movsd %xmm0, 0x20(%rsp)
divsd %xmm0, %xmm1
movsd 0xca682(%rip), %xmm0    # 0x1005a8
mulsd %xmm0, %xmm1
movsd 0xca67e(%rip), %xmm0    # 0x1005b0
mulsd %xmm0, %xmm1
movapd %xmm1, 0x50(%rsp)
movsd 0x30(%rax), %xmm0
addsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xa73a
movq 0xd8(%rsp), %r12
movq 0xd0(%rsp), %r13
movsd 0x60(%rsp), %xmm0
mulsd %xmm0, %xmm0
movapd 0x50(%rsp), %xmm3
mulsd %xmm0, %xmm3
cvtsi2sdl 0x44(%rsp), %xmm0
divsd 0x20(%rsp), %xmm0
mulsd 0xca618(%rip), %xmm0    # 0x1005a8
mulsd 0xca618(%rip), %xmm0    # 0x1005b0
movsd 0x30(%rax), %xmm2
addsd 0x28(%rsp), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm0, %xmm2
movq 0x90(%rsp), %rax
movupd (%rax), %xmm0
movapd %xmm3, %xmm1
movapd %xmm2, 0x60(%rsp)
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
addpd %xmm0, %xmm1
movupd %xmm1, (%rax)
movq (%r13), %rax
xorl %ecx, %ecx
movapd %xmm3, %xmm0
movapd %xmm3, 0x50(%rsp)
movl %ecx, %ebx
movq 0xdc8(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x36053
movq 0xb0(%rsp), %rax
movl (%rax,%rbx,4), %r15d
movq %rbp, %rdi
movq 0x38(%rsp), %rsi
callq 0xa73a
cvtsi2sd %r15d, %xmm0
divsd 0x20(%rsp), %xmm0
mulsd 0xca589(%rip), %xmm0    # 0x1005a8
mulsd 0xca589(%rip), %xmm0    # 0x1005b0
movsd 0x30(%rax), %xmm1
addsd 0x28(%rsp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm1
movq (%r13), %rax
addsd (%rax,%rbx,8), %xmm1
movsd %xmm1, (%rax,%rbx,8)
leal 0x1(%rbx), %ecx
movapd 0x50(%rsp), %xmm0
jmp 0x35fdd
movq 0x78(%rsp), %rax
movq (%rax), %rax
xorl %ecx, %ecx
movl %ecx, %ebx
movq 0xde0(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x360d7
movq 0x108(%rsp), %rax
movl (%rax,%rbx,4), %r15d
movq %rbp, %rdi
movq 0x38(%rsp), %rsi
callq 0xa73a
cvtsi2sd %r15d, %xmm0
divsd 0x20(%rsp), %xmm0
mulsd 0xca509(%rip), %xmm0    # 0x1005a8
mulsd 0xca509(%rip), %xmm0    # 0x1005b0
movsd 0x30(%rax), %xmm1
addsd 0x28(%rsp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm1
movq 0x78(%rsp), %rax
movq (%rax), %rax
addsd (%rax,%rbx,8), %xmm1
movsd %xmm1, (%rax,%rbx,8)
leal 0x1(%rbx), %ecx
movapd 0x50(%rsp), %xmm0
jmp 0x3605d
movsd %xmm0, 0x98(%rsp)
movapd 0x60(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0xc8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x375ec
leaq 0x108(%rsp), %rdi
callq 0xb290
leaq 0xb0(%rsp), %rdi
callq 0xb290
movq 0x38(%rsp), %rbx
incq %rbx
leaq 0x98(%rsp), %r15
jmp 0x35b38
movq 0x119eb6(%rip), %rdi    # 0x14fff0
leaq 0xca8a7(%rip), %rsi     # 0x1009e8
callq 0x4480
xorpd %xmm0, %xmm0
jmp 0x36208
movq 0x119e6a(%rip), %rdi    # 0x14ffc0
leaq 0xcae84(%rip), %rsi     # 0x100fe1
callq 0x4480
movl 0xd48(%r12), %esi
movq %rax, %rdi
callq 0x4760
leaq 0xcc405(%rip), %rsi     # 0x10257e
movq %rax, %rdi
callq 0x4480
movl 0xb18(%r12), %ebp
testl %ebp, %ebp
je 0x361fc
movq 0x119e5c(%rip), %rdi    # 0x14fff0
leaq 0xcc3e3(%rip), %rbx     # 0x10257e
movq %rbx, %rsi
callq 0x4480
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
leaq 0xca589(%rip), %rsi     # 0x10073e
movq %rax, %rdi
callq 0x4480
movq %rax, %rdi
movl %ebp, %esi
callq 0x4760
leaq 0xca584(%rip), %rsi     # 0x100752
movq %rax, %rdi
callq 0x4480
movl 0xd48(%r12), %esi
movq %rax, %rdi
callq 0x4760
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4480
movq 0x90(%rsp), %rax
movsd (%rax), %xmm0
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
movq %rax, %rbx
jmp 0x3624d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
jmp 0x3623d
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0xb290
leaq 0xb0(%rsp), %rdi
callq 0xb290
movq %rbx, %rdi
callq 0x4780