//
// sub_100695CC8 from 0x100695cc8 to 0x100695de0 (280 bytes)
//
// 2 xrefs:
// > sub_1006959CC @ 0x100695b0c
// > sub_1006959CC @ 0x100695bcc
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:11:34 +0000
//
__int64 __fastcall sub_100695CC8(_BYTE *a1, __int64 a2, _QWORD *a3)
{
__int64 v3; // x8
__int64 result; // x0
char v5; // w9
_BYTE *v7; // x10
unsigned __int64 v8; // x10
bool v9; // cc
int v10; // t1
__int64 v11; // x8
v3 = a2 - 10;
if ( a2 < 10 )
return 2;
if ( *a1 != 31 )
return 1;
if ( (unsigned __int8)a1[1] != 139 )
return 1;
v5 = a1[3];
if ( a1[2] != 8 || (v5 & 0xE0) != 0 )
return 1;
if ( (a1[3] & 4) != 0 )
{
if ( v3 < 2 )
return 2;
v8 = (unsigned __int8)a1[10] | ((unsigned __int64)(unsigned __int8)a1[11] << 8);
v9 = v3 < (__int64)(v8 + 2);
v3 -= v8 + 2;
if ( v9 )
return 2;
v7 = &a1[v8 + 12];
}
else
{
v7 = a1 + 10;
}
if ( (a1[3] & 8) != 0 )
{
while ( v3 )
{
v10 = (unsigned __int8)*v7++;
--v3;
if ( !v10 )
goto LABEL_22;
}
return 2;
}
else
{
LABEL_22:
if ( (a1[3] & 0x10) != 0 )
{
if ( !v3 )
return 2;
v11 = 1 - v3;
result = 2;
while ( *v7 )
{
++v7;
if ( ++v11 == 1 )
return result;
}
v3 = -v11;
}
if ( (v5 & 2) != 0 && (v9 = v3 < 2, v3 -= 2, v9) )
{
return 2;
}
else
{
*a3 = a2 - v3;
return 0;
}
}
}