// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movl %esi, %r12d
movq %rdi, %rbx
addq $0xf1, %rdi
movq (%rdx), %rsi
movq %rdi, -0x78(%rbp)
callq 0x3190
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x10620
leaq 0x6493(%rip), %rsi      # 0x15bd8
leaq -0x198(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq 0x1750(%rbx), %r14
leaq -0x198(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf386
leaq -0x198(%rbp), %rdi
callq 0x30d0
movq %rbx, 0x1900(%rbx)
leaq 0x6457(%rip), %rsi      # 0x15bdf
leaq -0x178(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq 0x548(%rbx), %rsi
leaq -0x178(%rbp), %rdx
movq %rbx, %rdi
movq %rsi, -0x30(%rbp)
callq 0xf386
leaq -0x178(%rbp), %rdi
callq 0x30d0
movq %rbx, 0x710(%rbx)
movq %r14, 0x718(%rbx)
leaq 0x6412(%rip), %rsi      # 0x15be5
leaq -0x158(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq 0x720(%rbx), %rsi
leaq -0x158(%rbp), %rdx
movq %rbx, %rdi
movq %rsi, -0x48(%rbp)
callq 0xf386
leaq -0x158(%rbp), %rdi
callq 0x30d0
movq %rbx, 0x980(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0x988(%rbx)
leaq 0x63ca(%rip), %rsi      # 0x15bec
leaq -0x138(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq 0x990(%rbx), %rsi
leaq -0x138(%rbp), %rdx
movq %rbx, %rdi
movq %rsi, -0x40(%rbp)
callq 0xf386
leaq -0x138(%rbp), %rdi
callq 0x30d0
movq %rbx, 0xc90(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0xc98(%rbx)
movq %r14, 0xca0(%rbx)
leaq 0x637b(%rip), %rsi      # 0x15bf3
leaq -0x118(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq 0xeb8(%rbx), %r13
leaq -0x118(%rbp), %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0xf386
leaq -0x118(%rbp), %rdi
callq 0x30d0
movq %rbx, 0x1038(%rbx)
leaq 0x3c8(%rbx), %rax
movq %rax, -0x50(%rbp)
movq %rax, 0x1030(%rbx)
leaq 0x632f(%rip), %rsi      # 0x15bfc
leaq -0xf8(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq 0x1588(%rbx), %r12
leaq -0xf8(%rbp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xf386
leaq -0xf8(%rbp), %rdi
callq 0x30d0
movq %r13, 0x1740(%rbx)
movq %rbx, 0x1738(%rbx)
movq %r14, 0x1748(%rbx)
leaq 0x62e5(%rip), %rsi      # 0x15c03
leaq -0xd8(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq 0x1040(%rbx), %r15
leaq -0xd8(%rbp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf386
leaq -0xd8(%rbp), %rdi
callq 0x30d0
movq %rbx, 0x1550(%rbx)
movq -0x40(%rbp), %rax
movq %rax, 0x1578(%rbx)
movq -0x48(%rbp), %rax
movq %rax, 0x1580(%rbx)
movq %r13, 0x1558(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0x1560(%rbx)
movq %r12, 0x1568(%rbx)
movq %r14, 0x1570(%rbx)
leaq 0x6274(%rip), %rsi      # 0x15c0b
leaq -0xb8(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq 0xca8(%rbx), %r12
leaq -0xb8(%rbp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xf386
leaq -0xb8(%rbp), %rdi
callq 0x30d0
movq %rbx, 0xe88(%rbx)
movq %r13, 0xe90(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0xea0(%rbx)
movq %r14, 0xea8(%rbx)
movq -0x40(%rbp), %rax
movq %rax, 0xeb0(%rbx)
movq %r15, 0xe98(%rbx)
movq -0x50(%rbp), %r14
movq %r14, 0xe80(%rbx)
leaq 0x6204(%rip), %rsi      # 0x15c14
leaq -0x98(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x11d4e
leaq -0x98(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf386
leaq -0x98(%rbp), %rdi
callq 0x30d0
movq %rbx, 0x530(%rbx)
movq %r13, 0x540(%rbx)
movq %r12, 0x538(%rbx)
andl $0x0, 0x380(%rbx)
andl $0x0, 0x304(%rbx)
andl $0x0, 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 -0x38(%rbp), %r15
andq $0x0, (%r15)
movq %rdi, -0x58(%rbp)
movq %r15, %rcx
callq 0xa43c
leaq 0x338(%rbx), %rdi
movq 0x340(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
andq $0x0, (%r15)
movq %r15, %rcx
callq 0xa43c
leaq 0x350(%rbx), %rdi
movq 0x358(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
andq $0x0, (%r15)
movq %rdi, -0x60(%rbp)
movq %r15, %rcx
callq 0xa43c
leaq 0x368(%rbx), %rdi
movq 0x370(%rbx), %rsi
movslq 0x16c(%rbx), %rdx
andq $0x0, (%r15)
leaq -0x38(%rbp), %rcx
movq %rdi, -0x68(%rbp)
callq 0xa43c
cmpb $0x1, 0x168(%rbx)
jne 0xfb78
leaq 0x60fd(%rip), %rdi      # 0x15c1e
leaq 0x60fa(%rip), %rsi      # 0x15c22
xorl %eax, %eax
callq 0x3040
leaq 0x60f0(%rip), %r15      # 0x15c26
leaq 0x60ee(%rip), %rsi      # 0x15c2b
movq %r15, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x60e2(%rip), %rsi      # 0x15c30
movq %r15, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x60d5(%rip), %rsi      # 0x15c34
movq %r15, %rdi
xorl %eax, %eax
callq 0x3040
pushq $0xa
popq %rdi
callq 0x3250
xorl %edi, %edi
callq 0x31e0
movl 0x16c(%rbx), %eax
movl 0x170(%rbx), %ecx
leaq 0x200(%rbx), %r15
leaq 0x261(%rbx), %r12
leaq 0x1b0(%rbx), %r13
movabsq $0x426d132148c00000, %r14 # imm = 0x426D132148C00000
movl %ecx, %edx
movq %r13, -0x48(%rbp)
movl %edx, 0x3a4(%rbx)
addl %eax, %ecx
cmpl %ecx, %edx
jge 0x1016f
movq %r12, %r13
leal -0x1(,%rdx,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
subl $0x1, %r12d
jb 0xfc01
xorpd %xmm0, %xmm0
movsd 0x5441(%rip), %xmm1     # 0x15038
movq %r15, %rdi
callq 0x964a
jmp 0xfbe5
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r13, %r12
movq %r13, %rdi
movq -0x78(%rbp), %rsi
callq 0x3190
movl 0x3a4(%rbx), %ecx
movq %r13, %rdi
leaq 0x6010(%rip), %rsi      # 0x15c39
movq %r13, %rdx
xorl %eax, %eax
callq 0x3070
movsd 0x158(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xfc60
movq %r12, %rdi
leaq 0x5ff6(%rip), %rsi      # 0x15c45
callq 0x31f0
movq %rax, %rdx
movq %rax, 0x210(%rbx)
jmp 0xfc67
movq 0x210(%rbx), %rdx
movq -0x48(%rbp), %r13
testq %rdx, %rdx
je 0xfc7c
movq (%rbx), %rax
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq *0x30(%rax)
movsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x258(%rbx)
movb $0x0, 0x260(%rbx)
xorl %eax, %eax
testb $0x1, %al
jne 0xfea7
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq %rbx, %rdi
callq 0xf4a8
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
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 0xfdbd
movsd 0x208(%rbx), %xmm0
ucomisd 0x150(%rbx), %xmm0
jb 0xfe7c
movb $0x1, 0x260(%rbx)
movq %r14, 0x1b8(%rbx)
movq %r14, 0x1b0(%rbx)
movq %r14, 0x190(%rbx)
jmp 0xfe7c
movb $0x1, 0x260(%rbx)
ucomisd %xmm4, %xmm1
jne 0xfde3
jp 0xfde3
andq $0x0, 0x190(%rbx)
xorpd %xmm0, %xmm0
movupd %xmm0, (%r13)
jmp 0xfe7c
mulsd %xmm1, %xmm3
divsd %xmm3, %xmm0
callq 0x31a0
movsd %xmm0, -0x30(%rbp)
movsd 0x1c8(%rbx), %xmm1
movsd %xmm1, -0x40(%rbp)
callq 0x3080
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, 0x190(%rbx)
movsd 0x1c8(%rbx), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x3360
mulsd -0x40(%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)
movb 0x260(%rbx), %al
testb %al, %al
jne 0xfc95
movsd 0x258(%rbx), %xmm0
addsd 0x208(%rbx), %xmm0
movsd %xmm0, 0x208(%rbx)
jmp 0xfc95
movq 0x210(%rbx), %rdx
testq %rdx, %rdx
je 0xfeca
movq (%rbx), %rax
movq %rbx, %rdi
xorl %esi, %esi
callq *0x30(%rax)
movq 0x210(%rbx), %rdi
callq 0x31b0
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 0x1008e
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)
cvtsi2sd %eax, %xmm1
movsd 0x190(%rbx), %xmm2
andpd 0x5651(%rip), %xmm2     # 0x155a0
movsd 0x238(%rbx), %xmm3
mulsd %xmm1, %xmm3
addsd %xmm2, %xmm3
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), %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
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x10003
sqrtsd %xmm0, %xmm0
jmp 0x10030
movsd %xmm3, -0x30(%rbp)
movsd %xmm4, -0x40(%rbp)
movsd %xmm5, -0x50(%rbp)
movsd %xmm6, -0x70(%rbp)
callq 0x3150
movsd -0x70(%rbp), %xmm6
movsd -0x50(%rbp), %xmm5
movsd -0x40(%rbp), %xmm4
movsd -0x30(%rbp), %xmm3
mulsd %xmm6, %xmm4
mulsd %xmm5, %xmm3
addsd %xmm4, %xmm3
divsd %xmm0, %xmm3
movapd %xmm3, %xmm0
callq 0x31a0
movsd 0x5b67(%rip), %xmm1     # 0x15bb8
subsd %xmm0, %xmm1
movsd %xmm1, 0x3c0(%rbx)
movl 0x380(%rbx), %eax
leal -0x1(%rax), %ecx
cvtsi2sd %ecx, %xmm0
mulsd 0x250(%rbx), %xmm0
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 0x100a2
incl 0x304(%rbx)
cmpb $0x1, 0x168(%rbx)
jne 0x10141
movsd 0x148(%rbx), %xmm0
movsd %xmm0, -0x30(%rbp)
movl 0x3a4(%rbx), %esi
leaq 0x5b7e(%rip), %rdi      # 0x15c47
xorl %eax, %eax
movsd %xmm1, -0x40(%rbp)
callq 0x3040
movsd -0x30(%rbp), %xmm0
ucomisd -0x40(%rbp), %xmm0
movsd 0x190(%rbx), %xmm0
leaq 0x5b69(%rip), %rdi      # 0x15c57
movq %r14, %r13
movq %r12, %r14
leaq 0x5b50(%rip), %r12      # 0x15c4b
cmovaq %r12, %rdi
movb $0x1, %al
callq 0x3040
movsd 0x208(%rbx), %xmm0
movq %r12, %rdi
movq %r14, %r12
movq %r13, %r14
movb $0x1, %al
callq 0x3040
movl 0x3ac(%rbx), %esi
leaq 0x5b27(%rip), %rdi      # 0x15c52
xorl %eax, %eax
callq 0x3040
pushq $0xa
popq %rdi
callq 0x3250
xorl %edi, %edi
callq 0x31e0
movl 0x3a8(%rbx), %ecx
movl 0x16c(%rbx), %eax
leal -0x1(%rax), %edx
cmpl %edx, %ecx
jge 0x1015c
incl %ecx
movl %ecx, 0x3a8(%rbx)
movl 0x3a4(%rbx), %edx
incl %edx
movl 0x170(%rbx), %ecx
jmp 0xfba9
cvtsi2sdl 0x304(%rbx), %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x398(%rbx)
movq 0x320(%rbx), %rdi
movq 0x328(%rbx), %rsi
callq 0x1201a
movslq 0x16c(%rbx), %r14
cvtsi2sd %r14d, %xmm1
movsd 0x4fba(%rip), %xmm0     # 0x15168
movsd %xmm1, -0x30(%rbp)
mulsd %xmm1, %xmm0
leaq -0x1a0(%rbp), %rdi
callq 0x3330
movsd 0x59cd(%rip), %xmm1     # 0x15b98
ucomisd %xmm0, %xmm1
jbe 0x101f9
pushq $0x2
popq %rcx
movl %r14d, %eax
cltd
idivl %ecx
movslq %eax, %rcx
movq -0x58(%rbp), %rax
movq (%rax), %rax
movsd (%rax,%rcx,8), %xmm0
addsd 0x8(%rax,%rcx,8), %xmm0
mulsd 0x4f71(%rip), %xmm0     # 0x15168
jmp 0x10212
leal -0x1(%r14), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movslq %eax, %rcx
movq -0x58(%rbp), %rax
movq (%rax), %rax
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x310(%rbx)
cmpl $0x2, %r14d
jl 0x10281
cvtsi2sd %r14d, %xmm0
mulsd 0x5973(%rip), %xmm0     # 0x15ba0
cvttsd2si %xmm0, %ecx
movslq %ecx, %rcx
movsd -0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x1a8(%rbx)
movsd 0x595e(%rip), %xmm0     # 0x15ba8
movsd -0x30(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movslq %ecx, %rcx
movsd -0x8(%rax,%rcx,8), %xmm0
movsd %xmm0, 0x198(%rbx)
mulsd 0x5940(%rip), %xmm1     # 0x15bb0
cvttsd2si %xmm1, %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,8), %rcx
addq $-0x8, %rcx
jmp 0x10298
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)
movsd -0x8(%rax,%r14,8), %xmm0
movsd %xmm0, 0x308(%rbx)
leaq -0x1d0(%rbp), %r14
movq %r14, %rdi
movq -0x60(%rbp), %rsi
callq 0x11d8a
movq %r14, %rsi
callq 0x10692
movsd %xmm0, 0x3b0(%rbx)
movq %r14, %rdi
callq 0xa4a8
leaq -0x1b8(%rbp), %r14
movq %r14, %rdi
movq -0x68(%rbp), %rsi
callq 0x11d8a
movq %r14, %rsi
callq 0x10692
movsd %xmm0, 0x3b8(%rbx)
movq %r14, %rdi
callq 0xa4a8
movl 0x16c(%rbx), %eax
subl 0x380(%rbx), %eax
movl %eax, 0x3a0(%rbx)
leaq 0x5930(%rip), %r14      # 0x15c5e
leaq 0x5a48(%rip), %rsi      # 0x15d7d
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x591e(%rip), %rsi      # 0x15c64
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5a0e(%rip), %rsi      # 0x15d65
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5901(%rip), %rsi      # 0x15c69
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58f7(%rip), %rsi      # 0x15c70
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58ee(%rip), %rsi      # 0x15c78
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58e4(%rip), %rsi      # 0x15c7f
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58da(%rip), %rsi      # 0x15c86
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58d4(%rip), %rsi      # 0x15c91
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58cb(%rip), %rsi      # 0x15c99
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58c2(%rip), %rsi      # 0x15ca1
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58ba(%rip), %rsi      # 0x15caa
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58b2(%rip), %rsi      # 0x15cb3
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58aa(%rip), %rsi      # 0x15cbc
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x58a2(%rip), %rsi      # 0x15cc5
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
leaq 0x5899(%rip), %rsi      # 0x15ccd
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
pushq $0xa
popq %rdi
callq 0x3250
movl 0x16c(%rbx), %esi
leaq 0x5881(%rip), %r14      # 0x15cd4
movq %r14, %rdi
xorl %eax, %eax
callq 0x3040
movsd 0x398(%rbx), %xmm0
leaq 0x57df(%rip), %rdi      # 0x15c4b
movb $0x1, %al
callq 0x3040
movsd 0x160(%rbx), %xmm0
leaq 0x5858(%rip), %r15      # 0x15cda
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 0x5767(%rip), %rdi      # 0x15ce2
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
leaq -0x98(%rbp), %rdi
jmp 0x1060e
jmp 0x10615
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
jmp 0x1060e
jmp 0x10615
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
jmp 0x1060e
jmp 0x10615
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
jmp 0x1060e
jmp 0x10615
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
jmp 0x1060e
jmp 0x10615
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
jmp 0x1060e
jmp 0x10615
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
jmp 0x1060e
jmp 0x10615
movq %rax, %rbx
leaq -0x178(%rbp), %rdi
jmp 0x1060e
jmp 0x10615
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
callq 0x30d0
jmp 0x10618
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3320