//
// sub_7464F4 from 0x7464f4 to 0x7465c2 (206 bytes)
//
// 2 xrefs:
// > sub_746620 @ 0x746646
// > sub_746620 @ 0x74666a
//
// 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_7464F4(int *a1, _BYTE *a2, int a3, int a4)
{
int v8; // r1
_DWORD *v9; // r5
unsigned __int8 *v10; // r3
int v11; // r0
unsigned int v12; // r3
unsigned int v13; // r1
bool v14; // zf
bool v15; // r2
char v18[4]; // [sp+4h] [bp-4h] BYREF
a1[1] = 0;
sub_745FB8(v18, a1, 1);
v8 = (unsigned __int8)v18[0];
if ( !v18[0] )
goto LABEL_20;
v9 = *(_DWORD **)((char *)a1 + *(_DWORD *)(*a1 - 12) + 120);
v10 = (unsigned __int8 *)v9[2];
if ( (unsigned int)v10 < v9[3] )
goto LABEL_7;
LABEL_3:
v11 = (*(int (__fastcall **)(_DWORD *))(*v9 + 36))(v9);
while ( 1 )
{
v14 = v11 == -1;
if ( v11 != -1 )
v14 = v11 == a4;
v15 = !v14;
if ( a1[1] + 1 >= a3 || !v15 )
break;
*a2++ = v11;
v12 = v9[2];
v13 = v9[3];
++a1[1];
if ( v12 < v13 )
{
v10 = (unsigned __int8 *)(v12 + 1);
v9[2] = v10;
goto LABEL_6;
}
v11 = (*(int (__fastcall **)(_DWORD *))(*v9 + 40))(v9);
if ( v11 != -1 )
{
v10 = (unsigned __int8 *)v9[2];
v13 = v9[3];
LABEL_6:
if ( (unsigned int)v10 >= v13 )
goto LABEL_3;
LABEL_7:
v11 = *v10;
}
}
if ( v11 == -1 )
v8 = 2;
else
v8 = 0;
LABEL_20:
if ( a3 > 0 )
*a2 = 0;
if ( !a1[1] )
{
v8 |= 4u;
goto LABEL_24;
}
if ( !v8 )
return a1;
LABEL_24:
sub_7446A4((int *)((char *)a1 + *(_DWORD *)(*a1 - 12)), v8 | *(int *)((char *)a1 + *(_DWORD *)(*a1 - 12) + 20));
return a1;
}