//
// sub_1004B3078 from 0x1004b3078 to 0x1004b318c (276 bytes)
//
// 2 xrefs:
// > sub_10028F358 @ 0x10028f384
// > sub_10028F358 @ 0x10028f3a8
//
// This function is hookable on this platform (idp: arm, 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 11:06:12 +0000
//
__int64 __fastcall sub_1004B3078(__int64 result, int a2)
{
__int64 v3; // x20
__int64 *v4; // x21
__int64 v5; // x22
unsigned __int64 v6; // x20
float v7; // s8
if ( *(unsigned __int8 *)(result + 449) != a2 )
{
v3 = result;
*(_BYTE *)(result + 449) = a2;
result = *(_QWORD *)(result + 416);
if ( result )
{
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)result + 488LL))(result);
if ( result )
{
result = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 416) + 488LL))(*(_QWORD *)(v3 + 416));
if ( result )
{
result = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 416) + 488LL))(*(_QWORD *)(v3 + 416));
if ( **(_DWORD **)(result + 56) )
{
v4 = *(__int64 **)(*(_QWORD *)((*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 416) + 488LL))(*(_QWORD *)(v3 + 416))
+ 56)
+ 16LL);
v5 = *(_QWORD *)(*(_QWORD *)((*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 416) + 488LL))(*(_QWORD *)(v3 + 416))
+ 56)
+ 16LL);
result = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 416) + 488LL))(*(_QWORD *)(v3 + 416));
v6 = v5 + 8LL * **(unsigned int **)(result + 56) - 8;
if ( (unsigned __int64)v4 <= v6 )
{
if ( a2 )
v7 = -0.5;
else
v7 = 0.5;
do
{
result = *v4;
if ( !*v4 )
break;
result = (*(__int64 (__fastcall **)(__int64, float))(*(_QWORD *)result + 128LL))(result, v7);
++v4;
}
while ( (unsigned __int64)v4 <= v6 );
}
}
}
}
}
}
return result;
}