//
// sub_645B58 from 0x645b58 to 0x645bd8 (128 bytes)
//
// 1 xrefs:
// > sub_64231C @ 0x64233c
//
// 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_645B58(int a1, size_t item_count)
{
int v3; // r3
void *v5; // r2
int v7; // r4
int v8; // r5
v3 = *(_DWORD *)(a1 + 34940);
if ( v3 )
{
if ( v3 <= 0 )
{
v8 = a1 + 34940;
}
else
{
v7 = 0;
v8 = a1 + 34940;
do
{
sub_63611C(*(_DWORD *)(*(_DWORD *)(v8 + 4) + 4 * v7));
*(_DWORD *)(*(_DWORD *)(v8 + 4) + 4 * v7++) = 0;
}
while ( v7 < *(_DWORD *)v8 );
}
off_ABAEB0(*(void **)(v8 + 4));
*(_DWORD *)(v8 + 4) = 0;
*(_DWORD *)(a1 + 34940) = 0;
}
v5 = off_ABAEBC(item_count, 4u);
if ( !v5 )
return 27;
*(_DWORD *)(a1 + 34940) = item_count;
*(_DWORD *)(a1 + 34944) = v5;
return 0;
}