//
// sub_6481EC from 0x6481ec to 0x64828a (158 bytes)
//
// 1 xrefs:
// > lws_client_connect_via_info @ 0x64ac34
//
// 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_6481EC(_DWORD *a1)
{
int v2; // r3
int v3; // r6
int v5; // r0
int v6; // r5
int v7; // r7
int v8; // r2
v2 = *a1;
v3 = a1[46];
if ( *a1 )
{
LABEL_2:
memset((void *)(v2 + 988), 0, 0x52u);
*(_BYTE *)(*a1 + 1105) = 0;
*(_WORD *)(*a1 + 1102) = 0;
return 0;
}
v5 = *(__int16 *)(v3 + 4626);
if ( *(__int16 *)(v3 + 4628) != v5 )
{
if ( v5 > 0 )
{
v7 = *(_DWORD *)(v3 + 52);
if ( *(_BYTE *)(v7 + 1104) )
{
v8 = v7 + 1108;
while ( 1 )
{
++v2;
v6 = v8;
v8 += 1108;
if ( v2 == v5 )
break;
if ( !*(_BYTE *)(v8 - 4) )
goto LABEL_11;
}
v6 = v7 + 1108 * v2;
}
else
{
v6 = *(_DWORD *)(v3 + 52);
}
}
else
{
v6 = *(_DWORD *)(v3 + 52);
}
LABEL_11:
*a1 = v6;
*(_BYTE *)(v6 + 1104) = 1;
++*(_WORD *)(v3 + 4628);
v2 = *a1;
goto LABEL_2;
}
lws_log(1, "No free ah\n");
return -1;
}