// File: /workspace/github_cpp_makefile_star2_O3/DavidLBruce[P]sim3dof/build/../src/SimExec.cpp
// Function: SimExec::Execute(int, char**)
void SimExec::Execute( int argc, char *argv[] )
{
  double angA;      // rad Angle between relative position and velocity vectors.
  double dummy;     // na  Throw away variable
  int    idx;       // na  Loop variable
  double overShoot; // m   Distance of travel beyond the closest point of
                    //     approach.

  strcpy( fileStub, argv[0] );

  process_command_line(argc, argv);

  //
  // Set up all the sim modules
  //

  //
  // Target
  //
  AddModel( &tgt, "Target" );
  tgt.SetSimExec( this );

  //
  // Fire Control Radar
  //
  AddModel( &fcRdr, "FcRdr" );
  fcRdr.SetSimExec( this );
  fcRdr.SetTarget( &tgt );

  //
  // Fire Control Target State Estimator
  //
  AddModel( &fcTseO, "fcTseO" );
  fcTseO.SetSimExec( this );
  fcTseO.SetRadar( &fcRdr );

  //
  // Fire Control six state Target State Estimator
  //
  AddModel( &fcTse6, "fcTse6" );
  fcTse6.SetSimExec( this );
  fcTse6.SetRadar( &fcRdr );
  fcTse6.SetTarget( &tgt ); 

  //
  // Projectile
  //
  AddModel( &msl, "madFires" );
  msl.SetSimExec( this );
  msl.SetAutopilot( &ap );

  //
  // Seeker
  //
  AddModel( &skr, "Seeker" );
  skr.SetMissile( &msl );
  skr.SetSimExec( this );
  skr.SetTarget( &tgt );

  //
  // Projectile MSC TSE
  //
  AddModel( &mslTse6, "mslTse6" );
  mslTse6.SetSimExec( this );
  mslTse6.SetFcTse6( &fcTse6 );
  mslTse6.SetFcTseO( &fcTseO );
  mslTse6.SetMissile( &msl );
  mslTse6.SetFcRadar( &fcRdr );
  mslTse6.SetSeeker( &skr );
  mslTse6.SetTarget( &tgt );

  //
  // Guidance
  //
  AddModel( &gdn, "guidance" );
  gdn.SetSimExec( this );
  gdn.SetMissile( &msl );
  gdn.SetRadar( &fcRdr );
  gdn.SetTarget( &tgt );
  gdn.SetTse6( &fcTse6 ); 
  gdn.SetMslTse( &mslTse6 ); 
  gdn.SetAutopilot( &ap ); 

  AddModel( &ap, "autopilot" );
  ap.SetSimExec( this );
  ap.SetMissile( &msl );
  ap.SetGuidance( &gdn ); 

  //
  //
  // 
  nonFlyerCnt  = 0;
  avgMissMag   = 0.0;
  avgMissX     = 0.0;
  avgMissY     = 0.0;
  avgXang      = 0.0;
  hitCnt       = 0;
  runIdx       = 0;

  //
  // Set size of vector containers.  Hopefully this is faster than push_back()
  //
  missVec.insert(missVec.end(), runs, 0.0);
  missNonFlyers.insert(missNonFlyers.end(), runs, 0.0);
  missXvec.insert(missXvec.end(), runs, 0.0);
  missYvec.insert(missYvec.end(), runs, 0.0);

  if ( printAll )  
  {
    printf( "%5s", "run" );
    printf( "%10s", "miss" );
    printf( "%10s", "tof" );
    printf( "%10s", "seed" );
    printf( "\n" );

    fflush( NULL );
  }

  for ( run = runStart; run < runStart + runs; run++ )
  {
    //
    // Initialize random number generator
    //
    seed = -abs(2 * run - 1) * 13579;
    runSeed = seed;

    //
    // "Warm up" random number seed
    //
    for ( idx = 0; idx < 500; ++idx )
    {
      uniform( 0.0, 1.0, &seed );
    }

    //
    // Run simulation
    //

    //
    // Initialize the modules
    //
    Initialize();

    sprintf( filename, "%s", fileStub );

    sprintf( filename, "%s-%05d.dat", filename, run );

    if ( outputRate > 0.0 )
    {
      pOutFile = fopen( filename, "w" );
    }

    //
    // Print the output file header if necessary
    //
    if ( pOutFile != NULL )
    {
      Output( true, pOutFile );
    }

    deltaTime = timeStep;

    //
    // Main simulation loop
    //
    done = false;
    while ( !done )
    {
      //
      // Update variables in preparation for derivative calculations.
      //
      Update();
    
      Integrate();

      //
      // Update variables with the resultes of integration.
      //
      Update();

      //
      // Frame updates can run asynchrously with respect to eash other and the
      // base simulation run rate.  Dynamics integration will be current at the
      // time of any frame update.
      //
      FrameUpdate();

      relPxf = tgt.pxf - msl.pxf;
      relPyf = tgt.pyf - msl.pyf;

      range = sqrt( SQ(relPxf) + SQ(relPyf) );

      relVxf = tgt.vxf - msl.vxf;
      relVyf = tgt.vyf - msl.vyf;

      relVmag = sqrt( SQ(relVxf) + SQ(relVyf) );

      rDot = ( relVxf * relPxf + relVyf * relPyf ) / range;

      if ( rDot >= 0.0 )
      {
        done = true;
     
        //
        // Calculate the miss distance
        //

        //
        // Use dot product to calculate the angle between relative position and
        // velocity vectors.
        //
        if ( range == 0.0 )
        {
          angA = 0.0;
          miss = 0.0;
          overShoot = 0.0;
          missX = 0.0;
          missY = 0.0;
        }
        else
        {
          angA = acos( (relPxf * relVxf + relPyf * relVyf) / (range * relVmag) );
          miss = range * sin( angA );

          overShoot = range * cos(angA);

          missX = relPxf - overShoot * relVxf / relVmag;
          missY = relPyf - overShoot * relVyf / relVmag;
        }
      }  // end if ( rDot >= 0.0 )
      else if ( simTime >= maxTime )
      {
        done = true;
        
        miss = missX = missY = LARGE;
      }

      if ( !done )
      {
        simTime += deltaTime;
      }
    
    }  // end while ( !done )
    
    //
    // Do final dump of data
    //
    if ( pOutFile != NULL ) 
    {
      Output( false, pOutFile );

      fclose( pOutFile );
    }

    //
    // Collect miss data
    //
    missVec[runIdx] = miss;
    if ( miss < flyerThld )
    {
      ++nonFlyerCnt;
      missNonFlyers[nonFlyerCnt-1] = miss;
      missXvec[nonFlyerCnt-1] = missX;
      missYvec[nonFlyerCnt-1] = missY;

      avgMissMag = ( avgMissMag * static_cast<double>(nonFlyerCnt - 1) +
                                                  fabs(miss) ) /  nonFlyerCnt;
      avgMissX = ( avgMissX * static_cast<double>(nonFlyerCnt - 1) + missX ) /
                                                                  nonFlyerCnt;
      avgMissY = ( avgMissY * static_cast<double>(nonFlyerCnt - 1) + missY ) /
                                                                  nonFlyerCnt;

      //
      // Crossing angle. Supplement of angle between tgt & msl velocity vectors.
      //
      Xang = acos( (msl.vxf * tgt.vxf + msl.vyf * tgt.vyf) /
              sqrt((msl.vxf*msl.vxf + msl.vyf*msl.vyf) *
                   (tgt.vxf*tgt.vxf + tgt.vyf*tgt.vyf)) );

      Xang = PI - Xang;

      avgXang = ( avgXang * static_cast<double>(nonFlyerCnt - 1) + Xang ) /
                                                                  nonFlyerCnt;

    }

    //
    // Count hits for pHit calculation
    //
    if ( miss < pHitThld )
    {
      ++hitCnt;
    }

    if ( printAll )  
    {
      if ( miss < flyerThld )
      {
        printf( "%5d",    run );
        printf( "%10.3f", miss );
        printf( "%10.3f", simTime );
        printf( "%10d",   runSeed );
        printf( "\n" );
        fflush( NULL );
      }
      else
      {
        printf( "%5d",    run );
        printf( "%10.3e", miss );
        printf( "%10.3f", simTime );
        printf( "%10d",   runSeed );
        printf( "\n" );
        fflush( NULL );
      }
    }
    
    if ( runIdx < runs - 1 )
    {
      ++runIdx;
    }

  }  // end for ( run = runStart; run < runStart + runs; run++ )

  pHit = static_cast<double>( hitCnt ) / static_cast<double>( runs );

  sort( missVec.begin(), missVec.end() );
  if ( modf(static_cast<double>(runs) / 2.0, &dummy) < SMALL )
  {
    medMiss = ( missVec[runs/2] + missVec[runs/2+1] ) / 2.0;
  }
  else
  {
    medMiss = missVec[(int)((runs-1)/2)];
  }

  if ( runs > 1 )
  {
    miss70 = missVec[(int)(runs*0.7)-1];
    miss20 = missVec[(int)(runs*0.2)-1];
    miss35 = missVec[(int)(runs*0.35)-1];
  }
  else
  {
    miss70 = missVec[0];
    miss20 = missVec[0];
    miss35 = missVec[0];
  }

  minMiss = missVec[0];
  maxMiss = missVec[runs-1];

  stdMissX = CalcStdDev( missXvec );
  stdMissY = CalcStdDev( missYvec );

  qtyFly = runs - nonFlyerCnt;

  printf( "%10s ", "runs" );
  printf( "%10s ", "pHit" );
  printf( "%10s ", "pHitThld" );
  printf( "%10s ", "miss70" );
  printf( "%10s ", "medMiss" );
  printf( "%10s ", "miss35" );
  printf( "%10s ", "miss20" );
  printf( "%10s ", "avgMissMag" );
  printf( "%10s ", "minMiss" );
  printf( "%10s ", "maxMiss" );
  printf( "%10s ", "avgMissX" );
  printf( "%10s ", "avgMissY" );
  printf( "%10s ", "stdMissX" );
  printf( "%10s ", "stdMissY" );
  printf( "%10s ", "avgXang" );
  printf( "%10s ", "qtyFly" );
  printf( "\n" );

  printf( "%10d ",   runs );  
  printf( "%10.3f",  pHit );
  printf( "%10.3f ", pHitThld );
  printf( "%10.3f ", miss70 );
  printf( "%10.3f ", medMiss );
  printf( "%10.3f ", miss35 );
  printf( "%10.3f ", miss20 );
  printf( "%10.3f ", avgMissMag );
  printf( "%10.3f ", minMiss );
  printf( "%10.3f ", maxMiss );
  printf( "%10.3f ", avgMissX );
  printf( "%10.3f ", avgMissY );
  printf( "%10.3f ", stdMissX );
  printf( "%10.3f ", stdMissY );
  printf( "%10.3f ", avgXang );
  printf( "%10d ",   qtyFly );
  printf( "\n " );

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %rbx
addq $0xf1, %rdi
movq (%rdx), %rsi
movq %rdi, -0x78(%rbp)
callq 0x3160
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x10dca
leaq 0x1750(%rbx), %r12
leaq -0x188(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6e65(%rip), %rsi      # 0x16bd8
leaq 0x6e64(%rip), %rdx      # 0x16bde
leaq -0x198(%rbp), %r14
movq %r14, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xf8c6
movq -0x198(%rbp), %rdi
cmpq %r13, %rdi
je 0xfdb2
movq -0x188(%rbp), %rsi
incq %rsi
callq 0x31a0
movq %rbx, 0x1900(%rbx)
leaq 0x548(%rbx), %r15
leaq -0x168(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6e0d(%rip), %rsi      # 0x16bdf
leaq 0x6e0b(%rip), %rdx      # 0x16be4
leaq -0x178(%rbp), %r14
movq %r14, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xf8c6
movq %r15, -0x38(%rbp)
movq -0x178(%rbp), %rdi
cmpq %r13, %rdi
je 0xfe15
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x31a0
movq %rbx, 0x710(%rbx)
movq %r12, 0x718(%rbx)
leaq 0x720(%rbx), %r15
leaq -0x148(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6da9(%rip), %rsi      # 0x16be5
leaq 0x6da8(%rip), %rdx      # 0x16beb
leaq -0x158(%rbp), %r14
movq %r14, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xf8c6
movq %r12, -0x40(%rbp)
movq -0x158(%rbp), %rdi
cmpq %r13, %rdi
je 0xfe7f
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x31a0
movq %rbx, 0x980(%rbx)
movq -0x38(%rbp), %rax
movq %rax, 0x988(%rbx)
leaq 0x990(%rbx), %r12
leaq -0x128(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6d42(%rip), %rsi      # 0x16bec
leaq 0x6d41(%rip), %rdx      # 0x16bf2
leaq -0x138(%rbp), %r14
movq %r14, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r12, -0x50(%rbp)
movq %r12, %rsi
movq %r14, %rdx
callq 0xf8c6
movq %r15, -0x60(%rbp)
movq -0x138(%rbp), %rdi
cmpq %r13, %rdi
movq -0x40(%rbp), %r12
je 0xfef5
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x31a0
movq %rbx, 0xc90(%rbx)
movq -0x38(%rbp), %rax
movq %rax, 0xc98(%rbx)
movq %r12, 0xca0(%rbx)
leaq 0xeb8(%rbx), %r15
leaq -0x108(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6ccc(%rip), %rsi      # 0x16bf3
leaq 0x6ccd(%rip), %rdx      # 0x16bfb
leaq -0x118(%rbp), %r14
movq %r14, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r15, -0x30(%rbp)
movq %r15, %rsi
movq %r14, %rdx
callq 0xf8c6
movq -0x118(%rbp), %rdi
cmpq %r13, %rdi
je 0xff6a
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x31a0
movq %rbx, 0x1038(%rbx)
leaq 0x3c8(%rbx), %rax
movq %rax, -0x58(%rbp)
movq %rax, 0x1030(%rbx)
leaq 0x1588(%rbx), %r14
leaq -0xe8(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6c60(%rip), %rsi      # 0x16bfc
leaq 0x6c5f(%rip), %rdx      # 0x16c02
leaq -0xf8(%rbp), %r15
movq %r15, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xf8c6
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0xffdb
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x31a0
movq -0x30(%rbp), %rax
movq %rax, 0x1740(%rbx)
movq %rbx, 0x1738(%rbx)
movq %r12, 0x1748(%rbx)
leaq 0x1040(%rbx), %r15
leaq -0xc8(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6bf6(%rip), %rsi      # 0x16c03
leaq 0x6bf6(%rip), %rdx      # 0x16c0a
leaq -0xd8(%rbp), %r12
movq %r12, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r15, -0x48(%rbp)
movq %r15, %rsi
movq %r12, %rdx
callq 0xf8c6
movq -0xd8(%rbp), %rdi
cmpq %r13, %rdi
je 0x10050
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x31a0
movq %rbx, 0x1550(%rbx)
movq -0x50(%rbp), %rax
movq %rax, 0x1578(%rbx)
movq -0x60(%rbp), %rax
movq %rax, 0x1580(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0x1558(%rbx)
movq -0x38(%rbp), %rax
movq %rax, 0x1560(%rbx)
movq %r14, 0x1568(%rbx)
movq -0x40(%rbp), %rax
movq %rax, 0x1570(%rbx)
leaq 0xca8(%rbx), %r14
leaq -0xa8(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6b5d(%rip), %rsi      # 0x16c0b
leaq 0x6b5e(%rip), %rdx      # 0x16c13
leaq -0xb8(%rbp), %r12
movq %r12, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xf8c6
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x100ed
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x31a0
movq %rbx, 0xe88(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0xe90(%rbx)
movq -0x38(%rbp), %rax
movq %rax, 0xea0(%rbx)
movq -0x40(%rbp), %rax
movq %rax, 0xea8(%rbx)
movq -0x50(%rbp), %rax
movq %rax, 0xeb0(%rbx)
movq -0x48(%rbp), %rax
movq %rax, 0xe98(%rbx)
movq -0x58(%rbp), %r12
movq %r12, 0xe80(%rbx)
leaq -0x88(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6acc(%rip), %rsi      # 0x16c14
leaq 0x6ace(%rip), %rdx      # 0x16c1d
leaq -0x98(%rbp), %r15
movq %r15, %rdi
callq 0x126fe
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xf8c6
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x10187
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x31a0
movq %rbx, 0x530(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0x540(%rbx)
movq %r14, 0x538(%rbx)
xorl %r15d, %r15d
movl %r15d, 0x380(%rbx)
movl %r15d, 0x304(%rbx)
movl %r15d, 0x3a8(%rbx)
leaq 0x320(%rbx), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x238(%rbx)
movupd %xmm0, 0x248(%rbx)
movq 0x328(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
leaq -0x68(%rbp), %r14
movq %r15, (%r14)
movq %rdi, -0x70(%rbp)
movq %r14, %rcx
callq 0xaa46
leaq 0x338(%rbx), %rdi
movq 0x340(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
movq %r15, (%r14)
movq %r14, %rcx
callq 0xaa46
leaq 0x350(%rbx), %rdi
movq 0x358(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
movq %r15, (%r14)
movq %rdi, -0x48(%rbp)
movq %r14, %rcx
callq 0xaa46
leaq 0x368(%rbx), %rdi
movq 0x370(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
movq %r15, (%r14)
leaq -0x68(%rbp), %rcx
movq %rdi, -0x58(%rbp)
callq 0xaa46
cmpb $0x1, 0x168(%rbx)
jne 0x102c6
leaq 0x69b1(%rip), %rdi      # 0x16c1e
leaq 0x69ae(%rip), %rsi      # 0x16c22
xorl %eax, %eax
callq 0x3040
leaq 0x69a4(%rip), %r14      # 0x16c26
leaq 0x69a2(%rip), %rsi      # 0x16c2b
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6996(%rip), %rsi      # 0x16c30
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6989(%rip), %rsi      # 0x16c34
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
movl $0xa, %edi
callq 0x3210
xorl %edi, %edi
callq 0x31b0
movl 0x16c(%rbx), %r12d
movl 0x170(%rbx), %eax
movl %eax, 0x3a4(%rbx)
testl %r12d, %r12d
jle 0x108bf
leaq 0x200(%rbx), %r15
leaq 0x261(%rbx), %rcx
movq %rcx, -0x40(%rbp)
leaq 0x1b0(%rbx), %r14
movabsq $0x426d132148c00000, %r13 # imm = 0x426D132148C00000
leal -0x1(,%rax,2), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
imull $0xffffcaf5, %ecx, %eax # imm = 0xFFFFCAF5
cltq
movq %rax, 0x200(%rbx)
movl %eax, 0x3ac(%rbx)
movl $0x1f4, %r12d           # imm = 0x1F4
xorpd %xmm0, %xmm0
movsd 0x5cfe(%rip), %xmm1     # 0x16038
movq %r15, %rdi
callq 0x9807
decl %r12d
jne 0x1032e
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq -0x40(%rbp), %r12
movq %r12, %rdi
movq -0x78(%rbp), %rsi
callq 0x3160
movl 0x3a4(%rbx), %ecx
movq %r12, %rdi
leaq 0x68c9(%rip), %rsi      # 0x16c39
movq %r12, %rdx
xorl %eax, %eax
callq 0x3070
movsd 0x158(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x103a7
movq %r12, %rdi
leaq 0x68af(%rip), %rsi      # 0x16c45
callq 0x31c0
movq %rax, %rdx
movq %rax, 0x210(%rbx)
jmp 0x103ae
movq 0x210(%rbx), %rdx
testq %rdx, %rdx
je 0x103c1
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x1, %esi
callq *0x30(%rax)
movsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x258(%rbx)
movb $0x0, 0x260(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq %rbx, %rdi
callq 0xfa86
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
movsd 0x18b0(%rbx), %xmm2
subsd 0xfe8(%rbx), %xmm2
movsd 0x18b8(%rbx), %xmm4
movsd %xmm2, 0x1d8(%rbx)
subsd 0xff0(%rbx), %xmm4
movsd %xmm4, 0x1e0(%rbx)
movapd %xmm2, %xmm0
mulsd %xmm2, %xmm0
movapd %xmm4, %xmm1
mulsd %xmm4, %xmm1
addsd %xmm0, %xmm1
sqrtsd %xmm1, %xmm1
movsd %xmm1, 0x1c8(%rbx)
movsd 0x18d0(%rbx), %xmm0
subsd 0x1008(%rbx), %xmm0
movsd %xmm0, 0x1f0(%rbx)
movsd 0x18e0(%rbx), %xmm5
subsd 0x1018(%rbx), %xmm5
movsd %xmm5, 0x1f8(%rbx)
movapd %xmm0, %xmm3
mulsd %xmm0, %xmm3
movapd %xmm5, %xmm6
mulsd %xmm5, %xmm6
addsd %xmm3, %xmm6
xorps %xmm3, %xmm3
sqrtsd %xmm6, %xmm3
movsd %xmm3, 0x1e8(%rbx)
mulsd %xmm4, %xmm5
mulsd %xmm2, %xmm0
addsd %xmm5, %xmm0
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x1d0(%rbx)
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm2
jae 0x104fb
movsd 0x208(%rbx), %xmm0
ucomisd 0x150(%rbx), %xmm0
jb 0x105c0
movb $0x1, 0x260(%rbx)
movq %r13, 0x1b8(%rbx)
movq %r13, 0x1b0(%rbx)
movq %r13, 0x190(%rbx)
jmp 0x105c0
movb $0x1, 0x260(%rbx)
ucomisd %xmm4, %xmm1
jne 0x10523
jp 0x10523
movq $0x0, 0x190(%rbx)
xorpd %xmm0, %xmm0
movupd %xmm0, (%r14)
jmp 0x105c0
mulsd %xmm1, %xmm3
divsd %xmm3, %xmm0
callq 0x3170
movsd %xmm0, -0x38(%rbp)
movsd 0x1c8(%rbx), %xmm1
movsd %xmm1, -0x30(%rbp)
callq 0x3080
mulsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x190(%rbx)
movsd 0x1c8(%rbx), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x38(%rbp), %xmm0
callq 0x3310
xorpd %xmm4, %xmm4
mulsd -0x30(%rbp), %xmm0
movsd 0x1f0(%rbx), %xmm1
mulsd %xmm0, %xmm1
movsd 0x1e8(%rbx), %xmm2
divsd %xmm2, %xmm1
movsd 0x1d8(%rbx), %xmm3
subsd %xmm1, %xmm3
movsd 0x1e0(%rbx), %xmm1
movsd %xmm3, 0x1b0(%rbx)
mulsd 0x1f8(%rbx), %xmm0
divsd %xmm2, %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, 0x1b8(%rbx)
cmpb $0x0, 0x260(%rbx)
jne 0x105e6
movsd 0x258(%rbx), %xmm0
addsd 0x208(%rbx), %xmm0
movsd %xmm0, 0x208(%rbx)
jmp 0x103d8
movq 0x210(%rbx), %rdx
testq %rdx, %rdx
je 0x1060d
movq (%rbx), %rax
movq %rbx, %rdi
xorl %esi, %esi
callq *0x30(%rax)
movq 0x210(%rbx), %rdi
callq 0x3180
xorpd %xmm4, %xmm4
movsd 0x190(%rbx), %xmm1
movslq 0x3a8(%rbx), %rax
movq 0x320(%rbx), %rcx
movsd %xmm1, (%rcx,%rax,8)
movsd 0x148(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x107d9
movslq 0x380(%rbx), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x380(%rbx)
movq 0x338(%rbx), %rdx
movsd %xmm1, (%rdx,%rax,8)
movsd 0x1b0(%rbx), %xmm0
movq 0x350(%rbx), %rdx
movsd %xmm0, (%rdx,%rax,8)
movsd 0x1b8(%rbx), %xmm0
movq 0x368(%rbx), %rdx
movsd %xmm0, (%rdx,%rax,8)
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x190(%rbx), %xmm2
andpd 0x5f0b(%rip), %xmm2     # 0x165a0
movsd 0x238(%rbx), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
xorps %xmm2, %xmm2
cvtsi2sd %ecx, %xmm2
divsd %xmm2, %xmm3
movsd %xmm3, 0x238(%rbx)
movsd 0x240(%rbx), %xmm3
mulsd %xmm1, %xmm3
addsd 0x1b0(%rbx), %xmm3
divsd %xmm2, %xmm3
movsd %xmm3, 0x240(%rbx)
mulsd 0x248(%rbx), %xmm1
addsd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x248(%rbx)
movsd 0x1008(%rbx), %xmm3
movsd 0x18d0(%rbx), %xmm6
movsd 0x1018(%rbx), %xmm5
movsd 0x18e0(%rbx), %xmm7
movapd %xmm5, %xmm0
mulsd %xmm5, %xmm0
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movapd %xmm7, %xmm2
mulsd %xmm7, %xmm2
movapd %xmm6, %xmm0
mulsd %xmm6, %xmm0
addsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
ucomisd %xmm4, %xmm0
jb 0x10748
sqrtsd %xmm0, %xmm0
jmp 0x10775
movsd %xmm3, -0x38(%rbp)
movsd %xmm5, -0x30(%rbp)
movsd %xmm6, -0x50(%rbp)
movsd %xmm7, -0x60(%rbp)
callq 0x3120
movsd -0x60(%rbp), %xmm7
movsd -0x50(%rbp), %xmm6
movsd -0x30(%rbp), %xmm5
movsd -0x38(%rbp), %xmm3
mulsd %xmm7, %xmm5
mulsd %xmm6, %xmm3
addsd %xmm5, %xmm3
divsd %xmm0, %xmm3
movapd %xmm3, %xmm0
callq 0x3170
movsd 0x640a(%rip), %xmm1     # 0x16ba0
subsd %xmm0, %xmm1
movsd %xmm1, 0x3c0(%rbx)
movl 0x380(%rbx), %eax
leal -0x1(%rax), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd 0x250(%rbx), %xmm0
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
addsd %xmm1, %xmm0
divsd %xmm2, %xmm0
movsd %xmm0, 0x250(%rbx)
movsd 0x190(%rbx), %xmm1
movsd 0x160(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x107ed
incl 0x304(%rbx)
cmpb $0x1, 0x168(%rbx)
jne 0x10882
movsd 0x148(%rbx), %xmm0
movsd %xmm0, -0x38(%rbp)
movl 0x3a4(%rbx), %esi
leaq 0x6433(%rip), %rdi      # 0x16c47
xorl %eax, %eax
movsd %xmm1, -0x30(%rbp)
callq 0x3040
movsd -0x38(%rbp), %xmm0
ucomisd -0x30(%rbp), %xmm0
movsd 0x190(%rbx), %xmm0
leaq 0x641e(%rip), %rdi      # 0x16c57
leaq 0x640b(%rip), %r12      # 0x16c4b
cmovaq %r12, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x208(%rbx), %xmm0
movq %r12, %rdi
movb $0x1, %al
callq 0x3040
movl 0x3ac(%rbx), %esi
leaq 0x63e8(%rip), %rdi      # 0x16c52
xorl %eax, %eax
callq 0x3040
movl $0xa, %edi
callq 0x3210
xorl %edi, %edi
callq 0x31b0
movl 0x3a8(%rbx), %eax
movl 0x16c(%rbx), %r12d
leal -0x1(%r12), %ecx
cmpl %ecx, %eax
jge 0x108a0
incl %eax
movl %eax, 0x3a8(%rbx)
movl 0x3a4(%rbx), %eax
incl %eax
movl %eax, 0x3a4(%rbx)
movl 0x170(%rbx), %ecx
addl %r12d, %ecx
cmpl %ecx, %eax
jl 0x10305
xorps %xmm0, %xmm0
cvtsi2sdl 0x304(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x398(%rbx)
movq 0x320(%rbx), %r14
movq 0x328(%rbx), %r15
cmpq %r15, %r14
je 0x1092d
movq %r15, %rax
subq %r14, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1279c
movq %r14, %rdi
movq %r15, %rsi
callq 0x12888
movl 0x16c(%rbx), %r12d
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
movsd 0x5833(%rip), %xmm0     # 0x16168
movsd %xmm1, -0x38(%rbp)
mulsd %xmm1, %xmm0
leaq -0x1a0(%rbp), %rdi
callq 0x32e0
movsd 0x6246(%rip), %xmm1     # 0x16b98
ucomisd %xmm0, %xmm1
jbe 0x10982
movl %r12d, %eax
shrl $0x1f, %eax
addl %r12d, %eax
sarl %eax
movslq %eax, %rcx
movq -0x70(%rbp), %rax
movq (%rax), %rax
movsd (%rax,%rcx,8), %xmm0
addsd 0x8(%rax,%rcx,8), %xmm0
mulsd 0x57e8(%rip), %xmm0     # 0x16168
jmp 0x109a0
leal -0x1(%r12), %eax
shrl $0x1f, %eax
addl %r12d, %eax
decl %eax
sarl %eax
movslq %eax, %rcx
movq -0x70(%rbp), %rax
movq (%rax), %rax
movsd (%rax,%rcx,8), %xmm0
movq -0x48(%rbp), %rsi
movsd %xmm0, 0x310(%rbx)
cmpl $0x2, %r12d
movsd -0x38(%rbp), %xmm1
jl 0x10a16
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
mulsd 0x61e1(%rip), %xmm0     # 0x16ba8
cvttsd2si %xmm0, %ecx
movslq %ecx, %rcx
movsd -0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1a8(%rbx)
movsd 0x61cc(%rip), %xmm0     # 0x16bb0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movslq %ecx, %rcx
movsd -0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x198(%rbx)
mulsd 0x61b3(%rip), %xmm1     # 0x16bb8
cvttsd2si %xmm1, %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,8), %rcx
addq $-0x8, %rcx
jmp 0x10a2d
movsd (%rax), %xmm0
movsd %xmm0, 0x1a8(%rbx)
movsd %xmm0, 0x198(%rbx)
movq %rax, %rcx
movsd (%rcx), %xmm0
movsd %xmm0, 0x1a0(%rbx)
movsd (%rax), %xmm0
movsd %xmm0, 0x318(%rbx)
movslq %r12d, %rcx
movsd -0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x308(%rbx)
leaq -0x1d0(%rbp), %r14
movq %r14, %rdi
callq 0x1253e
movq %r14, %rsi
callq 0x10e38
movsd %xmm0, 0x3b0(%rbx)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x10a8c
movq -0x1c0(%rbp), %rsi
subq %rdi, %rsi
callq 0x31a0
leaq -0x1b8(%rbp), %r14
movq %r14, %rdi
movq -0x58(%rbp), %rsi
callq 0x1253e
movq %r14, %rsi
callq 0x10e38
movsd %xmm0, 0x3b8(%rbx)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x10ac6
movq -0x1a8(%rbp), %rsi
subq %rdi, %rsi
callq 0x31a0
movl 0x16c(%rbx), %eax
subl 0x380(%rbx), %eax
movl %eax, 0x3a0(%rbx)
leaq 0x617f(%rip), %r14      # 0x16c5e
leaq 0x6297(%rip), %rsi      # 0x16d7d
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x616d(%rip), %rsi      # 0x16c64
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x625d(%rip), %rsi      # 0x16d65
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6150(%rip), %rsi      # 0x16c69
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6146(%rip), %rsi      # 0x16c70
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x613d(%rip), %rsi      # 0x16c78
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6133(%rip), %rsi      # 0x16c7f
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6129(%rip), %rsi      # 0x16c86
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6123(%rip), %rsi      # 0x16c91
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x611a(%rip), %rsi      # 0x16c99
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6111(%rip), %rsi      # 0x16ca1
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6109(%rip), %rsi      # 0x16caa
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6101(%rip), %rsi      # 0x16cb3
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x60f9(%rip), %rsi      # 0x16cbc
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x60f1(%rip), %rsi      # 0x16cc5
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x60e8(%rip), %rsi      # 0x16ccd
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
movl $0xa, %edi
callq 0x3210
movl 0x16c(%rbx), %esi
leaq 0x60ce(%rip), %r14      # 0x16cd4
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
movsd 0x398(%rbx), %xmm0
leaq 0x602c(%rip), %rdi      # 0x16c4b
movb $0x1, %al
callq 0x3040
movsd 0x160(%rbx), %xmm0
leaq 0x60a5(%rip), %r15      # 0x16cda
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x1a8(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x310(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x1a0(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x198(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x238(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x318(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x308(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x240(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x248(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x3b0(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x3b8(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x250(%rbx), %xmm0
movq %r15, %rdi
movb $0x1, %al
callq 0x3040
movl 0x3a0(%rbx), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fb4(%rip), %rdi      # 0x16ce2
xorl %eax, %eax
callq 0x3040
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x98(%rbp), %rdi
jmp 0x10db1
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
jmp 0x10db1
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
jmp 0x10db1
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
jmp 0x10db1
movq %rax, %rbx
movq -0x118(%rbp), %rdi
jmp 0x10db1
movq %rax, %rbx
movq -0x138(%rbp), %rdi
jmp 0x10db1
movq %rax, %rbx
movq -0x158(%rbp), %rdi
jmp 0x10db1
movq %rax, %rbx
movq -0x178(%rbp), %rdi
jmp 0x10db1
movq %rax, %rbx
movq -0x198(%rbp), %rdi
cmpq %r13, %rdi
je 0x10dc2
movq (%r13), %rsi
incq %rsi
callq 0x31a0
movq %rbx, %rdi
callq 0x32d0