//
// sub_993A00 from 0x993a00 to 0x993b18 (280 bytes)
//
// 2 xrefs:
// > sub_993910 @ 0x99396a
// > sub_99A5E8 @ 0x99a5fe
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:06:37 +0000
//
int __fastcall sub_993A00(_BYTE *a1, unsigned int **a2, unsigned int a3)
{
_BYTE *v3; // r11
unsigned int v4; // r10
unsigned int *v6; // r5
unsigned int v7; // r4
unsigned int v8; // r1
int v9; // r0
unsigned int *v10; // r0
unsigned int v11; // r1
unsigned int *v12; // r4
int v13; // r0
unsigned int v14; // t1
unsigned int *v15; // r6
unsigned int v16; // r1
unsigned int v17; // r0
unsigned int v18; // r5
_BYTE v20[4]; // [sp+4h] [bp-14h] BYREF
v3 = a1;
v4 = a3;
if ( !a1 )
{
v10 = *a2;
v11 = **a2;
if ( !v11 )
return 0;
v12 = v10 + 1;
v4 = 0;
while ( 1 )
{
if ( v11 < 0x80 )
{
v13 = 1;
}
else
{
v13 = sub_993870(v20, v11);
if ( v13 == -1 )
return -1;
}
v14 = *v12++;
v11 = v14;
v4 += v13;
if ( !v14 )
return v4;
}
}
if ( a3 >= 4 )
{
v6 = *a2;
v7 = a3;
while ( 1 )
{
v8 = *v6;
if ( *v6 - 1 < 0x7F )
{
v6 = *a2;
--v7;
*v3++ = v8;
}
else
{
if ( !v8 )
{
LABEL_32:
*v3 = 0;
*a2 = nullptr;
LABEL_33:
v4 -= v7;
return v4;
}
v9 = sub_993870(v3, v8);
if ( v9 == -1 )
return -1;
v7 -= v9;
v3 += v9;
}
*a2 = ++v6;
if ( v7 <= 3 )
goto LABEL_20;
}
}
v7 = a3;
LABEL_20:
if ( v7 )
{
v15 = *a2;
do
{
v16 = *v15;
if ( *v15 - 1 < 0x7F )
{
v15 = *a2;
--v7;
*v3++ = v16;
}
else
{
if ( !v16 )
goto LABEL_32;
v17 = sub_993870(v20, v16);
v18 = v17;
if ( v17 == -1 )
return -1;
if ( v7 < v17 )
goto LABEL_33;
sub_993870(v3, *v15);
v7 -= v18;
v3 += v18;
}
*a2 = ++v15;
}
while ( v7 );
}
return v4;
}