// File: /workspace/github_cpp_makefile_star2_O1/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 0x10f24
leaq 0x1750(%rbx), %r12
leaq -0x188(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x6d57(%rip), %rsi      # 0x16bd8
leaq 0x6d56(%rip), %rdx      # 0x16bde
leaq -0x198(%rbp), %r14
movq %r14, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xf9da
movq -0x198(%rbp), %rdi
cmpq %r13, %rdi
je 0xfec0
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 0x6cff(%rip), %rsi      # 0x16bdf
leaq 0x6cfd(%rip), %rdx      # 0x16be4
leaq -0x178(%rbp), %r14
movq %r14, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xf9da
movq %r15, -0x38(%rbp)
movq -0x178(%rbp), %rdi
cmpq %r13, %rdi
je 0xff23
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 0x6c9b(%rip), %rsi      # 0x16be5
leaq 0x6c9a(%rip), %rdx      # 0x16beb
leaq -0x158(%rbp), %r14
movq %r14, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xf9da
movq %r12, -0x40(%rbp)
movq -0x158(%rbp), %rdi
cmpq %r13, %rdi
je 0xff8d
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 0x6c34(%rip), %rsi      # 0x16bec
leaq 0x6c33(%rip), %rdx      # 0x16bf2
leaq -0x138(%rbp), %r14
movq %r14, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r12, -0x50(%rbp)
movq %r12, %rsi
movq %r14, %rdx
callq 0xf9da
movq %r15, -0x60(%rbp)
movq -0x138(%rbp), %rdi
cmpq %r13, %rdi
movq -0x40(%rbp), %r12
je 0x10003
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 0x6bbe(%rip), %rsi      # 0x16bf3
leaq 0x6bbf(%rip), %rdx      # 0x16bfb
leaq -0x118(%rbp), %r14
movq %r14, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r15, -0x30(%rbp)
movq %r15, %rsi
movq %r14, %rdx
callq 0xf9da
movq -0x118(%rbp), %rdi
cmpq %r13, %rdi
je 0x10078
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 0x6b52(%rip), %rsi      # 0x16bfc
leaq 0x6b51(%rip), %rdx      # 0x16c02
leaq -0xf8(%rbp), %r15
movq %r15, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xf9da
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0x100e9
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 0x6ae8(%rip), %rsi      # 0x16c03
leaq 0x6ae8(%rip), %rdx      # 0x16c0a
leaq -0xd8(%rbp), %r12
movq %r12, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r15, -0x48(%rbp)
movq %r15, %rsi
movq %r12, %rdx
callq 0xf9da
movq -0xd8(%rbp), %rdi
cmpq %r13, %rdi
je 0x1015e
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 0x6a4f(%rip), %rsi      # 0x16c0b
leaq 0x6a50(%rip), %rdx      # 0x16c13
leaq -0xb8(%rbp), %r12
movq %r12, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xf9da
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x101fb
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 0x69be(%rip), %rsi      # 0x16c14
leaq 0x69c0(%rip), %rdx      # 0x16c1d
leaq -0x98(%rbp), %r15
movq %r15, %rdi
callq 0x1286e
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xf9da
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x10295
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 0xaaea
leaq 0x338(%rbx), %rdi
movq 0x340(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
movq %r15, (%r14)
movq %r14, %rcx
callq 0xaaea
leaq 0x350(%rbx), %rdi
movq 0x358(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
movq %r15, (%r14)
movq %rdi, -0x48(%rbp)
movq %r14, %rcx
callq 0xaaea
leaq 0x368(%rbx), %rdi
movq 0x370(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
movq %r15, (%r14)
leaq -0x68(%rbp), %rcx
movq %rdi, -0x58(%rbp)
callq 0xaaea
cmpb $0x1, 0x168(%rbx)
jne 0x103d4
leaq 0x68a3(%rip), %rdi      # 0x16c1e
leaq 0x68a0(%rip), %rsi      # 0x16c22
xorl %eax, %eax
callq 0x3040
leaq 0x6896(%rip), %r14      # 0x16c26
leaq 0x6894(%rip), %rsi      # 0x16c2b
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6888(%rip), %rsi      # 0x16c30
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x687b(%rip), %rsi      # 0x16c34
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
movl $0xa, %edi
callq 0x3210
xorl %edi, %edi
callq 0x31b0
movl 0x16c(%rbx), %ecx
movl 0x170(%rbx), %eax
movl %eax, 0x3a4(%rbx)
testl %ecx, %ecx
jle 0x10a0b
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 0x5bf2(%rip), %xmm1     # 0x16038
movq %r15, %rdi
callq 0x98c1
decl %r12d
jne 0x1043a
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 0x67bd(%rip), %rsi      # 0x16c39
movq %r12, %rdx
xorl %eax, %eax
callq 0x3070
movsd 0x158(%rbx), %xmm0
ucomisd 0x6132(%rip), %xmm0     # 0x165c8
jbe 0x104af
movq -0x40(%rbp), %rdi
leaq 0x67a2(%rip), %rsi      # 0x16c45
callq 0x31c0
movq %rax, 0x210(%rbx)
movq 0x210(%rbx), %rdx
testq %rdx, %rdx
je 0x104c9
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 0xfb94
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
movsd 0x18b0(%rbx), %xmm1
movsd 0x18b8(%rbx), %xmm0
subsd 0xfe8(%rbx), %xmm1
movsd %xmm1, 0x1d8(%rbx)
subsd 0xff0(%rbx), %xmm0
movsd %xmm0, 0x1e0(%rbx)
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jb 0x1054f
sqrtsd %xmm0, %xmm0
jmp 0x10558
callq 0x3120
xorpd %xmm4, %xmm4
movsd %xmm0, 0x1c8(%rbx)
movsd 0x18d0(%rbx), %xmm1
movsd 0x18e0(%rbx), %xmm0
subsd 0x1008(%rbx), %xmm1
movsd %xmm1, 0x1f0(%rbx)
subsd 0x1018(%rbx), %xmm0
movsd %xmm0, 0x1f8(%rbx)
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm4, %xmm0
jb 0x105a8
sqrtsd %xmm0, %xmm0
jmp 0x105b1
callq 0x3120
xorpd %xmm4, %xmm4
movsd %xmm0, 0x1e8(%rbx)
movsd 0x1c8(%rbx), %xmm2
movsd 0x1f0(%rbx), %xmm1
movsd 0x1f8(%rbx), %xmm3
mulsd 0x1e0(%rbx), %xmm3
mulsd 0x1d8(%rbx), %xmm1
addsd %xmm3, %xmm1
movapd %xmm1, %xmm3
divsd %xmm2, %xmm3
movsd %xmm3, 0x1d0(%rbx)
ucomisd %xmm4, %xmm3
jae 0x10632
movsd 0x208(%rbx), %xmm0
ucomisd 0x150(%rbx), %xmm0
jb 0x106f7
movb $0x1, 0x260(%rbx)
movq %r13, 0x1b8(%rbx)
movq %r13, 0x1b0(%rbx)
movq %r13, 0x190(%rbx)
jmp 0x106f7
movb $0x1, 0x260(%rbx)
ucomisd %xmm4, %xmm2
jne 0x1065a
jp 0x1065a
movq $0x0, 0x190(%rbx)
xorpd %xmm0, %xmm0
movupd %xmm0, (%r14)
jmp 0x106f7
mulsd %xmm2, %xmm0
divsd %xmm0, %xmm1
movapd %xmm1, %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
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 0x10718
movsd 0x258(%rbx), %xmm0
addsd 0x208(%rbx), %xmm0
movsd %xmm0, 0x208(%rbx)
cmpb $0x1, 0x260(%rbx)
jne 0x104e0
movq 0x210(%rbx), %rdx
testq %rdx, %rdx
je 0x10748
movq (%rbx), %rax
movq %rbx, %rdi
xorl %esi, %esi
callq *0x30(%rax)
movq 0x210(%rbx), %rdi
callq 0x3180
movsd 0x190(%rbx), %xmm0
movslq 0x3a8(%rbx), %rax
movq 0x320(%rbx), %rcx
movsd %xmm0, (%rcx,%rax,8)
movsd 0x148(%rbx), %xmm1
movsd 0x190(%rbx), %xmm0
ucomisd %xmm0, %xmm1
jbe 0x1091c
movslq 0x380(%rbx), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x380(%rbx)
movq 0x338(%rbx), %rdx
movsd %xmm0, (%rdx,%rax,8)
movsd 0x1b0(%rbx), %xmm0
movq 0x350(%rbx), %rdx
movsd %xmm0, (%rdx,%rax,8)
movsd 0x1b8(%rbx), %xmm0
movq 0x368(%rbx), %rdx
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd %xmm0, (%rdx,%rax,8)
movsd 0x190(%rbx), %xmm0
andpd 0x5dc8(%rip), %xmm0     # 0x165a0
movsd 0x238(%rbx), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
divsd %xmm0, %xmm2
movsd %xmm2, 0x238(%rbx)
movsd 0x240(%rbx), %xmm2
mulsd %xmm1, %xmm2
addsd 0x1b0(%rbx), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, 0x240(%rbx)
mulsd 0x248(%rbx), %xmm1
addsd 0x1b8(%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x248(%rbx)
movsd 0x1008(%rbx), %xmm3
movsd 0x18d0(%rbx), %xmm5
movsd 0x1018(%rbx), %xmm4
movsd 0x18e0(%rbx), %xmm6
movapd %xmm4, %xmm0
mulsd %xmm4, %xmm0
movapd %xmm3, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movapd %xmm6, %xmm2
mulsd %xmm6, %xmm2
movapd %xmm5, %xmm0
mulsd %xmm5, %xmm0
addsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
ucomisd 0x5d3d(%rip), %xmm0     # 0x165c8
jb 0x10893
sqrtsd %xmm0, %xmm0
jmp 0x108c0
movsd %xmm3, -0x38(%rbp)
movsd %xmm4, -0x30(%rbp)
movsd %xmm5, -0x50(%rbp)
movsd %xmm6, -0x60(%rbp)
callq 0x3120
movsd -0x60(%rbp), %xmm6
movsd -0x50(%rbp), %xmm5
movsd -0x30(%rbp), %xmm4
movsd -0x38(%rbp), %xmm3
mulsd %xmm6, %xmm4
mulsd %xmm5, %xmm3
addsd %xmm4, %xmm3
divsd %xmm0, %xmm3
movapd %xmm3, %xmm0
callq 0x3170
movsd 0x62bf(%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
addsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x250(%rbx)
movsd 0x160(%rbx), %xmm0
movsd 0x190(%rbx), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x10938
incl 0x304(%rbx)
cmpb $0x1, 0x168(%rbx)
jne 0x109cd
movsd 0x148(%rbx), %xmm0
movsd %xmm0, -0x38(%rbp)
movl 0x3a4(%rbx), %esi
leaq 0x62e8(%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 0x62d3(%rip), %rdi      # 0x16c57
leaq 0x62c0(%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 0x629d(%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), %ecx
decl %ecx
cmpl %ecx, %eax
jge 0x109e7
incl %eax
movl %eax, 0x3a8(%rbx)
movl 0x3a4(%rbx), %eax
incl %eax
movl %eax, 0x3a4(%rbx)
movl 0x16c(%rbx), %ecx
movl 0x170(%rbx), %edx
addl %ecx, %edx
cmpl %edx, %eax
jl 0x10411
xorps %xmm0, %xmm0
cvtsi2sdl 0x304(%rbx), %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x398(%rbx)
movq 0x320(%rbx), %r14
movq 0x328(%rbx), %r15
cmpq %r15, %r14
je 0x10a69
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 0x12907
movq %r14, %rdi
movq %r15, %rsi
callq 0x129f3
movslq 0x16c(%rbx), %r14
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
movsd 0x56e8(%rip), %xmm0     # 0x16168
movsd %xmm1, -0x38(%rbp)
mulsd %xmm1, %xmm0
leaq -0x1a0(%rbp), %rdi
callq 0x32e0
movsd 0x60fb(%rip), %xmm1     # 0x16b98
ucomisd %xmm0, %xmm1
jbe 0x10acc
movl %r14d, %eax
shrl $0x1f, %eax
addl %r14d, %eax
sarl %eax
cltq
movq -0x70(%rbp), %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm0
addsd 0x8(%rcx,%rax,8), %xmm0
mulsd 0x569e(%rip), %xmm0     # 0x16168
jmp 0x10ae8
leal -0x1(%r14), %eax
shrl $0x1f, %eax
addl %r14d, %eax
decl %eax
sarl %eax
cltq
movq -0x70(%rbp), %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm0
movq -0x48(%rbp), %rsi
movsd %xmm0, 0x310(%rbx)
cmpl $0x2, %r14d
jl 0x10b62
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd 0x609e(%rip), %xmm0     # 0x16ba8
cvttsd2si %xmm0, %eax
movq 0x320(%rbx), %rcx
cltq
movsd -0x8(%rcx,%rax,8), %xmm0
movsd %xmm0, 0x1a8(%rbx)
movsd 0x6083(%rip), %xmm0     # 0x16bb0
movsd -0x38(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cltq
movsd -0x8(%rcx,%rax,8), %xmm0
movsd %xmm0, 0x198(%rbx)
mulsd 0x6066(%rip), %xmm1     # 0x16bb8
cvttsd2si %xmm1, %eax
cltq
leaq (%rcx,%rax,8), %rax
addq $-0x8, %rax
jmp 0x10b81
movq 0x320(%rbx), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x1a8(%rbx)
movsd (%rax), %xmm0
movsd %xmm0, 0x198(%rbx)
movsd (%rax), %xmm0
movsd %xmm0, 0x1a0(%rbx)
movq 0x320(%rbx), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x318(%rbx)
movsd -0x8(%rax,%r14,8), %xmm0
movsd %xmm0, 0x308(%rbx)
leaq -0x1d0(%rbp), %r14
movq %r14, %rdi
callq 0x126ae
movq %r14, %rsi
callq 0x10f92
movsd %xmm0, 0x3b0(%rbx)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x10be5
movq -0x1c0(%rbp), %rsi
subq %rdi, %rsi
callq 0x31a0
leaq -0x1b8(%rbp), %r14
movq %r14, %rdi
movq -0x58(%rbp), %rsi
callq 0x126ae
movq %r14, %rsi
callq 0x10f92
movsd %xmm0, 0x3b8(%rbx)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x10c1f
movq -0x1a8(%rbp), %rsi
subq %rdi, %rsi
callq 0x31a0
movl 0x16c(%rbx), %eax
subl 0x380(%rbx), %eax
movl %eax, 0x3a0(%rbx)
leaq 0x6026(%rip), %r14      # 0x16c5e
leaq 0x613e(%rip), %rsi      # 0x16d7d
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6014(%rip), %rsi      # 0x16c64
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x6104(%rip), %rsi      # 0x16d65
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5ff7(%rip), %rsi      # 0x16c69
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fed(%rip), %rsi      # 0x16c70
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fe4(%rip), %rsi      # 0x16c78
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fda(%rip), %rsi      # 0x16c7f
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fd0(%rip), %rsi      # 0x16c86
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fca(%rip), %rsi      # 0x16c91
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fc1(%rip), %rsi      # 0x16c99
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fb8(%rip), %rsi      # 0x16ca1
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fb0(%rip), %rsi      # 0x16caa
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fa8(%rip), %rsi      # 0x16cb3
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5fa0(%rip), %rsi      # 0x16cbc
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5f98(%rip), %rsi      # 0x16cc5
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5f8f(%rip), %rsi      # 0x16ccd
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
movl $0xa, %edi
callq 0x3210
movl 0x16c(%rbx), %esi
leaq 0x5f75(%rip), %r14      # 0x16cd4
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
movsd 0x398(%rbx), %xmm0
leaq 0x5ed3(%rip), %rdi      # 0x16c4b
movb $0x1, %al
callq 0x3040
movsd 0x160(%rbx), %xmm0
leaq 0x5f4c(%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 0x5e5b(%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 0x10f0a
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
jmp 0x10f0a
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
jmp 0x10f0a
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
jmp 0x10f0a
movq %rax, %rbx
movq -0x118(%rbp), %rdi
jmp 0x10f0a
movq %rax, %rbx
movq -0x138(%rbp), %rdi
jmp 0x10f0a
movq %rax, %rbx
movq -0x158(%rbp), %rdi
jmp 0x10f0a
movq %rax, %rbx
movq -0x178(%rbp), %rdi
jmp 0x10f0a
movq %rax, %rbx
movq -0x198(%rbp), %rdi
cmpq %r13, %rdi
je 0x10f1b
movq (%r13), %rsi
incq %rsi
callq 0x31a0
movq %rbx, %rdi
callq 0x32d0
nop