//
// PlayerObject::rotateGameplayObject from 0x1003f3da0 to 0x1003f4085 (741 bytes)
//
// 4 xrefs:
// > PlayerObject::handleRotatedCollisionInternal @ 0x1003f3c24
// > PlayerObject::handleRotatedCollisionInternal @ 0x1003f3c48
// > PlayerObject::rotatePreSlopeObjects @ 0x1003f40b7
// > PlayerObject::spiderTestJumpInternal @ 0x1003fae9e
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:29:55 +0000
//
unsigned __int64 __fastcall PlayerObject::rotateGameplayObject(_QWORD *a1, __int64 a2)
{
_QWORD *v4; // r12
unsigned __int64 v5; // rdi
unsigned __int64 v6; // rcx
unsigned __int64 v7; // r9
__int64 v8; // rsi
__int64 **v9; // rax
__int64 *v10; // r8
unsigned __int64 v11; // rdi
unsigned __int64 result; // rax
_QWORD *v13; // rax
__m128 v14; // xmm1
__m128 v15; // xmm2
__m128 v16; // xmm4
__m128 v17; // xmm4
unsigned __int64 *LastPosition; // r15
unsigned __int64 v19; // [rsp+8h] [rbp-88h] BYREF
__m128d v20; // [rsp+10h] [rbp-80h]
__m128 v21; // [rsp+20h] [rbp-70h]
__m128d v22; // [rsp+30h] [rbp-60h] BYREF
unsigned __int64 v23; // [rsp+48h] [rbp-48h] BYREF
unsigned __int64 v24; // [rsp+50h] [rbp-40h] BYREF
__int64 v25; // [rsp+58h] [rbp-38h]
double v26[6]; // [rsp+60h] [rbp-30h] BYREF
v4 = a1 + 212;
v5 = a1[213];
if ( !v5 )
goto LABEL_28;
v6 = *(int *)(a2 + 916);
v7 = (0x101010101010101LL
* ((((v5 - ((v5 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v5 - ((v5 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((v5 - ((v5 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v5 - ((v5 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v7 > 1 )
{
v8 = *(int *)(a2 + 916);
if ( v5 <= v6 )
{
if ( !((v5 | v6) >> 32) )
{
v8 = (unsigned int)v6 % (unsigned int)v5;
v9 = *(__int64 ***)(*v4 + 8 * v8);
if ( !v9 )
goto LABEL_28;
goto LABEL_9;
}
v8 = v6 % v5;
}
v9 = *(__int64 ***)(*v4 + 8 * v8);
if ( !v9 )
goto LABEL_28;
goto LABEL_9;
}
v8 = v6 & (v5 - 1);
v9 = *(__int64 ***)(*v4 + 8 * v8);
if ( !v9 )
goto LABEL_28;
LABEL_9:
v10 = *v9;
if ( *v9 )
{
if ( (unsigned int)v7 < 2 )
{
v11 = v5 - 1;
while ( 1 )
{
result = v10[1];
if ( result == v6 )
{
if ( *((_DWORD *)v10 + 4) == (_DWORD)v6 )
return result;
}
else if ( (v11 & result) != v8 )
{
goto LABEL_28;
}
v10 = (__int64 *)*v10;
if ( !v10 )
goto LABEL_28;
}
}
while ( 1 )
{
result = v10[1];
if ( result == v6 )
{
if ( *((_DWORD *)v10 + 4) == (_DWORD)v6 )
return result;
goto LABEL_18;
}
if ( result < v5 )
goto LABEL_23;
if ( (v5 | result) >> 32 )
break;
if ( (unsigned int)result % (unsigned int)v5 != v8 )
goto LABEL_28;
LABEL_18:
v10 = (__int64 *)*v10;
if ( !v10 )
goto LABEL_28;
}
result %= v5;
LABEL_23:
if ( result != v8 )
goto LABEL_28;
goto LABEL_18;
}
LABEL_28:
v25 = a2 + 916;
(*(void (__fastcall **)(double *, __int64))(*(_QWORD *)a2 + 1360LL))(v26, a2);
sub_1002782D0(&v23, v26);
v13 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD *))(*a1 + 192LL))(a1);
sub_1002782D0(&v24, v13);
v14 = _mm_sub_ps((__m128)*(unsigned __int64 *)&v26[0], (__m128)v24);
v15 = _mm_movehdup_ps(v14);
v16 = v14;
v16.f32[0] = (float)(v14.f32[0] * -0.000000043711388) - v15.f32[0];
v15.f32[0] = (float)(v15.f32[0] * -0.000000043711388) + v14.f32[0];
v17 = _mm_add_ps(_mm_insert_ps(v16, v15, 16), (__m128)v24);
_mm_storel_ps(v26, v17);
v21 = _mm_sub_ps(v17, (__m128)v23);
v20 = _mm_cvtps_pd(v21);
GameObject::addToTempOffset(a2, v20.f64[0], _mm_unpackhi_pd(v20, v20).f64[0]);
LastPosition = (unsigned __int64 *)GameObject::getLastPosition(a2);
sub_100278250((float *)&v19, v21.f32[0], _mm_movehdup_ps(v21).f32[0]);
sub_100278350(v22.f64, LastPosition, &v19);
GameObject::setLastPosition(a2, &v22);
_mm_storel_ps((double *)(a2 + 972), _mm_add_ps((__m128)*(unsigned __int64 *)(a2 + 972), (__m128)xmmword_100A09DA0));
(*(void (__fastcall **)(__int64, double))(*(_QWORD *)a2 + 1480LL))(a2, 0.0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a2 + 1776LL))(a2, 1);
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1800LL))(a2) == 25 )
GameObject::determineSlopeDirection(a2);
v22 = v20;
return sub_10040B680(v4, v25, &v22);
}