//
// sub_5C76A from 0x5c76a to 0x5c7ea (128 bytes)
//
// 2 xrefs:
// > sub_5C686 @ 0x5c700
// > sub_5C7EA @ 0x5c82c
//
// 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_5C76A(int a1, unsigned int a2, unsigned int a3, int ***a4, unsigned int *a5)
{
int **v5; // r5
unsigned int v7; // r3
int **v8; // r6
unsigned int v9; // r0
unsigned int v10; // r0
unsigned int v12; // r0
v5 = *(int ***)(a1 + 4);
v7 = -*(_DWORD *)(a1 + 20) & (*(_DWORD *)(a1 + 20) + 103);
v8 = v5;
while ( 1 )
{
if ( a2 )
{
v9 = *v8[7];
if ( v9 <= a2 && v9 + (_DWORD)v8[4] * v7 > a2 )
{
v12 = (a2 - v9) / v7;
goto LABEL_12;
}
}
if ( a3 )
{
v10 = (unsigned int)v8[6];
if ( v10 <= a3 && v10 + 12 * (_DWORD)v8[4] > a3 )
break;
}
v8 = (int **)*v8;
if ( v5 == v8 )
return 30;
}
v12 = (int)(a3 - v10) / 12;
LABEL_12:
if ( v12 == -1 )
return 30;
if ( a4 )
*a4 = v8;
if ( a5 )
*a5 = v12;
return 0;
}