// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Dasher.cpp
// Function: Dasher::CycleNeedToPointWithCertainPosture(PlayerState const&, Vector, bool, double*)
int Dasher::CycleNeedToPointWithCertainPosture(const PlayerState &player,
                                               Vector target,
                                               const bool inverse,
                                               double *buf) {
  int cycle = 0; //用的周期

  const double &decay = player.GetPlayerDecay();
  const double &speedmax = player.GetEffectiveSpeedMax();
  const double &stamina = player.GetStamina();
  const double &stamina_inc_max = player.GetStaminaIncMax();
  const double &dash_max = ServerParam::instance().maxDashPower();
  const Vector &pos = player.GetPos();
  const Vector &vel = player.GetVel();

  const double accrate = player.GetDashPowerRate() * player.GetEffort();
  double speed = vel.Mod();

  const Vector predict_pos_1 = pos + vel;
  const Vector predict_pos_2 = predict_pos_1 + vel * decay;
  const double dir = (target - pos).Dir();
  double dis = (target - predict_pos_1).Mod();

  const double kick_area = player.IsGoalie()
                               ? ServerParam::instance().catchAreaLength()
                               : (player.GetKickableArea() - GETBALL_BUFFER);

  if (dis <= kick_area) {
    dis = pos.Dist(target);
    if (buf)
      *buf = 0;
    return 1;
  }

  double facing;
  if (player.IsBodyDirValid()) {
    facing = player.GetBodyDir();
  } else if (speed > 0.26) {
    facing = vel.Dir();
  } else {
    facing = dir; //认为不用转身
  }

  double diffang = fabs(GetNormalizeAngleDeg(dir - facing));
  const double oneturnang = player.GetMaxTurnAngle();
  const double stamina_recovery_thr = ServerParam::instance().recoverDecThr() *
                                      ServerParam::instance().staminaMax();

  double angbuf = FLOAT_EPS;
  angbuf = ASin(kick_area / dis);
  angbuf = Max(angbuf, 15.0);

  if (inverse) {
    diffang = 180.0 - diffang;
    facing = GetNormalizeAngleDeg(180.0 + facing);
  }

  // I 调整阶段
  if (diffang <= angbuf) { //不需要转身
    target = (target - pos).Rotate(-facing);
    dis = fabs(target.X());
    double y = fabs(target.Y());
    if (y < kick_area) {
      dis -= sqrt(kick_area * kick_area - y * y);
    }
    speed *= Cos(vel.Dir() - facing); //身体方向上的投影
  } else if (diffang <= oneturnang) {
    cycle += 1;
    target -= predict_pos_1;
    speed *= Cos(vel.Dir() - dir); //取得目标方向的投影
    speed *=
        decay; //进行投影.垂直方向1个周期后衰减到10+厘米了,并且在1turn时可加入考虑修正掉
    dis = target.Mod();
    dis -= kick_area;
  } else { //认为转身两下（不细致）
    cycle += 2;
    target -= predict_pos_2;
    speed *= Cos(vel.Dir() - dir); //取得目标方向的投影
    speed *=
        decay *
        decay; //进行投影.垂直方向1个周期后衰减到10+厘米了,并且在1turn时可加入考虑修正掉
    dis = target.Mod();
    dis -= kick_area;
  }

  if (dis <= 0) {
    if (buf != NULL) {
      *buf = -dis / (speed / decay);
      *buf = Min(*buf, 0.99);
    }
    return Max(cycle, 0);
  }

  // II 加速 & 消耗体力阶段
  const double stamina_used_per_cycle = inverse ? dash_max * 2.0 : dash_max;
  const int full_cyc =
      int((stamina - stamina_recovery_thr) /
          (stamina_used_per_cycle - stamina_inc_max)); //满体力阶段
  int acc_cyc = 0;                                     //加速阶段
  const double speedmax_thr = speedmax * decay * 0.98;
  const double accmax = accrate * dash_max;

  while (acc_cyc < full_cyc && speed < speedmax_thr) {
    speed += accmax;
    if (speed > speedmax) {
      speed = speedmax;
    }
    dis -= speed;
    if (dis <= 0) { //还没加速到最大就跑到了...
      cycle += acc_cyc + 1;
      if (buf != NULL) {
        *buf = -dis / (speed / decay);
        *buf = Min(*buf, 0.99);
      }
      return Max(cycle, 0);
    }
    speed *= decay;
    ++acc_cyc;
  }

  cycle += acc_cyc;

  // III 满体匀速阶段
  int aver_cyc = full_cyc - acc_cyc;
  double aver_cyc_dis = aver_cyc * speedmax;
  if (aver_cyc_dis >= dis) {
    if (buf != NULL) {
      double realcyc = cycle + dis / speedmax;
      cycle = int(ceil(realcyc));
      *buf = cycle - realcyc;
      return Max(cycle, 0);

    } else {
      cycle = int(ceil(cycle + dis / speedmax));
      return Max(cycle, 0);
    }
  } else {
    cycle += aver_cyc;
    dis -= aver_cyc_dis;
  }

  // IV 没体(0消耗)减速阶段
  double acc_tired = stamina_inc_max * accrate;
  double speed_tired = acc_tired / (1 - decay);
  double speed_tired_thr = speed_tired * decay;
  speed *= decay;
  while (dis > 0 && fabs(speed - speed_tired_thr) > 0.004) {
    speed += acc_tired;
    dis -= speed;
    speed *= decay;
    ++cycle;
  }

  if (dis <= 0) {
    if (buf != NULL) {
      *buf = -dis / (speed / decay);
      *buf = Min(*buf, 0.99);
    }
    return Max(cycle, 0);
  }

  // V 没体(0消耗)匀速阶段

  if (buf != NULL) {
    double realcyc = cycle + dis / speed_tired;
    cycle = int(ceil(realcyc));
    *buf = cycle - realcyc;
    return Max(cycle, 0);
  } else {
    cycle = cycle + int(ceil(dis / speed_tired));
    return Max(cycle, 0);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movb %dl, %al
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
andb $0x1, %al
movb %al, -0x29(%rbp)
movq %rcx, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x28(%rbp), %rdi
callq 0x11740
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1d810
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
callq 0x10cd0
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
callq 0x328b0
movq %rax, -0x60(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x12b60
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rdi
callq 0x10a80
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rdi
callq 0x11670
movsd (%rax), %xmm0
movsd %xmm0, -0x218(%rbp)
movq -0x28(%rbp), %rdi
callq 0x11650
movsd -0x218(%rbp), %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x78(%rbp), %rdi
callq 0x104e0
movsd %xmm0, -0x88(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x11360
movsd %xmm0, -0x98(%rbp)
movsd %xmm1, -0x90(%rbp)
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x13320
movsd %xmm0, -0xb8(%rbp)
movsd %xmm1, -0xb0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x11360
movsd %xmm0, -0xa8(%rbp)
movsd %xmm1, -0xa0(%rbp)
movq -0x70(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0x110a0
movsd %xmm0, -0xd0(%rbp)
movsd %xmm1, -0xc8(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x10520
movsd %xmm0, -0xc0(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x110a0
movsd %xmm0, -0xe8(%rbp)
movsd %xmm1, -0xe0(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x104e0
movsd %xmm0, -0xd8(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1d780
testb $0x1, %al
jne 0x2f0f3
jmp 0x2f10e
callq 0x855e0
movq %rax, %rdi
callq 0x328f0
movsd (%rax), %xmm0
movsd %xmm0, -0x220(%rbp)
jmp 0x2f12c
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movsd (%rax), %xmm0
subsd 0xcf514(%rip), %xmm0    # 0xfe638
movsd %xmm0, -0x220(%rbp)
movsd -0x220(%rbp), %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0xd8(%rbp), %xmm1
movsd -0xf0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2f185
movq -0x70(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1d6d0
movsd %xmm0, -0xd8(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x2f179
movq -0x38(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2fc73
movq -0x28(%rbp), %rdi
callq 0x32880
testb $0x1, %al
jne 0x2f194
jmp 0x2f1ab
movq -0x28(%rbp), %rdi
callq 0x11170
movsd (%rax), %xmm0
movsd %xmm0, -0xf8(%rbp)
jmp 0x2f1e6
movsd -0x88(%rbp), %xmm0
movsd 0x92aa5(%rip), %xmm1    # 0xc1c60
ucomisd %xmm1, %xmm0
jbe 0x2f1d4
movq -0x78(%rbp), %rdi
callq 0x10520
movsd %xmm0, -0xf8(%rbp)
jmp 0x2f1e4
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
jmp 0x2f1e6
movsd -0xc0(%rbp), %xmm0
subsd -0xf8(%rbp), %xmm0
movsd 0x91e32(%rip), %xmm1    # 0xc1030
movsd %xmm1, -0x108(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x116b0
movaps 0x91e47(%rip), %xmm1    # 0xc1060
pand %xmm1, %xmm0
movsd %xmm0, -0x100(%rbp)
movq -0x28(%rbp), %rdi
callq 0x325d0
movsd %xmm0, -0x110(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x32910
movsd (%rax), %xmm0
movsd %xmm0, -0x228(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x32930
movsd -0x228(%rbp), %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, -0x118(%rbp)
movsd 0x91d90(%rip), %xmm0    # 0xc1008
movsd %xmm0, -0x120(%rbp)
movsd -0xf0(%rbp), %xmm0
divsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x128(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x32500
movsd %xmm0, -0x120(%rbp)
movsd 0x9246c(%rip), %xmm0    # 0xc1720
movsd %xmm0, -0x130(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x12a90
movsd (%rax), %xmm0
movsd %xmm0, -0x120(%rbp)
testb $0x1, -0x29(%rbp)
je 0x2f32d
movsd 0x91d3f(%rip), %xmm0    # 0xc1028
subsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movsd 0x91d27(%rip), %xmm0    # 0xc1028
addsd -0xf8(%rbp), %xmm0
movsd 0x91d1f(%rip), %xmm1    # 0xc1030
movsd %xmm1, -0x138(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x116b0
movsd %xmm0, -0xf8(%rbp)
movsd -0x100(%rbp), %xmm1
movsd -0x120(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2f4af
movq -0x70(%rbp), %rsi
leaq -0x18(%rbp), %rdi
callq 0x110a0
movsd %xmm0, -0x158(%rbp)
movsd %xmm1, -0x150(%rbp)
movsd -0xf8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x160(%rbp)
leaq -0x158(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x11110
movsd %xmm0, -0x148(%rbp)
movsd %xmm1, -0x140(%rbp)
movq -0x148(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x140(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x176f0
movsd (%rax), %xmm0
movaps 0x91c88(%rip), %xmm1    # 0xc1060
pand %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x17700
movsd (%rax), %xmm0
movaps 0x91c68(%rip), %xmm1    # 0xc1060
pand %xmm1, %xmm0
movsd %xmm0, -0x168(%rbp)
movsd -0x168(%rbp), %xmm1
movsd -0xf0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x2f475
movsd -0xf0(%rbp), %xmm0
movsd -0xf0(%rbp), %xmm2
movsd -0x168(%rbp), %xmm1
mulsd -0x168(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0xa470
movaps %xmm0, %xmm1
movsd -0xd8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movq -0x78(%rbp), %rdi
callq 0x10520
subsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0x170(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x32950
mulsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
jmp 0x2f5fe
movsd -0x100(%rbp), %xmm1
movsd -0x110(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2f561
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x32970
movq -0x78(%rbp), %rdi
callq 0x10520
subsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x178(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x32950
mulsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
mulsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x104e0
movsd %xmm0, -0xd8(%rbp)
movsd -0xf0(%rbp), %xmm1
movsd -0xd8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
jmp 0x2f5fc
movl -0x3c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x3c(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x32970
movq -0x78(%rbp), %rdi
callq 0x10520
subsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x180(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x32950
mulsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
movq -0x48(%rbp), %rax
mulsd (%rax), %xmm0
mulsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x104e0
movsd %xmm0, -0xd8(%rbp)
movsd -0xf0(%rbp), %xmm1
movsd -0xd8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
jmp 0x2f5fe
xorps %xmm0, %xmm0
ucomisd -0xd8(%rbp), %xmm0
jb 0x2f6a1
cmpq $0x0, -0x38(%rbp)
je 0x2f67d
movsd -0xd8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd -0x88(%rbp), %xmm1
movq -0x48(%rbp), %rax
divsd (%rax), %xmm1
divsd %xmm1, %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rdi
movsd 0x92bfb(%rip), %xmm0    # 0xc2258
movsd %xmm0, -0x188(%rbp)
leaq -0x188(%rbp), %rsi
callq 0x12a60
movsd (%rax), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x18c(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x18c(%rbp), %rsi
callq 0x329c0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2fc73
testb $0x1, -0x29(%rbp)
je 0x2f6c1
movq -0x68(%rbp), %rax
movsd 0x91dfd(%rip), %xmm0    # 0xc14b0
mulsd (%rax), %xmm0
movsd %xmm0, -0x230(%rbp)
jmp 0x2f6d1
movq -0x68(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x230(%rbp)
movsd -0x230(%rbp), %xmm0
movsd %xmm0, -0x198(%rbp)
movq -0x58(%rbp), %rax
movsd (%rax), %xmm0
subsd -0x118(%rbp), %xmm0
movsd -0x198(%rbp), %xmm1
movq -0x60(%rbp), %rax
subsd (%rax), %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x19c(%rbp)
movl $0x0, -0x1a0(%rbp)
movq -0x50(%rbp), %rax
movsd (%rax), %xmm0
movq -0x48(%rbp), %rax
mulsd (%rax), %xmm0
movsd 0x92b17(%rip), %xmm1    # 0xc2248
mulsd %xmm1, %xmm0
movsd %xmm0, -0x1a8(%rbp)
movsd -0x80(%rbp), %xmm0
movq -0x68(%rbp), %rax
mulsd (%rax), %xmm0
movsd %xmm0, -0x1b0(%rbp)
movl -0x1a0(%rbp), %ecx
xorl %eax, %eax
cmpl -0x19c(%rbp), %ecx
movb %al, -0x231(%rbp)
jge 0x2f785
movsd -0x88(%rbp), %xmm1
movsd -0x1a8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
seta %al
movb %al, -0x231(%rbp)
movb -0x231(%rbp), %al
testb $0x1, %al
jne 0x2f794
jmp 0x2f8c8
movsd -0x1b0(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm0
movq -0x50(%rbp), %rax
ucomisd (%rax), %xmm0
jbe 0x2f7ce
movq -0x50(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm1
movsd -0xd8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
xorps %xmm0, %xmm0
ucomisd -0xd8(%rbp), %xmm0
jb 0x2f89c
movl -0x1a0(%rbp), %eax
addl $0x1, %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x2f878
movsd -0xd8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd -0x88(%rbp), %xmm1
movq -0x48(%rbp), %rax
divsd (%rax), %xmm1
divsd %xmm1, %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rdi
movsd 0x92a00(%rip), %xmm0    # 0xc2258
movsd %xmm0, -0x1b8(%rbp)
leaq -0x1b8(%rbp), %rsi
callq 0x12a60
movsd (%rax), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x1bc(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x1bc(%rbp), %rsi
callq 0x329c0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2fc73
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
mulsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movl -0x1a0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a0(%rbp)
jmp 0x2f752
movl -0x1a0(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x19c(%rbp), %eax
subl -0x1a0(%rbp), %eax
movl %eax, -0x1c0(%rbp)
cvtsi2sdl -0x1c0(%rbp), %xmm0
movq -0x50(%rbp), %rax
mulsd (%rax), %xmm0
movsd %xmm0, -0x1c8(%rbp)
movsd -0x1c8(%rbp), %xmm0
ucomisd -0xd8(%rbp), %xmm0
jb 0x2f9d2
cmpq $0x0, -0x38(%rbp)
je 0x2f989
cvtsi2sdl -0x3c(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm1
movq -0x50(%rbp), %rax
divsd (%rax), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x1d0(%rbp)
movsd -0x1d0(%rbp), %xmm0
callq 0xa110
cvttsd2si %xmm0, %eax
movl %eax, -0x3c(%rbp)
cvtsi2sdl -0x3c(%rbp), %xmm0
subsd -0x1d0(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x1d4(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x1d4(%rbp), %rsi
callq 0x329c0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2fc73
cvtsi2sdl -0x3c(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm1
movq -0x50(%rbp), %rax
divsd (%rax), %xmm1
addsd %xmm1, %xmm0
callq 0xa110
cvttsd2si %xmm0, %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x1d8(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x329c0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2fc73
movl -0x1c0(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movsd -0x1c8(%rbp), %xmm1
movsd -0xd8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movq -0x60(%rbp), %rax
movsd (%rax), %xmm0
mulsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x1e0(%rbp)
movsd -0x1e0(%rbp), %xmm0
movq -0x48(%rbp), %rax
movsd 0x915ed(%rip), %xmm1    # 0xc1010
subsd (%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x1e8(%rbp)
movsd -0x1e8(%rbp), %xmm0
movq -0x48(%rbp), %rax
mulsd (%rax), %xmm0
movsd %xmm0, -0x1f0(%rbp)
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
mulsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0xd8(%rbp), %xmm0
xorl %eax, %eax
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movb %al, -0x232(%rbp)
jbe 0x2faac
movsd -0x88(%rbp), %xmm0
subsd -0x1f0(%rbp), %xmm0
movaps 0x915cd(%rip), %xmm1    # 0xc1060
pand %xmm1, %xmm0
movsd 0x927b1(%rip), %xmm1    # 0xc2250
ucomisd %xmm1, %xmm0
seta %al
movb %al, -0x232(%rbp)
movb -0x232(%rbp), %al
testb $0x1, %al
jne 0x2fab8
jmp 0x2fb12
movsd -0x1e0(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm1
movsd -0xd8(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
mulsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2fa63
xorps %xmm0, %xmm0
ucomisd -0xd8(%rbp), %xmm0
jb 0x2fbb5
cmpq $0x0, -0x38(%rbp)
je 0x2fb91
movsd -0xd8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd -0x88(%rbp), %xmm1
movq -0x48(%rbp), %rax
divsd (%rax), %xmm1
divsd %xmm1, %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x38(%rbp), %rdi
movsd 0x926e7(%rip), %xmm0    # 0xc2258
movsd %xmm0, -0x1f8(%rbp)
leaq -0x1f8(%rbp), %rsi
callq 0x12a60
movsd (%rax), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x1fc(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x1fc(%rbp), %rsi
callq 0x329c0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2fc73
cmpq $0x0, -0x38(%rbp)
je 0x2fc27
cvtsi2sdl -0x3c(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm1
divsd -0x1e8(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x208(%rbp)
movsd -0x208(%rbp), %xmm0
callq 0xa110
cvttsd2si %xmm0, %eax
movl %eax, -0x3c(%rbp)
cvtsi2sdl -0x3c(%rbp), %xmm0
subsd -0x208(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x20c(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x20c(%rbp), %rsi
callq 0x329c0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2fc73
movl -0x3c(%rbp), %eax
movl %eax, -0x238(%rbp)
movsd -0xd8(%rbp), %xmm0
divsd -0x1e8(%rbp), %xmm0
callq 0xa110
movl -0x238(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x210(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x329c0
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
nop