void __cdecl PredictPlayer(int Entity, tick_record *tickRecord, tick_record *nextTickrecord)
{
struct_v3 *Entity_1; // eax
__int64 v5; // xmm0_8
EngineClient::EngineClient_VTable *EngineClient_vtable; // eax
int (*nci)(void); // eax
INetChannelInfoPtr *NetChannelInfo_1; // esi
INetChannelInfoPtr *NetChannelInfo; // eax
float interval_per_tick; // ST20_4
float simulationTime; // xmm4_4
float deltaTime; // xmm2_4
float simulationTimeDelta; // xmm4_4
signed int iSimTickDelta; // edi
float v15; // xmm1_4
float velocityDegree; // xmm2_4
float velocityAngle; // xmm3_4
int v18; // ebp
float v19; // xmm3_4 MAPDST
signed int iTicksLeft; // esi
float v21; // xmm0_4
char InAir; // ST04_1
float v23; // eax
float tickInterval; // [esp+14h] [ebp-34h]
float originalOrigin; // [esp+1Ch] [ebp-2Ch]
__int64 v26; // [esp+20h] [ebp-28h]
simulation_data data; // [esp+28h] [ebp-20h]
float incomingAvgLatency; // [esp+4Ch] [ebp+4h]
float v29; // [esp+4Ch] [ebp+4h]
float v30; // [esp+4Ch] [ebp+4h]
float velocityLength2D; // [esp+4Ch] [ebp+4h]
float outgoingAvgLatency; // [esp+50h] [ebp+8h]
float extrapolatedMovement; // [esp+50h] [ebp+8h]
Entity_1 = *Entity;
data.m_pEntity = Entity;
Entity_1->GetAbsOrigin();
v5 = *&tickRecord->m_vecVelocity.x;
data.m_vecVelocity.z = tickRecord->m_vecVelocity.z;
originalOrigin = tickRecord->m_vecOrigin.z;
data.m_vecOrigin.z = tickRecord->m_vecOrigin.z;
data.m_fFlags = tickRecord->m_fFlags;
EngineClient_vtable = EngineClient->vtable;
*&data.m_vecVelocity.x = v5;
v26 = *&tickRecord->m_vecOrigin.x;
nci = EngineClient_vtable->GetNetChannelInfo;
*&data.m_vecOrigin.x = v26;
NetChannelInfo_1 = nci();
NetChannelInfo = EngineClient->vtable->GetNetChannelInfo();
interval_per_tick = GlobalVars->interval_per_tick;
tickInterval = 1.0 / GlobalVars->interval_per_tick;
incomingAvgLatency = NetChannelInfo->vtable->GetAvgLatency(1);
outgoingAvgLatency = NetChannelInfo_1->vtable->GetAvgLatency(0);
simulationTime = tickRecord->m_flSimulationTime;
deltaTime = (((((incomingAvgLatency + outgoingAvgLatency) * tickInterval) + 0.5) + AimwareGlobalVars->m_nTickCount + 1)
* interval_per_tick)
- simulationTime;
if ( deltaTime > 1.0 )
deltaTime = 1.0;
simulationTimeDelta = simulationTime - nextTickrecord->m_flSimulationTime;
iSimTickDelta = ((simulationTimeDelta * tickInterval) + 0.5);
if ( iSimTickDelta <= 15 )
{
if ( iSimTickDelta < 1 )
iSimTickDelta = 1;
}
else
{
iSimTickDelta = 15;
}
v29 = atan2(tickRecord->m_vecVelocity.y, tickRecord->m_vecVelocity.x);
v15 = (tickInterval * deltaTime) + 0.5;
velocityDegree = v29 * 57.295776;
v30 = atan2(nextTickrecord->m_vecVelocity.y, nextTickrecord->m_vecVelocity.x);
velocityAngle = velocityDegree - (v30 * 57.295776);
if ( velocityAngle <= 180.0 )
{
if ( velocityAngle < -180.0 )
velocityAngle = velocityAngle + 360.0;
}
else
{
velocityAngle = velocityAngle - 360.0;
}
v18 = v15 - iSimTickDelta;
v19 = velocityAngle / simulationTimeDelta;
velocityLength2D = fsqrt((data.m_vecVelocity.y * data.m_vecVelocity.y) + (data.m_vecVelocity.x * data.m_vecVelocity.x));
if ( v18 < 0 )
{
_mm_storel_epi64(tickRecord, _mm_loadl_epi64(&v26));
tickRecord->m_vecOrigin.z = originalOrigin;
}
else
{
do
{
if ( iSimTickDelta > 0 )
{
iTicksLeft = iSimTickDelta;
do
{
extrapolatedMovement = velocityDegree + (GlobalVars->interval_per_tick * v19);
data.m_vecVelocity.x = j___libm_sse2_cosf(extrapolatedMovement * 0.017453292) * velocityLength2D;
v21 = j___libm_sse2_sinf(extrapolatedMovement * 0.017453292);
InAir = ~LOBYTE(tickRecord->m_fFlags) & 1;
data.m_vecVelocity.y = v21 * velocityLength2D;
SimulateMovement(&data, InAir);
velocityDegree = extrapolatedMovement;
--iTicksLeft;
}
while ( iTicksLeft );
}
v18 -= iSimTickDelta;
}
while ( v18 >= 0 );
v23 = data.m_vecOrigin.z;
_mm_storel_epi64(tickRecord, _mm_loadl_epi64(&data.m_vecOrigin));
tickRecord->m_vecOrigin.z = v23;
}
}