//
// sub_6FF768 from 0x6ff768 to 0x6ff866 (254 bytes)
//
// 5 xrefs:
// > sub_6FF874 @ 0x6ffa14
// > sub_6FFCC0 @ 0x6ffdc0
// > WebPGetInfo @ 0x700292
// > WebPGetFeaturesInternal @ 0x7007b4
// > WebPDecode @ 0x700b60
//
// 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_6FF768(
unsigned __int8 **a1,
unsigned int *a2,
unsigned int a3,
unsigned __int8 **a4,
unsigned int *a5)
{
unsigned int v5; // r6
unsigned __int8 *v6; // r11
bool v7; // cc
unsigned int v8; // r4
char v9; // r10
unsigned int v11; // r7
int result; // r0
int v13; // r0
unsigned __int8 *v14; // r2
unsigned int v15; // r5
v5 = *a2;
v6 = *a1;
v7 = *a2 > 7;
*a4 = nullptr;
*a5 = 0;
*a1 = v6;
*a2 = v5;
if ( !v7 )
return 7;
v8 = v6[4] | (v6[5] << 8) | ((v6[6] | (v6[7] << 8)) << 16);
if ( v8 <= 0xFFFFFFF6 )
{
v9 = a3;
if ( a3 )
v9 = 1;
v11 = 22;
do
{
v15 = (v8 + 9) & 0xFFFFFFFE;
v11 += v15;
if ( v11 > a3 && v9 & 1 )
break;
result = memcmp(v6, "VP8 ", 4u);
if ( !result )
return result;
result = memcmp(v6, "VP8L", 4u);
if ( !result )
return result;
v7 = v15 > v5;
v5 -= v15;
if ( v7 )
return 7;
v13 = memcmp(v6, "ALPH", 4u);
v14 = v6 + 8;
v6 += v15;
if ( !v13 )
{
*a4 = v14;
*a5 = v8;
}
*a1 = v6;
*a2 = v5;
if ( v5 <= 7 )
return 7;
v8 = v6[4] | (v6[5] << 8) | ((v6[6] | (v6[7] << 8)) << 16);
}
while ( v8 <= 0xFFFFFFF6 );
}
return 3;
}