// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/WorldState.cpp
// Function: WorldStateUpdater::UpdateSpecificPlayer(PlayerObserver const&, int, bool)
void WorldStateUpdater::UpdateSpecificPlayer(const PlayerObserver &player,
                                             Unum unum, bool is_teammate) {
  //根据底层的parser类的信息
  //更新的有：位置，速度，身体角度，头部角度，手指向，是否铲球
  //原则是：只有结果是最新时才更新

  if (is_teammate) {
    Teammate(unum).SetIsAlive(true);
    Teammate(unum).UpdateGuessedTimes(0);
    //位置更新
    if (player.GetDir().time() == mpObserver->LatestSightTime()) {
      Vector vec = Polar2Vector(
          PlayerParam::instance().ConvertSightDist(player.Dist()),
          GetNeckGlobalDirFromSightDelay(mSightDelay) + player.Dir());
      vec = GetSelf().GetPos() + vec;
      Teammate(unum).UpdatePos(vec, mSightDelay, mPlayerConf);

      double eps = PlayerParam::instance().GetEpsInSight(player.Dist()) +
                   SelfState().GetPosEps();
      Teammate(unum).UpdatePosEps(eps);
    }

    //速度更新
    if (player.GetDirChg().time() == mpObserver->LatestSightTime()) {
      //公式：relPos = polar2vector(1.0, ballAngle)
      Vector vec = Polar2Vector(1.0, player.Dir());
      double distChg = player.DistChg();
      double dirChg = player.DirChg();
      double dist = player.Dist();
      //计算公式见USTC_Material 第七章
      //公式：relVel = (distChg * relPos.x() - (dirChg * PI / 180 * ballDist *
      //relPos.y()),distChg * rpos.y() + (dirChg * PI / 180 * ballDist *
      //relPos.x())
      Vector relvel =
          Vector(distChg * vec.X() - (dirChg * M_PI / 180 * dist * vec.Y()),
                 distChg * vec.Y() + (dirChg * M_PI / 180 * dist * vec.X()));
      //公式：ballVel = playerVel() + relVel.rotate(neckGlobalAngle)
      relvel = GetSelfVelFromSightDelay(mSightDelay) +
               relvel.Rotate(GetNeckGlobalDirFromSightDelay(mSightDelay));
      Teammate(unum).UpdateVel(relvel, mSightDelay, mPlayerConf);
    } else if (player.GetDir().time() ==
               mpObserver->LatestSightTime()) //只看到位置但是看不到速度的情况
    {
      //	if (player.Dist() < ServerParam::instance().visibleDistance() *
      //2)

      if (mpWorldState->GetHistory(1 + mSightDelay)) {
        int delay = mpWorldState->GetHistory(1 + mSightDelay)
                        ->Teammate(unum)
                        .GetPosDelay();
        if (delay < HistoryState::HISTORY_SIZE - 1 - mSightDelay) {
          Vector vel = Teammate(unum).GetPos() -
                       mpWorldState->GetHistory(1 + mSightDelay + delay)
                           ->Teammate(unum)
                           .GetPos();
          vel /= (delay + 1);

          // use  speed of self sense instead of pos of self sight to reduce the
          // error
          Vector self_vel = GetSelfVelFromSightDelay(mSightDelay);
          if (mpObserver->Sense().IsCollideWithBall() ||
              mpObserver->Sense().IsCollideWithPlayer() ||
              mpObserver->Sense().IsCollideWithPost()) {
            self_vel /= -0.1;
          }
          self_vel /= PlayerParam::instance()
                          .HeteroPlayer(SelfState().GetPlayerType())
                          .playerDecay();
          Vector self_vel_pos =
              SelfState().GetPos() - mpWorldState->GetHistory(1 + mSightDelay)
                                         ->Teammate(GetSelfUnum())
                                         .GetPos();
          vel += self_vel - self_vel_pos;

          double max_speed =
              PlayerParam::instance()
                  .HeteroPlayer(mpObserver->GetTeammateType(unum))
                  .effectiveSpeedMax();
          //根据速度大致猜测朝向 有视觉时会覆盖
          if (vel.Mod() > max_speed *
                              mpWorldState->GetTeammate(unum).GetPlayerDecay() *
                              0.8 &&
              GetTeammate(unum).IsBodyDirMayChanged()) {
            //					Logger::instance().GetTextLogger("bodydir") <<
            //mpWorldState->CurrentTime().T() << "\t" <<
            //mpWorldState->CurrentTime().S() << "\t" << unum << "\t" <<
            //vel.Dir() << "\t" << Teammate(unum).GetBodyDir() << "\n";
            Teammate(unum).UpdateBodyDir(vel.Dir(),
                                         GetTeammate(unum).GetBodyDirDelay(),
                                         GetTeammate(unum).GetBodyDirConf());
            //					Teammate(unum).UpdateBodyDirMayChanged(false);
          } else if (vel.Mod() <=
                     max_speed *
                         mpWorldState->GetTeammate(unum).GetPlayerDecay()) {
            Teammate(unum).UpdateBodyDirMayChanged(true);
          }

          //				Logger::instance().GetTextLogger("bodydir") <<
          //mpWorldState->CurrentTime().T() << "\t" <<
          //mpWorldState->CurrentTime().S() << "\t" << unum << "\t" <<
          //Teammate(unum).GetBodyDir() << "\n";
          if (vel.Mod() > max_speed) {
            vel = Polar2Vector(max_speed, vel.Dir());
          }

          vel *= PlayerParam::instance()
                     .HeteroPlayer(mpObserver->GetTeammateType(unum))
                     .playerDecay();

          Teammate(unum).UpdateVel(vel, mSightDelay, mPlayerConf);
        }
      }
    }

    //身体角度
    if (player.GetBodyDir().time() == mpObserver->LatestSightTime()) {
      AngleDeg angle = player.BodyDir();
      angle = angle + GetNeckGlobalDirFromSightDelay(mSightDelay);
      Teammate(unum).UpdateBodyDir(angle, mSightDelay, mPlayerConf);
      Teammate(unum).UpdateBodyDirMayChanged(false);
    }

    //头部角度
    if (player.GetHeadDir().time() == mpObserver->LatestSightTime()) {
      AngleDeg angle = player.HeadDir() - player.BodyDir();
      Teammate(unum).UpdateNeckDir(angle, mSightDelay, mPlayerConf);
    }

    //手指向
    if (player.GetIsPointing().time() == mpObserver->LatestSightTime()) {
      if (player.IsPointing()) {
        Teammate(unum).UpdateArmPoint(
            player.PointDir() + GetNeckGlobalDirFromSightDelay(mSightDelay),
            mSightDelay, mPlayerConf);
        Teammate(unum).SetIsPointing(true);
      } else {
        Teammate(unum).SetIsPointing(false);
      }
    }

    //是否铲球
    if (player.GetIsTackling().time() == mpObserver->LatestSightTime()) {
      if (player.IsTackling()) {
        if (Teammate(unum).GetTackleBan() == 0) {
          Teammate(unum).UpdateTackleBan(
              ServerParam::instance().tackleCycles() - 1);
        }
        // tacle速度一定为零
        Teammate(unum).UpdateVel(Vector(0, 0), mSightDelay, mPlayerConf);
      } else {
        Teammate(unum).UpdateTackleBan(0);
      }
    }

    //是否被铲倒
    if (player.GetIsLying().time() == mpObserver->LatestSightTime()) {
      if (player.IsLying()) {
        if (Teammate(unum).GetFoulChargedCycle() == 0) {
          Teammate(unum).UpdateFoulChargedCycle(
              ServerParam::instance().foulCycles() - 1);
        }
        Teammate(unum).UpdateVel(Vector(0, 0), mSightDelay, mPlayerConf);
      } else {
        Teammate(unum).UpdateFoulChargedCycle(0);
      }
    }

    Teammate(unum).UpdateCardType(mpObserver->GetTeammateCardType(unum));

    //是否上周期踢过球
    if (player.GetIsKicked().time() == mpObserver->LatestSightTime()) {
      Teammate(unum).UpdateKicked(player.IsKicked());
    }
  } else {
    Opponent(unum).SetIsAlive(true);
    Opponent(unum).UpdateGuessedTimes(0);
    //位置更新
    if (player.GetDir().time() == mpObserver->LatestSightTime()) {
      Vector vec = Polar2Vector(
          PlayerParam::instance().ConvertSightDist(player.Dist()),
          GetNeckGlobalDirFromSightDelay(mSightDelay) + player.Dir());
      vec = GetSelf().GetPos() + vec;
      Opponent(unum).UpdatePos(vec, mSightDelay, mPlayerConf);

      double eps = PlayerParam::instance().GetEpsInSight(player.Dist()) +
                   SelfState().GetPosEps();
      Opponent(unum).UpdatePosEps(eps);
    }

    //速度更新
    if (player.GetDirChg().time() == mpObserver->LatestSightTime()) {
      //公式：relPos = polar2vector(1.0, ballAngle)
      Vector vec = Polar2Vector(1.0, player.Dir());
      double distChg = player.DistChg();
      double dirChg = player.DirChg();
      double dist = player.Dist();
      //计算公式见USTC_Material 第七章
      //公式：relVel = (distChg * relPos.x() - (dirChg * PI / 180 * ballDist *
      //relPos.y()),distChg * rpos.y() + (dirChg * PI / 180 * ballDist *
      //relPos.x())
      Vector relvel =
          Vector(distChg * vec.X() - (dirChg * M_PI / 180 * dist * vec.Y()),
                 distChg * vec.Y() + (dirChg * M_PI / 180 * dist * vec.X()));

      //公式：ballVel = playerVel() + relVel.rotate(neckGlobalAngle)
      relvel = GetSelfVelFromSightDelay(mSightDelay) +
               relvel.Rotate(GetNeckGlobalDirFromSightDelay(mSightDelay));
      Opponent(unum).UpdateVel(relvel, mSightDelay, mPlayerConf);
    } else if (player.GetDir().time() ==
               mpObserver
                   ->LatestSightTime()) //只看到球的位置但是看不到速度的情况
    {
      if (mpWorldState->GetHistory(1 + mSightDelay)) {
        int delay = mpWorldState->GetHistory(1 + mSightDelay)
                        ->Opponent(unum)
                        .GetPosDelay();
        if (delay < HistoryState::HISTORY_SIZE - 1 - mSightDelay) {
          Vector vel = Opponent(unum).GetPos() -
                       mpWorldState->GetHistory(1 + mSightDelay + delay)
                           ->Opponent(unum)
                           .GetPos();
          vel /= (delay + 1);

          // use  speed of self sense instead of pos of self sight to reduce the
          // error
          Vector self_vel = GetSelfVelFromSightDelay();
          if (mpObserver->Sense().IsCollideWithBall() ||
              mpObserver->Sense().IsCollideWithPlayer() ||
              mpObserver->Sense().IsCollideWithPost()) {
            self_vel /= -0.1;
          }
          self_vel /= PlayerParam::instance()
                          .HeteroPlayer(SelfState().GetPlayerType())
                          .playerDecay();
          Vector self_vel_pos =
              SelfState().GetPos() - mpWorldState->GetHistory(1 + mSightDelay)
                                         ->Teammate(GetSelfUnum())
                                         .GetPos();
          vel += self_vel - self_vel_pos;

          double max_speed = GetOpponent(unum).GetEffectiveSpeedMax();

          //根据速度预测对手身体朝向
          if (vel.Mod() >
                  max_speed * GetOpponent(unum).GetPlayerDecay() * 0.8 &&
              GetOpponent(unum).IsBodyDirMayChanged()) {
            //					Logger::instance().GetTextLogger("bodydir") <<
            //mpWorldState->CurrentTime().T() << "\t" <<
            //mpWorldState->CurrentTime().S() << "\t" << unum + TEAMSIZE << "\t"
            //<< vel.Dir() << "\t" << Opponent(unum).GetBodyDir() << "\n";
            Opponent(unum).UpdateBodyDir(vel.Dir(),
                                         GetOpponent(unum).GetBodyDirDelay(),
                                         GetOpponent(unum).GetBodyDirConf());
            //					Opponent(unum).UpdateBodyDirMayChanged(false);
          } else if (vel.Mod() <=
                     max_speed * GetOpponent(unum).GetPlayerDecay()) {
            Opponent(unum).UpdateBodyDirMayChanged(true);
          }

          //				Logger::instance().GetTextLogger("bodydir") <<
          //mpWorldState->CurrentTime().T() << "\t" <<
          //mpWorldState->CurrentTime().S() << "\t" << unum + TEAMSIZE << "\t"
          //<< Opponent(unum).GetBodyDir() << "\n";
          if (vel.Mod() > max_speed) {
            vel = Polar2Vector(max_speed, vel.Dir());
          }
          vel *= GetOpponent(unum).GetPlayerDecay();

          Opponent(unum).UpdateVel(vel, mSightDelay, mPlayerConf);
        }
      }
    }

    //身体角度
    if (player.GetBodyDir().time() == mpObserver->LatestSightTime()) {
      AngleDeg angle = player.BodyDir();
      angle = angle + GetNeckGlobalDirFromSightDelay(mSightDelay);
      Opponent(unum).UpdateBodyDir(angle, mSightDelay, mPlayerConf);
      Opponent(unum).UpdateBodyDirMayChanged(false);
    }

    //头部角度
    if (player.GetHeadDir().time() == mpObserver->LatestSightTime()) {
      AngleDeg angle = player.HeadDir() - player.BodyDir();
      Opponent(unum).UpdateNeckDir(angle, mSightDelay, mPlayerConf);
    }

    //手指向
    if (player.GetIsPointing().time() == mpObserver->LatestSightTime()) {
      if (player.IsPointing()) {
        Opponent(unum).UpdateArmPoint(
            player.PointDir() + GetNeckGlobalDirFromSightDelay(mSightDelay),
            mSightDelay, mPlayerConf);
      }
    }

    //是否铲球
    if (player.GetIsTackling().time() == mpObserver->LatestSightTime()) {
      if (player.IsTackling()) {
        if (Opponent(unum).GetTackleBan() == 0) {
          Opponent(unum).UpdateTackleBan(
              ServerParam::instance().tackleCycles() - 1);
        }
        // tackle速度一定为零
        Opponent(unum).UpdateVel(Vector(0, 0), mSightDelay, mPlayerConf);
      } else {
        Opponent(unum).UpdateTackleBan(0);
      }
    }

    //是否被铲倒
    if (player.GetIsLying().time() == mpObserver->LatestSightTime()) {
      if (player.IsLying()) {
        if (Opponent(unum).GetFoulChargedCycle() == 0) {
          Opponent(unum).UpdateFoulChargedCycle(
              ServerParam::instance().foulCycles() - 1);
        }
        Opponent(unum).UpdateVel(Vector(0, 0), mSightDelay, mPlayerConf);
      } else {
        Opponent(unum).UpdateFoulChargedCycle(0);
      }
    }

    Opponent(unum).UpdateCardType(mpObserver->GetOpponentCardType(unum));

    //是否上周期踢过球
    if (player.GetIsKicked().time() == mpObserver->LatestSightTime()) {
      Opponent(unum).UpdateKicked(player.IsKicked());
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %r12
decl %edx
movslq %edx, %rax
leaq 0x10(%rsi), %r15
testl %ecx, %ecx
movq %rax, -0x60(%rbp)
je 0x5202b
imulq $0x178, %rax, %r13      # imm = 0x178
movb $0x1, 0x1ba(%r12,%r13)
andl $0x0, 0x118(%r12,%r13)
movq (%r14), %rcx
movl 0x14(%rcx), %eax
movl 0x18(%rcx), %ecx
cmpl %ecx, 0x1c(%rbx)
jne 0x51ed2
cmpl %eax, 0x18(%rbx)
jne 0x51ed2
callq 0x38d94
movsd (%rbx), %xmm0
movq %rax, %rdi
callq 0x5584e
leaq -0x68(%rbp), %r12
movsd %xmm0, (%r12)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x5593e
addsd 0x10(%rbx), %xmm0
leaq -0x70(%rbp), %rsi
movsd %xmm0, (%rsi)
movq %r12, %rdi
callq 0xd15b
leaq -0x50(%rbp), %rsi
movsd %xmm0, (%rsi)
movsd %xmm1, 0x8(%rsi)
movslq 0x14(%r14), %rax
movq 0x8(%r14), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
addsd -0xc8(%rax,%rcx), %xmm0
addsd -0xc0(%rax,%rcx), %xmm1
movsd %xmm0, (%rsi)
movsd %xmm1, 0x8(%rsi)
leaq (%rcx,%r13), %rdi
addq $0xa8, %rdi
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
callq 0xde1c
callq 0x38d94
movsd (%rbx), %xmm0
movq %rax, %rdi
callq 0x55720
movslq 0x14(%r14), %rax
movq 0x8(%r14), %r12
imulq $0x178, %rax, %rax      # imm = 0x178
addsd -0xa8(%rax,%r12), %xmm0
movsd %xmm0, 0xd0(%r12,%r13)
movq (%r14), %rcx
movl 0x14(%rcx), %eax
movl 0x18(%rcx), %ecx
cmpl %ecx, 0x3c(%rbx)
movq %r13, -0x58(%rbp)
jne 0x52282
cmpl %eax, 0x38(%rbx)
jne 0x52282
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
leaq -0x50(%rbp), %r12
movq %rax, (%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0xd15b
movsd 0x30(%rbx), %xmm2
mulsd 0x5196(%rip), %xmm2     # 0x570a8
divsd 0x514e(%rip), %xmm2     # 0x57068
mulsd (%rbx), %xmm2
movsd 0x20(%rbx), %xmm3
movapd %xmm3, %xmm4
mulsd %xmm1, %xmm3
mulsd %xmm2, %xmm1
mulsd %xmm0, %xmm4
subsd %xmm1, %xmm4
mulsd %xmm0, %xmm2
addsd %xmm2, %xmm3
movsd %xmm4, (%r12)
movsd %xmm3, 0x8(%r12)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x559b8
movsd %xmm0, -0x38(%rbp)
movsd %xmm1, -0x30(%rbp)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x5593e
leaq -0x68(%rbp), %rsi
movsd %xmm0, (%rsi)
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0xd02c
addsd -0x38(%rbp), %xmm0
addsd -0x30(%rbp), %xmm1
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
movq 0x8(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0xa8, %rdi
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
movq %r15, %rsi
callq 0xdde8
movq (%r14), %rax
movl 0x14(%rax), %edx
movl 0x18(%rax), %ecx
cmpl %ecx, 0x54(%rbx)
jne 0x5270b
cmpl %edx, 0x50(%rbx)
movq -0x58(%rbp), %r13
jne 0x5270f
movsd 0x48(%rbx), %xmm0
movsd %xmm0, -0x30(%rbp)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x5593e
addsd -0x30(%rbp), %xmm0
movq 0x8(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0xa8, %rdi
movl 0x28(%r14), %esi
movsd 0x18(%r14), %xmm1
callq 0x382a6
movq 0x8(%r14), %rax
movb $0x0, 0x21c(%rax,%r13)
movq (%r14), %rax
movl 0x14(%rax), %edx
movl 0x18(%rax), %ecx
jmp 0x5270f
imulq $0x178, %rax, %r13      # imm = 0x178
movb $0x1, 0x11e2(%r12,%r13)
andl $0x0, 0x1140(%r12,%r13)
movq (%r14), %rcx
movl 0x14(%rcx), %eax
movl 0x18(%rcx), %ecx
cmpl %ecx, 0x1c(%rbx)
jne 0x52129
cmpl %eax, 0x18(%rbx)
jne 0x52129
callq 0x38d94
movsd (%rbx), %xmm0
movq %rax, %rdi
callq 0x5584e
leaq -0x68(%rbp), %r12
movsd %xmm0, (%r12)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x5593e
addsd 0x10(%rbx), %xmm0
leaq -0x70(%rbp), %rsi
movsd %xmm0, (%rsi)
movq %r12, %rdi
callq 0xd15b
leaq -0x50(%rbp), %rsi
movsd %xmm0, (%rsi)
movsd %xmm1, 0x8(%rsi)
movslq 0x14(%r14), %rax
movq 0x8(%r14), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
addsd -0xc8(%rax,%rcx), %xmm0
addsd -0xc0(%rax,%rcx), %xmm1
movsd %xmm0, (%rsi)
movsd %xmm1, 0x8(%rsi)
leaq (%rcx,%r13), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
callq 0xde1c
callq 0x38d94
movsd (%rbx), %xmm0
movq %rax, %rdi
callq 0x55720
movslq 0x14(%r14), %rax
movq 0x8(%r14), %r12
imulq $0x178, %rax, %rax      # imm = 0x178
addsd -0xa8(%r12,%rax), %xmm0
movsd %xmm0, 0x10f8(%r12,%r13)
movq (%r14), %rcx
movl 0x14(%rcx), %eax
movl 0x18(%rcx), %ecx
cmpl %ecx, 0x3c(%rbx)
movq %r13, -0x58(%rbp)
jne 0x524e4
cmpl %eax, 0x38(%rbx)
jne 0x524e4
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
leaq -0x50(%rbp), %r12
movq %rax, (%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0xd15b
movsd 0x30(%rbx), %xmm2
mulsd 0x4f3f(%rip), %xmm2     # 0x570a8
divsd 0x4ef7(%rip), %xmm2     # 0x57068
mulsd (%rbx), %xmm2
movsd 0x20(%rbx), %xmm3
movapd %xmm3, %xmm4
mulsd %xmm1, %xmm3
mulsd %xmm2, %xmm1
mulsd %xmm0, %xmm4
subsd %xmm1, %xmm4
mulsd %xmm0, %xmm2
addsd %xmm2, %xmm3
movsd %xmm4, (%r12)
movsd %xmm3, 0x8(%r12)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x559b8
movsd %xmm0, -0x38(%rbp)
movsd %xmm1, -0x30(%rbp)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x5593e
leaq -0x68(%rbp), %rsi
movsd %xmm0, (%rsi)
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0xd02c
addsd -0x38(%rbp), %xmm0
addsd -0x30(%rbp), %xmm1
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
movq 0x8(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
movq %r15, %rsi
callq 0xdde8
movq (%r14), %rax
movl 0x14(%rax), %edx
movl 0x18(%rax), %ecx
cmpl %ecx, 0x54(%rbx)
jne 0x52758
cmpl %edx, 0x50(%rbx)
movq -0x58(%rbp), %r13
jne 0x5275c
movsd 0x48(%rbx), %xmm0
movsd %xmm0, -0x30(%rbp)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x5593e
addsd -0x30(%rbp), %xmm0
movq 0x8(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
movl 0x28(%r14), %esi
movsd 0x18(%r14), %xmm1
callq 0x382a6
movq 0x8(%r14), %rax
movb $0x0, 0x1244(%rax,%r13)
movq (%r14), %rax
movl 0x14(%rax), %edx
movl 0x18(%rax), %ecx
jmp 0x5275c
cmpl %ecx, 0x1c(%rbx)
jne 0x51fb8
cmpl %eax, 0x18(%rbx)
jne 0x51fb8
movl 0x28(%r14), %eax
movq %rax, -0x30(%rbp)
leal 0x1(%rax), %r13d
movq %r12, %rdi
movl %r13d, %esi
callq 0x4c81e
testq %rax, %rax
je 0x51fb8
movq -0x58(%rbp), %rcx
movl 0xc0(%rax,%rcx), %r15d
pushq $0x9
popq %rax
subl -0x30(%rbp), %eax
cmpl %eax, %r15d
jge 0x51fb8
addl %r15d, %r13d
movq %r12, %rdi
movl %r13d, %esi
callq 0x4c81e
movq -0x58(%rbp), %rcx
movsd 0xb0(%r12,%rcx), %xmm0
movsd 0xb8(%r12,%rcx), %xmm1
subsd 0xb0(%rax,%rcx), %xmm0
subsd 0xb8(%rax,%rcx), %xmm1
incl %r15d
cvtsi2sd %r15d, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, -0x50(%rbp)
divsd %xmm2, %xmm1
movsd %xmm1, -0x48(%rbp)
movq %r14, %rdi
movq -0x30(%rbp), %rsi
callq 0x559b8
movq (%r14), %rax
cmpb $0x0, 0x1b2(%rax)
jne 0x5234f
cmpb $0x0, 0x1b1(%rax)
jne 0x5234f
cmpb $0x1, 0x1b0(%rax)
jne 0x52d2c
movsd 0x6241(%rip), %xmm2     # 0x58598
divsd %xmm2, %xmm0
movsd %xmm0, -0x38(%rbp)
divsd %xmm2, %xmm1
movsd %xmm1, -0x30(%rbp)
movq -0x60(%rbp), %r13
callq 0x38d94
movslq 0x14(%r14), %rcx
movq 0x8(%r14), %r15
imulq $0x178, %rcx, %r12      # imm = 0x178
movslq 0x44(%r15,%r12), %rcx
movq 0x5c38(%rax), %rax
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3020(%rax,%rcx), %xmm0
movsd -0x38(%rbp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, -0x38(%rbp)
movsd -0x30(%rbp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movl 0x28(%r14), %esi
incl %esi
movq %r15, %rdi
callq 0x4c81e
movsd -0xc8(%r15,%r12), %xmm0
movsd -0xc0(%r15,%r12), %xmm1
subsd -0xc8(%rax,%r12), %xmm0
subsd -0xc0(%rax,%r12), %xmm1
movsd -0x38(%rbp), %xmm2
subsd %xmm0, %xmm2
movsd -0x30(%rbp), %xmm0
subsd %xmm1, %xmm0
addsd -0x50(%rbp), %xmm2
movsd %xmm2, -0x50(%rbp)
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
callq 0x38d94
movq (%r14), %rcx
movq 0x5c38(%rax), %rax
movslq 0x3c(%rcx,%r13,4), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3098(%rax,%rcx), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd %xmm0, -0x68(%rbp)
movsd -0x50(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movq 0x8(%r14), %rax
movq -0x58(%rbp), %r12
leaq (%rax,%r12), %rdi
addq $0xa8, %rdi
callq 0xd344
movsd (%rax), %xmm0
mulsd -0x30(%rbp), %xmm0
mulsd 0x6115(%rip), %xmm0     # 0x585a0
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movq 0x8(%r14), %rax
jbe 0x52b4e
cmpb $0x1, 0x21c(%rax,%r12)
jne 0x52b4e
leaq (%rax,%r12), %r15
addq $0xa8, %r15
leaq -0x50(%rbp), %rdi
callq 0xcd30
movq 0x8(%r14), %rax
movl 0x160(%rax,%r12), %esi
movsd 0x168(%rax,%r12), %xmm1
movq %r15, %rdi
callq 0x382a6
jmp 0x52b9d
cmpl %ecx, 0x1c(%rbx)
jne 0x5220f
cmpl %eax, 0x18(%rbx)
jne 0x5220f
movl 0x28(%r14), %r13d
leal 0x1(%r13), %r15d
movq %r12, %rdi
movl %r15d, %esi
callq 0x4c81e
testq %rax, %rax
je 0x5220f
movq -0x58(%rbp), %rcx
movl 0x10e8(%rax,%rcx), %ecx
pushq $0x9
popq %rax
subl %r13d, %eax
cmpl %eax, %ecx
jge 0x5220f
addl %ecx, %r15d
movq %r12, %rdi
movl %r15d, %esi
movl %ecx, %r15d
callq 0x4c81e
movq -0x58(%rbp), %r13
movsd 0x10d8(%r12,%r13), %xmm0
movsd 0x10e0(%r12,%r13), %xmm1
subsd 0x10d8(%rax,%r13), %xmm0
subsd 0x10e0(%rax,%r13), %xmm1
incl %r15d
cvtsi2sd %r15d, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, -0x50(%rbp)
divsd %xmm2, %xmm1
movsd %xmm1, -0x48(%rbp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x559b8
movq (%r14), %rax
cmpb $0x0, 0x1b2(%rax)
jne 0x525ae
cmpb $0x0, 0x1b1(%rax)
jne 0x525ae
cmpb $0x1, 0x1b0(%rax)
jne 0x52d3f
movsd 0x5fe2(%rip), %xmm2     # 0x58598
divsd %xmm2, %xmm0
movsd %xmm0, -0x30(%rbp)
divsd %xmm2, %xmm1
movsd %xmm1, -0x38(%rbp)
callq 0x38d94
movslq 0x14(%r14), %rcx
movq 0x8(%r14), %r15
imulq $0x178, %rcx, %r12      # imm = 0x178
movslq 0x44(%r15,%r12), %rcx
movq 0x5c38(%rax), %rax
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3020(%rax,%rcx), %xmm0
movsd -0x30(%rbp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movsd -0x38(%rbp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, -0x38(%rbp)
movl 0x28(%r14), %esi
incl %esi
movq %r15, %rdi
callq 0x4c81e
movsd -0xc8(%r15,%r12), %xmm0
movsd -0xc0(%r15,%r12), %xmm1
subsd -0xc8(%rax,%r12), %xmm0
movsd -0x30(%rbp), %xmm2
subsd %xmm0, %xmm2
subsd -0xc0(%rax,%r12), %xmm1
addsd -0x50(%rbp), %xmm2
movsd -0x38(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm2, -0x50(%rbp)
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
leaq 0x10d0(%r15,%r13), %rdi
movsd 0x60(%rdi), %xmm1
movsd %xmm1, -0x30(%rbp)
movsd %xmm1, -0x68(%rbp)
mulsd %xmm0, %xmm0
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
sqrtsd %xmm2, %xmm0
movsd %xmm0, -0x38(%rbp)
callq 0xd344
movsd (%rax), %xmm0
mulsd -0x30(%rbp), %xmm0
mulsd 0x5eee(%rip), %xmm0     # 0x585a0
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movq 0x8(%r14), %rax
jbe 0x52c4b
cmpb $0x1, 0x1244(%rax,%r13)
jne 0x52c4b
leaq (%rax,%r13), %r15
addq $0x10d0, %r15           # imm = 0x10D0
leaq -0x50(%rbp), %rdi
callq 0xcd30
movq 0x8(%r14), %rax
movl 0x1188(%rax,%r13), %esi
movsd 0x1190(%rax,%r13), %xmm1
movq %r15, %rdi
callq 0x382a6
jmp 0x52c97
movq -0x58(%rbp), %r13
cmpl %ecx, 0x64(%rbx)
jne 0x527a8
cmpl %edx, 0x60(%rbx)
movq -0x60(%rbp), %r12
jne 0x527ac
movsd 0x58(%rbx), %xmm0
subsd 0x48(%rbx), %xmm0
movq 0x8(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0xa8, %rdi
movl 0x28(%r14), %esi
movsd 0x18(%r14), %xmm1
callq 0x382f8
movq (%r14), %rax
movl 0x14(%rax), %edx
movl 0x18(%rax), %ecx
jmp 0x527ac
movq -0x58(%rbp), %r13
cmpl %ecx, 0x64(%rbx)
jne 0x5282f
cmpl %edx, 0x60(%rbx)
movq -0x60(%rbp), %r12
jne 0x52833
movsd 0x58(%rbx), %xmm0
subsd 0x48(%rbx), %xmm0
movq 0x8(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
movl 0x28(%r14), %esi
movsd 0x18(%r14), %xmm1
callq 0x382f8
movq (%r14), %rax
movl 0x14(%rax), %edx
movl 0x18(%rax), %ecx
jmp 0x52833
movq -0x60(%rbp), %r12
cmpl %ecx, 0x88(%rbx)
jne 0x5291c
cmpl %edx, 0x84(%rbx)
jne 0x5291c
movl $0xa8, %r15d
addq 0x8(%r14), %r15
cmpb $0x1, 0x80(%rbx)
jne 0x52913
addq %r13, %r15
movsd 0xa0(%rbx), %xmm0
movsd %xmm0, -0x60(%rbp)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x5593e
addsd -0x60(%rbp), %xmm0
movl 0x28(%r14), %esi
movsd 0x18(%r14), %xmm1
pushq $-0x1
popq %rcx
xorpd %xmm2, %xmm2
movq %r15, %rdi
movl %ecx, %edx
callq 0x3834a
movq 0x8(%r14), %rax
movb $0x1, 0x1b8(%rax,%r13)
movq (%r14), %rax
movl 0x18(%rax), %ecx
jmp 0x5291c
movq -0x60(%rbp), %r12
cmpl %ecx, 0x88(%rbx)
jne 0x5289d
cmpl %edx, 0x84(%rbx)
jne 0x5289d
cmpb $0x1, 0x80(%rbx)
jne 0x5289d
movq 0x8(%r14), %rax
leaq (%rax,%r13), %r15
addq $0x10d0, %r15           # imm = 0x10D0
movsd 0xa0(%rbx), %xmm0
movsd %xmm0, -0x60(%rbp)
movl 0x28(%r14), %esi
movq %r14, %rdi
callq 0x5593e
addsd -0x60(%rbp), %xmm0
movl 0x28(%r14), %esi
movsd 0x18(%r14), %xmm1
pushq $-0x1
popq %rcx
xorpd %xmm2, %xmm2
movq %r15, %rdi
movl %ecx, %edx
callq 0x3834a
movq (%r14), %rax
movl 0x14(%rax), %edx
movl 0x18(%rax), %ecx
cmpl %ecx, 0x70(%rbx)
jne 0x52999
cmpl %edx, 0x6c(%rbx)
jne 0x52999
movq 0x8(%r14), %rdx
leaq (%rdx,%r13), %r15
addq $0x1198, %r15           # imm = 0x1198
cmpb $0x1, 0x68(%rbx)
jne 0x52995
cmpl $0x0, (%r15)
jne 0x528e2
callq 0x3db2c
movl 0x3320(%rax), %eax
decl %eax
movl %eax, (%r15)
movq 0x8(%r14), %rdx
leaq (%rdx,%r13), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
xorpd %xmm0, %xmm0
leaq -0x50(%rbp), %rsi
movapd %xmm0, (%rsi)
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
callq 0xdde8
movq (%r14), %rax
movl 0x18(%rax), %ecx
jmp 0x52999
movb $0x0, 0x110(%r15,%r13)
cmpl %ecx, 0x70(%rbx)
jne 0x52a1c
movl 0x14(%rax), %edx
cmpl %edx, 0x6c(%rbx)
jne 0x52a1c
movq 0x8(%r14), %rdx
leaq (%rdx,%r13), %r15
addq $0x170, %r15            # imm = 0x170
cmpb $0x1, 0x68(%rbx)
jne 0x52a18
cmpl $0x0, (%r15)
jne 0x52964
callq 0x3db2c
movl 0x3320(%rax), %eax
decl %eax
movl %eax, (%r15)
movq 0x8(%r14), %rdx
leaq (%rdx,%r13), %rdi
addq $0xa8, %rdi
xorpd %xmm0, %xmm0
leaq -0x50(%rbp), %rsi
movapd %xmm0, (%rsi)
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
callq 0xdde8
movq (%r14), %rax
movl 0x18(%rax), %ecx
jmp 0x52a1c
andl $0x0, (%r15)
cmpl %ecx, 0x94(%rbx)
jne 0x52a9c
movl 0x14(%rax), %ecx
cmpl %ecx, 0x90(%rbx)
jne 0x52a9c
movq 0x8(%r14), %rcx
leaq (%rcx,%r13), %r15
addq $0x11f4, %r15           # imm = 0x11F4
cmpb $0x1, 0x8c(%rbx)
jne 0x52a98
cmpl $0x0, (%r15)
jne 0x529ea
callq 0x3db2c
movl 0x33e8(%rax), %eax
decl %eax
movl %eax, (%r15)
movq 0x8(%r14), %rcx
leaq (%rcx,%r13), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
xorpd %xmm0, %xmm0
leaq -0x50(%rbp), %rsi
movapd %xmm0, (%rsi)
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
callq 0xdde8
movq (%r14), %rax
jmp 0x52a9c
andl $0x0, (%r15)
cmpl %ecx, 0x94(%rbx)
jne 0x52ae8
movl 0x14(%rax), %ecx
cmpl %ecx, 0x90(%rbx)
jne 0x52ae8
movq 0x8(%r14), %rcx
leaq (%rcx,%r13), %r15
addq $0x1cc, %r15            # imm = 0x1CC
cmpb $0x1, 0x8c(%rbx)
jne 0x52ae4
cmpl $0x0, (%r15)
jne 0x52a6d
callq 0x3db2c
movl 0x33e8(%rax), %eax
decl %eax
movl %eax, (%r15)
movq 0x8(%r14), %rcx
leaq (%rcx,%r13), %rdi
addq $0xa8, %rdi
xorpd %xmm0, %xmm0
leaq -0x50(%rbp), %rsi
movapd %xmm0, (%rsi)
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
callq 0xdde8
movq (%r14), %rax
jmp 0x52ae8
andl $0x0, (%r15)
movq 0x8(%r14), %rcx
movl 0xec(%rax,%r12,4), %edx
movl 0x1240(%rcx,%r13), %esi
testl %esi, %esi
je 0x52abe
cmpl $0x2, %edx
jne 0x52acb
cmpl $0x1, %esi
jne 0x52acb
leaq (%rcx,%r13), %rsi
addq $0x1240, %rsi           # imm = 0x1240
movl %edx, (%rsi)
movl 0x7c(%rbx), %edx
cmpl 0x18(%rax), %edx
jne 0x52b3f
movl 0x14(%rax), %eax
cmpl %eax, 0x78(%rbx)
jne 0x52b3f
addq $0x10d0, %rcx           # imm = 0x10D0
jmp 0x52b2e
andl $0x0, (%r15)
movq 0x8(%r14), %rcx
movl 0xc0(%rax,%r12,4), %edx
movl 0x218(%rcx,%r13), %esi
testl %esi, %esi
je 0x52b0a
cmpl $0x2, %edx
jne 0x52b17
cmpl $0x1, %esi
jne 0x52b17
leaq (%rcx,%r13), %rsi
addq $0x218, %rsi            # imm = 0x218
movl %edx, (%rsi)
movl 0x7c(%rbx), %edx
cmpl 0x18(%rax), %edx
jne 0x52b3f
movl 0x14(%rax), %eax
cmpl %eax, 0x78(%rbx)
jne 0x52b3f
addq $0xa8, %rcx
movb 0x74(%rbx), %al
imulq $0x178, %r12, %rdx      # imm = 0x178
movb %al, 0x111(%rcx,%rdx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsd -0x50(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq (%rax,%r12), %rdi
addq $0xa8, %rdi
callq 0xd344
movsd (%rax), %xmm0
mulsd -0x30(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
jb 0x52b9d
movq 0x8(%r14), %rax
movq -0x58(%rbp), %rcx
movb $0x1, 0x21c(%rax,%rcx)
movsd -0x50(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x52be6
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0xcd30
leaq -0x70(%rbp), %rsi
movsd %xmm0, (%rsi)
leaq -0x68(%rbp), %rdi
callq 0xd15b
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
callq 0x38d94
movq (%r14), %rcx
movq 0x5c38(%rax), %rax
movslq 0x3c(%rcx,%r13,4), %rcx
imulq $0x3700, %rcx, %rcx     # imm = 0x3700
movsd 0x3020(%rax,%rcx), %xmm0
leaq -0x50(%rbp), %rsi
mulsd (%rsi), %xmm0
movsd %xmm0, (%rsi)
movsd 0x3020(%rax,%rcx), %xmm0
mulsd 0x8(%rsi), %xmm0
movsd %xmm0, 0x8(%rsi)
movq 0x8(%r14), %rax
movq -0x58(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq $0xa8, %rdi
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
jmp 0x51fb3
movsd -0x50(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq (%rax,%r13), %rdi
addq $0x10d0, %rdi           # imm = 0x10D0
callq 0xd344
movsd (%rax), %xmm0
mulsd -0x30(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
jb 0x52c97
movq 0x8(%r14), %rax
movb $0x1, 0x1244(%rax,%r13)
movsd -0x50(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x52ce0
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0xcd30
leaq -0x70(%rbp), %rsi
movsd %xmm0, (%rsi)
leaq -0x68(%rbp), %rdi
callq 0xd15b
movsd %xmm0, (%r15)
movsd %xmm1, 0x8(%r15)
movq 0x8(%r14), %rdi
addq %r13, %rdi
movl $0x10d0, %r15d          # imm = 0x10D0
addq %r15, %rdi
callq 0xd344
movsd (%rax), %xmm0
leaq -0x50(%rbp), %rsi
mulsd (%rsi), %xmm0
movsd %xmm0, (%rsi)
movsd (%rax), %xmm0
mulsd 0x8(%rsi), %xmm0
movsd %xmm0, 0x8(%rsi)
movq 0x8(%r14), %rdi
addq %r13, %rdi
addq %r15, %rdi
movl 0x28(%r14), %edx
movsd 0x18(%r14), %xmm0
jmp 0x5220a
movq -0x60(%rbp), %r13
movsd %xmm1, -0x30(%rbp)
movsd %xmm0, -0x38(%rbp)
jmp 0x5236d
movsd %xmm0, -0x30(%rbp)
jmp 0x525c3
nop