//
// sub_C94D8 from 0xc94d8 to 0xc95ce (246 bytes)
//
// 1 xrefs:
// > sub_CE264 @ 0xce2ba
//
// 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 11:41:54 +0000
//
int __fastcall sub_C94D8(int *a1, _DWORD *a2, int a3, int a4)
{
__int64 v6; // kr00_8
int v7; // r5
int v8; // r0
int v9; // r9
int v10; // r1
int result; // r0
int v12; // r10
__int64 v13; // r0
char *v14; // r0
int v15; // r1
int v16; // r1
int v17; // r2
unsigned int v18; // r0
unsigned int v19; // r2
unsigned __int64 v20; // kr08_8
int v21; // r3
unsigned int i; // r2
_DWORD v23[4]; // [sp+4h] [bp-2Ch] BYREF
int v24; // [sp+14h] [bp-1Ch]
v23[0] = a4;
if ( a1[1] < 0 )
return 0;
v6 = *((_QWORD *)a1 + 1);
v7 = *a1 + HIDWORD(v6);
v8 = a1[5];
v9 = v6 - HIDWORD(v6);
if ( v8 )
goto LABEL_3;
if ( v9 < 27 )
return 0;
if ( *(_DWORD *)v7 != 1399285583 )
goto LABEL_9;
v21 = *(unsigned __int8 *)(v7 + 26);
v8 = v21 + 27;
if ( v9 < v21 + 27 )
return 0;
for ( i = 0; i < (unsigned __int8)v21; ++i )
{
v21 = *(unsigned __int8 *)(v7 + 27 + i);
a1[6] += v21;
LOBYTE(v21) = *(_BYTE *)(v7 + 26);
}
a1[5] = v8;
LABEL_3:
v10 = a1[6] + v8;
result = 0;
if ( v10 > v9 )
return result;
v12 = *(_DWORD *)(v7 + 22);
v24 = v12;
*(_DWORD *)(v7 + 22) = 0;
v23[0] = v7;
v13 = *(_QWORD *)(a1 + 5);
v23[1] = v13;
v23[2] = v13 + v7;
v23[3] = HIDWORD(v13);
sub_C93A0(v23);
if ( v24 != *(_DWORD *)(v7 + 22) )
{
*(_DWORD *)(v7 + 22) = v12;
LABEL_9:
a1[5] = 0;
a1[6] = 0;
v14 = (char *)memchr((const void *)(v7 + 1), 79, v9 - 1);
v15 = *a1;
if ( !v14 )
v14 = (char *)(a1[2] + v15);
a1[3] = (int)&v14[-v15];
return v7 - (_DWORD)v14;
}
v16 = a1[3];
if ( a2 )
{
v17 = *a1 + v16;
*a2 = v17;
v18 = a1[5];
a2[1] = v18;
a2[2] = v17 + v18;
v19 = a1[6];
a2[3] = v19;
v20 = __PAIR64__(v19, v18);
}
else
{
v20 = *(_QWORD *)(a1 + 5);
}
result = v20 + HIDWORD(v20);
a1[3] = v16 + v20 + HIDWORD(v20);
a1[4] = 0;
a1[5] = 0;
a1[6] = 0;
return result;
}