//
// sub_485A8 from 0x485a8 to 0x4861a (114 bytes)
//
// 4 xrefs:
// > sub_753C4 @ 0x77320
// > sub_753C4 @ 0x773a6
// > sub_77560 @ 0x7761a
// > sub_7782E @ 0x77874
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall sub_485A8(int a1, int a2, _DWORD *a3)
{
int v4; // r5
__int64 v7; // kr00_8
int result; // r0
bool v9; // zf
int v10; // r0
int v11; // [sp+4h] [bp-1Ch] BYREF
v11 = 0;
if ( !a3 )
return 31;
v4 = *(_DWORD *)(a1 + 56);
if ( v4 )
{
v7 = *(_QWORD *)(a1 + 60);
result = (*(int (__fastcall **)(int, int *))(*(_DWORD *)a1 + 148))(a1, &v11);
if ( result )
return result;
if ( (unsigned int)(a2 + 1) <= 1 )
{
*a3 = v4;
return 0;
}
v10 = a2 + 3;
v9 = a2 == -3;
if ( a2 != -3 )
{
v10 = v11;
v9 = v11 - 1 == a2;
}
if ( v9 )
{
*a3 = v7;
return 0;
}
if ( a2 == -2 )
{
*a3 = HIDWORD(v7);
return 0;
}
if ( v10 > a2 )
{
*a3 = *(_DWORD *)(*(_DWORD *)(a1 + 8) + 4 * a2);
return 0;
}
}
return 9;
}